Paper notes

Qwen3 Technical Report: One Model, Two Modes, a Thinking Budget and Strong-to-Weak Distillation

Qwen3 (2025) is a family of eight Apache-2.0 open models, six dense and two MoE. One checkpoint has thinking and non-thinking modes, thinking can be capped by a budget, and small models are distilled from large ones. This post recomputes all parameter counts and runs a budget experiment.

Published Updated 46 min read

On this page
  1. Why This Paper Is Worth Reading
  2. Background: Two Models or One?
  3. Core Idea: Learn to Think First, Fuse Non-Thinking in, Distill the Small Models
  4. Method
  5. Architecture: Qwen2.5 Plus QK-Norm; MoE Without Shared Experts
  6. Pre-training: 36 Trillion Tokens in Three Stages
  7. The Four Post-Training Stages
  8. Strong-to-Weak Distillation
  9. Thinking Budget
  10. Experiments and Conclusions
  11. Hands-on: reconciling parameter counts, the chat template and soft switches, the thinking budget
  12. Parameter counts: six models match the Hub exactly, 0.6B and 1.7B carry an extra output head
  13. MoE activated parameters and the KV cache
  14. Chat template and soft switches: all 60 checks match the paper
  15. Thinking budget: accuracy rises with the budget, but on these problems not thinking does better
  16. Where in the thinking the correct answer first appears
  17. Design, adjustments and limitations
  18. Limitations and What Came Next
  19. What to Take Away From This Paper
  20. Further Reading
  21. FAQ

Qwen3 (Qwen3 Technical Report, Alibaba’s Qwen team) is a family of open-weight language models: six dense models (0.6B, 1.7B, 4B, 8B, 14B, 32B) and two mixture-of-experts (MoE) models (30B-A3B and 235B-A22B, where the number after “A” is the parameters activated per token), all released under Apache 2.0. Three design choices define it. One checkpoint holds both a chat model and a reasoning model, switched turn by turn with /think and /no_think in the chat template. A “thinking budget” lets the serving code cut thinking short. And the small models do not each repeat the four-stage post-training recipe; they are distilled from the flagships (“strong-to-weak distillation”), which the paper says needs about 1/10 of the GPU hours.

The paper appeared on arXiv on May 14, 2025 (v1), and this post follows v1. Besides summarizing it, I did three things you can check yourself: recompute the parameter counts of all eight models from their public config.json and compare them with Hugging Face’s statistics; test the chat template and the /think and /no_think soft switches on Qwen3-4B; and run a small “thinking budget” experiment on Qwen3-4B with 48 synthetic arithmetic problems. The results: the recomputed parameter counts match the Hub’s to the last digit except for 0.6B and 1.7B (where the Hub counts an extra output head); all 60 checks of /think, /no_think and “the last tag wins” match the paper; and on the 48 arithmetic chains, raising the thinking budget from 0 to 1,024 tokens lifts accuracy from 0.12 to 0.90, yet the same model answers all 48 correctly without thinking when it simply reasons step by step (158 tokens on average), so a budget only pays off when a problem really needs long reasoning. External information (model cards, later releases) was consulted in November 2026.

Why This Paper Is Worth Reading

  • It turns “should the model think?” into a switch. The abstract says the aim is to remove the need to move between chat-optimized models (such as GPT-4o) and dedicated reasoning models (such as QwQ-32B). Section 4.3 describes the switch, the budget and the template in enough detail to reproduce.
  • It is a fairly complete open-weight recipe. Three pre-training stages, four post-training stages, a cost comparison of reinforcement learning and distillation (Table 21) and a stage-by-stage ablation (Table 22) all come with numbers; what is missing is the data and the training code (see the limitations).
  • The models are widely used. The Qwen3 series is a base for many fine-tuning, evaluation and agent projects; the experiments on this site’s agents and tool calling page use Qwen3-4B.
  • It gives a head-to-head of distillation and reinforcement learning. From the same 8B checkpoint, reinforcement learning took 17,920 GPU hours and on-policy distillation 1,800, and distillation scored 6.8 points higher on AIME’24 with a better pass@64 (Table 21).
  • It does not show only the flattering numbers. Table 22 shows that after thinking-mode fusion and general reinforcement learning, the 32B model’s thinking-mode scores on AIME’24 and LiveCodeBench go down, and the paper says it accepted that trade-off for versatility.

Background: Two Models or One?

The paper opens by splitting the landscape in two: reasoning models that get long chains of thought from reinforcement learning (it names OpenAI o3, DeepSeek-R1 and QwQ-32B) and general chat models (GPT-4o, Qwen2.5 and others). The former are stronger at mathematics and code but must write a long deliberation before every answer; the latter are fast and cheap. A product that serves both kinds of request usually runs two models behind a router, doubling deployment and evaluation work.

Qwen3 tries to teach one set of weights both behaviors and let the template decide. That is hard for three reasons:

  1. The two kinds of answer look very different. Thinking answers carry a long <think> block and non-thinking answers do not; one set of parameters has to fit both distributions without hurting either.
  2. The switch must be reliable. Users drop flags into multi-turn chats at will, and the model has to obey the last one.
  3. There should be a middle setting. Choosing only between “full thinking” and “no thinking” is too coarse; developers want an adjustable knob.

Core Idea: Learn to Think First, Fuse Non-Thinking in, Distill the Small Models

The post-training pipeline is drawn below. The flagships (Qwen3-235B-A22B and Qwen3-32B) go through four stages: the first two build the thinking ability, the last two fuse in non-thinking behavior and add general reinforcement learning. The other six models skip the four stages and are distilled from a flagship.

Qwen3 post-training: four stages for the flagships, distillation for the rest Top row: a base model passes through long-CoT cold start, reasoning RL, thinking-mode fusion and general RL to give Qwen3-235B-A22B and Qwen3-32B. Bottom row: with a flagship as teacher, off-policy and then on-policy distillation produce 30B-A3B, 14B, 8B, 4B, 1.7B and 0.6B. Flagship models: four stages Lightweight: distillation Base model 36T tokens Stage 1 Long-CoT cold start few filtered samples Stage 2 Reasoning RL GRPO, 3,995 pairs Stage 3 Thinking fusion SFT + chat template Stage 4 General RL 20+ task types Flagships 235B-A22B 32B Teacher: Qwen3-235B-A22B or Qwen3-32B Off-policy distillation SFT on teacher outputs in both modes learn reasoning and mode switching On-policy distillation the student writes its own responses match teacher logits, minimise KL Lightweight models 30B-A3B · 14B · 8B 4B · 1.7B · 0.6B Flagships go through all four stages; the other six models are distilled, which the paper says takes about 1/10 of the GPU hours of the four-stage recipe.
Figure: Qwen3's post-training pipeline, redrawn from Figure 1 and Section 4 of the paper. The 3,995 in Stage 2, the "20+ task types" in Stage 4, the teachers and the 1/10 GPU-hour figure all come from Section 4.

