New Tool Radar

Local AI

How to Read a Model’s Modelfile with Ollama Show

Run ollama show --modelfile to print the recipe behind a model — its base, template, system prompt, and parameters — before you copy or change it.

Schematic diagram with three steps: show the Modelfile with ollama show --modelfile, read the FROM line for the base model, then read the template and stop parameters.

A Modelfile is the blueprint to create and share models with Ollama: it combines a base model with a system message, parameters, and a prompt template into a model you can run by name. Before you build your own model, or change one you already have, you can read the recipe of a model that is already on your machine. The command is ollama show --modelfile, and the Modelfile reference says to use it to view the Modelfile of a given model. It is a different read from the plain ollama show flags: --parameters prints only the parameters and --license prints only the license, while --modelfile prints the whole recipe.

What the output shows

The Modelfile reference gives the output for llama3.2 as its example. The first lines are comments the command writes for you, then the recipe itself.

Line in the output Exact value (reference’s own example) What it tells you
Comment # Modelfile generated by "ollama show" This file was printed by Ollama, not written by hand
Comment # To build a new Modelfile based on this one, replace the FROM line with: How to reuse this recipe for your own model
Comment # FROM llama3.2:latest The FROM line to use when you rebuild from it
FROM FROM /Users/pdevine/.ollama/models/blobs/sha256-00e1317cbf74d901080d7100f57580ba8dd8de57203072dc6f668324ba545f29 The base weights, named here by their blob path, not by a model name
PARAMETER stop PARAMETER stop "<|start_header_id|>", "<|end_header_id|>", "<|eot_id|>", "<|reserved_special_token" The stop sequences that tell the model when to stop generating

The TEMPLATE line holds the full prompt template, built from {{ .System }}, {{ .Prompt }}, and {{ .Response }}. The reference’s example template wraps the system message and the prompt in <|start_header_id|> and <|eot_id|> markers. The other instructions the format supports are PARAMETER for how Ollama runs the model, SYSTEM for the system message, ADAPTER for a LoRA adapter, LICENSE for the legal license, and MESSAGE for example message history.

Use it as a starting point

Save the printed Modelfile, replace the FROM line with the commented-out FROM llama3.2:latest, edit what you want to change, and build it with ollama create choose-a-model-name -f <location of the file>, then run it with ollama run choose-a-model-name. Two details from the cheat sheet will save you confusion: --system prints nothing for stock library models, because they ship without a system prompt, so do not expect a SYSTEM line in the printed file; and on newer models --template prints only {{ .Prompt }}, because prompt formatting has moved into the built-in RENDERER and PARSER that --modelfile reveals.

Try it: read the recipe for llama3.2

Run the command on a model you already have pulled:

ollama show --modelfile llama3.2

Check What you should see What it means
Header comments # Modelfile generated by "ollama show" and the # FROM llama3.2:latest hint Ollama printed this recipe for you to reuse
Base A FROM line with a blob path Which weights this model is built from
Stop sequences PARAMETER stop lines such as "<|eot_id|>" When the model stops generating

Expected result. We checked the Ollama Modelfile reference, which gives the ollama show –modelfile output for llama3.2 line by line, and the Ollama commands cheat sheet, which lists the –modelfile flag. We did not run ollama show –modelfile on this machine, so we have no output of our own; the lines above are the reference’s, not ours.

Limits

This command reads a configuration, not a quality score: it tells you what the model is built from and how it is prompted, not how well it answers or how fast it runs. The generated FROM line is a blob path on the machine that printed it, so replace it with a model name before you rebuild from it, as the printed comment says. The Modelfile reference notes that Modelfile syntax is in development. To read only the parameters or only the license, use --parameters or --license instead; those are separate reads covered by the model-inspection guide. The printed output in this guide comes from the Modelfile reference and a third-party cheat sheet that was checked against Ollama 0.40.14. We did not test any of this ourselves.

Sources

See all