Ollama Modelfile Generator
Turn a base model, system prompt and sampling parameters into a valid Ollama Modelfile — plus the exact ollama create and ollama run commands. Built entirely in your browser from the official spec. No signup, no upload.
How it works
A Modelfile is Ollama's build recipe for a custom model — the local-LLM equivalent of a Dockerfile. This generator maps each form field to an instruction from the official Ollama Modelfile grammar and assembles them in the order Ollama expects. Nothing is invented: every default and valid range is pinned from the Ollama documentation and the reference table below renders from those same constants, so the tool and the docs cannot drift.
- FROM — always the first line:
FROM <base model>. The spec requires it, so the tool blocks generation until you supply a base model such asllama3.1. - SYSTEM — if you enter a system prompt, it is emitted as a triple-quote block:
SYSTEM """…""". The block form keeps multi-line prompts intact, and any literal"""inside your text is escaped so it cannot close the block early. - PARAMETER — one line per setting:
PARAMETER <name> <value>. With "Only emit changed params" on (the default), a parameter is written only when it differs from the Ollama default, keeping the file minimal. Turn it off to write every parameter explicitly. Each stop sequence becomes its ownPARAMETER stop "…"line, which the spec allows you to repeat. - TEMPLATE and LICENSE — emitted verbatim in
"""blocks only when the advanced fields are filled, so most files stay clean. - Commands — the tool assembles
ollama create <name> -f Modelfileandollama run <name>. Your name is lowercased and stripped to[a-z0-9._-]to match Ollama's naming rules; if it changes, a notice tells you what it became.
Validation runs on every keystroke. Out-of-range values (for example a temperature above 2.0) raise an inline warning before the output, so you never copy a file Ollama will reject. Because the whole thing is a pure, deterministic function of the form, the same inputs always produce the same Modelfile — and an internal cross-check confirms the number of PARAMETER lines in the output matches the number of non-default values you set.
Parameter reference
Every supported PARAMETER with its Ollama default, valid range and effect. These are the exact values the generator writes and diffs against.
| Parameter | Default | Range | What it does |
|---|---|---|---|
| temperature | 0.8 | 0.0 – 2 | Creativity vs. determinism. Higher is more random; lower is more focused. Ollama default 0.8. |
| top_k | 40 | 0 – 200 | Sample only from the K most likely next tokens. Higher gives more diversity; lower is more conservative. |
| top_p | 0.9 | 0.0 – 1 | Nucleus sampling: keep the smallest set of tokens whose probability sums to top_p. Works with top_k. |
| min_p | 0.0 | 0.0 – 1 | Drop tokens below this fraction of the most likely token's probability. An alternative to top_p. |
| repeat_penalty | 1.1 | 0.0 – 2 | Penalise repeated tokens. Higher penalises repetition more strongly; 1.0 disables the penalty. |
| repeat_last_n | 64 | -1 – 2,048 | How far back the repeat penalty looks. 0 disables it; -1 uses the full context window (num_ctx). |
| num_ctx | 2048 | 256 – 131,072 | Context window size in tokens. Larger fits more history but uses more memory (VRAM/RAM). |
| num_predict | -1 | -2 – 8,192 | Max tokens to generate per reply. -1 = generate until a stop; -2 = fill the remaining context. |
| seed | 0 | 0 – 4,294,967,295 | Random seed. A fixed non-zero value makes generations reproducible for the same prompt; 0 is random. |
Worked examples
Frequently asked questions
Sources & references
- Ollama — Modelfile reference (instruction set + block syntax)
- Ollama — Valid parameters, defaults and value types
- Ollama — CLI reference (ollama create / ollama run)
Parameter defaults and ranges on this page were last cross-checked against the Ollama documentation on 2026-07-09. They are reviewed whenever Ollama publishes a change to the Modelfile spec.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, edge case, or want to suggest an improvement?
Email me at [email protected] — most fixes ship within 24 hours.