Ollama Modelfile Generator

Build an Ollama Modelfile with FROM, PARAMETER values, a SYSTEM prompt, a TEMPLATE preset, an optional ADAPTER, stop tokens and example MESSAGE lines.

Use the tool

Why this tool exists

Customising a local model with Ollama means writing a Modelfile, and the format has its own rules: triple-quoted SYSTEM and TEMPLATE blocks, one PARAMETER per line and quoted stop tokens. A small mistake means the model silently ignores a setting.

Enter the base model or a .gguf path, tune temperature, context size, top_p, top_k, repeat penalty and other parameters, and write your system prompt. Extra lines let you add stop tokens and example conversation turns. You can choose a template preset such as a Llama 3 chat format, ChatML or Mistral, but it should match the model you start from, because a wrong template degrades answers. Zero values for optional parameters are omitted. Nothing is uploaded.

How to use it

  1. Enter the FROM model name or the path to a .gguf file.
  2. Set the parameters you care about, such as temperature and num_ctx; use 0 to leave optional ones out.
  3. Write the system prompt in the first box, and stop tokens or example messages in the second.
  4. Choose a template preset if needed, then copy the Modelfile and run ollama create.

Frequently asked questions

How do I add stop tokens or example messages?

Use the second box. Write stop: followed by the token for a stop sequence, and user: or assistant: lines for example conversation turns. Each becomes a PARAMETER stop or MESSAGE line.

Which template should I choose?

The one that matches your model. Llama 3, ChatML and Mistral each expect a specific format. If you leave it on none, Ollama uses the template built into the base model, which is usually right.

Why are some parameters missing from the output?

Optional values such as num_ctx, top_p and top_k are left out when set to 0 so the model default applies. Temperature is always written.

Can my system prompt contain triple quotes?

No. The SYSTEM block is wrapped in triple quotes, so a prompt containing them would break the file, and the tool shows an error. Rephrase that part.