Chat Template
A template that collects messages from a dialogue (user / assistant / system) into a single prompt for the model. Each model expects its own format.
Why
You send the dialogue as a structure, but the model only understands text. The chat template translates the structure into text with role markers.
Example
<|system|>You are a helpful assistant<|user|>Hello<|assistant|>
Llama, Qwen, Mistral each have their own templates. Using someone else's template will cause the model to 'glitch'.
Where It Matters
- fine-tuning — data is formatted with the same template;
- Ollama and LM Studio — the template is set in the model's config.