Explainer AI & ML 7 min read

What Qwen's chat template adds to your prompt

An open-weight Qwen model never reads your prompt as typed: its chat template wraps it first, and in Qwen3.8 that wrapping includes a reasoning-effort system message of its own. We rendered the templates of eleven Qwen repos to see what each adds, opens and keeps from earlier turns.

Kenji Tanaka
Developer Tools & Cloud Analyst
Published 19 Nov 2026, 9:25 AM (SGT)
Share:
Lines of source code in an editor on a laptop screen, lit by striped orange light
Photo by Daniil Komov on Pexels
Advertisement

A chat template is the short program shipped with an open-weight model that turns your messages into the single string the model reads. Qwen3.8's adds a sentence of its own. We rendered the template files Qwen publishes on Hugging Face on 18 November 2026: on every thinking-mode request with reasoning effort unset or xhigh, Qwen3.8 writes a 207-character system message beginning "Reasoning effort is set to xhigh". That is 37 tokens on the Qwen3 tokenizer, which is older than Qwen3.8's own. It appeared in all three Qwen3.8 repos we rendered and in none of the eight earlier ones.

Qwen3.8 pencils in a system message of its own

The full line, from the Qwen3.8-27B template at commit 3756181 (modified 7 November 2026, Apache-2.0), asks the model to "think carefully through the task, validate key assumptions, consider plausible alternatives". Setting reasoning_effort to low swaps in a 136-character "Keep your thinking brief" line, medium adds nothing, and high stops the render with an error. A system message you send goes after the line. The Qwen3.8-27B card does not mention the line.

The three repos hold two distinct template files (27B and Flash-Next are byte-identical), under different licences: Flash-Next's card metadata says qwen-community-1.0 and 2.4T-A95B's qwen3.8-max. The eight earlier repos hold seven distinct files.

Qwen's Key Concepts page, last modified 9 January 2026 when it called Qwen3 "the newest edition", says: "Starting with Qwen3, no default system messages are used." Qwen3.8 came later. The line Qwen3 did drop is Qwen2.5's: Qwen2.5-7B-Instruct adds "You are Qwen, created by Alibaba Cloud. You are a helpful assistant." (68 characters, 16 tokens) when no system message is sent; no Qwen3, 3.5 or 3.6 template does.

Alibaba's Chat Completions reference, as read on 18 November 2026, maps each level of Qwen3.8's reasoning_effort to a thinking-token budget, default xhigh, and maps high to xhigh where the open template refuses it. It says nothing about system text, and what Alibaba's servers send the model we cannot see.

TemplateCharacters added around a 194-character promptAssistant turn opens with
Qwen2.5-7B-Instruct148assistant
QwQ-32B58<think>
Qwen3-8B50assistant
Qwen3-4B-Instruct-250750assistant
Qwen3-4B-Thinking-250758<think>
Qwen3.5-27B58<think>
Qwen3.6-27B58<think>
Qwen3.8-27B295<think>

One user turn, default settings, transformers 4.57.6. The prompt arrived intact in all 24 single-turn renders.

Most thinking templates open the reasoning block before the model writes a word

Five of the eight templates end the prompt with <think>, so the model starts inside a block it never opened. The reply then shows a closing tag and no opening one, and the Qwen3-4B-Thinking-2507 card says "it is normal for the model's output to contain only </think>". Qwen3-8B's template instead stops at the assistant label and leaves the tag to the model. The Qwen3-0.6B reply in our vLLM on CPU guide opens with the tag; we did not render that model's template.

enable_thinking is read by the template, while /no_think passes straight through it

Four templates in the table read enable_thinking: Qwen3-8B, 3.5, 3.6 and 3.8. Set to False, each writes an empty think block into the prompt, and on Qwen3.8-27B the reasoning-effort line disappears. The other four ignore the argument, and the 2.4T-A95B template refuses it with an error.

Advertisement

Appending " /no_think" to the prompt passed through all eight templates unchanged, and no template contains the string, so whatever it does is learned by the model. The Qwen3-8B card calls it a "soft switch" and adds that it is not valid once enable_thinking=False. The Qwen3.6-27B card, like 3.5's, says the model "does not officially support the soft switch", spelling it /nothink.

