# Ollama Modelfile

> A small text file. It builds your own model in Ollama from a base model.

**Field:** Artificial Intelligence  
**Category:** Running Locally  
**Also known as:** Modelfile, Ollama Model File

## Think of it like

It is like a recipe card. It names the base dish, then adds your own spices.

## Definition

A Modelfile is a small text file that tells Ollama how to build a model of your own. It starts with FROM and a base model, which is the one line it must have. PARAMETER lines set things like the temperature or the size of the context. A SYSTEM line gives the standing instructions. You build it with ollama create and a new name. The new model then runs like any other, with your settings baked in.

## Example

Emma wants a model that always answers as a kind maths tutor. She puts that rule in a SYSTEM line. She builds it as tutor and then runs it.

## Example code

```dockerfile
FROM llama3.2
PARAMETER temperature 0.3
SYSTEM You are a kind maths tutor. Explain one step at a time.

# then build it:
# ollama create tutor -f ./Modelfile
```

A base model, one setting and one rule. Then it is built as a new model named tutor.

## Why it matters

You set it up once, and every chat starts with the same rules. Nobody has to paste them in.

## Common mistake

Thinking it trains the model. It only wraps settings and instructions around the same weights.

## Three principles

- **FROM comes first.** It names the base model.
- **Settings and rules.** PARAMETER and SYSTEM lines.
- **Build, then run.** Create it once, then use its name.

## Related terms

- [Ollama](https://learn.benibix.com/term/ai/ollama)
- [System Prompt](https://learn.benibix.com/term/ai/system-prompt)
- [LLM Temperature](https://learn.benibix.com/term/ai/temperature)
- [Context Window](https://learn.benibix.com/term/ai/context-window)
- [Model Weights File](https://learn.benibix.com/term/ai/model-weights)
- [Dockerfile](https://learn.benibix.com/term/infrastructure/dockerfile)

![Four layers of a local AI setup, top to bottom. A chat screen, such as Open WebUI or Jan. An OpenAI-compatible API on the same machine, at an address like localhost:11434/v1. A runtime that runs the model, such as Ollama, llama.cpp, LM Studio, Jan or MLX. And the weights file it loads, as GGUF or safetensors. Under it all sits your own hardware.](https://learn.benibix.com/diagrams/ai4-local-stack.svg)

---

Source: https://learn.benibix.com/term/ai/ollama-modelfile
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
