Downloads · 30 days
0
Smoffyy/Revised-Qwen-Templates
Revised-Qwen-Templates is a machine learning model from Smoffyy. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
<img width="900px" src="https://cdn-uploads.huggingface.co/production/uploads/648812cd28c3bccafcd68e4c/2lvLaFSTCqugEgiyF0aFn.png"
Downloads · 30 days
0
Access
Public
Updated May 20, 2026
Repo size
—
Likes
2
Public
Click a slice to open those files.
.json19 KB · 35%
From the Hugging Face model README
2026-05-20: Merged Qwen 3.5 and Qwen 3.6 chat templates together, they're the exact same and should be compatible!
Revised Jinja2 chat templates for Qwen models. Drop in replacements for the official templates with bug fixes and quality of life improvements.
Within each Qwen version folder there are two sub-folders:
| Folder | Reasoning toggle scope |
|---|---|
strict/ | System prompt only |
flexible/ | System prompt or user message |
Both variants are otherwise identical. Use strict/ if reasoning should be a server-side decision only. Use flexible/ if you want end users to be able to toggle it themselves per message.
Recommendation: Most users will want
flexible/as it covers all the same use cases asstrict/with more flexibility.
| Qwen Version | Coverage |
|---|---|
| Qwen 3.6 | All models |
| Qwen 3.5 | All models |
Thinking is off by default. To enable it, place <|reasoning|> anywhere in the system prompt:
You are a helpful assistant.
<|reasoning|>
To explicitly turn it back off (useful in flexible/ when a user wants to disable reasoning mid-conversation):
<|no_reasoning|>
In the flexible/ variant, both tokens are accepted in either the system prompt or user messages. The last token seen wins, so a user can override the system prompt's setting and vice versa.
default (off) → <|reasoning|> / <|no_reasoning|> → external enable_thinking param
The enable_thinking parameter passed by your runtime always takes final precedence over any token in the prompt.
Improper tag hallucinations normalized - The model occasionally outputs malformed closing tags such as </ think> or < /think>. These are now normalized to </think> before any processing occurs, preventing broken reasoning extraction.
Reasoning hallucination suppressed - When thinking is disabled, Qwen models are prone to hallucinating <think> tags anyway. An empty closed <think>\n\n</think> block is now injected at the generation prompt to actively force the bypass rather than simply omitting the tag.
Dead-weight <think> tags respect preserve_thinking — The official template could emit empty <think></think> blocks on past turns even with preserve_thinking enabled. Tags are now only emitted when reasoning_content is actually non-empty, regardless of preserve_thinking state.
Same fixes as Qwen 3.5 - Incorporates most of the same fixes and features.
Dead-weight <think> tags removed - The official template wraps every past assistant turn in <think></think> even when there is no reasoning content. Tags are now only emitted when reasoning_content is non-empty.
Unclosed <think> block handled - If a framework captures a tool call mid-reasoning before </think> is emitted, the content arrives malformed. The template now extracts the partial reasoning and clears the broken tag instead of emitting raw <think> text into the output.
is sequence -> is iterable - is sequence is not a registered Jinja2 test in all inference runtimes (LM Studio, llama.cpp, etc). Replaced with is iterable, which is universally supported. Behavior is identical for all real tool argument types.
Thinking off by default - The official template defaults to thinking enabled. This template defaults to disabled, so you never need to pass enable_thinking=false on every request.
Reasoning toggle via prompt tokens - Use <|reasoning|> to enable and <|no_reasoning|> to disable. Scope depends on the variant (strict/ = system prompt only, flexible/ = any message).
developer role support - The official template only accepts system for system-level instructions. This template also accepts role: developer (OpenAI API spec) and maps it to the system role transparently.
froggeric's Qwen Fixed Chat Templates - a similar project that inspired me to make my own templates.
These templates follow the original Qwen license for their respective model version.