Search

Search papers and lessons

Qwen3 Technical Report

An Yang, Anfeng Li, Baosong Yang et al. · 2025

Open-weight Qwen3 models from 0.6 to 235 billion parameters switch between thinking and fast modes in one model and pass skills to small models by distillation.

On this page

  • Colour = topic mix
  • Neural network basics
  • Calculus
  • Discrete math
  • Linear algebra
  • Probability
  • Architectures
  • ReadReady to readNot yet

TL;DR

Qwen3 is a family of open-weight language models from 2025, in eight sizes from 0.6 billion to 235 billion parameters. Six are dense models and two are mixture-of-experts (MoE) models. Its main idea is that one model can both reason at length ("thinking" mode) and answer quickly ("non-thinking" mode), and that users can cap how many tokens the model spends thinking. The report also shows that small models can take on reasoning ability from large ones by distillation, which uses about a tenth of the GPU hours of running reinforcement learning on each small model.

Builds on: Mixture of Experts, Grouped-Query Attention, Rotary Position Embedding, Instruction Tuning, Knowledge Distillation, Chain-of-Thought Prompting · Leads to: test-time compute scaling

Why it mattered

The report's weights and code are public, so the design choices can be copied and tested by anyone. Its most reusable ideas are:

  • One model, two modes. A team that wanted fast chat and deep reasoning often ran two models. Qwen3 puts both behaviours behind a switch in the chat template: the user adds /think or /no_think to a message.
  • A thinking budget. The report shows that the model can be stopped part-way through its reasoning and still give an answer, so compute can be traded against latency for each request.
  • Cheaper small models. In the report's comparison on Qwen3-8B, distillation from a larger teacher beat reinforcement learning from the same starting checkpoint while using about one tenth of the GPU hours. The small models in the family were built this way.
  • Wider language coverage. The report says pre-training covers 119 languages and dialects, up from 29 in Qwen2.5, on about 36 trillion tokens.

The problem

The report starts from three limits of the previous generation, Qwen2.5 and its reasoning sibling QwQ.

  1. Two models for two jobs. A chat model answered quickly but reasoned poorly. A reasoning model reasoned well but was slow and verbose on simple questions. Developers had to pick one and route traffic by hand.
  2. Expensive small models. Each model size needed its own long, multi-stage post-training. Running reinforcement learning on every small model multiplies the cost.
  3. Narrow language support and short training context. Qwen2.5 covered 29 languages. The general pre-training stage of Qwen3 itself uses 4,096-token sequences, so the context has to be extended in a later stage.

The report's answer is one architecture shared across sizes, a four-stage post-training recipe for the flagship model, and distillation for the smaller ones.

How it works

The pipeline runs in nine steps, from architecture to inference.