Alibaba's 深度思考 (deep thinking) page, as read on 18 November 2026, names 35 Qwen model IDs. By our count, 26 are hybrid with thinking on by default and three always think, so 29 of the 35 think by default; five default to off, and qwen3.6-35b-a3b has no mode stated. Vendor defaults are covered in our guide to prompting Chinese language models.

Last turn's thinking is dropped by most templates and kept by default on Qwen3.8

We built a two-turn chat whose first reply carried synthetic reasoning in the reasoning_content field. QwQ, Qwen3-8B, Thinking-2507 and Qwen3.5 dropped the turn-one reasoning from the second prompt. Qwen3.6 dropped it unless preserve_thinking=True. Qwen3.8 kept it, and its card says preserve_thinking "is enabled by default". Qwen3.5's template ignored the flag.

Qwen3.8's template reads only the reasoning_content field, so reasoning left inline as <think> text in the reply stayed in the history whatever the flag said. The deep-thinking page notes that preserved reasoning_content "会计入输入 Token 数量和计费", that is, it counts toward billed input tokens.

Written-out reasoning sits in the reply, which every template carries forward

Alibaba's text-generation prompt guide (文生文Prompt指南) lists, as its fourth technique (技巧四), asking the model to show its reasoning before the answer. Our Qwen prompt builder adds that as a checkbox, which appends 先输出思考判断过程,再给出结论。 ("first output the reasoning, then give the conclusion"), 16 characters and 10 tokens. To re-run it, set Labels to #背景# 简体, press "Fill the guide's example" and tick the checkbox. The builder counts 194 characters, which come to 114 tokens on the Qwen3 tokenizer.

That sentence asks for reasoning in the visible reply, and the visible reply was kept in history in every one of our 96 renders, across all eight templates and every setting. On a model that already thinks, the checkbox asks for a second, written chain of reasoning, and that is the chain a multi-turn chat carries forward; five of six thinking templates drop the separate one by default. We ran no model and make no quality claim. The prompt guide's body never mentions 深度思考 or 思考模式 (thinking mode).

Before a revision dated 18 November 2026, the builder offered the checkbox with no note on thinking models, described Alibaba's guide as written for Qwen although it speaks of "LLM" throughout, and let a ticked checkbox hide its "add an output" hint. The revision adds a hint under the checkbox, sourced to the deep-thinking page, and switches delimiter when the material already contains ###.

Traditional characters cost about a fifth more tokens at the same length

On the Qwen3 tokenizer, the guide's example in Simplified with Simplified labels is 177 characters and 104 tokens. The same text in Traditional with Traditional labels is also 177 characters and takes 123 tokens, 18% more on our arithmetic. On the Simplified example, English labels add 28 characters but only two tokens. The builder counts code points, which track tokens loosely. These figures hold for the vocabulary Qwen2.5 and Qwen3 share. Qwen3.5 and later use a 248,320-entry vocabulary, which we did not count with.

Rendering a model's own template takes a single function call

The template ships in the repo as chat_template.jinja or inside tokenizer_config.json. Load the tokenizer and call apply_chat_template(messages, tokenize=False, add_generation_prompt=True). Extra keyword arguments such as enable_thinking, reasoning_effort or preserve_thinking are passed to the template, so one render per value shows what each adds. Make sure to note the commit you rendered, as Qwen modified the 3.6 and 3.8 repos on 7 November 2026. Ollama or llama.cpp may carry their own copy of a template; we did not check theirs.

Advertisement
Tags: #LLM #AI #Chinese
Kenji Tanaka
Developer Tools & Cloud Analyst

Kenji Tanaka covers developer tools, cloud platforms, DevOps, CI/CD, and software supply-chain topics for RECATOOLS.

View author profile → · Editorial policy

About this byline Kenji Tanaka is a RECATOOLS editorial persona for developer tools, cloud, DevOps, and software supply-chain coverage. Articles are produced and reviewed under RECATOOLS editorial supervision.

Corrections policy

Go further

Relevant tools

More from AI & ML

Advertisement
Advertisement