Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path →
Qwen3,
explained.
"What's 2+2?" doesn't need a model to sit and think — it needs an answer. "Prove this identity" does. Yet most deployments run one fixed policy: either a reasoning model that overthinks trivia, or a chat model that fumbles hard problems. Qwen3's move is to put both in one model and hand you a dial: a thinking budget you can turn up for hard queries and down to zero for easy ones. The interesting question isn't "can it reason?" — it's "when is reasoning worth the tokens?" Here's the arithmetic of spending thought wisely.
What changes against Llama 3: one model, two modes, a budget you set
Rungs 1 and 2 give you a model with one behaviour: ask, and it answers. The reasoning ladder gives you a model with a different single behaviour: ask, and it thinks at length first. Both are wrong some of the time — thinking through a factual lookup wastes tokens and latency, and answering a hard problem immediately wastes the accuracy that was available for the asking.
The change is to put both in one model and expose the choice. A thinking mode and a non-thinking mode in the same weights, with a controllable budget for how many reasoning tokens a query may spend. This is an architecture decision about products as much as about models: it means one deployment rather than two, and it means the allocation decision can be made per query by whoever knows how hard the query is.
Stated in the units the reasoning ladder established, this rung is about the slope of the test-time compute curve rather than its ceiling. Reasoning tokens buy accuracy log-linearly, so the marginal token is worth very different amounts on an easy and a hard query — and the quantity to optimise is therefore accuracy per token spent across a whole workload, not accuracy on the hardest example. Always-think and never-think are both corner solutions to that problem, and a difficulty-gated budget is the interior one.
One model, two modes
Reasoning models like DeepSeek-R1 showed that letting a model generate a long chain-of-thought before answering dramatically improves hard problems — at the cost of many extra tokens. That created an awkward split: teams deployed a slow "reasoning" model for math and code, and a fast "chat" model for everything else, and had to route between them.
Qwen3 collapses that split. A single model supports a thinking mode (emit reasoning tokens, then answer) and a non-thinking mode (answer directly), and you choose per request. More than a toggle, it exposes a thinking budget — a cap on reasoning tokens — turning test-time compute into a continuous dial. One set of weights, tuned to be good at both, so you stop paying to host and route between two models.
Put thinking and non-thinking in one model with a controllable budget, and spend reasoning tokens only where they help — hard queries — to maximize accuracy per token.
The thinking budget
The thinking budget is a cap on how many reasoning tokens the model may spend before it must commit to an answer. It makes the test-time-compute trade-off explicit and tunable: budget 0 is pure direct answering; a large budget lets the model reason at length. Two empirical facts about that curve make the budget powerful.
First, the accuracy gain from thinking saturates — the first reasoning tokens help a lot, later ones little, so past some point more thinking is wasted. Second, thinking helps far more on hard queries than easy ones: an easy question is usually answered correctly with no reasoning at all, leaving almost no headroom for thinking to add. Together these mean the value of a token of thinking depends heavily on which query it's spent on — and that's the opening for a smarter policy than "always" or "never".
Spend it wisely
If thinking mostly helps hard queries, the efficient policy is obvious: gate it on difficulty. Estimate how hard a query is, skip thinking when it's easy, and spend the budget when it's hard. That's how a controllable budget beats a fixed one — it moves compute to where the marginal token buys the most accuracy.
Concretely: on a batch of mixed queries, always-thinking pays the full reasoning cost on every request, including the majority that were easy and gained nothing. Gating on difficulty pays that cost only on the hard subset, keeping essentially the same accuracy for a fraction of the tokens. The saturation point also tells you how much to spend once you do think — enough to catch the steep part of the curve, not so much that you're past diminishing returns.
Accuracy per token
Model accuracy as a direct-answer baseline plus a saturating gain from thinking, where the headroom for that gain scales with query difficulty:
d = difficulty, t = thinking tokens, τ = saturation scale. At t=0, A=1−d (direct answer). The gain term is scaled by d, so easy queries (small d) have almost no headroom — thinking barely moves them — while hard queries (large d) gain a lot. The (1−e^−t/τ) factor saturates: early tokens help most.
Now the policy. Gate thinking on a difficulty threshold, and only spend the budget when the gate fires:
Easy queries cost 0 reasoning tokens; hard ones cost B. Against always-thinking (B on every query), the gate keeps the accuracy that mattered while spending a fraction of the tokens — the accuracy-per-token win. The runnable version below shows thinking helping hard queries far more, and adaptive budgeting undercutting always-think on tokens.
How the Qwen team trained Qwen3
The Qwen3 technical report comes from the Qwen team at Alibaba, released in May 2025. It covers six dense models from 0.6B to 32B parameters and two mixture-of-experts models, Qwen3-30B-A3B and Qwen3-235B-A22B, all released under the Apache 2.0 licence.
Architecture and pretraining
The models use grouped-query attention, SwiGLU, rotary positions and RMSNorm pre-normalization, with one change from Qwen2: the bias on the query, key and value projections is removed and QK-Norm is added for training stability. The MoE models have 128 experts with 8 active per token and, unlike Qwen2.5-MoE, no shared expert. Pretraining covers 36T tokens in 119 languages and dialects, in three stages: a general stage of more than 30T tokens at a 4,096-token context; a reasoning stage of about 5T higher-quality tokens weighted toward STEM, code, reasoning and synthetic data; and a long-context stage of hundreds of billions of tokens at 32,768 tokens, with the rotary base frequency raised from 10,000 to 1,000,000.
Post-training the flagship models
- Long chain-of-thought cold start. Math, code, logic and STEM problems with verified answers or test cases. Queries that cannot be verified, or that a strong instruct model answers without reasoning, are removed, and candidate responses from QwQ-32B are filtered for wrong answers, repetition, guesswork and language mixing. The aim is to plant reasoning patterns with few samples and few steps, not to maximize scores.
- Reasoning reinforcement learning. GRPO on 3,995 query-verifier pairs chosen to be unseen in the cold start, learnable by the cold-start model, and as hard as possible, with large batches, many rollouts per query and controlled entropy. For Qwen3-235B-A22B, AIME'24 rose from 70.1 to 85.1 over 170 RL steps.
- Thinking-mode fusion. Continued supervised fine-tuning on a mix of thinking data, produced by rejection sampling from the stage-2 model, and non-thinking data covering coding, math, instruction following, writing and more. The chat template accepts /think and /no_think flags in the user or system message; non-thinking answers keep an empty thinking block so the format stays the same, and in a multi-turn chat the most recent flag wins.
- General reinforcement learning. A reward system spanning more than 20 tasks, including instruction following, format following (honoring the flags and the thinking tags), preference alignment, tool calling in multi-turn agent episodes, and retrieval-augmented answers. Rewards are rule-based, model-scored against a reference answer, or taken from a preference-trained reward model where no reference exists.
The thinking budget
The budget is not a separately trained skill; the report says it emerged from thinking-mode fusion. When the thinking reaches the user's token budget, generation is halted, a fixed sentence saying time is up is inserted with the closing think tag, and the model writes its answer from the partial reasoning it has.
Strong-to-weak distillation
The four stages run only for the two flagships, Qwen3-235B-A22B and Qwen3-32B. The 0.6B to 14B dense models and the 30B-A3B MoE are distilled instead: first off-policy, on teacher outputs generated in both modes, then on-policy, where the student generates responses and is trained to match the teacher's token distributions by minimizing KL divergence.
The thinking-budget rule and the mode flags
Qwen3 sets how much to think with a template, not a learned controller. Given a prompt x, a mode set by the most recent /think or /no_think flag, and a budget B:
/think: zt ∼ πθ( · | x, z<t ) for t = 1 … T, with T = min(Tstop, B)
if T = B: append sstop and </think>
y ∼ πθ( · | x, <think> z1:T </think> )
zt— the thinking tokens, sampled until the model closes its own think block at step Tstop or the budget runs outB— the caller's cap on thinking tokenssstop— a fixed sentence telling the model time is up and it must answer from the thinking it hasy— the final answer, conditioned on whatever thinking exists
When B is at least Tstop the budget never binds, and this is full thinking mode. As B shrinks, the answer is written from an ever shorter partial chain, and the report shows accuracy on math, code and science benchmarks rising smoothly as the budget grows. The /no_think extreme is not a budget of zero with a forced stop: it is the empty think block the model was trained on directly during thinking-mode fusion, which is why it behaves as a genuine direct answerer rather than a reasoner cut off mid-thought.
What the Qwen3 report measured
The flagships were evaluated in both modes against leading models of early 2025, including DeepSeek-R1 and OpenAI's o1 in thinking mode and DeepSeek-V3 and GPT-4o in non-thinking mode, across math, code, reasoning, alignment, agent and multilingual benchmarks. The report also ablates its own training stages.
| Qwen3-235B-A22B | Reported |
|---|---|
| AIME'24, thinking mode | 85.7 |
| AIME'25, thinking mode | 81.5 |
| LiveCodeBench v5, thinking mode | 70.7 |
| Reasoning RL alone, AIME'24 | 70.1 → 85.1 in 170 steps |
| Pretraining | 36T tokens, 119 languages and dialects |
| Active / total parameters | 22B / 235B, 8 of 128 experts per token |
The thinking-budget experiments show scores on AIME, LiveCodeBench and GPQA-Diamond climbing smoothly as the budget increases, which is what makes the budget usable as a dial rather than a switch.
The trade-offs the report admits. Stages 3 and 4 improved general abilities, instruction following and agent skills, but lowered thinking-mode scores on the hardest tasks such as AIME'24 and LiveCodeBench; the team attributes this to training on a broader range of tasks and accepted it for versatility. Distillation beat reinforcement learning for the small models: on-policy distillation from a flagship reached better scores than running RL on the same student, for about a tenth of the GPU hours. And the hybrid design itself did not last: in July 2025 the team released separate Instruct and Thinking versions of Qwen3-235B-A22B, the 2507 models, saying that training the two modes separately gave better quality than one hybrid model.
What is claimed, and what remains open
The hard part is not the two modes but the gate, and it is genuinely hard for a reason that does not go away: deciding how much thinking a question needs is a judgement about difficulty made before the question has been worked, and the cases where that judgement is wrong are exactly the cases that matter — a question that looks simple and is not. A budget dial hands that problem to the caller, which is honest, and does not solve it.
The benchmark figures are vendor-reported, and the accuracy-per-token framing makes cross-model comparison harder rather than easier, since two models can be compared at equal quality or at equal cost and those give different orderings. Worth asking of any such claim: at what budget, against which baseline, on whose workload.
How it held up: the pattern spread fast and is now ordinary. A user-visible thinking toggle, a reasoning-effort parameter, or an automatic difficulty router — the tiered routing at the top of the frontier ladder is the same idea moved server-side and hidden — are all versions of the allocation problem this rung named. That an open model shipped it as an explicit control rather than a hidden policy is the part worth keeping.
Budget the thinking
Qwen3's dial is a trade-off you can compute. Accuracy is a direct-answer baseline (1 − difficulty) plus a saturating gain from thinking whose headroom scales with difficulty — so thinking barely helps an easy query but lifts a hard one a lot, and more tokens never hurt. A gate skips thinking on easy queries and spends the budget on hard ones, so a mixed batch pays the reasoning cost only where it matters — fewer tokens than always-thinking for essentially the same accuracy. Change the difficulties, threshold, or budget and watch the spend move.
Write the body of accuracy. Everything else in the file is
already written; this is the function the paper is about. Press ▶ Run to check it against
the 5 assertions below — they start red.
- With no thinking, accuracy is the direct-answer baseline (1 - difficulty)
- Thinking helps hard queries more than easy ones
- The gate skips easy queries and engages on hard ones
- More thinking tokens never reduce accuracy (monotone)
- Adaptive budgeting spends fewer tokens than always-thinking
The dial, not the switch
Qwen3 reframed reasoning from a property of the model to a property of the request. The reasoning-model wave asked "is this a thinking model?"; Qwen3 answers "how much should this query think?" — the more useful question once you're paying per token in production. Treating test-time compute as an adjustable budget, rather than baked-in, is now a common design point, and other frontier models have adopted similar controllable-reasoning behavior.
The underlying principle is broader than any one model: reasoning tokens are compute, compute has diminishing returns, and returns depend on the problem — so the right amount of thinking is adaptive, not fixed. Qwen3 packaged that principle into a single deployable model with a knob a developer can actually turn. The frontier isn't only about models that can think harder; it's about models that know when to, and let you decide when they don't.
The gate is only as good as its difficulty estimate. Misjudge an easy query as hard and you waste the budget; misjudge a hard one as easy and you fail it. In practice difficulty is estimated from the query (and sometimes a quick model pass), so the accuracy-per-token win depends on that estimate being roughly right.
Questions people ask about Qwen3
How does the Qwen3 thinking budget work?
The thinking budget is a cap on how many tokens Qwen3 may spend reasoning before it answers. When the model's thinking reaches the cap, generation is stopped, a fixed instruction saying time is up is inserted along with the closing think tag, and the model then writes its final answer from the partial reasoning it already has. The Qwen team says this ability was not trained explicitly; it emerged from thinking-mode fusion, the stage that taught one model both to think and to answer directly. The report shows accuracy on math, coding and science benchmarks rising smoothly as the budget grows, so the cap trades accuracy for tokens and latency in a predictable way.
What do /think and /no_think do in Qwen3?
They are soft switches placed in a user message or the system message. With /think, the model writes its reasoning inside a think block before the answer; with /no_think, it answers directly and leaves the think block empty, which is exactly the format it was trained on during thinking-mode fusion. Thinking is the default when no flag is given. In a multi-turn conversation the model follows the most recent flag, so a user can turn reasoning on for one hard question and off again for the next. Serving frameworks typically also expose the same switch as a chat-template setting, so an application can choose the mode without editing the prompt text.
Why did Qwen release separate Instruct and Thinking models after Qwen3?
In July 2025 the Qwen team released Qwen3-235B-A22B-Instruct-2507 and a matching Thinking-2507 model instead of updating the hybrid model, saying that training the two modes separately gave better quality than one model that does both. That is consistent with a trade-off the original report already admitted: the stages that fused the modes and broadened the model's skills slightly lowered thinking-mode scores on the hardest math and coding benchmarks. A hybrid model has to share one set of weights between two behaviors, while separate models can each be optimized for one. The cost of the split is hosting and routing between two models, which is exactly what the hybrid design set out to avoid.
How does strong-to-weak distillation train the small Qwen3 models?
Instead of running the full four-stage pipeline on every size, the 0.6B, 1.7B, 4B, 8B and 14B dense models and the 30B-A3B mixture-of-experts model learn from a flagship teacher, Qwen3-235B-A22B or Qwen3-32B, in two phases. Off-policy distillation fine-tunes the student on responses the teacher generated in both thinking and non-thinking modes, which gives it both behaviors. On-policy distillation then has the student generate its own responses and trains it to match the teacher's token-level distributions by minimizing KL divergence. The report says this gave better results than reinforcement learning on the small models while using about one-tenth of the GPU hours.
How large are the Qwen3 mixture-of-experts models, and how many experts do they activate?
Two MoE models were released. Qwen3-235B-A22B has 235 billion total parameters with about 22 billion active per token, and Qwen3-30B-A3B has 30 billion total with about 3 billion active. Both use 128 experts and route each token to 8 of them, and unlike Qwen2.5-MoE they have no shared expert that every token passes through; a global-batch load-balancing loss encourages the experts to specialize. The active parameter count sets the per-token compute, so the 30B-A3B model runs at roughly the cost of a 3B dense model while drawing on a much larger set of weights. Both support the same thinking and non-thinking modes as the dense models.
4 questions to test what you just read
Work each one out before you open it — a number, a prediction or a reason, not a definition. Producing the answer is what makes it stick. Your progress is kept on this device.
A batch has 1,000 queries: 800 easy ones that need no thinking and 200 hard ones. With a 4,000-token budget, how many thinking tokens can always-think spend, and how many does thinking only on the hard 200 spend?
Show answer
Always-think: up to 1,000 × 4,000 = 4,000,000 tokens. Thinking only on the hard queries: 200 × 4,000 = 800,000, a fifth of the spend. Qwen3 does not make that choice for you: the caller sets /think, /no_think and the budget per request, so the saving depends on routing queries correctly.
Qwen3-235B-A22B went from 70.1 to 85.1 on AIME'24 over 170 reasoning-RL steps. What is the average gain per step, and why can the later stages lower this kind of score?
Show answer
(85.1 − 70.1) ÷ 170 ≈ 0.09 points per step. Stages 3 and 4 then train on a much broader set of tasks, and the report's stage ablation found thinking-mode scores on the hardest benchmarks, such as AIME'24, slightly lower afterward: generality was bought with a little peak reasoning.
Why does Qwen3 keep an empty think block in non-thinking answers instead of leaving it out?
Show answer
So both modes share one output format. The model always emits a think block, empty or not, which keeps the template consistent and lets a parser treat every response the same way. It also makes non-thinking a trained state the model recognizes, not a reasoning run cut off early.
With a fixed small thinking budget, which fails more often, an easy lookup or a hard multi-step proof, and why does the budget make that failure easy to miss?
Show answer
The hard proof. Easy questions are usually solved with little or no thinking, so the cap rarely binds, while a hard problem hits the cap mid-reasoning. The model is then told to answer from a partial chain and still produces a confident-looking answer, so nothing in the output shows that the reasoning was cut off.
The open-weights line
Five releases you can actually download, in the order each one answered the last. This is where "what does a frontier recipe look like" is documented in public.
- 1Llama 22023
- 2Llama 32024
- 3Qwen32025
- 4Kimi K22025
- 5Kimi K32026
Explore the topic
See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.
More Paper Breakdowns
- Attention Is All You NeedThe paper that introduced the Transformer — the architecture underneath GPT, BERT, Claude, and Gemini. Self-attention, Query/Key/Value, multi-head attention, positional encoding, and the real BLEU results, explained in depth with analogies and animated visuals, not just equations.Read →
- BERTThe paper that made "pre-train once, fine-tune anywhere" the default for NLP. Bidirectional context, masked language modeling, next-sentence prediction, the [CLS]/[SEP] tokens, and the GLUE sweep — explained with analogies, not just equations.Read →
- Chain-of-Thought PromptingShow a model a few worked examples with their reasoning and it starts solving problems it used to fail. Why reasoning emerges only at scale, the GSM8K jump, zero-shot "Let's think step by step", and how CoT seeded modern reasoning models.Read →
- LoRAThe paper that made fine-tuning affordable. Freeze the giant pretrained model and train two tiny low-rank matrices instead — up to 10,000x fewer trainable parameters, no extra inference latency, and swappable per-task adapters. The road to QLoRA and PEFT.Read →
- Direct Preference OptimizationRLHF without the RL. Align a model to human preference pairs with one simple classification-style loss — no separate reward model, no unstable reinforcement learning. Why "your LM is secretly a reward model", and how DPO became the default alignment method.Read →
- ChinchillaThe compute-optimal scaling law that said models were too big. Parameters and training tokens should scale together — ~20 tokens per parameter — so a 70B model trained on 1.4T tokens beat the 280B giants. Why every model since trains on trillions of tokens.Read →