DevTools Logo

Ollama Modelfile Builder

Ollama Modelfile Builder

Build an Ollama Modelfile visually: FROM, SYSTEM, PARAMETER sliders, TEMPLATE and MESSAGE blocks. Validated, commented, download.

Runs in your browser
Try an example

Build the file

0 parameters · 0 messages

Emitted as SYSTEM """…""" with LF line endings.

Parameters

No parameters yet. Each row is validated against the Modelfile spec when the file is built.

Stop sequences

Example messages

Modelfile

Pick a base model to start building

The preview updates as you edit. Nothing leaves your browser.

Download always uses LF newlines and the file name Modelfile.

Details

Pick a base model (FROM), write a SYSTEM prompt, add spec-validated PARAMETER entries like temperature or num_ctx, and optionally include TEMPLATE, ADAPTER, LICENSE and MESSAGE blocks. The preview assembles the file in the documented instruction order with explanatory comments, so ollama create accepts it on the first try. Invalid values (bad numbers, out-of-range parameters, malformed FROM references) are refused before anything is emitted, and triple quotes inside SYSTEM or TEMPLATE are rejected because the Ollama parser ends a """ block at the next """. Everything runs in your browser: import an existing Modelfile to edit it, share settings via a link (prompts never leave the page), and download the file named Modelfile with LF line endings.

More examples

Persona-tuned chat model

FROM llama3.1:8b
PARAMETER temperature 0.7
PARAMETER num_ctx 8192
SYSTEM """
You are Ada, a friendly assistant who answers concisely.
"""

The builder emits the SYSTEM block with triple quotes and LF endings; download it and run: ollama create mymodel -f Modelfile.

Stop sequences and penalties

PARAMETER repeat_penalty 1.1
PARAMETER stop "<|eot|>"
PARAMETER stop "END"

Each stop sequence becomes its own PARAMETER stop line, with embedded quotes escaped the way the Ollama parser expects.

Importing an existing Modelfile

FROM mistral:7b
PARAMETER temperature 0.2
SYSTEM """
Output JSON only.
"""