Three decisions shape the whole system:

  • The switch lives in the data, not in the architecture. There are no extra modules or parameters: in the fusion-stage SFT data, thinking samples carry /think (or omit it, since thinking is the default) and non-thinking samples carry /no_think and keep an empty think block. The model learns to look at the flag and decide how to answer.
  • The budget is a cut at inference time, not a training objective. Once a model can answer directly and can think before answering, it can also cope with being interrupted halfway through thinking (see “Thinking budget” below).
  • Distillation replaces repeated training. A small model that matches the teacher’s logits is far cheaper than another round of reinforcement learning of its own, and the paper says it also gives the student a wider exploration space.

Method

Architecture: Qwen2.5 Plus QK-Norm; MoE Without Shared Experts

The dense models follow Qwen2.5: grouped-query attention (GQA), SwiGLU feed-forward layers, rotary position embeddings (RoPE) and pre-normalization RMSNorm. Qwen3 drops the QKV bias of Qwen2 and adds QK-Norm to the attention (an RMSNorm over the head dimension on queries and keys, as implemented in transformers; the paper says it is there for stable training). The tokenizer is byte-level BPE with 151,669 tokens. The MoE models share the same basic structure, with 128 experts per layer, 8 activated per token and fine-grained expert segmentation; unlike Qwen2.5-MoE they have no shared experts, and they use a global-batch load-balancing loss (Qiu et al., 2025) to encourage specialization.

The table repeats the architecture parameters of Tables 1 and 2 of the paper; the last two columns are parameter counts I recomputed from the public config.json files (formulas and the reconciliation are in “Hands-On Check” below):

ModelLayersHeads (Q/KV)Tied embeddingTotal paramsActive per token
Qwen3-0.6B2816 / 8yes0.596B0.596B
Qwen3-1.7B2816 / 8yes1.721B1.721B
Qwen3-4B3632 / 8yes4.022B4.022B
Qwen3-8B3632 / 8no8.191B8.191B
Qwen3-14B4040 / 8no14.768B14.768B
Qwen3-32B6464 / 8no32.762B32.762B
Qwen3-30B-A3B4832 / 4no30.532B3.353B
Qwen3-235B-A22B9464 / 4no235.094B22.191B

The paper lists a context length of 32K for the 0.6B and 1.7B models and 128K for the rest. The 128K comes from YaRN and Dual Chunk Attention (DCA) at inference time, which the paper says give a four-fold increase in sequence-length capacity over the training length.

Pre-training: 36 Trillion Tokens in Three Stages

The corpus has twice as many tokens as Qwen2.5’s and three times as many languages: 36 trillion tokens in 119 languages and dialects. Beyond web text it includes PDF-like documents recognized with Qwen2.5-VL and then refined with Qwen2.5, and textbooks, question-answer pairs and code synthesized with Qwen2.5, Qwen2.5-Math and Qwen2.5-Coder. A multilingual annotation system labeled more than 30 trillion tokens for educational value, domain and safety, and the data mixture is optimized at the instance level with ablations on small proxy models rather than at the level of sources or domains.

StageDataSequence lengthPurpose
S1 Generalover 30T tokens4,096Language ability and world knowledge in 119 languages
S2 Reasoningabout 5T tokens4,096More STEM, code, reasoning and synthetic data; faster learning-rate decay
Long contexthundreds of billions of tokens32,76875% of text 16,384 to 32,768 tokens long, 25% 4,096 to 16,384; RoPE base frequency raised from 10,000 to 1,000,000 (ABF)

Following Qwen2.5, the paper also says it built scaling laws for optimal hyper-parameters (learning-rate schedule, batch size) across the three stages and used them to set each dense or MoE model’s values, without giving curves or coefficients.

The base-model evaluation (Tables 3 to 8) uses one evaluation pipeline for all models. The flagship base, Qwen3-235B-A22B-Base, beats DeepSeek-V3 Base (671B total, 37B active parameters) on 14 of 15 benchmarks, the exception being INCLUDE (73.46 against 75.17), with less than 2/5 of its total parameters (235B against 671B) and about 3/5 of its active parameters (22B against 37B). The paper also summarizes that, with the same pre-training data, Qwen3 MoE base models match dense base models with 1/5 of the active parameters.

The Four Post-Training Stages

Stage 1: long-CoT cold start. First a dataset is built across mathematics, code, logical reasoning and general STEM, each problem paired with a verifiable answer or test cases. Filtering has two steps: query filtering (Qwen2.5-72B-Instruct removes queries that are hard to verify, and also those it can answer correctly without chain of thought, so the model does not learn to guess) and response filtering (QwQ-32B samples N candidates per query, and answers are dropped if the final answer is wrong, there is heavy repetition, they look like guesswork, thinking and summary disagree, languages are mixed, or they look too similar to validation items). This stage uses only a small, carefully chosen subset and as few training steps as possible: the aim is to instill basic reasoning patterns, not to maximize current scores, so the reinforcement-learning stage has room to improve.

Stage 2: reasoning RL. The query-verifier pairs number 3,995 and must be unused in the cold start, learnable by the cold-start model, as hard as possible and broad in coverage. Training uses GRPO (see the DeepSeekMath breakdown); the paper mentions a large batch size, many rollouts per query and off-policy training for sample efficiency, and entropy controlled to rise steadily or hold, which balances exploration and exploitation without manual tuning in a single run. Example: Qwen3-235B-A22B’s AIME’24 score rises from 70.1 to 85.1 over 170 reinforcement-learning steps.

Stage 3: thinking-mode fusion. Continued SFT on the Stage 2 model. Thinking data comes from the Stage 2 model itself by rejection sampling on Stage 1 queries (so fusion does not drag Stage 2 down); non-thinking data covers code, mathematics, instruction following, multilingual tasks, creative writing, question answering and role-play, with response quality checked by automatically generated checklists, and with more translation tasks to help low-resource languages. The chat template is in this table (the paper’s Table 9):

ModeUser messageStart of the assistant turn
Thinking{query} /think (thinking is the default, so the flag can be omitted)<think>, the thinking, </think>, then the answer
Non-thinking{query} /no_thinkan empty <think> block, then the answer

Keeping the empty think block makes both kinds of sample the same shape and lets a developer forbid thinking by appending an empty block in the template; in multi-turn data several /think and /no_think flags are inserted at random, and the model must follow the last one.

Stage 4: general RL. A reward system covers more than 20 task types (instruction following, format following, preference alignment, agent ability and specialized scenarios such as RAG) with three kinds of reward: rule-based, model-based with a reference answer (Qwen2.5-72B-Instruct as the judge), and a reward model without a reference answer (trained on human preference data). “Format following” explicitly includes switching modes on /think and /no_think.

Strong-to-Weak Distillation

The lightweight models (the five dense models and 30B-A3B) go through two steps:

  1. Off-policy distillation: supervised fine-tuning on the teacher’s outputs in both modes, so the student first learns basic reasoning and mode switching.
  2. On-policy distillation: the student generates responses in /think or /no_think mode, and its logits are aligned with a teacher’s (Qwen3-32B or Qwen3-235B-A22B) by minimizing the KL divergence.

The paper’s argument is that matching logits gives a finer signal than plain SFT on the teacher’s text, so it is cheaper and also improves pass@64, which reflects exploration.

Thinking Budget