flowchart LR
  A[Architecture: dense or MoE] --> B[Pre-training: about 36T tokens, 3 stages]
  B --> C[Stages 1-2: thinking, cold start and reasoning RL]
  C --> D[Stage 3: Thinking Mode Fusion, /think and /no_think]
  D --> E[Stage 4: General RL, over 20 tasks]
  E --> F[Flagship model]
  F --> G[Strong-to-weak distillation]
  G --> H[Small models in both modes]
  1. Pick the architecture. The dense models follow Qwen2.5: grouped-query attention, SwiGLU feed-forward blocks, rotary position embeddings, and RMSNorm applied before each sub-layer. Two changes are new: the QKV bias that Qwen2 used is removed, and QK-Norm is added to attention for stable training. The MoE models have 128 experts with 8 activated per token. Unlike Qwen2.5-MoE, they have no shared expert, and they use a global-batch load-balancing loss to encourage specialisation. The flagship, Qwen3-235B-A22B, has 94 layers, 64 query heads and 4 key-value heads.

  2. Build the pre-training data. The team fine-tunes Qwen2.5-VL to extract text from PDF documents, and generates synthetic data with Qwen2.5-Math and Qwen2.5-Coder. The report says it annotates over 30 trillion tokens for educational value, field, domain and safety, so the data can be filtered and mixed on those labels.

  3. Pre-train in three stages. Stage 1 trains on over 30 trillion tokens at a sequence length of 4,096, building general knowledge across 119 languages. Stage 2 adds about 5 trillion tokens with more STEM, coding, reasoning and synthetic data, and decays the learning rate faster. Stage 3 trains on hundreds of billions of tokens at a sequence length of 32,768. For this stage the RoPE base frequency is raised from 10,000 to 1,000,000, so position signals stay distinct over long distances.

  4. Stretch the context at inference. For length extrapolation the report uses YaRN with a scaling factor of 4 when it evaluates long inputs on RULER.

  5. Teach long reasoning (stages 1 and 2). A cold-start fine-tune on long chain-of-thought answers, generated by QwQ-32B and filtered for correctness and style, gives the model the habit of thinking first. Reinforcement learning with GRPO then runs on 3,995 query-verifier pairs, chosen to be hard but learnable and to cover many sub-domains.

  6. Fuse the two modes (stage 3). Continued supervised fine-tuning mixes thinking data, generated by rejection sampling from the stage-2 model, with curated non-thinking data. A user flag selects the mode. Non-thinking answers keep an empty think block, so the format stays the same.

  7. Generalise with general RL (stage 4). A reward system with over 20 tasks uses three kinds of reward: rule-based checks, a model that compares the answer with a reference answer, and a reward model trained on preference data.

  8. Distil into the small models. The five dense models from 0.6B to 14B and the 30B-A3B MoE model are trained in two phases. First, off-policy distillation trains them on teacher outputs in both modes. Then on-policy distillation has each student generate its own responses, and its logits are aligned with a teacher's (Qwen3-32B or Qwen3-235B-A22B) by minimising the KL divergence.

  9. Spend a budget at inference. When the thinking reaches a user-set length, the serving code stops it and inserts a fixed sentence telling the model to answer now from what it has reasoned so far. The report says the model "naturally develops" this ability once Thinking Mode Fusion has taught it both modes.

A small illustration of step 9, with made-up numbers: with a budget of 1,000 tokens, the model writes 1,000 tokens of reasoning, the stop sentence is inserted, and the next tokens are the answer. The report tests budgets up to 32K tokens and leaves longer outputs to future work.

The math

The paper states few formulas. The math below uses its numbers and the one loss it names.

Step 1 in symbols: active parameters

In a MoE layer with NN experts and kk active per token, the fraction of expert weights used for each token is k/Nk/N. For Qwen3's MoE layers that is 8/128=1/168/128 = 1/16. For the whole flagship model, 22 billion of 235 billion parameters are activated:

22235≈0.094\frac{22}{235} \approx 0.094

so about 9.4 percent of the weights run for each token. The report makes the same point in comparison with DeepSeek-V3: Qwen3-235B-A22B uses "about 1/3 the total number of parameters and 2/3 activated parameters" of that model. The fraction is what makes a MoE model cheap to run relative to its size.

Step 3 in symbols: context and position

Sequence length grows from L1=4,096L_1 = 4{,}096 to L3=32,768L_3 = 32{,}768 tokens, a factor of L3/L1=8L_3 / L_1 = 8. The RoPE base grows from b1=10,000b_1 = 10{,}000 to b3=1,000,000b_3 = 1{,}000{,}000, a factor of 100. A larger base slows the rotation of each position angle, so the same range of angles covers much longer sequences.

Step 8 in symbols: distillation

For a student distribution pSp_S and a teacher distribution pTp_T over the vocabulary, given the prefix x<tx_{<t} at position tt, one common per-token form of logit distillation is

Lt=DKL ⁣(pT(⋅∣x<t) ∥ pS(⋅∣x<t))\mathcal{L}_t = D_{\mathrm{KL}}\!\left(p_T(\cdot \mid x_{<t}) \,\|\, p_S(\cdot \mid x_{<t})\right)

The report says only that the student is trained to minimise the KL divergence to the teacher's logits. It does not write the formula or state its direction, so treat this as the standard form, not a quoted equation. The KL divergence itself is explained in Kullback–Leibler Divergence.

The cost ratio

Table 21 lists GPU hours of 17,920 for reinforcement learning on Qwen3-8B and 1,800 for on-policy distillation. The ratio is

1,80017,920≈0.10\frac{1{,}800}{17{,}920} \approx 0.10

