Jargonautica
Language Models Specifically

Chat Template

The exact formatting that turns a list of messages into the single string a model actually sees. Each model family has its own, defined during training, and using the wrong one produces output that is subtly worse in ways that are hard to diagnose because nothing errors.

Technical view

Usually specified as a template shipped with the tokeniser, inserting role markers and special tokens around each message and appending a generation prompt for the assistant turn. Mismatches degrade instruction following and safety behaviour without any explicit failure. It is also the boundary that separates system, user and tool content, so its integrity is directly relevant to injection resistance.


Part of AI Terminology Index, section: Language Models Specifically.

How it connects

Chat Template links to 6 other terms. The faint lines are links between those terms. See it in the full graph.

System PromptSystem PromptPromptPromptBase Model and Instruct ModelBase Model and Inst…Assistant PrefillAssistant PrefillVocabulary and Special TokensVocabulary and Spec…Stop SequenceStop SequenceChat Template