Fusion brings a side benefit: a model that has learned to answer directly and to think before answering also learns to answer after thinking halfway. The implementation is plain. When the thinking reaches a user-set threshold, the serving code stops generation and inserts a fixed sentence:

Considering the limited time by the user, I have to give the solution based on the thinking directly now.
</think>.

and the model continues with its final answer. The paper stresses that this ability was not trained explicitly; it emerged from fusion.

Experiments and Conclusions

Section 4.6 evaluates each model in both modes on more than 20 benchmarks. The results most worth seeing, with numbers taken from the paper’s tables:

The flagship in thinking mode (Table 11). Qwen3-235B-A22B has 235B total and 22B active parameters; the DeepSeek-R1 it is compared with has 671B total and 37B active:

BenchmarkOpenAI-o1DeepSeek-R1Gemini2.5-ProQwen3-235B-A22B
AIME’2474.379.892.085.7
AIME’2579.270.086.781.5
LiveCodeBench v563.964.370.470.7
BFCL v367.856.962.970.8
GPQA-Diamond78.071.584.071.1
Arena-Hard92.192.396.495.6

(The table also has a Grok-3-Beta column with many gaps, omitted here.) Read both sides: Qwen3-235B-A22B beats DeepSeek-R1 on AIME, LiveCodeBench, BFCL and Arena-Hard and is slightly lower on GPQA-Diamond; against Gemini2.5-Pro it is 5 to 13 points lower on AIME and GPQA-Diamond, about level on LiveCodeBench (70.7 against 70.4), 7.9 points higher on BFCL (70.8 against 62.9) and 0.8 points lower on Arena-Hard (95.6 against 96.4).

One model, thinking on or off (Tables 17 and 18, Qwen3-4B):

BenchmarkNon-thinkingThinkingDifference
AIME’2425.073.8+48.8
AIME’2519.165.6+46.5
LiveCodeBench v521.354.2+32.9
GPQA-Diamond41.755.9+14.2
Arena-Hard66.276.6+10.4
MATH-50084.897.0+12.2
MMLU-Redux77.383.7+6.4

The gap is largest on competition mathematics and code, which need many deduction steps, and smallest on knowledge benchmarks. The 4B model in thinking mode also beats DeepSeek-R1-Distill-Qwen-14B on AIME’24 and AIME’25 (73.8 against 69.7, 65.6 against 44.5).

The thinking budget (Figure 2). The paper varies the budget from 1K to 32K tokens on Qwen3-235B-A22B and measures AIME’24, AIME’25, LiveCodeBench v5 and GPQA-Diamond; scores rise smoothly with the budget. The paper gives no table for the figure, so these are my readings off the plot (accurate to about 1 or 2 points): AIME’24 goes from about 42 at 1K to about 86 at 32K and AIME’25 from about 31 to about 82; at a 1K budget the thinking mode is already no lower than the dashed non-thinking line. The paper adds that extending the output beyond 32K is expected to help further, but it did not run that experiment.

Distillation against reinforcement learning (Table 21). From the same off-policy-distilled 8B checkpoint, one branch continues with reinforcement learning and the other with on-policy distillation (math and code queries only; pass@64 in parentheses):

MethodAIME’24AIME’25LiveCodeBench v5GPU hours
Off-policy distillation55.0 (90.0)42.8 (83.3)42.0none
plus reinforcement learning67.6 (90.0)55.5 (83.3)52.917,920
plus on-policy distillation74.4 (93.3)65.5 (86.7)60.31,800

On-policy distillation raises pass@64 (AIME’24 from 90.0 to 93.3, AIME’25 from 83.3 to 86.7) while reinforcement learning does not, which the paper takes to mean the student’s exploration space expanded. It is also higher on MATH500, MMLU-Redux and GPQA-Diamond (97.0 against 94.8, 88.3 against 86.9, 63.3 against 61.3).

The price of fusion and general RL (Table 22, Qwen3-32B, thinking mode):

BenchmarkStage 2Stage 3Stage 4
ThinkFollow (in-house)none88.798.9
ToolUse (in-house)63.370.485.5
IFEval strict prompt73.078.485.0
Arena-Hard86.889.493.8
AIME’2483.881.981.4
LiveCodeBench v568.467.265.7

Stage 3 gives the model a first ability to switch modes (ThinkFollow 88.7) and Stage 4 lifts it to 98.9; instruction following, agent ability and general chat clearly improve. The price is that thinking-mode scores on AIME’24 and LiveCodeBench fall at each step; the paper’s guess is that training on a broader range of tasks weakens the specialized skill for hard problems, and it says the team chose to accept that trade-off.

Hands-on: reconciling parameter counts, the chat template and soft switches, the thinking budget

Qwen3’s open weights can be inspected directly on a laptop. The script below has four parts, in the same order as the output: 1 recomputes the parameter counts of 8 models from config.json, checks them against Hugging Face’s statistics, and then computes the MoE activated parameters and the KV cache; 2 checks the chat template and the /think and /no_think soft switches (Qwen3-4B, 12 questions × 5 phrasings); 3 runs a small thinking-budget experiment (48 synthetic arithmetic problems, 7 budgets, against two non-thinking baselines); 4 looks at where the correct answer first appears in a finished thinking trace.

Environment: Apple M2 Max (64 GB, MPS backend), Python 3.14.3, PyTorch 2.10.0, transformers 5.3.0. The model is Qwen3-4B (Apache-2.0, bfloat16, 36 layers). SDPA attention on MPS returned NaN when decoding a batch with a long cache, so the script uses attn_implementation="eager". Part 1 reads the config.json, model card and parameter statistics of 8 Hugging Face repositories online (queried on 12 November 2026; the repositories may change later). The thinking traces in part 3 are sampled once (temperature 0.6, top-p 0.95, top-k 20, the model card’s recommended settings for thinking mode, seed 0); every other generation is greedy, and individual numbers may differ slightly in another environment. One complete run of the script takes about 35 minutes.

import json
import random
import re
import urllib.request

import numpy as np
import torch
from transformers import (AutoModelForCausalLM, AutoTokenizer,
                          StoppingCriteria, StoppingCriteriaList)
from transformers.utils import logging as hf_logging

hf_logging.set_verbosity_error()
hf_logging.disable_progress_bar()

# ---------- Part 1: parameter counts from the configs vs the Hub ----------
NAMES = ["Qwen3-0.6B", "Qwen3-1.7B", "Qwen3-4B", "Qwen3-8B", "Qwen3-14B",
         "Qwen3-32B", "Qwen3-30B-A3B", "Qwen3-235B-A22B"]
HUB = "https://huggingface.co"


def fetch(url):
    return urllib.request.urlopen(url, timeout=30).read().decode()