Paste any Modelfile into the import box and it is parsed back into the form — parameters, blocks, and messages — ready to edit.

    Examples

    Persona-tuned chat model

    Input
    FROM llama3.1:8b · SYSTEM "You are Ada…" · temperature 0.7 · num_ctx 8192
    Output
    Commented Modelfile that builds with: ollama create mymodel -f Modelfile

    The classic hobbyist flow: pick a tag, write the persona, tune two parameters, download, build.

    Stop sequences done right

    Input
    stop chips: <|eot|> and END
    Output
    PARAMETER stop "<|eot|>"
    PARAMETER stop "END"

    Each sequence gets its own line with proper quoting — the format users most often get wrong by hand.

    Import, don't transcribe

    Input
    Paste an existing Modelfile into Import
    Output
    The whole form reloads: parameters, blocks, and messages, ready to edit

    Unknown parameters are imported as custom rows and warned about instead of dropped.

    About this tool

    The Ollama Modelfile Builder turns the Modelfile reference into a form. You pick a base model for FROM, type a SYSTEM prompt, add PARAMETER rows for temperature, top_k, num_ctx and friends, and — if you need them — TEMPLATE, ADAPTER, LICENSE and MESSAGE blocks. The preview assembles the file in the documented instruction order (FROM, PARAMETER…, TEMPLATE, ADAPTER, LICENSE, SYSTEM, MESSAGE…) with a short # comment above each section, so the result reads like a tutorial and works on the first ollama create.

    Every parameter row is validated against a registry that mirrors the Modelfile spec: numbers stay numbers, whole-number parameters refuse decimals, booleans emit true or false, and each stop sequence becomes its own PARAMETER stop line with the quotes and backslashes escaped the way Ollama's parser expects. Values Ollama documents without a cap (like repeat_penalty) are not artificially limited, and the documented negative sentinels for num_predict (-1 = infinite, -2 = fill context) are accepted.

    The builder is honest about the parts of the format that have no escape hatch: the Ollama parser ends a """ block at the next """ and defines no way to escape it, so a SYSTEM, TEMPLATE, LICENSE or MESSAGE containing triple quotes is refused with a fix-it hint instead of emitted as a broken file. TEMPLATE is emitted verbatim with a warning, because Go template syntax is not validated here.

    Everything runs in your browser — no Ollama server connection, no uploads, no telemetry on your prompts. You can paste an existing Modelfile into the import box to load it back into the form (unknown parameters survive as custom rows), share settings through a link that encodes the base model and parameters but never your prompt text, and download the result named Modelfile with LF line endings.

    How to use this tool

    1. Pick the base model

      Type or choose a FROM reference like llama3.1:8b. The field validates the name[:tag][@digest] shape so a typo fails here, not at pull time.

    2. Write the prompt and parameters

      Fill the SYSTEM editor, add parameter rows from the registry (each shows its spec description), and manage stop sequences as chips.

    3. Review the live preview

      The right panel assembles the file in canonical order with comments, and refuses to render anything ollama create would reject.

    4. Download or share

      Download the file named Modelfile (LF endings), copy it, or share a settings-only link — prompt contents never enter the URL.

    Use cases

    Persona-tune a local model

    Start from llama3.1:8b, add a team-standard system prompt and two sampling parameters, and hand teammates a Modelfile that builds without edits.

    Package deterministic extractors

    Lock temperature to 0 with a fixed seed and num_predict -1, add stop chips, and ship a model that returns strict JSON every time.

    Learn the parameter space safely

    Every control carries the spec description inline, so you can experiment with mirostat or min_p without misreading the docs.

    Edit an existing Modelfile

    Import a file you found or wrote months ago, tweak the values in validated controls, and re-download instead of transcribing by hand.

    Modelfile instruction quick reference

    InstructionWhat the builder emits
    FROMname[:tag][@digest], always first
    PARAMETEROne line per value; stop arrays emit one line per sequence
    TEMPLATEVerbatim inside a """ block, with an unvalidated-syntax warning
    ADAPTERLoRA GGUF path, optional
    LICENSELicense text inside a """ block
    SYSTEMPrompt inside a """ block, LF newlines
    MESSAGErole + """ block per example exchange, after SYSTEM

    Order follows the documented Modelfile reference: FROM → PARAMETER → TEMPLATE → ADAPTER → LICENSE → SYSTEM → MESSAGE.

    Common mistakes

    Mistake:Putting triple quotes inside a SYSTEM block

    Fix:The Ollama parser ends the """ block at the next """ with no escape, so the builder refuses the text up front — remove or replace the triple quotes (e.g. with typographic quotes).

    Mistake:Writing a FROM reference with spaces like "llama 3.1 latest"

    Fix:The file parses but the pull fails later with an unhelpful registry error. Use the exact tag shape: name[:tag][@digest], e.g. llama3.1:8b.

    Mistake:Hand-capping or mistyping parameter values

    Fix:Invented ranges reject valid configs and typos like a comma decimal fail at ollama create. The registry validates types and only the bounds Ollama actually documents, including num_predict -1/-2.

    Frequently asked questions

    What instructions can a Modelfile contain?

    The documented set is FROM (the base model, always first), PARAMETER (sampling and runtime values, one per line), TEMPLATE (the Go prompt template), ADAPTER (an optional LoRA GGUF), LICENSE, SYSTEM, and MESSAGE (example exchanges). The builder emits all of them in that canonical order with a # comment above each section, so the file explains itself as well as builds.

    Why is my PARAMETER rejected by ollama create?

    Usually one of three things: the parameter name is misspelled or no longer exists in the spec, the value type is wrong (a decimal where a whole number is required, or anything but true/false for a boolean), or a custom name was invented. The builder validates every row against a registry that mirrors the Modelfile reference before emitting anything, so the preview can never show a file ollama create would reject.

    How do multi-line SYSTEM prompts work?

    Ollama expects SYSTEM """ ... """ — a triple-quoted block that preserves line breaks. There is no escape mechanism inside such a block: the parser ends it at the very next """. That is why the builder refuses a SYSTEM, TEMPLATE, LICENSE or MESSAGE containing triple quotes and asks you to remove or replace them, instead of emitting a file that breaks silently halfway through your prompt.

    What is the difference between SYSTEM and MESSAGE?

    SYSTEM is a standing instruction applied to every conversation. MESSAGE blocks are example exchanges (MESSAGE role """ text """ with role user, assistant, or system) that some base models use to demonstrate the assistant's style at generation time. If your goal is to control behavior, SYSTEM is the reliable choice; MESSAGE pairs work only with models whose templates use them.

    Does the Modelfile need a specific name?

    No — you pass the path to ollama create with -f. The convention (and the builder's download name) is Modelfile with no extension: ollama create mymodel -f Modelfile. The download always uses LF line endings, since ollama create on Linux or macOS can misbehave with CRLF files edited on Windows.

    Can I edit a Modelfile I already have?

    Yes. Paste it into the Import box and the tool parses it back into the form: base model, parameter values, stop sequences, template, adapter, license, system prompt, and messages. Parameters it does not recognize are kept as custom rows and flagged with a warning rather than dropped, so nothing in your file disappears silently.

    Are my prompts uploaded anywhere?

    No. The tool is fully client-side: it never contacts an Ollama server or any API, and your prompt text never leaves the browser tab. Even the share link deliberately encodes only the base model and parameter settings — system prompts, templates, and messages stay out of the URL.

    References & standards