Models

Chat Template Converter

Every instruction-tuned model expects its own wrapping of roles and special tokens, and getting it slightly wrong quietly degrades answers. Enter a conversation once and see the rendered prompt for each template, with special tokens highlighted, ready to paste into a raw completion call, a llama.cpp prompt, or a test.

Loading the tool…

How it works

01

Write the conversation

System, then alternating user and assistant turns; add or remove turns freely.

02

Pick templates

ChatML (Qwen, many fine-tunes), Llama 3 and 3.1, Llama 2, Mistral / Mixtral, Gemma, Phi-3, Alpaca, Vicuna, and a custom Jinja-lite editor.

03

Copy

The rendered string, with an option to add the generation prompt (the assistant header without content) for inference.

Formats, limits and the numbers that matter

Special tokens

Rendered as text here; when tokenising with the real tokenizer they must map to their single ids. Most Hugging Face tokenizers handle this when add_special_tokens is left on.

System prompts

Llama 2 and Mistral place the system text inside the first user turn; Gemma has no system role and the tool folds it into the first user message, as the model card recommends.

Training data

The same rendering is what SFTTrainer applies via tokenizer.apply_chat_template; use it to check what the model actually sees.

Common questions

Which template does my fine-tune use?

The one in its tokenizer_config.json chat_template; the custom editor accepts a subset of that Jinja syntax.

Does it add BOS?

Per template: Llama and Mistral start with <s> or <|begin_of_text|>; ChatML does not.

Multi-turn?

Yes; templates that require alternation warn when turns do not alternate.