def count(c):
    """Return (total parameters, parameters activated per token)."""
    d, L, V = c["hidden_size"], c["num_hidden_layers"], c["vocab_size"]
    hd = c["head_dim"]
    nq, nkv = c["num_attention_heads"], c["num_key_value_heads"]
    # q, k, v, o projections plus the two QK-Norm scales (head_dim each)
    attn = d * nq * hd + 2 * d * nkv * hd + nq * hd * d + 2 * hd
    norms = 2 * d  # an RMSNorm before attention and one before the FFN
    if c.get("num_experts"):
        E, k, m = (c["num_experts"], c["num_experts_per_tok"],
                   c["moe_intermediate_size"])
        mlp_all = d * E + E * 3 * d * m  # router + all experts (3 matrices)
        mlp_act = d * E + k * 3 * d * m  # router + the k chosen experts
    else:
        mlp_all = mlp_act = 3 * d * c["intermediate_size"]
    emb = V * d * (1 if c["tie_word_embeddings"] else 2)
    rest = emb + d  # embeddings (and the head if untied), final RMSNorm
    return (L * (attn + norms + mlp_all) + rest,
            L * (attn + norms + mlp_act) + rest)


cfgs, hub = {}, {}
for n in NAMES:
    cfgs[n] = json.loads(fetch(f"{HUB}/Qwen/{n}/raw/main/config.json"))
    info = json.loads(fetch(f"{HUB}/api/models/Qwen/{n}?blobs=true"))
    hub[n] = info["safetensors"]["total"]
print("model                  formula_total         hub_total   hub-formula")
for n in NAMES:
    tot, act = count(cfgs[n])
    print(f"{n:16s} {tot:>18,d} {hub[n]:>17,d} {hub[n] - tot:>13,d}")

print("\nMoE: model, experts/active, activated params, share, expert share")
for n in NAMES[-2:]:
    c = cfgs[n]
    tot, act = count(c)
    exp = (c["num_hidden_layers"] * c["num_experts"] * 3
           * c["hidden_size"] * c["moe_intermediate_size"])
    card = next(line for line in
                fetch(f"{HUB}/Qwen/{n}/raw/main/README.md").splitlines()
                if line.startswith("- Number of Parameters:"))
    print(f"{n:16s} {c['num_experts']}/{c['num_experts_per_tok']} "
          f"{act:>16,d} {act / tot:6.1%} {exp / tot:6.1%}")
    print(f"  all layers MoE: {c['mlp_only_layers'] == []} | "
          f"shared expert key: {'shared_expert_intermediate_size' in c} | "
          f"card: {card[2:]}")

print("\nKV cache (bf16): model, layers, kv_heads, KiB/token, "
      "GiB at 32K / 128K, MHA ratio")
for n in NAMES:
    c = cfgs[n]
    per = (2 * c["num_hidden_layers"] * c["num_key_value_heads"]
           * c["head_dim"] * 2)  # K and V, 2 bytes per number
    ratio = c["num_attention_heads"] // c["num_key_value_heads"]
    print(f"{n:16s} {c['num_hidden_layers']:>3d} "
          f"{c['num_key_value_heads']:>3d} {per / 1024:>6.0f} "
          f"{per * 32768 / 2**30:>6.1f} {per * 131072 / 2**30:>6.1f} "
          f"{ratio:>4d}x")
c = cfgs["Qwen3-4B"]
print("\nrope_theta:", c["rope_theta"], "| max_position_embeddings:",
      c["max_position_embeddings"], "| tie:", c["tie_word_embeddings"])

# ---------- Part 2: chat template and soft switches (Qwen3-4B, MPS) ----------
dev = "mps"
NAME = "Qwen/Qwen3-4B"
tok = AutoTokenizer.from_pretrained(NAME)
tok.padding_side = "left"
# SDPA attention on MPS once returned NaN when decoding a batch with a long
# cache, so use eager attention
model = AutoModelForCausalLM.from_pretrained(
    NAME, dtype=torch.bfloat16, attn_implementation="eager")
model = model.to(dev).eval()
print("\ntokenizer entries:", len(tok), "| config vocab_size:",
      c["vocab_size"])
demo = [{"role": "user", "content": "1+1=?"}]
for flag in (True, False):
    s = tok.apply_chat_template(demo, tokenize=False,
                                add_generation_prompt=True,
                                enable_thinking=flag)
    print(f"enable_thinking={flag}:",
          repr(s[s.index("<|im_start|>assistant"):]))

QS = ["What is the capital of Australia?",
      "Explain what a hash table is in two sentences.",
      "Give me three tips for learning to swim.", "Why is the sky blue?",
      "Translate 'good morning' into French.",
      "What does the Python function enumerate do?",
      "Name two differences between TCP and UDP.",
      "How many days are there in a leap year?",
      "Suggest a name for a coffee shop.",
      "What is the derivative of x squared?",
      "Summarize the plot of Romeo and Juliet in one sentence.",
      "What is the boiling point of water at sea level in Celsius?"]
REPLY = "OK."
N = len(QS)


@torch.no_grad()
def starts(histories, n=12):
    """Greedy-decode the first n tokens of a batch and return the text."""
    texts = [tok.apply_chat_template(h, tokenize=False,
                                     add_generation_prompt=True)
             for h in histories]
    enc = tok(texts, return_tensors="pt", padding=True).to(dev)
    out = model.generate(**enc, max_new_tokens=n, do_sample=False)
    return [tok.decode(o[enc.input_ids.shape[1]:]) for o in out]


def one(i, flag):
    return [{"role": "user", "content": QS[i] + flag}]


def two(i, a, b):
    return [{"role": "user", "content": QS[i] + a},
            {"role": "assistant", "content": REPLY},
            {"role": "user", "content": QS[(i + 1) % N] + b}]


cases = [
    ("single turn, no flag", [one(i, "") for i in range(N)], 0),
    ("single turn, /think", [one(i, " /think") for i in range(N)], 0),
    ("single turn, /no_think", [one(i, " /no_think") for i in range(N)], N),
    ("two turns, /think then /no_think",
     [two(i, " /think", " /no_think") for i in range(N)], N),
    ("two turns, /no_think then /think",
     [two(i, " /no_think", " /think") for i in range(N)], 0)]
print("\nempty think block in the reply (greedy, first 12 tokens):")
for name, hs, want in cases:
    got = sum(s.startswith("<think>\n\n</think>") for s in starts(hs))
    print(f"  {name:34s} {got:>2d}/{N}  (expected {want})")

# ---------- Part 3: thinking budget (Qwen3-4B, MPS) ----------
LEVELS = [2, 4, 6]  # number of operations at the three difficulty levels
PER = 16  # problems per level
BUDGETS = [0, 128, 256, 384, 512, 768, 1024]  # thinking budgets (tokens)
BMAX = BUDGETS[-1]
STOP = ("Considering the limited time by the user, I have to give the "
        "solution based on the thinking directly now.\n</think>.\n\n")
READ = "The final answer is \\boxed{"  # continue this; keep the integer
END = tok.convert_tokens_to_ids("</think>")
EOS = tok.convert_tokens_to_ids("<|im_end|>")
ASK = " What is the result? Put the final integer in \\boxed{}."


def make_problems(seed):
    rng = random.Random(seed)
    out = []
    for lvl, nops in enumerate(LEVELS, 1):
        for _ in range(PER):
            val = rng.randint(11, 99)
            text = f"Start with {val}."
            for _ in range(nops):
                op = rng.choice(["add", "subtract", "multiply by"])
                mul = op == "multiply by"
                t = rng.randint(2, 9) if mul else rng.randint(11, 99)
                val = {"add": val + t, "subtract": val - t,
                       "multiply by": val * t}[op]
                text += f" Then {op} {t}."
            out.append((lvl, text + ASK, val))
    return out


