A chat template formats system, user and assistant messages into the exact token sequence (special role and end-of-turn tokens) the model was trained on.
Training or serving with a different template shifts the input distribution: quality drops, the model may not stop generating, or it may echo role tokens.
Use the tokenizer's built-in chat template for both training and inference, and test a few formatted examples by decoding them back to text.
Loading…