Building, Running, and Sharing Custom Models for Ollama (Modelfile)
Step 6: See and Pin the Prompt with TEMPLATE
Every model wraps your inputs in a fixed layout before the model sees them. That layout is the TEMPLATE. You did not write one, so your model inherited it from granite4.1:3b. Look at it:
ollama show --modelfile commitwriter
In the output you will see a TEMPLATE block with special tokens and three variables. The variables are the moving parts. {{ .System }} is where your SYSTEM message goes. {{ .Prompt }} is where the user's input goes. {{ .Response }} is where the model's reply goes.
The template also has guards like {{ if .System }} ... {{ end }}. That means the system block only gets added when a system message exists. The shape, in plain form, looks like this. The tokens below are made up, only to show how the variables slot in. This is not granite's real template:
Local AI Engineering with Ollama
Run, understand, customize, fine-tune, and build agentic apps on your own hardwareEnroll now to unlock all content and receive all future updates for free.