def chat_ids(q, thinking):
    """Thinking mode writes <think> into the prompt; budgets count from it."""
    text = tok.apply_chat_template([{"role": "user", "content": q}],
                                   tokenize=False, add_generation_prompt=True,
                                   enable_thinking=thinking)
    return tok(text + ("<think>\n" if thinking else "")).input_ids


@torch.no_grad()
def generate(seqs, n, **kw):
    """Left-pad into one batch, generate, return new tokens without padding."""
    L = max(len(s) for s in seqs)
    ids = torch.full((len(seqs), L), tok.pad_token_id)
    mask = torch.zeros((len(seqs), L), dtype=torch.long)
    for i, s in enumerate(seqs):
        ids[i, L - len(s):] = torch.tensor(s)
        mask[i, L - len(s):] = 1
    out = model.generate(input_ids=ids.to(dev), attention_mask=mask.to(dev),
                         max_new_tokens=n, **kw)
    res = []
    for row in out[:, L:].tolist():
        while row and row[-1] == tok.pad_token_id:
            row.pop()
        res.append(row)
    return res


class Closed(StoppingCriteria):
    """Stop a sequence as soon as it writes </think>."""

    def __init__(self, plen):
        self.plen = plen

    def __call__(self, ids, scores, **kw):
        return (ids[:, self.plen:] == END).any(dim=1)


def to_int(s):
    return int(s.replace(",", "").replace("−", "-"))


def last_boxed(txt):
    m = re.findall(r"\\boxed\{\s*([-−]?\d[\d,]*)\s*\}", txt)
    return to_int(m[-1]) if m else None


def first_int(txt):
    m = re.match(r"\s*([-−]?\d[\d,]*)", txt)
    return to_int(m[1]) if m else None


probs = make_problems(7)
n_all = len(probs)
prompts = [chat_ids(q, True) for _, q, _ in probs]
torch.manual_seed(0)
traces = generate(prompts, BMAX, do_sample=True, temperature=0.6,
                  top_p=0.95, top_k=20,
                  stopping_criteria=StoppingCriteriaList(
                      [Closed(max(len(p) for p in prompts))]))
closed = [t.index(END) + 1 if END in t else None for t in traces]
stop_ids, read_ids = tok(STOP).input_ids, tok(READ).input_ids
nl_ids = tok("\n\n").input_ids


def job_key(i, b):
    """Which continuation problem i uses at budget b; finished ones share."""
    return (i, "nat") if closed[i] is not None and closed[i] <= b else (i, b)


jobs = {}
for i in range(n_all):
    for b in BUDGETS:
        key = job_key(i, b)
        if key[1] == "nat":  # finished thinking itself: newline, read out
            jobs[key] = prompts[i] + traces[i][:closed[i]] + nl_ids + read_ids
        else:  # cut at token b, insert the stop sentence, read out
            jobs[key] = prompts[i] + traces[i][:b] + stop_ids + read_ids
order = sorted(jobs, key=lambda k: len(jobs[k]))
answers = {}
for s in range(0, len(order), 8):
    chunk = order[s:s + 8]
    outs = generate([jobs[k] for k in chunk], 16, do_sample=False)
    for k, o in zip(chunk, outs):
        answers[k] = first_int(tok.decode(o))

truth = np.array([a for _, _, a in probs])
level = np.array([lv for lv, _, _ in probs])
ok = np.array([[answers[job_key(i, b)] == truth[i] for b in BUDGETS]
               for i in range(n_all)])
# Two non-thinking baselines: read the answer out directly, or write the
# reasoning first (at most 512 tokens)
nt = [chat_ids(q, False) for _, q, _ in probs]
direct = generate([s + read_ids for s in nt], 16, do_sample=False)
direct_ok = np.array([first_int(tok.decode(o)) == a
                      for o, (_, _, a) in zip(direct, probs)])
cot = generate(nt, 512, do_sample=False)
cot_ok = np.array([last_boxed(tok.decode(o)) == a
                   for o, (_, _, a) in zip(cot, probs)])
print(f"{n_all} problems ({PER} per level), same problems for every budget")
print("closed within 1024 tokens, by level:",
      [sum(closed[i] is not None for i in range(n_all) if level[i] == lv)
       for lv in (1, 2, 3)])
print("readout without an integer:", sum(a is None for a in answers.values()),
      "| non-thinking CoT cut at 512 tokens:",
      sum(len(o) >= 512 and o[-1] != EOS for o in cot))

rng = np.random.default_rng(123)
boot = rng.integers(0, n_all, size=(2000, n_all))


def row(name, v, extra):
    lo, hi = np.percentile(v[boot].mean(axis=1), [2.5, 97.5])
    by = " ".join(f"{v[level == lv].mean():5.2f}" for lv in (1, 2, 3))
    return f"{name:>7s} {by} {v.mean():5.2f}   [{lo:.2f}, {hi:.2f}]  {extra}"


print(f"\n{'budget':>7s} {'L1':>5s} {'L2':>5s} {'L3':>5s} {'all':>5s}"
      f"   {'95% CI':<12s}  {'done':>5s} {'used':>5s}")
for j, b in enumerate(BUDGETS):
    used = np.mean([min(b, c) if c is not None else b for c in closed])
    share = np.mean([c is not None and c <= b for c in closed])
    print(row(str(b), ok[:, j], f"{share:5.2f} {used:5.0f}"))
print(row("direct", direct_ok, "    -     0"))
print(row("cot", cot_ok, f"    - {np.mean([len(o) for o in cot]):5.0f}"))

print("\nsplit halves (even / odd problem index), accuracy by budget:")
for h in (0, 1):
    sel = np.arange(n_all) % 2 == h
    print(f"  half {h}: "
          + " ".join(f"{ok[sel, j].mean():.2f}" for j in range(len(BUDGETS)))
          + f" | direct {direct_ok[sel].mean():.2f}"
          + f" | cot {cot_ok[sel].mean():.2f}")
j4, j6 = BUDGETS.index(512), BUDGETS.index(1024)
for name, a, b2 in [("512 - 0", ok[:, j4], ok[:, 0]),
                    ("1024 - 512", ok[:, j6], ok[:, j4]),
                    ("512 - direct", ok[:, j4], direct_ok),
                    ("1024 - cot", ok[:, j6], cot_ok)]:
    d = a.astype(float) - b2.astype(float)
    lo, hi = np.percentile(d[boot].mean(axis=1), [2.5, 97.5])
    print(f"paired diff {name:13s} {d.mean():+.3f}  [{lo:+.3f}, {hi:+.3f}]")


# ---------- Part 4: when is the right answer first reached? ----------
def first_pos(text, v):
    """Position of the first standalone occurrence of v (None if absent)."""
    hits = []
    # a positive v must not follow a minus sign
    pre = r"(?<![\d,.])" if v < 0 else r"(?<![\d,.\-−])"
    for s in {f"{v:,}", str(v)}:
        m = re.search(pre + re.escape(s) + r"(?![\d,]|\.\d)", text)
        if m:
            hits.append(m.start())
    return min(hits) if hits else None


