Chat Template

Domain: LLM Concepts

🎯 Motivation

Different LLMs expect different formats for conversations (system/user/assistant turns). Chat templates structure the conversation correctly for each model.

πŸ“‹ Concrete Example

ChatML format: <|im_start|>system\nYou are helpful<|im_end|>\n<|im_start|>user\nHi<|im_end|>. Each model has its own template. Using the wrong one confuses the model.

πŸ”— Analogy

Different schools have different uniform formats - one school requires blazers, another requires polo shirts. You must dress according to the school’s template. Same content, different packaging.