# Ollama Modelfile: a Custom Model With a System Prompt

> An Ollama Modelfile bakes FROM, SYSTEM and PARAMETER into a named local model with ollama create, so behaviour travels with the model, not your scripts.

- Canonical: https://guides-ai.pages.dev/guides/ollama-custom-model-modelfile/
- Plate 09.02 · Topic: Local LLMs (https://guides-ai.pages.dev/topics/local-llm/)
- Published: 13 Jun 2026 · Updated: 06 Sept 2026 · 3 min read
- Source site: guides-ai — https://guides-ai.pages.dev/

A [Modelfile](/glossary/#modelfile) is Ollama's recipe: a base model plus a standing instruction and settings, built into a new model you call by name. Stop pasting the same preamble into every script — bake it once. Prerequisite: Ollama installed ([Windows](/guides/run-local-llm-ollama-windows/) or [macOS and Linux](/guides/run-local-llm-ollama-macos-linux/)). Prefer clicking to typing? Generate one in the [Modelfile builder](/tools/modelfile/).

## 1. Write the Modelfile

In any folder, create a file called `Modelfile`:

```dockerfile
FROM llama3.2

SYSTEM """
You are a blunt code reviewer. Lead with bugs and risks.
Be terse. Use bullet points. No praise.
"""

PARAMETER temperature 0.4
PARAMETER num_ctx 8192
```

`FROM` names the base model and tag, `SYSTEM """…"""` holds the multi-line standing instruction, and each `PARAMETER` sets one runtime option. The instructions are not case sensitive and may appear in any order, though `FROM` first reads best.

## 2. Pick parameters that matter

`temperature` controls variation — 0.2–0.4 for review and extraction, 0.8 upwards for drafting. `num_ctx` sets the [context window](/glossary/#context-window), and raising it costs memory: check what your machine can hold with [RAM and VRAM requirements](/guides/local-llm-ram-vram-requirements/) before asking for 32k.

Two more directives are worth knowing. `TEMPLATE` overrides how prompts are formatted for the base model, which you almost never need to touch, and `MESSAGE` seeds an example exchange into every conversation — a cheap way to demonstrate a format instead of describing it. `ADAPTER` attaches a fine-tuned LoRA on top of the base.

## 3. Build it

```bash
ollama create reviewer -f ./Modelfile
```

Turns the file into a model named `reviewer`. It layers on the base rather than copying it, so a variant costs almost nothing on disk.

## 4. Run it

```bash
ollama run reviewer "review this: def add(a,b): return a-b"
```

Starts with your system prompt already applied. The name works anywhere a normal model does, including [the HTTP API](/guides/call-ollama-api/).

## Verify it worked

```bash
ollama show --modelfile reviewer
```

Prints the recipe Ollama actually stored — your `SYSTEM` text and every `PARAMETER` should be there. **If it fails:** `model not found` means the `FROM` tag was never pulled, so run `ollama pull llama3.2` first; and unquoted multi-line text without `"""` silently truncates at the first newline. Full directive list: [the Modelfile reference](https://docs.ollama.com/modelfile).