first, total = [], []
for i, tr in enumerate(traces):
    if closed[i] is None:
        continue
    text = tok.decode(tr)
    pos = first_pos(text, truth[i])
    if pos is not None and str(abs(truth[i])) not in re.findall(
            r"\d+", probs[i][1]):
        first.append(len(tok(text[:pos]).input_ids))
        total.append(closed[i])
first, total = np.array(first), np.array(total)
print("\nclosed traces where the true answer appears as a result:",
      len(first), "of", sum(c is not None for c in closed))
print("median thinking length:", int(np.median(total)),
      "| median position of the first true answer:", int(np.median(first)))
print("share of thinking after the first true answer, median:",
      f"{np.median(1 - first / total):.2f}")

The output:

model                  formula_total         hub_total   hub-formula
Qwen3-0.6B              596,049,920       751,632,384   155,582,464
Qwen3-1.7B            1,720,574,976     2,031,739,904   311,164,928
Qwen3-4B              4,022,468,096     4,022,468,096             0
Qwen3-8B              8,190,735,360     8,190,735,360             0
Qwen3-14B            14,768,307,200    14,768,307,200             0
Qwen3-32B            32,762,123,264    32,762,123,264             0
Qwen3-30B-A3B        30,532,122,624    30,532,122,624             0
Qwen3-235B-A22B     235,093,634,560   235,093,634,560             0

MoE: model, experts/active, activated params, share, expert share
Qwen3-30B-A3B    128/8    3,353,032,704  11.0%  95.0%
  all layers MoE: True | shared expert key: False | card: Number of Parameters: 30.5B in total and 3.3B activated
Qwen3-235B-A22B  128/8   22,190,763,520   9.4%  96.6%
  all layers MoE: True | shared expert key: False | card: Number of Parameters: 235B in total and 22B activated

KV cache (bf16): model, layers, kv_heads, KiB/token, GiB at 32K / 128K, MHA ratio
Qwen3-0.6B        28   8    112    3.5   14.0    2x
Qwen3-1.7B        28   8    112    3.5   14.0    2x
Qwen3-4B          36   8    144    4.5   18.0    4x
Qwen3-8B          36   8    144    4.5   18.0    4x
Qwen3-14B         40   8    160    5.0   20.0    5x
Qwen3-32B         64   8    256    8.0   32.0    8x
Qwen3-30B-A3B     48   4     96    3.0   12.0    8x
Qwen3-235B-A22B   94   4    188    5.9   23.5   16x

rope_theta: 1000000 | max_position_embeddings: 40960 | tie: True

tokenizer entries: 151669 | config vocab_size: 151936
enable_thinking=True: '<|im_start|>assistant\n'
enable_thinking=False: '<|im_start|>assistant\n<think>\n\n</think>\n\n'

empty think block in the reply (greedy, first 12 tokens):
  single turn, no flag                0/12  (expected 0)
  single turn, /think                 0/12  (expected 0)
  single turn, /no_think             12/12  (expected 12)
  two turns, /think then /no_think   12/12  (expected 12)
  two turns, /no_think then /think    0/12  (expected 0)
48 problems (16 per level), same problems for every budget
closed within 1024 tokens, by level: [13, 0, 0]
readout without an integer: 0 | non-thinking CoT cut at 512 tokens: 0

 budget    L1    L2    L3   all   95% CI         done  used
      0  0.38  0.00  0.00  0.12   [0.04, 0.23]   0.00     0
    128  0.50  0.12  0.00  0.21   [0.10, 0.33]   0.00   128
    256  0.75  0.12  0.00  0.29   [0.17, 0.42]   0.00   256
    384  0.88  0.25  0.00  0.38   [0.25, 0.50]   0.02   384
    512  0.81  0.62  0.12  0.52   [0.40, 0.67]   0.02   509
    768  0.88  0.81  0.75  0.81   [0.71, 0.92]   0.08   757
   1024  1.00  0.88  0.81  0.90   [0.79, 0.98]   0.27   968
 direct  0.38  0.00  0.00  0.12   [0.04, 0.23]      -     0
    cot  1.00  1.00  1.00  1.00   [1.00, 1.00]      -   158

split halves (even / odd problem index), accuracy by budget:
  half 0: 0.12 0.29 0.42 0.38 0.62 0.79 0.92 | direct 0.12 | cot 1.00
  half 1: 0.12 0.12 0.17 0.38 0.42 0.83 0.88 | direct 0.12 | cot 1.00
paired diff 512 - 0       +0.396  [+0.250, +0.542]
paired diff 1024 - 512    +0.375  [+0.250, +0.521]
paired diff 512 - direct  +0.396  [+0.250, +0.542]
paired diff 1024 - cot    -0.104  [-0.208, -0.021]

closed traces where the true answer appears as a result: 13 of 13
median thinking length: 852 | median position of the first true answer: 276
share of thinking after the first true answer, median: 0.63

Parameter counts: six models match the Hub exactly, 0.6B and 1.7B carry an extra output head

The script’s count adds things up one by one from the structure: each layer’s attention has the four projections q, k, v and o plus the two QK-Norm scales (head_dim values each); each layer has two RMSNorms; the feed-forward block is the three SwiGLU matrices (an MoE layer is a router plus 128 experts of three matrices each); on top of that come the token embedding, the final RMSNorm, and the output head when the embedding is not shared.

  • Six models match exactly. The recomputed totals for 4B, 8B, 14B, 32B, 30B-A3B and 235B-A22B equal the Hub’s safetensors totals to the last digit, for example 8,190,735,360 for Qwen3-8B and 235,093,634,560 for Qwen3-235B-A22B. So the structure described in Tables 1 and 2 (GQA, SwiGLU, QK-Norm, 128 experts) agrees with the public configuration.
  • The Hub’s counts for 0.6B and 1.7B are larger. The differences are 155,582,464 and 311,164,928, exactly the vocabulary size 151,936 times the hidden sizes 1,024 and 2,048, which is one output head. The config.json of these two models says the embedding and the output head are tied, but the weight files still store a separate lm_head.weight, and the Hub’s count includes it. I also read the safetensors headers of the 0.6B, 1.7B and 4B repositories to confirm this: the 0.6B file (shape [151936, 1024]) and the 1.7B file contain lm_head.weight and the 4B file does not (this check is not in the script above). So by the configuration, 0.6B has 596,049,920 parameters (about 0.6 billion) and 1.7B has 1,720,574,976 (about 1.7 billion); keep the accounting convention in mind when comparing with the Hub’s numbers.
  • Vocabulary. The tokenizer has 151,669 entries, the same as the paper’s vocabulary size; the embedding matrix has 151,936 rows, the extra rows being padding for alignment.

