Chat template
Also called Chat Template
The fixed format of special markers that tells a model who said what — system, user, assistant — in a conversation.
Think of it like
A screenplay's formatting: character names and stage directions so everyone knows whose line is whose.
Example
Behind a chat interface, your message gets wrapped with role markers like a user tag before the model ever sees it.
How it actually works
Models do not inherently know turn boundaries; a chat template encodes them with special tokens marking system, user, and assistant roles. The model is trained with this exact format, so using a mismatched template at inference degrades quality or breaks behavior. It is a small, rigid contract that carries a lot of weight — get the template wrong and even a great model acts confused.
For product teams
An invisible formatting layer whose correctness quietly determines whether a model behaves right.
For engineers
The role-delimiting token format a model was trained on; must match exactly at inference.
Related
- Instruction dataset — The data authored in this format.
- System message — One role it marks.
- Turn — The unit it delimits.
Read anything AI without the jargon
Look up any term in plain English, or save terms as you read with the free Chrome extension.
Open DecoderAdd to Chrome