Typing the same instructions at the start of every chat is slow, and the model forgets them when the chat ends. A Modelfile fixes that: Ollama’s Modelfile reference calls it “the blueprint to create and share customized models using Ollama”. You write the base model, a system prompt, and any settings into one small text file, build it once with ollama create, and every chat with the new model starts with those instructions already in place.
Write the Modelfile
A Modelfile has one required instruction, FROM, which defines the base model to use. The other instructions are optional. The two that matter most for a first custom model are SYSTEM, which specifies the system message, and PARAMETER, which sets how Ollama will run the model.
| Line | What it does | Fictional practice value |
|---|---|---|
| FROM llama3.2 | The base model the custom model is built on | llama3.2 |
| SYSTEM “You are a concise assistant for a community garden. Answer in short bullet lists.” | The system prompt, used in every chat with this model | Community-garden assistant, short bullet lists |
| PARAMETER temperature 0.7 | How creative the answers are; the Modelfile reference gives temperature 0.7 as its example | 0.7 |
Save those three lines as a file called Modelfile. The Modelfile reference’s own steps are then: build it with ollama create choose-a-model-name -f ./Modelfile — for the practice model, ollama create garden-helper -f ./Modelfile — and run it with ollama run garden-helper.
Check the build worked
Run ollama list and look for garden-helper alongside the base model. To see the instructions you baked in, run ollama show --modelfile garden-helper: the Modelfile reference says that command shows the Modelfile of a given model. Then ask the model a practice question, for example “What should I plant in a shady corner?”, and check that the answer comes back as short bullet lists, as the system prompt asked.
Try it: one custom model, one check
Write the three-line Modelfile above, build it as garden-helper, and run it. Ask the shady-corner question, then ask a second, unrelated question — for the fictional practice, “How often should I water new seedlings?” — and check that both answers follow the bullet-list instruction. If an answer does not, the system prompt needs rewording, not the model. Expected result. We checked the Ollama Modelfile reference. We did not create or run a custom model on this machine.
Limits
A system prompt changes how the model answers, not what it knows: it cannot give the model facts about your garden, your soil, or your local weather. A custom model also inherits the base model’s limits, including its context window — the Modelfile reference lists num_ctx as a separate parameter you can set if a longer window is needed. If you share the model name with someone else, they need the same Modelfile and base model to rebuild it; the name alone is not the model. We did not test any custom model ourselves.
