Chat Template Tester
Paste a model's tokenizer_config.json and a conversation,
and see the exact prompt string its chat template produces, with
special tokens highlighted and every newline visible. It also
checks for a double BOS token, the common silent bug where both the
template and the tokenizer add one. Works on private models:
nothing leaves your browser.
What is a double BOS token and why does it matter?
Many chat templates write the beginning-of-sequence token (such as <|begin_of_text|> or <s>) themselves, and many tokenizers and runtimes also prepend one when the prompt is tokenized with special tokens, which is the default in transformers and llama.cpp. The prompt then starts with two BOS tokens, a sequence the model never saw in training, and output quality quietly drops. llama.cpp has shipped several fixes for it, and the same question comes up for Llama 3, Gemma and Mistral templates.
How do I fix a double BOS?
Either tokenize the rendered prompt with add_special_tokens=False, or remove the BOS from the template and let the tokenizer add it. Afterwards, check that the first token ID appears only once.
Which Jinja engine renders the template?
@huggingface/jinja, the JavaScript implementation Hugging Face built for chat templates (it powers transformers.js). Python transformers uses jinja2, so very unusual template features can differ, but standard chat templates render identically. Nothing you paste leaves your browser.