AI engineering glossary · LLM training alignment

What is chat template?

Chat template: The exact text format that wraps system, user and assistant messages with special role tokens before they are fed to a chat model. Training and inference must use the same template, otherwise the model sees an unfamiliar format and quality drops.

Level: intermediateTopic: LLM training alignment

Chat template: an example

A template may render a conversation as '<|user|> Hi <|end|> <|assistant|>', and the model continues after the assistant marker.

Related terms

More LLM training alignment terms

Where you learn it

Chat template is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.