MoE activated parameters and the KV cache

  • Activated parameters. Qwen3-30B-A3B activates 3,353,032,704 parameters per token, 11.0% of the total; Qwen3-235B-A22B activates 22,190,763,520, 9.4%. Expert weights make up 95.0% and 96.6% of the totals, so almost everything sits in the experts. Every layer in the configuration is an MoE layer (mlp_only_layers is empty) and there is no shared-expert field, matching the paper’s statement that shared experts were removed. The model cards say 3.3B and 22B, and my formula gives 3,353,032,704 and 22,190,763,520; the gap is within 0.05B, and I did not chase down whether it is rounding or a different definition.
  • KV cache. In bfloat16 the KV cache per token depends only on the number of layers, KV heads and head dimension: 144 KiB for 4B, which is 4.5 GiB at a 32K context and 18.0 GiB at 128K. The ratio of query heads to KV heads (the saving against full multi-head attention) runs from 2× for 0.6B to 16× for 235B-A22B. One counter-intuitive result: at a 128K context, the 32B dense model needs 32.0 GiB of KV cache, while the much larger 235B-A22B needs only 23.5 GiB and 30B-A3B only 12.0 GiB, because the latter two have only 4 KV heads.
  • Other numbers in the configuration. rope_theta is 1,000,000, consistent with the paper’s ABF; the 4B model’s max_position_embeddings is 40,960, while Table 1 of the paper lists a 128K context length for 4B (reached by YaRN and DCA at inference time).

Chat template and soft switches: all 60 checks match the paper

With enable_thinking=True the template writes only <|im_start|>assistant\n and lets the model write <think> itself; with enable_thinking=False the template writes an empty think block (<think>\n\n</think>\n\n) at the start of the assistant turn, consistent with the paper’s Table 9, which keeps an empty think block.

For 12 questions and 5 phrasings I greedily generated 12 tokens and checked whether the reply starts with an empty think block. No flag and /think are both 0/12 (the model thinks on its own) and /no_think is 12/12. Across two turns, /think then /no_think is 12/12 and /no_think then /think is 0/12, so the most recent tag wins. All 60 checks match the expectation. This only checks whether the reply begins with an empty think block, not the quality of the answers; the sample is 12 simple questions, and longer, more complex conversations may not behave as cleanly.

Thinking budget: accuracy rises with the budget, but on these problems not thinking does better

