Ollama Modelfile Generator
Build a valid Ollama Modelfile without memorizing the syntax. Choose a base model, write a system prompt, set the sampling parameters and context length, and add any stop sequences — the Modelfile is generated live and ready to paste into a file. Then run ollama create to bake your settings into a reusable named model. Everything is generated in your browser.
Save as a file named Modelfile, then run ollama create my-model -f Modelfile and ollama run my-model.
How to use the Ollama Modelfile Generator
Start by setting the base model in the FROM field — this is any model Ollama can pull (such as llama3.1 or qwen2.5) or a path to a local GGUF file. Write the system prompt that defines your model's behavior; this is the single most useful customization. Adjust the sampling parameters — temperature for creativity, top_p and top_k for the candidate pool, and repeat_penalty to discourage loops — and set the context length you need.
Add any stop sequences, one per line, if you want generation to halt at specific strings. The Modelfile updates as you type. Copy it, save it to a file called Modelfile with no extension, and run ollama create my-model -f Modelfile to register your customized model. From then on, ollama run my-model launches it with all your settings baked in — no need to repeat flags each time.
What a Modelfile does
A Modelfile is Ollama's recipe for a model — a small text file that layers your customizations on top of a base model, much like a Dockerfile layers changes on a base image. Instead of passing the same system prompt and parameters every time you run a model, you encode them once in a Modelfile, run ollama create, and get a new named model that always behaves the way you specified.
The core directives are simple. FROM names the base model or a local GGUF file. SYSTEM sets the system prompt. Each PARAMETER line sets one sampling or runtime option: temperature, top_p, top_k, repeat_penalty, num_ctx for context length, and stop for stop sequences (you can have several). More advanced directives include TEMPLATE to override the prompt template, ADAPTER to apply a LoRA, LICENSE, and MESSAGE to seed few-shot conversation history.
The most common use is the cheapest win: a custom system prompt plus a tuned temperature. A coding assistant might pin a low temperature and a system prompt that enforces a style; a brainstorming model might raise the temperature and widen top_p. Because the result is a normal Ollama model, you can share the Modelfile with teammates so everyone runs an identical configuration, or push the resulting model to a registry. This generator produces the standard directives; for the rarer ones, add them by hand to the file afterward.
Common use cases
- Pinning a system prompt. Bake a persona or instruction set into a named model so it is applied automatically every run.
- Locking sampling settings. Save a tuned temperature and top_p for a specific task instead of passing flags each time.
- Sharing configs. Hand a teammate a Modelfile so everyone runs an identical local model.
- Wrapping a local GGUF. Point FROM at a downloaded GGUF file to turn it into a managed Ollama model.