# Chat Template Anatomy: Jinja, Special Tokens, and Token-by-Token Breakdown

> Source: https://sukruyusufkaya.com/en/learn/fine-tuning-cookbook/ftc-chat-template-anatomi-jinja-tokens
> Updated: 2026-05-14T14:42:50.450Z
> Category: Fine-Tuning Cookbook (Model-by-Model)
> Module: Part II — Tokenizer & Data Engineering
**TLDR:** Chat template = the format LLM understands as 'conversation'. Token-by-token anatomy of Llama-3, Qwen 2.5, Gemma 3, Mistral, Phi-4 chat templates. What apply_chat_template does under the hood, token IDs of system/user/assistant roles, tool-calling extensions, multimodal turn formats.

