Glossary · Term

chat template

← all terms

Definition

Plain language

A small script shipped with a model that glues your messages into the exact text format the model was trained to read.

As stated in the literature

A per-model formatting spec (commonly Jinja) that renders role-labelled messages, system prompts, and tool definitions into a single token string; differences or unfilled variables between engines produce observable behavioural tells.

Also called: chat templates

Why it matters: Get the template wrong and a perfectly good model starts rambling, ignoring instructions, or leaking stray formatting text — and the exact mistakes it makes reveal which software is running it.

For example, the same question "what is 2+2?" might be handed to one model as "<|user|>what is 2+2?<|assistant|>" and to another as "[INST] what is 2+2? [/INST]", and the template is the little script that decides which.

Heard on the show

“… rather than the structured five-quantile prompt — because base models don't reliably follow chat templates. …”
Episode 069 — When Smarter Models Forecast Worse: The Hidden Failure Mode in LLM Predictions

Related concepts

Related terms