models / compare / qwen3-5-vs-gemma-4
Qwen3.5-397B-A17B vs Gemma 4 31B
How Qwen3.5-397B-A17B (Alibaba Qwen, February 2026) and Gemma 4 31B (Google DeepMind, April 2026) are built, drawn on the same November 2026 blueprint. They make different choices on 16 of 29 components. Select a component in either diagram to find it in the table.
--- frontier-llm@2026-11+++ qwen3-5@2026-02+0~3−3
Qwen3.5-397B-A17B
Alibaba Qwen, February 2026, 397B total, 17B active
--- frontier-llm@2026-11+++ gemma-4@2026-04+2~7−6
Gemma 4 31B
Google DeepMind, April 2026, 30.7B
Component by component
Qwen3.5-397B-A17B and Gemma 4 31B differ on 16 of 29 components.
| Blueprint component | Qwen3.5-397B-A17B | Gemma 4 31B |
|---|---|---|
Same as the blueprintByte-level BPE (Qwen2Tokenizer): 248,044 BPE entries plus 33 special tokens, padded to 248,320 rows. The pre-tokenizer splits numbers into single digits. Qwen says the ~250K vocabulary (vs. ~150K in Qwen3) boosts encoding/decoding efficiency by 10–60% across most languages. | SentencePiece BPE with byte fallbackGemini's 262,144-entry SentencePiece vocabulary: character-level BPE, split digits, bytes only as a fallback. | |
Single residual streamOne d = 4,096 pre-norm residual stream with zero-centred RMSNorm gains; no hyper-connections or depth attention. | Single residual stream with per-layer scalarsOne d = 5,376 stream, RMSNorm before and after each sublayer, and a stored scalar that rescales the stream after every block. | |
Same as the blueprintPartial, interleaved multimodal RoPE (M-RoPE) in the attention layers only: 64 of 256 head dims rotate (partial_rotary_factor 0.25), θ = 10,000,000, with the 32 frequency pairs split 11/11/10 between time, height and width. The Gated DeltaNet layers carry no explicit position. | RoPE by layer type: full RoPE local, p-RoPE globalLocal layers rotate all 256 dims (θ = 10⁴); global layers keep only the 64 fastest of 256 frequency pairs (θ = 10⁶). | |
Same as the blueprintGated DeltaNet in 45 of 60 layers, three before every attention layer. 16 query/key heads and 64 value heads of dim 128 (each q/k head serves 4 value heads); short causal conv (kernel 4) + SiLU on q, k, v; per-head scalar decay g = −eᴬ·softplus(a + dt_bias) and write strength β = σ(b). Each layer keeps a 64 × 128 × 128 state per sequence, held in FP32. | ||
Gated grouped-query attentionEvery fourth layer: full causal GQA with 32 query heads sharing 2 KV heads of dim 256, QK-Norm and a sigmoid output gate. | Global GQA with keys reused as valuesEvery sixth layer: full causal attention, 32 query heads and 4 KV heads of dim 512, V taken from the key projection. | |
Same as the blueprint50 of 60 layers, in runs of five between global layers. Each uses a 1,024-token window with 32 query heads and 16 KV heads of dim 256 (2 query heads per KV head), separate K and V projections and full RoPE with θ = 10,000. Their KV cache is bounded at 1,024 tokens per layer. | ||
Same as the blueprintIn the attention layers q_proj emits 2 × 32 × 256 values per token; the second half is an elementwise sigmoid gate, computed from the layer input, applied to the attention output before W_o. Gated DeltaNet layers gate their output with SiLU(z) after a per-head RMSNorm. No sink logits. | ||
Softmax top-k routerA linear router scores 512 experts; softmax, keep the top 10, renormalize. No selection bias. | Dense GeGLU feed-forwardOne gated MLP per layer, 5,376 → 21,504 → 5,376 with tanh-approximated GELU; all 30.7B parameters are active. | |
Same as the blueprint512 SwiGLU experts with intermediate size 1,024 at the full model width 4,096 (no latent projection); 10 are active per token, about 2% of the pool. Weights ship in BF16, with an official FP8 variant. | ||
Same as the blueprintOne shared SwiGLU expert per layer (intermediate 1,024) runs on every token, but its output is scaled by a learned per-token sigmoid gate σ(w·x), w ∈ ℝ^4096, before it is added to the routed sum. Unlike DeepSeek-style shared experts it is not ungated. | ||
Same as the blueprintUntied 4,096 → 248,320 output projection (~1.02B parameters), also used by the MTP layer; kept in BF16 in the FP8 release. | Tied LM head with logit soft-cappingLogits come from the input embedding matrix (no separate head) and are squashed by 30·tanh(z/30). | |
Same as the blueprintOne MTP layer: a full gated-attention + 512-expert MoE block whose input is a linear projection (8,192 → 4,096) of the RMSNorm'd next-token embedding concatenated with the RMSNorm'd trunk state. It reuses the main embedding and LM head and, per the model card, was trained with multiple steps, so the one layer is applied repeatedly to draft several tokens. | Autoregressive MTP drafter (4 layers, reads trunk KV)A separate ~500M-parameter, 4-layer Transformer drafts tokens one at a time while attending to the 31B's own KV cache. | |
Same as the blueprint262,144 tokens natively. The model card extends this to 1,010,000 tokens with static YaRN (factor 4 over 262,144) on the rotary dims, and warns that static YaRN can hurt performance on shorter texts. The pretraining context schedule is not published. | ||
Same as the blueprintQwen describes RL scaled across million-scale agent scaffolds and environments on an asynchronous, fully disaggregated training–inference framework, using FP8 end-to-end training, rollout router replay, speculative decoding and multi-turn rollout locking for throughput and train–inference consistency (3–5× end-to-end speedup). The policy-optimization algorithm is not published. | ||
| Not present | Post-attention RMSNorm (sandwich norm)The attention output is RMS-normalized with a learned gain before the residual add; there is no output gate or sink. | |
| Not present | Post-feed-forward RMSNorm (sandwich norm)The MLP output is RMS-normalized with a learned gain before it is added to the residual stream. |