which is the "about one tenth" the report states.

Results

All numbers below come from the report's text or tables, with the report's own settings and baselines.

ComparisonModelResult (as reported)
Thinking vs DeepSeek-R1, 23 benchmarksQwen3-235B-A22Bbetter on 17 of 23
Non-thinking vs GPT-4o-2024-11-20, 23 benchmarksQwen3-235B-A22Bbetter on 18 of 23
Thinking vs QwQ-32B, 23 benchmarksQwen3-32Bbetter on 17 of 23
Base vs DeepSeek-V3 Base, 15 benchmarksQwen3-235B-A22Bbetter on 14 of 15
AIME'24, distillation vs RLQwen3-8B74.4 vs 67.6
AIME'25, distillation vs RLQwen3-8B65.5 vs 55.5
GPU hours, distillation vs RLQwen3-8B1,800 vs 17,920
ThinkFollow (mode switching), stage 3 vs stage 4Qwen3-32B88.7 vs 98.9

Three results need care.

  • Thinking mode can lose ground on some tasks. In Table 22, Qwen3-32B thinking scores 83.8 on AIME'24 after Reasoning RL (stage 2), 81.9 after Thinking Mode Fusion (stage 3), and 81.4 after General RL (stage 4). On LiveCodeBench v5 it goes from 68.4 to 67.2 to 65.7. The report accepts small losses on these benchmarks for the gains in general and instruction-following tasks.
  • Long context is a little weaker in thinking mode. On RULER, Qwen3-235B-A22B averages 95.0 in non-thinking mode and 92.2 in thinking mode.
  • The thinking-budget curve covers four benchmarks in mathematics, coding and STEM. The report shows smooth gains as the budget grows, and leaves outputs beyond 32K tokens to future work.

The distillation comparison is narrower than it looks. Both methods start from the same off-policy distilled 8B checkpoint, and the report compares only math and code queries. The report also notes that distillation raises pass@64 on AIME'24 and AIME'25, while reinforcement learning does not.

The limits are the report's own. The comparisons use benchmarks the authors chose, some of them in-house (for example CounterFactQA, LengthCtrl, ThinkFollow and ToolUse), and sampling settings are tuned per mode: temperature 0.6 with top-p 0.95 for thinking, and temperature 0.7 with top-p 0.8 for non-thinking. The architecture changes (removing the QKV bias, adding QK-Norm, dropping the shared expert) are stated without a separate ablation table, so the report shows that the whole package works, not what each part contributes.

Reading guide

Read the sections in this order. Each one names the lessons it leans on.

Check yourself

QuestionHow many experts are activated per token in each MoE layer of Qwen3-235B-A22B, out of how many in total?Show answer
8 activated out of 128 total experts, per the architecture section. Combined with the 22 billion activated of 235 billion total parameters, this is why the model is far cheaper per token than its size suggests.
QuestionThe flagship has 235 billion total parameters and 22 billion activated. What fraction of weights runs per token, to two decimal places?Show answer
22 divided by 235 is about 0.0936, which is 0.09 to two decimal places (about 9.4 percent). Most of the model is idle on any given token.
QuestionWhy does the thinking budget rely on a fixed stop sentence rather than cutting the output off at the limit?Show answer
Cutting the output would leave the answer unfinished and the think block unclosed. The inserted sentence tells the model to stop reasoning, close the block and write a final answer from the reasoning it already has. The report says the model "naturally develops" this ability once Thinking Mode Fusion has taught it both modes.
QuestionA small team wants a 4-billion-parameter model that reasons well on a limited GPU budget. Using only the report's Table 21 evidence, which method should they try first, and what is the main caveat?Show answer
Strong-to-weak distillation from a larger teacher, in the off-policy then on-policy order. Table 21 shows it beats reinforcement learning on AIME'24 (74.4 vs 67.6) and AIME'25 (65.5 vs 55.5) at about one tenth of the GPU hours. The caveat is that the comparison is on Qwen3-8B, only on math and code queries, starting from the same distilled checkpoint.

Sources

Read the full paper

An Yang, Anfeng Li, Baosong Yang et al., 2025. arXiv:2505.09388