SyncAI.news, a Varaisys broadcasting
The 4 Things Qwen-3’s Chat Template Teaches Us
HF

Hugging Face Blog

· 1 min read

AI LabsHugging Face Blog

The 4 Things Qwen-3’s Chat Template Teaches Us

What a boring Jinja snippet tells us about the new Qwen-3 model.

The new Qwen-3 model by Qwen ships with a much more sophisticated chat template than its predecessors Qwen-2.5 and QwQ. By taking a look at the differences in the Jinja template, we can find interesting insights into the new model.

Chat Templates

  • Qwen-3 Chat Template
  • Qwen-2.5 Chat Template
  • Qwen-QwQ Chat Template

What is a Chat Template?

A chat template defines how conversations between users and models are structured and formatted. The template acts as a translator, converting a human-readable conversation:

  [
    { role: "user", content: "Hi there!" },
    { role: "assistant", content: "Hi there, how can I help you today?" },
    { role: "user", content: "I'm looking for a new pair of shoes." },
  ]

into a model friendly format:

<|im_start|>user
Hi there!<|im_end|>
<|im_start|>assistant
Hi there, how can I help you today?<|im_end|>
<|im_start|>user
I'm looking for a new pair of shoes.<|im_end|>
<|im_start|>assistant
<think>

</think>

You can easily view the chat template for a given model on the Hugging Face model page.

Chat Template for Qwen/Qwen3-235B-A22B

Let's dive into the Qwen-3 chat template and see what we can learn!

1. Reasoning doesn't have to be forced

and you can make it optional via a simple prefill...

Qwen-3 is unique in its ability to toggle reasoning via the enable_thinking flag. When set to false, the template inserts an empty <think></think> pair, telling the model to skip step‑by‑step thoughts. Earlier models baked the <think> tag into every generation, forcing chain‑of‑thought whether you wanted it or not.

{# Qwen-3 #}
{%- if enable_thinking is defined and enable_thinking is false %}
    {{- '<think>\n\n</think>\n\n' }}
{%- endif %}

QwQ for example, forces reasoning in every conversation.

{# QwQ #}
{%- if add_generation_prompt %}
    {{- '<|im_start|>assistant\n<think>\n' }}
{%- endif %}

If the enable_thinking is true, the model is able to decide whether to think or not.

Why this matters:

Original source

This story was published by Hugging Face Blog. SyncAI.news shows a preview; the complete article is on the publisher's site.

Read the full story on huggingface.co

Similar News