The question the experiment asks is narrow: take one thinking trace, cut it at different positions and insert the paper’s stop sentence; is the answer the model can read out at that moment correct? The problems are 48 synthetic arithmetic chains, 16 at each of three difficulty levels (2, 4 and 6 operations, for example “Start with 47. Then multiply by 8. Then add 62.”). Each problem gets one sampled thinking trace (at most 1,024 tokens). The result for a budget bb takes the first bb tokens of the trace, appends the stop sentence and “The final answer is \boxed{”, continues greedily for at most 16 tokens and takes the first integer; problems that finished thinking on their own share one natural continuation.

Qwen3-4B thinking budget: accuracy rises with budget, but non-thinking step-by-step is cheaper Left: accuracy on 48 synthetic arithmetic problems for thinking budgets from 0 to 1024 tokens, overall and by the three difficulty levels, with two non-thinking baselines (direct readout and step-by-step). Right: share of problems whose thinking finished naturally within each budget. Accuracy (overall and by level) 0.00 0.25 0.50 0.75 1.00 0 128 256 384 512 768 1024 Thinking budget (tokens) non-thinking, direct non-thinking, CoT L1 L2 L3 all Share finished thinking 0.0 0.5 1.0 0.00 0 0.00 128 0.00 256 0.02 384 0.02 512 0.08 768 0.27 1024 Thinking budget (tokens)
Figure: the thinking-budget experiment on Qwen3-4B (the output of the script above). Left: accuracy by difficulty level and overall; the shaded band is the 95% bootstrap interval of the overall accuracy and the dashed lines are the two non-thinking baselines. Right: the share of problems that finished thinking on their own at each budget.
  • A larger budget is more accurate, and the budget needed grows with the number of steps. Overall accuracy rises from 0.12 at budget 0 to 0.38 at 384, 0.52 at 512, 0.81 at 768 and 0.90 at 1,024. The paired difference 512 minus 0 is +0.396 (95% interval [+0.250, +0.542]) and 1,024 minus 512 is +0.375 ([+0.250, +0.521]). By level, the 2-step problems (L1) reach 0.88 at 384; the 4-step problems (L2) are at 0.25 at 384, climb to 0.62 at 512 and reach 0.88 at 1,024; the 6-step problems (L3) stay at 0.00 up to 384, are at 0.12 at 512 and jump to 0.75 at 768 (0.81 at 1,024). The overall curve is smooth, as in Figure 2 of the paper, but each difficulty level is really a step, and the step moves to larger budgets as the number of operations grows.
  • Budget 0 means “do not think, answer directly”. The budget-0 accuracy of 0.12 equals what non-thinking mode reads out directly (0.12), with identical per-level accuracies and an identical interval, so “stop sentence plus readout” degenerates into answering directly when the budget is zero.
  • These numbers must not be read as “thinking beats not thinking”. The same model in non-thinking mode, writing step-by-step reasoning (at most 512 tokens, greedy), gets all 48 problems right with only 158 tokens on average. Thinking mode with a 1,024 budget gets 0.90 with 968 tokens on average, and the paired difference is −0.104 ([−0.208, −0.021]). On simple arithmetic chains like these, thinking mode is both slower and worse than non-thinking mode’s own step-by-step reasoning. The large gaps between the two modes in the paper’s Tables 17 and 18 are on competition math and code, and these problems are nowhere near that difficulty; the budget here only lets you see the shape of the “more thinking, more accurate” curve.
  • Few problems finish thinking on their own. At 1,024 tokens only 27% of the problems have finished thinking (13 of the 16 level-1 problems and no level-2 or level-3 problem); at 768 it is 8%. Even the thinking for a 2-step problem can run to several hundred tokens, and not one 4-step or 6-step problem finished within 1,024 tokens.
  • Noise and small samples. The even and odd halves have the same shape and reach 0.92 and 0.88 at 1,024. Level 1’s dip from 0.88 at 384 to 0.81 at 512, and level 2’s rise from 0.81 at 768 to 0.88 at 1,024, are each a difference of one problem (1/16 of a level). With 48 problems, one seed and one trace each, one problem is about 2 percentage points, and the intervals contain only the variation from “different problems”, not the variation from “different samples”.

Where in the thinking the correct answer first appears

Among the 13 traces that finished thinking (all from 2-step problems), the correct answer appeared as a result in all 13. Its first appearance has a median position of token 276, while the median total thinking length of these traces is 852, so the median trace spends 0.63 of its length after it first got the answer right, mostly verifying. That explains why, when thinking is cut before the budget is used up, the answer is often already in the trace. Three cautions apply: these 13 are the traces that finished within 1,024 tokens, so they are shorter and easier than average; “first appears” was found by string matching (excluding numbers already in the problem statement), so a coincidentally equal number may be counted; and they are all 2-step problems, since no 4-step or 6-step trace finished, so the number cannot be extrapolated to harder problems.

Design, adjustments and limitations

  • Differences from the paper. In the paper the model writes its own answer after the stop sentence; to keep cost and scoring under control I force a single integer readout instead, so what is measured here is “the answer the model can state at this point in its thinking”, not the quality of a full response.
  • Adjustments made in trial runs. At first I let the model continue freely after the stop sentence, and it wrote out full solutions, which made scoring and cost uncontrollable; so I changed it to continue after “The final answer is \boxed{” and keep only the first integer, and the request in the problem statement to put the final integer in \boxed{} was added at the same time. SDPA attention on MPS produced NaN, so I switched to eager attention. The first trial used a 2,048-token limit with batches of 24 and ran for 34 minutes; the final version uses 1,024 tokens and batches of 48, which is why the budgets are measured only up to 1,024. The numbers on this page come from one complete run of the final script.
  • Inconsistent sampling settings. The thinking traces are sampled with the model card’s recommended thinking-mode settings, while the two non-thinking baselines are greedy; for non-thinking mode the model card recommends temperature 0.7 and top-p 0.8, so these baselines do not use the recommended settings.
  • The problems are home-made synthetic ones. They are generated with fixed seed 7 (I used this set while debugging the non-thinking readout; the trial run of the thinking traces used a different set generated with seed 0), and difficulty is determined only by the number of operations. This is not the paper’s benchmark and does not represent real math or code tasks.
  • No other models, no repeats. Only Qwen3-4B was tested, with one seed; the paper tests the 235B flagship, and this experiment cannot tell whether the conclusion changes with model size.

Limitations and What Came Next

  • The data and the training code are not released. The composition of the 36 trillion tokens and the mixture at each stage are described only qualitatively; the batch size, number of rollouts and learning rate of the reinforcement-learning stages are not given. The weights and inference code are open, but the pipeline cannot be reproduced end to end.
  • Evaluation is mostly the authors’ own pipeline. The starred benchmarks in Table 22 (CounterFactQA, LengthCtrl, ThinkFollow, ToolUse) are in-house and cannot be checked from outside; sampling parameters differ between modes (thinking: T=0.6, top-p 0.95, top-k 20; non-thinking: T=0.7, top-p 0.8, top-k 20, presence penalty 1.5) and the maximum output is 32,768 tokens (38,912 for AIME), which matters for cross-model comparisons.
  • Fusion is not free. The drops on AIME’24 and LiveCodeBench in Table 22 are the paper’s own finding; a unified switch trades off against the best single-mode score.
  • The thinking budget was verified only up to 32K, only on the flagship, and without error bars. The curves come from a single evaluation, and the paper does not say whether the stop sentence works equally well for every model. The experiment below uses a 4B model and easy problems and a small sample; it cannot be extended to hard reasoning tasks.
  • The distillation comparison is narrow. Table 21 has one 8B checkpoint and only math and code queries, and the reinforcement-learning configuration is not detailed.
  • Later releases changed the “one model, two modes” approach. Updates with the -2507 suffix split the two modes into separate checkpoints: the model card of Qwen3-235B-A22B-Instruct-2507 says “supports only non-thinking mode” and that of Qwen3-235B-A22B-Thinking-2507 says “supports only thinking mode”. The cards do not give a reason, so it would be wrong to conclude that the hybrid failed; at least it shows a trade-off between one switch and the best score in each mode, in the same direction as the drop in Table 22 (consulted in November 2026).

What to Take Away From This Paper

  1. The switch is in the data, not in the structure. Same parameters, one flag in the template; what needs design is the fusion data: the empty think block keeps the format identical, and multi-turn chats follow the last flag.
  2. The thinking budget is a cheap middle setting. Cut the thinking at inference time and insert a fixed stop sentence; it is a by-product of fusion and not a training goal, so do not expect it to work equally well on every model and task, and measure it yourself.
  3. Strong-to-weak distillation pays by saving. On-policy distillation matches teacher logits and in Table 21 costs about a tenth of reinforcement learning with better pass@64; it needs a strong enough teacher.
  4. The architecture is a combination of mature parts. GQA, SwiGLU, RoPE, RMSNorm, QK-Norm, plus 128 fine-grained experts with 8 active, no shared experts and a global-batch balancing loss; parameter counts can be recomputed exactly from config.json.
  5. Read Table 22, not only Table 11. The gain in versatility has a price: the hardest reasoning benchmarks went down after fusion.

Further Reading

FAQ

What is Qwen3 and which models does it include?
Qwen3 is a family of open-weight language models released by Alibaba's Qwen team in 2025, all under the Apache 2.0 license. The report lists eight models: six dense ones (0.6B, 1.7B, 4B, 8B, 14B, 32B) and two mixture-of-experts (MoE) models, Qwen3-30B-A3B and Qwen3-235B-A22B, where the suffix is the number of parameters activated per token. Pre-training used 36 trillion tokens in 119 languages and dialects, against 29 languages for Qwen2.5. Its distinguishing feature is a thinking mode and a non-thinking mode in the same model, with control over how long it thinks.
How do you switch Qwen3 between thinking and non-thinking mode?
There are two switches. The hard switch is the chat template argument enable_thinking: when it is False, the template writes an empty think block at the start of the assistant turn and the model does not think. The soft switch is /think or /no_think in a user or system message; in a multi-turn chat the model follows the most recent flag, and the soft switch only works while enable_thinking is True. Section 4.3 of the report explains that the fusion-stage training data carries these flags and that non-thinking samples keep an empty think block so the format stays the same.
What is Qwen3's thinking budget?
The thinking budget is an inference-time procedure: once the model has written the user's chosen number of tokens inside its think block, the serving code stops the thinking and inserts a fixed sentence ("Considering the limited time by the user, I have to give the solution based on the thinking directly now." followed by the end-of-thinking marker), so the model answers from its unfinished reasoning. The report stresses that this ability was not trained explicitly; it emerged once thinking-mode fusion was done. Figure 2 shows Qwen3-235B-A22B improving smoothly with the budget on four benchmarks.
How are the smaller Qwen3 models trained?
The five small dense models (0.6B to 14B) and Qwen3-30B-A3B use strong-to-weak distillation. First comes off-policy distillation: supervised fine-tuning on a teacher's outputs in both /think and /no_think modes. Then on-policy distillation: the student writes its own responses and its logits are matched to a teacher's (Qwen3-32B or Qwen3-235B-A22B) by minimizing the KL divergence. The report says this takes about 1/10 of the GPU hours of the four-stage recipe; in Table 21, on one 8B checkpoint, on-policy distillation used 1,800 GPU hours against 17,920 for reinforcement learning and scored 6.8 points higher on AIME'24.
Why does Hugging Face show a larger parameter count for Qwen3-0.6B and Qwen3-1.7B than the real model has?
The config.json of both models says the input embedding and the output head share weights, but the repositories' safetensors files also store a separate lm_head.weight, and the Hub's statistic counts it. The excess is exactly vocabulary size times hidden size: 155,582,464 for the 0.6B and 311,164,928 for the 1.7B. Recomputed from the configuration, the 0.6B has about 596 million parameters and the 1.7B about 1.72 billion. For the other six models the recomputed totals match the Hub exactly. This does not change how the models behave; it only affects comparisons that use the Hub's number.