Chat template
Beginner
The fixed way a chat is written out for a model, with special marks that show who is talking.
Novice
The exact text format a chat model expects: special control tokens that mark where each turn starts and ends and who is speaking (system, user, assistant). Training and use must follow the same template.
Expert
A Jinja template shipped with the tokenizer that renders a list of messages into tokens (Qwen uses ChatML: <|im_start|>role … <|im_end|>). Mismatches between training and serving templates are a top cause of broken fine-tunes.
See also: Loss masking, Tokenizer.