Track VI · Frontier Tech Reports · 08/20

Qwen3.8-Flash-Next — sparse attention, gated residual, n-gram 임베딩, MuonQwen3.8-Flash-Next — sparse attention, gated residual, n-gram embeddings, Muon

Qwen의 2026-08 아키텍처 보고서를 읽는다. GDN 하이브리드의 full attention을 블록 압축 indexer의 Qwen Sparse Attention으로 바꾸고, residual stream을 4갈래로 넓혀 원소별 gate로 읽고, 51B짜리 n-gram 임베딩을 가속기 밖에 두고, Muon과 다시 맞춘 scaling law로 학습해 활성 6B로 직전 397B-A17B와 비슷한 base 성능을 1/9 FLOPs에 낸 과정을, 각 구성 요소의 식과 ablation, 장난감 재현으로 따라간다.A reading of Qwen's 2026-08 architecture report. It replaces the full attention of the GDN hybrid with Qwen Sparse Attention (a block-compressing indexer), widens the residual stream to four branches read through an elementwise gate, keeps a 51B n-gram embedding off the accelerator, and trains with Muon and a refitted scaling law — matching the previous 397B-A17B base with 6B active parameters at 1/9 of the FLOPs. We follow each component through its equations, ablations and a toy re-implementation.

Qwen3-Next and Qwen3.5 shipped without a technical report. Qwen3.8-Flash-Next, which takes that architecture one step further, did the opposite and published a report about the architecture only (arXiv 2608.30320, 2026-08-31). Post-training and data are barely mentioned; instead it is packed with ablations that evaluate every component along three axes: “loss and benchmarks / cost in training, prefill and decode / optimal hyperparameters and stability”. The model card calls the model “an experimental preview of the architecture that will underpin Qwen4”.

The result fits in one sentence. A base model with 125B total and 6B active parameters per token (plus 51B of n-gram tables off the accelerator) leads the previous generation’s 397B-A17B base on 8 of 14 benchmarks and trails by at most 2.6 points on the rest — with 1/3 of the active parameters, 1/3 of the training tokens and about 1/9 of the training FLOPs. This lesson goes through the four changes in turn: QSA, the Gated Residual, n-gram embeddings and the Muon recipe.

At a glance

ItemDetails
LabQwen Team, Alibaba
ReportarXiv 2608.30320, 2026-08-31
Parameters125B total, 6B active. Plus 51B of n-gram embeddings (host memory) and 4B MTP (model card)
Layer layout48 layers = 12 × (3 × Gated DeltaNet → MoE, 1 × Qwen Sparse Attention → MoE)
Hidden size2560
GDNV 48 / QK 16 heads, head 128
QSAQ 24 / KV 2 heads, head 256, RoPE on 64 dims. Indexer: MQA with 4 query heads + 1 shared key, head 128, budget 2,048 tokens (512 blocks), compression ratio r=4
MoE512 experts, 10 routed + 1 shared, expert dim 640
Gated Residual4 branches, bottleneck rank 320 (= d/8)
n-gram embeddings20M slots (bigrams/trigrams), once at layer 2
Context262,144 native, extensible to 1M
TrainingMuon (2D linear maps) + AdamW (embeddings, head, router, GR low-rank), refitted LR/batch scaling law, no batch warmup
Opennessopen weights, Qwen community license 1.0 (not Apache)
Report §1–3, model card.

What is new

  • Qwen Sparse Attention (QSA). The full-attention layers become sparse attention. As in DeepSeek’s DSA, a light indexer chooses which tokens to attend to, but the keys are first average-compressed into blocks of rr tokens, which cuts the cost of the indexer itself to O(n2/r)O(n^2/r). At 1M context the attention kernels are 7.6× faster in prefill and 4.9× in decode.
  • Gated Residual (GR). The residual stream is widened to four branches, and each block reads it through an elementwise sigmoid gate. Dropping the branch-mixing operator HresH_{\text{res}} of HC/mHC reduces decode memory traffic.
  • n-gram embeddings. An embedding table looked up by a hash of the previous 2–3 tokens sits at layer 2, adding 51B parameters with no per-token FLOPs, prefetched from host memory.
  • Muon + a new scaling law. Optimal batch size and learning rate both grew, and batch-size warmup became unnecessary. In stress tests it is clearly more stable than the Qwen3.5 structure with AdamW, and the real run had not a single loss spike, without devices such as qk-clip.
  • Evaluation methodology. The report explicitly lists cases where loss and benchmarks disagree (n-gram vocabulary, GR’s dynamic operators, sparse reads and NoPE problems that surfaced only after post-training).

Architecture

→ Go deeper: The Qwen lineage — how Qwen3 → Qwen3-Next → Qwen3.5 led to these choices.

1. The GDN hybrid stays; the output gate becomes sigmoid

Token mixing is the same 3:1 GDN hybrid as in Qwen3.5 (equations and intuition in the previous lesson). Two things changed. The GDN output gate went from SiLU to sigmoid, with consistent gains (Eq. 11). And a NoPE variant that removes positional encoding from the full-attention layers was indistinguishable in pre-training but showed a much higher rate of endless generation after post-training, so RoPE was kept. The GDN kernel, FlashQLA (TileLang-based), is 2–3× faster forward and about 2× backward than the FLA Triton kernel.

2. Qwen Sparse Attention

The DSA indexer scores every previous token for each query, so on long sequences the indexer itself becomes an O(n2)O(n^2) bottleneck. QSA compresses the keys first. The indexer is MQA (HH query heads, one shared key):

q^ih=RMSNorm⁡(WQhxi),ki=WKxi,k^b=RMSNorm⁡(AvgPool⁡(kpb:pb+r−1)),pb=b r\hat q^{h}_i=\operatorname{RMSNorm}(W^h_Qx_i),\qquad k_i=W_Kx_i,\qquad \hat k_b=\operatorname{RMSNorm}\big(\operatorname{AvgPool}(k_{p_b:p_b+r-1})\big),\quad p_b=b\,r

Position is added after compression: each block is first summarised by content, then given a partial RoPE (64 of 128 dims) at its start position pbp_b. This avoids averaging tokens with different rotary phases. The score is a sum over heads of ReLU dot products, and only fully observed blocks are scored:

Iib={∑h=1HReLU⁡(⟨qih,kˉb⟩)pb+r−1≤i−∞otherwise,Bi=TopK⁡KB(Ii,:),KB=⌈K/r⌉I_{ib}=\begin{cases}\sum_{h=1}^{H}\operatorname{ReLU}\big(\langle q^h_i,\bar k_b\rangle\big) & p_b+r-1\le i\\ -\infty & \text{otherwise}\end{cases},\qquad \mathcal{B}_i=\operatorname{TopK}_{K_B}(I_{i,:}),\quad K_B=\lceil K/r\rceil

The selected blocks are expanded back to tokens, and the tokens of the incomplete block the query sits in are always included for core attention: Si=Expand⁡(Bi)∪{r⌊i+1r⌋,…,i}\mathcal{S}_i=\operatorname{Expand}(\mathcal{B}_i)\cup\{r\lfloor\frac{i+1}{r}\rfloor,\dots,i\}. Flash-Next uses K=2048K=2048 and r=4r=4, i.e. at most 512 blocks.

Count the cost. Dense attention computes QK and AV over a core width of 24×25624\times256 for every query–key pair. QSA’s indexer computes only 4×1284\times128 per query–block pair, and core attention looks at only KK tokens per query:

denseQSA≈n2⋅ccoren2rcidx+nK ccore\frac{\text{dense}}{\text{QSA}}\approx\frac{n^2\cdot c_{\text{core}}}{\frac{n^2}{r}c_{\text{idx}}+nK\,c_{\text{core}}}

For large nn the first denominator term dominates, so rr multiplies straight into the speed-up. The theoretical compute ratio and measured kernel speed differ a lot, though (right panel below).

Qwen3-Next와 Qwen3.5는 기술 보고서 없이 나왔다. 그 아키텍처를 다음 단계로 옮긴 Qwen3.8-Flash-Next는 반대로 아키텍처만 다루는 보고서(arXiv 2608.30320, 2026-08-31)를 냈다. 사후학습이나 데이터는 거의 없고, 대신 구성 요소 하나하나를 “손실·벤치마크 / 학습·prefill·decode 비용 / 최적 하이퍼파라미터·안정성”의 세 축으로 평가한 ablation이 빽빽하다. model card는 이 모델을 “Qwen4의 기반이 될 아키텍처의 실험적 미리보기”라고 부른다.

결과의 요약은 한 문장이다. 총 125B, 토큰당 활성 6B(+가속기 밖의 n-gram 테이블 51B)인 base 모델이 직전 세대 397B-A17B base를 14개 벤치마크 중 8개에서 앞서고 나머지에서도 최대 2.6점 차이인데, 활성 파라미터 1/3, 학습 토큰 1/3, 학습 FLOPs 약 1/9로 그렇게 했다. 이 레슨은 그 네 가지 변화(QSA, Gated Residual, n-gram 임베딩, Muon 레시피)를 차례로 본다.

한눈에

항목내용
연구실Qwen Team, Alibaba
보고서arXiv 2608.30320, 2026-08-31
파라미터총 125B, 활성 6B. 별도로 n-gram 임베딩 51B(호스트 메모리), MTP 4B (model card)
층 배치48층 = 12 × (3 × Gated DeltaNet → MoE, 1 × Qwen Sparse Attention → MoE)
hidden2560
GDNV 48 / QK 16 head, head 128
QSAQ 24 / KV 2 head, head 256, RoPE 64차원. indexer: MQA 4 query head + 공유 key 1, head 128, 예산 2,048 토큰(512 블록), 압축 비율 r=4
MoE512 expert, 10 routed + 1 shared, expert 차원 640
Gated Residual4 branch, bottleneck rank 320 (= d/8)
n-gram 임베딩2천만 슬롯(bigram/trigram), 층 2에 한 번
문맥262,144 기본, 1M까지 확장
학습Muon(2D 선형사상) + AdamW(임베딩·head·router·GR 저랭크), 다시 맞춘 LR·배치 scaling law, 배치 warmup 없음
공개가중치 공개, Qwen community license 1.0 (Apache가 아님)
보고서 §1–3, model card.

무엇이 새로운가

  • Qwen Sparse Attention(QSA). full attention 층을 sparse attention으로 바꾼다. DeepSeek DSA처럼 가벼운 indexer가 고른 토큰만 보지만, key를 rr개 블록으로 평균 압축해 **indexer 자체의 비용을 O(n2/r)O(n^2/r)**로 줄였다. 1M 문맥에서 attention 커널이 prefill 7.6×, decode 4.9× 빨라진다.
  • Gated Residual(GR). residual stream을 4갈래로 넓히고 각 block이 그것을 원소별 sigmoid gate로 읽는다. HC/mHC의 branch 섞기 연산자 HresH_{\text{res}}를 빼서 decode 메모리 traffic을 줄였다.
  • n-gram 임베딩. 직전 토큰 2–3개의 해시로 찾는 임베딩 테이블을 층 2에 넣어, 토큰당 FLOPs 없이 파라미터를 51B 늘리고 호스트 메모리에서 prefetch한다.
  • Muon + 새 scaling law. 최적 배치·학습률이 더 커졌고, 배치 크기 warmup이 필요 없어졌다. stress test에서 Qwen3.5 구조+AdamW보다 확연히 안정적이고, 실제 학습은 qk-clip 같은 장치 없이 loss spike가 한 번도 없었다.
  • 평가 방법론. 손실과 벤치마크가 어긋나는 사례(n-gram 어휘, GR의 동적 연산자, 사후학습 뒤에야 드러난 sparse 읽기·NoPE 문제)를 명시적으로 보고한다.

아키텍처

→ 더 깊이: Qwen 계보 — Qwen3 → Qwen3-Next → Qwen3.5를 거쳐 이 선택에 이른 과정.

1. GDN 하이브리드는 유지, 출력 gate는 sigmoid로

토큰 혼합은 Qwen3.5와 같은 3:1 GDN 하이브리드다(식과 직관은 이전 레슨). 두 가지가 바뀌었다. GDN 출력 gate를 SiLU에서 sigmoid로 바꿔 일관되게 좋아졌고(Eq. 11), full attention 층의 위치 인코딩을 빼는 NoPE 변형은 사전학습에서는 구분되지 않았지만 사후학습 뒤 끝나지 않는 생성이 크게 늘어 RoPE를 유지했다. GDN 커널은 TileLang 기반 FlashQLA로 FLA Triton 커널 대비 forward 2–3×, backward 약 2× 빨라졌다.

2. Qwen Sparse Attention

DSA의 indexer는 query마다 모든 이전 토큰에 점수를 매기므로, 시퀀스가 길면 indexer 자체가 O(n2)O(n^2) 병목이 된다. QSA는 key를 먼저 압축한다. indexer는 MQA(query head HH개, 공유 key 하나)다.

q^ih=RMSNorm⁡(WQhxi),ki=WKxi,k^b=RMSNorm⁡(AvgPool⁡(kpb:pb+r−1)),pb=b r\hat q^{h}_i=\operatorname{RMSNorm}(W^h_Qx_i),\qquad k_i=W_Kx_i,\qquad \hat k_b=\operatorname{RMSNorm}\big(\operatorname{AvgPool}(k_{p_b:p_b+r-1})\big),\quad p_b=b\,r

위치는 압축 뒤에 넣는다. 블록 하나를 내용으로 요약한 다음 블록 시작 위치 pbp_b의 partial RoPE(128차원 중 64차원)를 준다. 회전 위상이 다른 토큰들을 평균하는 문제를 피하기 위해서다. 점수는 head별 ReLU 내적의 합이고, 완전히 관찰된 블록만 채점한다.

Iib={∑h=1HReLU⁡(⟨qih,kˉb⟩)pb+r−1≤i−∞otherwise,Bi=TopK⁡KB(Ii,:),KB=⌈K/r⌉I_{ib}=\begin{cases}\sum_{h=1}^{H}\operatorname{ReLU}\big(\langle q^h_i,\bar k_b\rangle\big) & p_b+r-1\le i\\ -\infty & \text{otherwise}\end{cases},\qquad \mathcal{B}_i=\operatorname{TopK}_{K_B}(I_{i,:}),\quad K_B=\lceil K/r\rceil

선택된 블록을 토큰으로 펼치고, query가 속한 미완성 블록의 토큰은 항상 포함해 core attention을 돌린다: Si=Expand⁡(Bi)∪{r⌊i+1r⌋,…,i}\mathcal{S}_i=\operatorname{Expand}(\mathcal{B}_i)\cup\{r\lfloor\frac{i+1}{r}\rfloor,\dots,i\}. Flash-Next는 K=2048K=2048, r=4r=4, 즉 최대 512 블록이다.

비용을 세 보자. dense attention은 query·key 쌍마다 core 차원 24×25624\times256의 QK와 AV를 계산한다. QSA의 indexer는 query·블록 쌍마다 4×1284\times128만 계산하고, core attention은 query마다 KK개 토큰만 본다.

denseQSA≈n2⋅ccoren2rcidx+nK ccore\frac{\text{dense}}{\text{QSA}}\approx\frac{n^2\cdot c_{\text{core}}}{\frac{n^2}{r}c_{\text{idx}}+nK\,c_{\text{core}}}

nn이 크면 분모의 첫 항이 지배하므로 rr이 그대로 속도에 곱해진다. 다만 이론 연산비와 실측 커널 속도는 크게 다르다(아래 그림 오른쪽).

선택 블록selected blocks – dense attention 질량 recallrecall of dense attention mass – query당 indexer 점수 수indexer scores per query –
Left: a 1,024-token context (32×32, row-major from the top left). Cell shade is the dense attention of the query; violet outlines are the tokens QSA selects (the red dot is the query, grey cells after it are future tokens, and the incomplete block containing the query is always kept). Raise r: the number of blocks the indexer scores falls to 1/r, but once blocks are larger than the relevant spans, block averaging dilutes the signal and recall drops. More indexer heads H average out noisy scores. Right: the theoretical attention compute ratio (dense/QSA) with Flash-Next dimensions (core 24 heads×256, indexer 4 heads×128, K=2048). Dots are the report's measured kernel speed-ups at 1M context (prefill 7.6×, decode 4.9×); the large gap from theory is the memory and top-k cost of real kernels. 왼쪽: 1,024 토큰 문맥(32×32, 왼쪽 위부터 행 순서). 칸의 진하기는 마지막 query의 dense attention, 보라 테두리는 QSA가 고른 토큰이다(빨간 점이 query, 그 뒤 회색은 미래 토큰, query가 속한 미완성 블록은 항상 포함). r을 올려 보면 indexer가 채점할 블록 수가 1/r로 줄지만, 관련 구간보다 블록이 커지면 블록 평균이 신호를 희석해 recall이 떨어진다. head 수 H를 늘리면 잡음 섞인 점수가 평균되어 안정된다. 오른쪽: Flash-Next 차원(core 24 head×256, indexer 4 head×128, K=2048)으로 센 이론적 attention 연산 비율(dense/QSA). 점은 보고서가 잰 1M 문맥의 커널 속도 향상(prefill 7.6×, decode 4.9×)이다. 이론값과의 큰 차이가 실제 커널의 메모리·top-k 비용이다.

Training. QSA enters not in pre-training but in continued pre-training (CPT) on 256K sequences.

  1. Dense distillation (warm-up). Distil the backbone’s full-attention distribution into the indexer. The teacher’s token-level distribution aia_i (the sum of all heads’ softmax, L1L_1-normalised) is max-pooled to blocks; max rather than mean so that a single important token in a block is not diluted. Only the indexer trains, for 1,000 steps (lr 10−310^{-3}, 8 sequences of 256K per step, about 2B tokens).
aˉib=max⁡t∈block bait,a^i=aˉi/∥aˉi∥1,LKL=1N∑iDKL(a^i ∥ softmax⁡(Ii,:))\bar a_{ib}=\max_{t\in\text{block }b} a_{it},\qquad \hat a_i=\bar a_i/\|\bar a_i\|_1,\qquad \mathcal{L}_{\text{KL}}=\frac1N\sum_i D_{\text{KL}}\big(\hat a_i\,\|\,\operatorname{softmax}(I_{i,:})\big)
  1. Sparse training. The whole backbone trains on the blocks the indexer picks, with the KL computed on the selected blocks after renormalising the teacher probabilities. 8,000 steps (lr 2.5×10−52.5\times10^{-5}, 96 sequences of 256K per step, about 200B tokens). The LM-loss difference from full attention was on the order of 10−410^{-4} (Figure 4).

The attention in the MTP module also becomes QSA, and top-k indices are reused across speculative-decoding steps (the GLM-5 approach). Mean accepted length was unchanged, 4.06 → 4.07 (Table 4).

→ Go deeper: Sparse attention — QSA next to NSA, DSA and CSA/HCA.

3. Gated Residual

In a pre-norm residual network every block reads the same single stream, so a feature written early has to compete with everything written after it. HC (Hyper-Connections) widens the stream into nrn_r branches R∈Rnr×dR\in\mathbb{R}^{n_r\times d} and learns three operators: read HmixH_{\text{mix}}, write HcombineH_{\text{combine}} and branch mixing HresH_{\text{res}}.

x(ℓ)=Hmix⊤R(ℓ),y(ℓ)=F(ℓ)(Norm⁡(x(ℓ))),R(ℓ+1)=HresR(ℓ)+Hcombine y(ℓ)⊤x^{(\ell)}=H_{\text{mix}}^\top R^{(\ell)},\qquad y^{(\ell)}=\mathcal{F}^{(\ell)}\big(\operatorname{Norm}(x^{(\ell)})\big),\qquad R^{(\ell+1)}=H_{\text{res}}R^{(\ell)}+H_{\text{combine}}\,y^{(\ell)\top}

The report started from static operators and added expressiveness “only where it paid for itself”. The result is GR: normalise each branch separately, predict a gate per branch and channel from all branches to read, and write the output with one scalar per branch. There is no HresH_{\text{res}}.

R^i=RMSNorm⁡(Ri;γi),G=σ(WuSiLU⁡(1nrWdvec⁡(R^)))∈Rnr×d,x=1nr∑i=1nrGi⊙R^i\hat R_i=\operatorname{RMSNorm}(R_i;\gamma_i),\qquad G=\sigma\Big(W_u\operatorname{SiLU}\big(\tfrac{1}{n_r}W_d\operatorname{vec}(\hat R)\big)\Big)\in\mathbb{R}^{n_r\times d},\qquad x=\frac1{n_r}\sum_{i=1}^{n_r}G_i\odot\hat R_is=2 σ(1nrWwvec⁡(R^))∈Rnr,Ri′=Ri+si ys=2\,\sigma\Big(\tfrac1{n_r}W_w\operatorname{vec}(\hat R)\Big)\in\mathbb{R}^{n_r},\qquad R'_i=R_i+s_i\,y

Wd,WuW_d, W_u form a rank-r=d/8r=d/8 bottleneck. Because the read already normalises and gates, it replaces the block’s pre-norm. The read is the same as the authors’ separately found GatedNorm, RMSNorm⁡(u)⊙σ(W2SiLU⁡(W1RMSNorm⁡(u)))\operatorname{RMSNorm}(u)\odot\sigma(W_2\operatorname{SiLU}(W_1\operatorname{RMSNorm}(u))), applied to the widened stream. Five ablation observations shaped it (§2.2):

  • A sigmoid gate beats tanh in both loss and stability.
  • Making read and write data-dependent lowers loss by only 0.002 but raises the benchmark average by 1.98 points (Table 5).
  • A finer read (per-branch scalar → per branch × channel) helps; a finer write gives almost nothing.
  • Operators are better predicted from all branches.
  • Once read and write are expressive enough, HresH_{\text{res}} brings no significant gain — and dropping it removes a full read of the residual state per block, the dominant decode cost.

What are the branches used for? With no HresH_{\text{res}}, each branch is a plain accumulator of past outputs, and block vv‘s input can be decomposed exactly into contributions from earlier blocks uu:

Rc(v)=Rc(0)+∑u<vsc(u) y(u),au→v=1nr∑c=1nrGc(v)⊙γc⊙sc(u) y(u)rms⁡(Rc(v)),πuv=∥au→v∥∑u′<v∥au′→v∥R^{(v)}_c=R^{(0)}_c+\sum_{u<v}s^{(u)}_c\,y^{(u)},\qquad a_{u\to v}=\frac1{n_r}\sum_{c=1}^{n_r}G^{(v)}_c\odot\gamma_c\odot\frac{s^{(u)}_c\,y^{(u)}}{\operatorname{rms}(R^{(v)}_c)},\qquad \pi_{uv}=\frac{\|a_{u\to v}\|}{\sum_{u'<v}\|a_{u'\to v}\|}

Comparing a 20-layer MoE with GR against a reference without GR, in all five checkpoints exactly one branch became a long-range path (typical skip 10.9 layers, versus 3.4–3.9 for the others). The share of layer-0 GDN in layer-15 attention rose from 0.020 to 0.138, and long-range paths landed mostly on softmax-attention layers. Overall, adjacent-layer (+0.96) and long-range (+0.91) paths gained share and mid-range paths (−3.21) lost it.

→ Go deeper: Stability components — the gated residual among other residual variants (mHC, attention residuals).

학습. QSA는 사전학습이 아니라 256K 시퀀스의 continued pretraining(CPT)에서 들어온다.

  1. dense 증류(warm-up). backbone의 full attention 분포를 indexer에 증류한다. teacher의 토큰 단위 분포 aia_i(모든 head의 softmax 합을 L1L_1 정규화)를 블록 단위로 max pooling해 맞춘다. 평균 대신 max를 쓰는 것은 블록 안의 단일 중요 토큰 신호가 희석되지 않게 하기 위해서다. indexer만 1,000 step(lr 10−310^{-3}, step당 256K × 8개, 약 2B 토큰).
aˉib=max⁡t∈block bait,a^i=aˉi/∥aˉi∥1,LKL=1N∑iDKL(a^i ∥ softmax⁡(Ii,:))\bar a_{ib}=\max_{t\in\text{block }b} a_{it},\qquad \hat a_i=\bar a_i/\|\bar a_i\|_1,\qquad \mathcal{L}_{\text{KL}}=\frac1N\sum_i D_{\text{KL}}\big(\hat a_i\,\|\,\operatorname{softmax}(I_{i,:})\big)
  1. sparse 학습. indexer가 고른 블록으로 backbone 전체를 학습하고, KL은 선택된 블록 위에서 teacher 확률을 재정규화해 계산한다. 8,000 step(lr 2.5×10−52.5\times10^{-5}, step당 256K × 96개, 약 200B 토큰). full attention 대비 LM loss 차이는 10−410^{-4} 수준이었다(Figure 4).

MTP 모듈의 attention도 QSA로 바꾸고, speculative decoding의 여러 step에서 top-k 인덱스를 재사용한다(GLM-5 방식). 평균 수락 길이는 4.06 → 4.07로 변하지 않았다(Table 4).

→ 더 깊이: Sparse attention — QSA를 NSA·DSA·CSA/HCA와 비교한다.

3. Gated Residual

pre-norm residual에서는 모든 block이 같은 한 줄기 stream을 읽는다. 앞에서 쓴 특징은 그 뒤에 쓰인 모든 것과 경쟁해야 한다. HC(Hyper-Connections)는 stream을 nrn_r갈래 R∈Rnr×dR\in\mathbb{R}^{n_r\times d}로 넓히고, 읽기 HmixH_{\text{mix}}, 쓰기 HcombineH_{\text{combine}}, 갈래 섞기 HresH_{\text{res}} 세 연산자를 배운다.

x(ℓ)=Hmix⊤R(ℓ),y(ℓ)=F(ℓ)(Norm⁡(x(ℓ))),R(ℓ+1)=HresR(ℓ)+Hcombine y(ℓ)⊤x^{(\ell)}=H_{\text{mix}}^\top R^{(\ell)},\qquad y^{(\ell)}=\mathcal{F}^{(\ell)}\big(\operatorname{Norm}(x^{(\ell)})\big),\qquad R^{(\ell+1)}=H_{\text{res}}R^{(\ell)}+H_{\text{combine}}\,y^{(\ell)\top}

보고서는 정적 연산자에서 시작해 “값을 하는 곳에만” 표현력을 더했다. 그 결과가 GR이다. 각 branch를 따로 RMSNorm하고, 모든 branch를 보고 branch×채널별 gate를 예측해 읽고, 출력은 branch마다 스칼라 하나로 쓴다. HresH_{\text{res}}는 없다.

R^i=RMSNorm⁡(Ri;γi),G=σ(WuSiLU⁡(1nrWdvec⁡(R^)))∈Rnr×d,x=1nr∑i=1nrGi⊙R^i\hat R_i=\operatorname{RMSNorm}(R_i;\gamma_i),\qquad G=\sigma\Big(W_u\operatorname{SiLU}\big(\tfrac{1}{n_r}W_d\operatorname{vec}(\hat R)\big)\Big)\in\mathbb{R}^{n_r\times d},\qquad x=\frac1{n_r}\sum_{i=1}^{n_r}G_i\odot\hat R_is=2 σ(1nrWwvec⁡(R^))∈Rnr,Ri′=Ri+si ys=2\,\sigma\Big(\tfrac1{n_r}W_w\operatorname{vec}(\hat R)\Big)\in\mathbb{R}^{n_r},\qquad R'_i=R_i+s_i\,y

Wd,WuW_d, W_u는 rank r=d/8r=d/8의 병목이다. 읽기가 이미 정규화와 gate를 하므로 block의 pre-norm을 대체한다. 이 읽기는 저자들이 따로 찾은 GatedNorm, RMSNorm⁡(u)⊙σ(W2SiLU⁡(W1RMSNorm⁡(u)))\operatorname{RMSNorm}(u)\odot\sigma(W_2\operatorname{SiLU}(W_1\operatorname{RMSNorm}(u)))을 넓힌 stream에 적용한 것과 같다. 다섯 가지 ablation 관찰이 이 모양을 정했다(§2.2).

  • sigmoid gate가 tanh보다 손실과 안정성 모두 낫다.
  • 읽기·쓰기를 데이터 의존으로 만들면 손실은 0.002만 줄지만 벤치마크 평균은 1.98점 오른다(Table 5).
  • 읽기를 branch당 스칼라 → branch×채널로 세밀하게 하면 좋아지지만, 쓰기는 세밀하게 해도 거의 효과가 없다.
  • 연산자는 모든 branch를 보고 예측하는 것이 좋다.
  • 읽기·쓰기가 충분히 표현력이 있으면 HresH_{\text{res}}는 의미 있는 이득이 없다. 빼면 block마다 residual 전체를 한 번 더 읽는 비용(decode의 지배적 비용)이 사라진다.

branch는 무엇에 쓰이나. HresH_{\text{res}}가 없으니 각 branch는 과거 출력의 단순 누적이고, block vv의 입력을 앞선 block uu들의 기여로 정확히 분해할 수 있다.

Rc(v)=Rc(0)+∑u<vsc(u) y(u),au→v=1nr∑c=1nrGc(v)⊙γc⊙sc(u) y(u)rms⁡(Rc(v)),πuv=∥au→v∥∑u′<v∥au′→v∥R^{(v)}_c=R^{(0)}_c+\sum_{u<v}s^{(u)}_c\,y^{(u)},\qquad a_{u\to v}=\frac1{n_r}\sum_{c=1}^{n_r}G^{(v)}_c\odot\gamma_c\odot\frac{s^{(u)}_c\,y^{(u)}}{\operatorname{rms}(R^{(v)}_c)},\qquad \pi_{uv}=\frac{\|a_{u\to v}\|}{\sum_{u'<v}\|a_{u'\to v}\|}

20층 MoE에서 GR 모델과 GR 없는 참조 모델을 비교하니, 다섯 체크포인트 모두에서 정확히 한 branch만 장거리 통로(평균 건너뛰기 10.9층, 나머지는 3.4–3.9층)가 되었다. 층 0 GDN → 층 15 attention의 몫이 0.020에서 0.138로 올랐고, 장거리 경로가 도착하는 곳은 주로 softmax attention 층이었다. 전체로는 인접 층(+0.96)과 장거리(+0.91) 경로가 늘고 중간 거리(−3.21)가 줄었다.

→ 더 깊이: 안정화 부품 — gated residual을 mHC, attention residual 같은 다른 residual 변형과 함께 본다.

층 0의 몫share of layer 0 π0→v: 단일 streamsingle stream – · GR – 직전 층의 몫: 단일share of the previous layer: single – · GR –
How much of reader layer v's input came from each earlier writer (emb, layer 0, 1, …) — πu→v, Eq. 37. Grey: a single residual stream; violet: a 4-branch GR. In a single stream every writer passes through the same RMSNorm and mixes into one vector, so with equal output sizes each share shrinks as 1/v. Raise the layer 0 → branch 0 write and keep later writes near 0: branch 0 becomes a "long-range path" carrying only layer 0's output, and the reader gate G0 sets how much of that path is read. This hand-built toy mimics the pattern the report observed in trained models (layer-0 GDN → layer-15 attention share 0.020 → 0.138, exactly one long-range branch). reader 층 v의 입력이 앞선 각 writer(emb, 층 0, 1, …)에서 얼마씩 왔는지(πu→v, Eq. 37). 회색은 단일 residual stream, 보라는 4-branch GR이다. 단일 stream에서는 모든 writer가 같은 RMSNorm을 거쳐 한 벡터로 섞이므로 출력 크기가 같으면 몫이 1/v로 줄어든다. 층 0 → branch 0 쓰기를 키우고 이후 쓰기를 0에 가깝게 두면 branch 0은 층 0의 출력만 담은 "장거리 통로"가 되고, reader gate G0로 그 통로를 얼마나 읽을지 정한다. 보고서가 학습된 모델에서 관찰한 패턴(층 0 GDN → 층 15 attention의 몫 0.020 → 0.138, 한 branch만 장거리)을 손으로 만든 장난감이다.

Inference cost. The cost of a widened stream is memory traffic. Two things were tried. (1) Seeing that writes in trained models usually concentrate on two branches, they let blocks read only the top-2 branches: pre-training loss and benchmarks barely moved, but quality degraded clearly after post-training, so it was dropped. (2) The gates in GR, gated attention and GDN bound the magnitude of what is written into the residual, so storing the residual in FP8 cost almost no quality and halved the bytes moved relative to BF16. Read and write are each fused into a single kernel.

4. N-gram embeddings

At each token position, the short n-grams (bigram, trigram) ending there are used as keys into hash tables, and the retrieved vectors are added to the residual. Lookup uses multi-head hashing; injection uses contextual gating (Cheng et al. 2026). Because the address depends only on input tokens, it is known before the forward pass, so the tables can live in host memory and be prefetched asynchronously. That is also why the layer sits at layer 2: the prefetch overlaps with layer 1’s compute. The tables train with Adam without weight decay.

In the placement ablation (Table 7, fixed parameter budget) no depth dominated and splitting across two layers gave no consistent gain. A single layer at layer 2 had the best average, 47.94 (no n-gram: 45.44).

→ Go deeper: Both ends of the model — n-gram embeddings (including DeepSeek’s Engram) compared.

Data

The report hardly covers data. What can be gleaned:

  • Training tokens are about 1/3 of the previous 397B-A17B’s (absolute number not given). FLOPs about 1/9.
  • QSA CPT on 256K sequences: about 2B tokens (indexer warm-up) + about 200B tokens (sparse training).
  • The n-gram ablations train at 300 tokens per active parameter (TPP). The base vocabulary is Qwen3.5’s 250K, and n-gram vocabularies of 20–200× that were tested (Tables 8–9). The released model has 20M slots (model card).
  • Post-training data and methods are not covered; only post-trained results appear in the model card.

Training

Optimizer: where and how Muon is used

Muon (Jordan et al. 2024) orthogonalises the momentum of a matrix parameter and uses it as the update. Instead of an SVD, a Newton–Schulz (NS) polynomial iteration X←aX+b(XX⊤)X+c(XX⊤)2XX\leftarrow aX+b(XX^\top)X+c(XX^\top)^2X pushes all singular values towards 1.

Mt=μMt−1+∇WL,ΔW=−η⋅0.2max⁡(A,B)⋅NS⁡k(Nesterov(Mt)/∥⋅∥F)M_t=\mu M_{t-1}+\nabla_W\mathcal{L},\qquad \Delta W=-\eta\cdot 0.2\sqrt{\max(A,B)}\cdot\operatorname{NS}_k\big(\text{Nesterov}(M_t)/\|\cdot\|_F\big)

μ=0.95\mu=0.95; the scale 0.2max⁡(A,B)0.2\sqrt{\max(A,B)} for an A×BA\times B matrix makes the update RMS independent of the matrix shape (at AdamW’s level) (Liu et al. 2025). NS uses the per-step Polar Express coefficients for 8 steps (more accurate than fewer, and it reduced gradient-norm spikes in the stress test), with ϵ=10−14\epsilon=10^{-14} in the Frobenius normalisation.

Where it is used. Attention q/k/v/o, GDN input and output projections, routed and shared experts’ fc1/fc2 and the key/value projections of the n-gram layer use Muon. AdamW covers the input embeddings, the output head, the MoE router (Muon amplified early fluctuations and destabilised the router; each output dimension is one expert, so there is no shared linear structure), GR’s low-rank projections (very elongated shapes), the attention and GDN output gates, and GDN’s α,β\alpha,\beta projections (one scalar per head, i.e. vectors).

Fused parameters are split. Megatron stores qkv, the SwiGLU fc1 and the GDN input projection as single concatenated matrices. Orthogonalising them whole mixes singular directions across unrelated blocks and computes the scale γ(A,B)\gamma(A,B) from the concatenated shape. So the gradient is split per head (qkv, GDN input) or into gate/up halves (fc1) and NS is run on each piece separately. Per-head splitting improved both loss and benchmarks.

→ Go deeper: the derivations behind Muon and Newton–Schulz are in Muon and orthogonalised optimisers.

추론 비용. 넓힌 stream의 비용은 메모리 traffic이다. 두 가지를 시도했다. (1) 학습된 모델에서 쓰기가 보통 두 branch에 몰리는 것을 보고 상위 2개 branch만 읽게 했더니 사전학습 손실·벤치마크는 거의 그대로였지만 사후학습 뒤 품질이 분명히 나빠져 버렸다. (2) GR, gated attention, GDN의 gate들이 residual에 쓰이는 값의 크기를 제한하므로 residual을 FP8로 저장해도 품질 손실이 거의 없었고, BF16 대비 이동 바이트가 절반이 됐다. 읽기와 쓰기는 각각 커널 하나로 융합했다.

4. N-gram 임베딩

각 토큰 위치에서 끝나는 짧은 n-gram(bigram, trigram)을 키로 해시 테이블에서 벡터를 찾아 residual에 더한다. multi-head hashing으로 찾고, contextual gating(Cheng et al. 2026)으로 주입한다. 주소가 입력 토큰만으로 결정되므로 forward 전에 미리 알 수 있고, 그래서 테이블을 호스트 메모리에 두고 비동기로 prefetch할 수 있다. 층 2에 두는 이유도 이것이다. 층 1의 계산과 prefetch가 겹친다. 테이블은 weight decay 없는 Adam으로 학습한다.

배치 ablation(Table 7, 파라미터 예산 고정)에서 어느 깊이도 압도적이지 않았고, 두 층에 나눠도 일관된 이득이 없었다. 층 2 단일 배치가 평균 47.94로 가장 높았다(n-gram 없음 45.44).

→ 더 깊이: 모델의 양 끝 — n-gram 임베딩(DeepSeek의 Engram 포함)을 비교한다.

데이터

이 보고서는 데이터를 거의 다루지 않는다. 알 수 있는 것은 이 정도다.

  • 학습 토큰은 직전 397B-A17B의 약 1/3(절대량 비공개). FLOPs는 약 1/9.
  • QSA CPT: 256K 시퀀스로 약 2B 토큰(indexer warm-up) + 약 200B 토큰(sparse 학습).
  • n-gram ablation은 활성 파라미터당 300 토큰(TPP)으로 학습했다. base 어휘는 Qwen3.5의 250K이고, n-gram 어휘는 그 20–200배를 실험했다(Table 8–9). 배포 모델은 2천만 슬롯이다(model card).
  • 사후학습 데이터·방법은 다루지 않는다. model card에 사후학습 모델의 결과만 있다.

학습

Optimizer: Muon을 어디에, 어떻게

Muon(Jordan et al. 2024)은 행렬 파라미터의 momentum을 직교화해 update로 쓴다. 특이값분해 대신 Newton–Schulz(NS) 다항식 반복 X←aX+b(XX⊤)X+c(XX⊤)2XX\leftarrow aX+b(XX^\top)X+c(XX^\top)^2X로 모든 특이값을 1 근처로 민다.

Mt=μMt−1+∇WL,ΔW=−η⋅0.2max⁡(A,B)⋅NS⁡k(Nesterov(Mt)/∥⋅∥F)M_t=\mu M_{t-1}+\nabla_W\mathcal{L},\qquad \Delta W=-\eta\cdot 0.2\sqrt{\max(A,B)}\cdot\operatorname{NS}_k\big(\text{Nesterov}(M_t)/\|\cdot\|_F\big)

μ=0.95\mu=0.95, A×BA\times B 행렬의 스케일 0.2max⁡(A,B)0.2\sqrt{\max(A,B)}는 update RMS를 행렬 모양과 무관하게(AdamW 수준으로) 맞추는 규칙이다(Liu et al. 2025). NS는 Polar Express의 step별 계수로 8 step(적은 step보다 정확하고 stress test에서 gradient norm spike를 줄였다), Frobenius 정규화의 ϵ=10−14\epsilon=10^{-14}.

어디에 쓰나. attention q/k/v/o, GDN 입출력 투영, routed·shared expert의 fc1/fc2, n-gram 층의 key/value 투영이 Muon이다. 입력 임베딩, 출력 head, MoE router(Muon이 초기 요동을 키워 router를 불안정하게 했다; 출력 차원마다 expert 하나라 공유된 선형 구조가 없다), GR의 저랭크 투영(아주 길쭉한 모양), attention·GDN 출력 gate, GDN의 α,β\alpha,\beta 투영(head당 스칼라, 즉 벡터)은 AdamW다.

fused 파라미터는 쪼갠다. Megatron은 qkv, SwiGLU fc1, GDN 입력 투영을 한 행렬로 이어 붙여 저장한다. 이것을 통째로 직교화하면 서로 무관한 블록 사이의 특이 방향이 섞이고, 스케일 γ(A,B)\gamma(A,B)도 이어 붙인 모양으로 계산된다. 그래서 기울기를 head 단위(qkv, GDN 입력) 또는 gate/up 반쪽(fc1)으로 쪼개 따로 NS를 돌린다. head 단위 분할은 손실과 벤치마크를 모두 개선했다.

→ 더 깊이: Muon과 Newton–Schulz의 유도는 Muon과 직교화 옵티마이저에 있다.

fused에서 k 블록 update RMSk-block update RMS, fused – split에서 k 블록 update RMSk-block update RMS, split –
Left: Muon divides the momentum matrix by its Frobenius norm, then a polynomial iteration pushes every singular value towards 1 (orthogonalisation). The grey band is the small-value region where singular values typically sit after normalisation. Increase k from 1: the quintic coefficients lift even small singular values within a few steps but do not converge exactly to 1, staying roughly within 0.68–1.13; the classic cubic is exact but slow. The report uses Polar Express coefficients, minimax-optimal for a given number of steps, for 8 steps (shown here with Muon's original coefficients instead). Right: orthogonalising different operators concatenated into one matrix, like attention's qkv projection, squeezes the update of the small-gradient block (k) under the large one (v). Shrink the k gradient: fused, k's update goes almost to zero, while split gives every block an update of the same size. 왼쪽: Muon은 momentum 행렬을 Frobenius norm으로 나눈 뒤 다항식 반복으로 모든 특이값을 1 근처로 민다(직교화). 회색 띠는 정규화 뒤 특이값이 흔히 놓이는 작은 값 영역이다. k를 1에서 늘려 보면 5차 계수는 몇 번 만에 작은 특이값까지 끌어올리지만 1로 정확히 수렴하지 않고 약 0.68–1.13 사이에 머물고, 3차 고전 계수는 정확하지만 느리다. 보고서는 같은 step 수에서 minimax 최적인 Polar Express 계수를 8 step 쓴다(여기서는 그 계수 대신 Muon 원 계수를 보인다). 오른쪽: attention의 qkv 투영처럼 한 행렬에 이어 붙인 서로 다른 연산자를 통째로 직교화하면, 기울기가 작은 블록(k)의 update가 큰 블록(v)에 눌려 작아진다. k 기울기 크기를 줄여 보면 fused에서는 k의 update가 거의 0이 되지만, split은 블록마다 같은 크기의 update를 준다.

Implementation. NS needs the whole matrix, which clashes with TP (weights are sharded), and its cost is cubic in the shorter side, so DP’s equal-element partition creates stragglers. A partitioner called Canzona reassigns whole parameters to DP ranks so that NS cost is balanced, and the hundred-odd small kernels per layer created by splitting are captured in a CUDA graph.

Refitting the hyperparameter scaling law

With the new structure and Muon making training more stable, the optimal hyperparameters were bound to move. Refitting the LR and batch scaling law used for Qwen3.5 predicted larger batches and learning rates, with learning rate falling more slowly as models grow. Each prediction was checked separately in the regime where it is most sensitive.

  • Batch (small model, many tokens). 20-layer 10.8B-A0.89B MoE, 4T tokens. Previous recipe BB = 12.6M, prediction 25.2M, 1.5× = 37.7M. Mean loss over the last 20B tokens 1.5774 / 1.5702 / 1.5707. Below the prediction loss rises steeply; above it, it stays flat.
  • No batch warmup needed. A ramp from 6.3M in steps of 6.3M to 25.2M at 524B tokens ended 2.5×10−42.5\times10^{-4} and 3.5×10−43.5\times10^{-4} worse than using 25.2M from the start, and took 18.8% more optimizer steps. The rationale: Muon keeps data efficiency at large batch, and in an MoE a large batch gives every expert enough tokens.
  • Learning rate (large model, few tokens). 48-layer 156B-A7B MoE, 419B tokens. The four settings around the predicted optimum (BB = 8.4M, η=1.76×10−3\eta=1.76\times10^{-3}) end within 7×10−47\times10^{-4} of each other (a flat bowl), while the old Qwen3.5 recipe (BB = 4.2M, η=6.8×10−4\eta=6.8\times10^{-4}) ends 7.8×10−37.8\times10^{-3} higher.
Setting (156B-A7B, 419B tokens)BBη\etaMMLUMMLU-ProMATHGSM8KBBHAvg (7)
New fit, predicted optimum8.4M1.76e-373.8448.3549.9880.8973.2560.55
η÷2\eta\div\sqrt28.4M1.24e-373.5947.0048.9277.4872.0059.14
η×2\eta\times\sqrt28.4M2.49e-373.8446.9249.5880.0673.8260.10
B×1.25B\times1.2510.5M2.01e-373.7348.5149.3280.0672.5860.06
Qwen3.5 recipe4.2M6.8e-471.2345.3545.5474.3269.5456.41
Report Table 10 (SuperGPQA and MMMLU columns omitted; the average is the original 7-benchmark average).

Stability stress test

To reproduce large-scale instabilities in a small model, the learning rate was held (no decay) at 2× and 4× the optimum on a 28-layer 25B-A3B MoE (clip 0.5). The criterion: be no less stable than the Qwen3.5 structure with AdamW, which had already been scaled successfully.

Conditionloss spikes / 10k stepsclip-threshold crossings
2× LR: Qwen3.5 + AdamW4.3
2× LR: Muon (with or without GR)0.2
4× LR: Qwen3.5 + AdamW183213 of 19,932 steps
4× LR: Muon0
4× LR: Muon + GR00
3× LR, AdamW, GatedNorm off → on32.0 → 3.2256 → 20
Report §3.3. Blank cells: not given in the report.

The single-variable comparison that toggles only the gate is the key one. Without the gate, raising the learning rate grows activation outliers almost proportionally, and spikes grow much faster. The report’s reading: at high learning rates something must rescale magnitudes; without an explicit gate the network does it by growing activation outliers, which is fragile, while a multiplicative gate supplies the rescaling directly. It is the same story as the attention sink in the previous lesson.

It was also confirmed at the production setting (the first 276B tokens). Adding GR to the Qwen3.5 structure + Muon lowered loss by 0.026, and the full Flash-Next recipe by a further 0.032, 0.058 in total. Median / p99.9 pre-clip gradient norms were 0.097/0.298 for Muon alone, 0.053/0.071 with GR and 0.043/0.066 for Flash-Next, and only Muon alone crossed the clip threshold. The full run finished with no loss spike or gradient-norm anomaly, without qk-clip or SwiGLU-clip.

Post-training. Not in the report. RL algorithm, rewards and data are all undisclosed, so this lesson does not cover them.

Core methods in depth

1. The QSA indexer, by hand

NumPy QSA indexer: block compression, ReLU scores, top-K, recall and cost
import numpy as np
rng = np.random.default_rng(0)
n, d, H = 4096, 32, 4                  # context length, head dim, indexer query heads

# toy context: mostly irrelevant tokens + a few short "relevant spans"
K = rng.normal(size=(n, d))
q_true = rng.normal(size=d); q_true /= np.linalg.norm(q_true)
spans = rng.choice(n // 8 - 1, 12, replace=False) * 8 + rng.integers(0, 8, 12)
for s in spans:
    K[s:s + 3] += 3.0 * q_true         # keys of relevant tokens lean towards the query
logits = K @ q_true * 1.5
att = np.exp(logits - logits.max()); att /= att.sum()      # true (dense) attention a_i

# indexer: H query heads sharing one key (MQA); imitated here by noisy heads around q_true
Qh = q_true + 0.5 * rng.normal(size=(H, d))

def qsa_select(r, K_budget):
    """The query sits right after the context. Only complete blocks are scored; the tail block is always kept."""
    nb = n // r
    kc = K[:nb * r].reshape(nb, r, d).mean(1)               # Eq. 13: compress keys by block mean
    I = np.maximum(Qh @ kc.T, 0).sum(0)                     # Eq. 15: sum of per-head ReLU scores
    tail_start = r * (n // r)
    KB = int(np.ceil(K_budget / r))                         # Eq. 16: block budget
    top = np.argsort(-I)[:KB]
    idx = (top[:, None] * r + np.arange(r)[None, :]).ravel()[:K_budget]
    return np.union1d(idx, np.arange(tail_start, n)), nb

print(f"n={n}, token budget K=256  (share of dense attention mass covered by selected tokens)")
print(f"{'r':>3} | {'recall':>6} | indexer scoring cost (vs dense)")
for r in [1, 4, 16, 64]:
    sel, nb = qsa_select(r, 256)
    print(f"{r:>3} | {att[sel].sum():6.3f} | {nb / n:.4f}  ({nb} block scores per query)")
 

At r=4r=4 recall barely drops while indexer scores shrink to 1/4; when blocks become much larger than the relevant spans (r=64r=64, a 256-token budget = 4 blocks) it collapses. The report’s block-size ablation (Figure 5a) has the same shape: QSA matched the full-attention RULER score at a relative indexer latency of 0.25, while IndexShare, which shares indices across adjacent full-attention layers, stayed below it even at 0.5. In the hybrid, three GDN layers sit between full-attention layers, so cross-layer similarity is low.

PyTorch PyTorch: QSA indexer and dense distillation loss (Eq. 12–18, reference) 로컬에서 실행run locally (pip install torch)
import torch, torch.nn as nn, torch.nn.functional as F

def rope(x, pos, dim):
    """RoPE on the first dim dimensions only (partial RoPE); which dims varies by implementation."""
    half = dim // 2
    freqs = 1.0 / (10000 ** (torch.arange(half, device=x.device) / half))
    ang = pos[:, None].float() * freqs[None, :]                     # (n, half)
    cos, sin = ang.cos(), ang.sin()
    while cos.dim() < x.dim() - 1:                                  # x: (B, n, [H,] D) -> cos: (n, [1,] half)
        cos, sin = cos.unsqueeze(-2), sin.unsqueeze(-2)
    x1, x2 = x[..., :half], x[..., half:dim]
    return torch.cat([x1 * cos - x2 * sin, x1 * sin + x2 * cos, x[..., dim:]], -1)

class QSAIndexer(nn.Module):
    def __init__(self, d, H=4, dh=128, r=4, rope_dim=64):
        super().__init__()
        self.H, self.dh, self.r, self.rd = H, dh, r, rope_dim
        self.wq = nn.Linear(d, H * dh, bias=False)
        self.wk = nn.Linear(d, dh, bias=False)                     # MQA: one shared key head
        self.qn, self.kn = nn.RMSNorm(dh), nn.RMSNorm(dh)

    def forward(self, x):                                           # x: (B, n, d)
        B, n, _ = x.shape
        nb = n // self.r
        q = self.qn(self.wq(x).view(B, n, self.H, self.dh))         # Eq. 12
        k = self.wk(x)[:, : nb * self.r].view(B, nb, self.r, self.dh)
        kc = self.kn(k.mean(2))                                     # Eq. 13: compress → normalise
        pos_q = torch.arange(n, device=x.device)
        pos_b = torch.arange(nb, device=x.device) * self.r
        q, kc = rope(q, pos_q, self.rd), rope(kc, pos_b, self.rd)   # Eq. 14: position after compression
        I = F.relu(torch.einsum('bihd,bjd->bhij', q, kc)).sum(1)   # Eq. 15: (B, n, nb)
        full = (pos_b[None, :] + self.r - 1) <= pos_q[:, None]       # fully observed blocks only
        return I.masked_fill(~full, float('-inf')), full

def indexer_distill_loss(I, full, teacher_probs, r):
    """teacher_probs: (B, n, n) token distribution a_i = sum of all heads' softmax, L1-normalised."""
    B, n, _ = teacher_probs.shape
    nb = I.shape[-1]
    a_bar = teacher_probs[..., : nb * r].view(B, n, nb, r).amax(-1)  # Eq. 17: max pooling
    a_bar = a_bar.masked_fill(~full, 0)
    a_hat = a_bar / a_bar.sum(-1, keepdim=True).clamp_min(1e-12)
    logp = torch.log_softmax(I.masked_fill(~full, -1e9), -1)
    kl = (a_hat * (a_hat.clamp_min(1e-12).log() - logp)).sum(-1)   # Eq. 18
    has = full.any(-1).expand(B, n)                                  # queries with at least one block
    return kl[has].mean()

# warm-up: backbone frozen, train only the indexer (report: 1,000 steps, lr 1e-3, 8 × 256K sequences/step)
# sparse stage: core attention on the top-⌈K/r⌉ blocks + tail; KL on the selected blocks, renormalised (Eq. 20)
 

2. Checking the Gated Residual decomposition

The report verified that GR’s decomposition (Eq. 35–37) is exact: “each reader’s shares sum to one within 3×10−83\times10^{-8}”. Below we implement GR’s read and write as written and check that a block input xx is reconstructed exactly, as a vector, from the embedding’s share plus each block’s share.

NumPy Gated Residual: read (Eq. 30–32), write (Eq. 33–34), contribution decomposition (Eq. 35–37)
import numpy as np
rng = np.random.default_rng(1)
d, nr, L = 16, 4, 6                         # hidden, branches, blocks
rank = d // 4

def rms(x):
    return np.sqrt((x ** 2).mean(-1, keepdims=True) + 1e-12)

sig = lambda z: 1 / (1 + np.exp(-z))
silu = lambda z: z * sig(z)
blocks = [dict(gamma=1 + 0.1 * rng.normal(size=(nr, d)),
               Wd=rng.normal(size=(rank, nr * d)) / np.sqrt(nr * d),
               Wu=rng.normal(size=(nr * d, rank)) / np.sqrt(rank),
               Ww=rng.normal(size=(nr, nr * d)) / np.sqrt(nr * d),
               F=rng.normal(size=(d, d)) / np.sqrt(d)) for _ in range(L)]

def gr_read(R, b):
    Rh = R / rms(R) * b["gamma"]                                         # Eq. 30: per-branch RMSNorm
    G = sig(b["Wu"] @ silu(b["Wd"] @ Rh.ravel() / nr)).reshape(nr, d)   # Eq. 31: elementwise gate
    x = (G * Rh).mean(0)                                                 # Eq. 32: gate, then average
    s = 2 * sig(b["Ww"] @ Rh.ravel() / nr)                               # Eq. 33: per-branch write scalar
    return x, s, G

emb = rng.normal(size=d)
R = np.tile(emb, (nr, 1))                     # every branch starts from the embedding
writes = []                                   # (block u, write scalars s^(u), output y^(u))
for v, b in enumerate(blocks):
    x, s, G = gr_read(R, b)
    # decomposition: block v's input x = Σ_u a_{u→v} + (embedding share)   (Eq. 35–36)
    scale = G * b["gamma"] / rms(R) / nr      # (nr, d): read coefficient of branch c
    parts = [(scale * su[:, None] * yu[None, :]).sum(0) for (_, su, yu) in writes]
    emb_part = (scale * emb[None, :]).sum(0)
    recon = emb_part + sum(parts) if parts else emb_part
    shares = np.array([np.linalg.norm(p) for p in parts])
    if v >= 1:
        pi = shares / (shares.sum() + np.linalg.norm(emb_part))
        print(f"block {v}: reconstruction error {np.abs(recon - x).max():.1e}  π(u→v) = {np.round(pi, 3)}")
    y = np.tanh(b["F"] @ x)                   # block body F (a small MLP stand-in)
    R = R + s[:, None] * y[None, :]           # Eq. 34: add s_c y to every branch
    writes.append((v, s, y))
 

With random weights the shares spread evenly over earlier blocks. In a trained model one branch becomes a long-range path because the write scalars ss and read gates GG are learned to pick such a route; the toy in the figure above sets that state by hand.

3. Muon: fused vs split

NumPy Newton–Schulz orthogonalisation: [W_q; W_k; W_v] whole vs split
import numpy as np
rng = np.random.default_rng(2)
def newton_schulz(G, steps=5, a=3.4445, b=-4.7750, c=2.0315):
    """Muon's quintic NS iteration (coefficients of Jordan et al. 2024). Pushes singular values towards 1."""
    X = G / (np.linalg.norm(G) + 1e-14)
    tr = X.shape[0] > X.shape[1]
    if tr: X = X.T
    for _ in range(steps):
        A = X @ X.T
        X = a * X + (b * A + c * A @ A) @ X
    return X.T if tr else X

def muon_update(G, steps=8):
    A_, B_ = G.shape
    return 0.2 * np.sqrt(max(A_, B_)) * newton_schulz(G, steps)   # shape-independent update RMS

dm = 64
Gq, Gk, Gv = (s * rng.normal(size=(dm, dm)) @ np.diag(rng.uniform(0.1, 1, dm)) for s in (1.0, 0.1, 3.0))
fused = muon_update(np.vstack([Gq, Gk, Gv]))                  # [W_q; W_k; W_v] as one matrix
split = [muon_update(g) for g in (Gq, Gk, Gv)]
r = lambda M: np.sqrt((M ** 2).mean())
print("update RMS      q       k       v")
print("fused NS     ", "  ".join(f"{r(fused[i*dm:(i+1)*dm]):.4f}" for i in range(3)))
print("split NS     ", "  ".join(f"{r(u):.4f}" for u in split))
sv = np.linalg.svd(split[1], compute_uv=False)
print(f"singular values of the split k-block update in [{sv.min():.3f}, {sv.max():.3f}]  (clustered near 0.2·√64 = 1.6)")
 

Fused, the update RMS of WkW_k, whose gradient is small, is crushed to under 1/10 of the other blocks’. Orthogonalisation evens out the singular values of the whole matrix, so in a concatenated matrix the large blocks take over the singular directions. Split gives each block an update of RMS about 0.2 — the reason per-head splitting improved both loss and benchmarks in the report.

확인 문제Check yourself

Why does Qwen3.8-Flash-Next use AdamW rather than Muon for the MoE router, according to the report?

Report §3.1: Muon amplified the router’s early-training fluctuations, and applying it mid-to-late training was not unstable but gave no meaningful gain. The explanation offered: one output dimension is one expert’s score, the dimensions are largely independent, and orthogonalisation has no structure to exploit. The parameters excluded for being 1-D are GDN’s α and β projections.

Results

Base models

구현. NS는 행렬 전체가 필요해 TP(가중치를 쪼개 가짐)와 충돌하고, 비용이 짧은 변의 세제곱이라 원소 수로 균등 분할하는 DP에서 straggler가 생긴다. Canzona라는 분할기로 파라미터를 통째로 DP rank에 NS 비용이 같도록 재배정하고, 쪼갠 뒤 생기는 층당 백여 개의 작은 커널은 CUDA graph로 묶었다.

Hyperparameter scaling law를 다시 맞추다

새 구조와 Muon이 함께 학습을 더 안정적으로 만들었으니 최적 하이퍼파라미터가 움직였을 것이다. Qwen3.5 때 쓰던 LR·배치 scaling law를 다시 맞추자 더 큰 배치와 학습률, 모델이 커질 때 학습률이 더 천천히 줄어드는 예측이 나왔다. 두 예측을 각자 가장 민감한 조건에서 따로 검증했다.

  • 배치(작은 모델, 많은 토큰). 20층 10.8B-A0.89B MoE, 4T 토큰. 이전 레시피 BB=12.6M, 예측 25.2M, 1.5배 37.7M. 마지막 20B 토큰 평균 손실 1.5774 / 1.5702 / 1.5707. 예측보다 작으면 손실이 가파르게 오르고 크면 평평하다.
  • 배치 warmup 불필요. 6.3M에서 6.3M씩 늘려 524B 토큰에 25.2M에 도달하는 ramp는 처음부터 25.2M인 것보다 2.5×10−42.5\times10^{-4}, 3.5×10−43.5\times10^{-4} 나빴고 optimizer step은 18.8% 더 들었다. Muon은 큰 배치에서도 data efficiency를 유지하고, MoE에서는 큰 배치가 expert마다 충분한 토큰을 준다는 것이 근거다.
  • 학습률(큰 모델, 적은 토큰). 48층 156B-A7B MoE, 419B 토큰. 예측 최적(BB=8.4M, η=1.76×10−3\eta=1.76\times10^{-3}) 주변 네 설정은 손실이 7×10−47\times10^{-4} 안에 모이고(평평한 그릇), 이전 Qwen3.5 레시피(BB=4.2M, η=6.8×10−4\eta=6.8\times10^{-4})는 7.8×10−37.8\times10^{-3} 높았다.
설정 (156B-A7B, 419B 토큰)BBη\etaMMLUMMLU-ProMATHGSM8KBBH평균(7개)
새 fit, 예측 최적8.4M1.76e-373.8448.3549.9880.8973.2560.55
η÷2\eta\div\sqrt28.4M1.24e-373.5947.0048.9277.4872.0059.14
η×2\eta\times\sqrt28.4M2.49e-373.8446.9249.5880.0673.8260.10
B×1.25B\times1.2510.5M2.01e-373.7348.5149.3280.0672.5860.06
Qwen3.5 레시피4.2M6.8e-471.2345.3545.5474.3269.5456.41
보고서 Table 10 (SuperGPQA, MMMLU 열은 생략, 평균은 원표의 7개 평균).

Stability stress test

작은 모델에서 대규모 불안정성을 재현하려고 학습률을 최적값의 2×, 4×로 고정(감쇠 없음)하고 28층 25B-A3B MoE를 돌렸다(clip 0.5). 기준은 “이미 대규모로 검증된 Qwen3.5 구조 + AdamW보다 덜 불안정할 것”이다.

조건loss spike / 10k stepclip 임계 초과
2× LR: Qwen3.5 + AdamW4.3
2× LR: Muon (GR 유무 모두)0.2
4× LR: Qwen3.5 + AdamW18319,932 step 중 213
4× LR: Muon0
4× LR: Muon + GR00
3× LR, AdamW, GatedNorm 끔 → 켬32.0 → 3.2256 → 20
보고서 §3.3. 빈칸은 보고서가 해당 수치를 주지 않은 곳.

gate만 켰다 끈 단일 변수 비교가 핵심이다. gate가 없는 모델에서 학습률을 올리면 activation outlier가 거의 비례해서 커지고 spike는 그보다 훨씬 빨리 늘었다. 보고서의 해석은 이렇다. 높은 학습률에서는 무언가 값의 크기를 다시 맞추는(rescaling) 장치가 필요한데, 명시적 gate가 없으면 네트워크가 activation outlier를 키워서 그 일을 하고, 그것이 취약하다. 곱셈 gate가 그 rescaling을 직접 공급한다. 이전 레슨의 attention sink와 같은 이야기다.

실제 학습 설정(첫 276B 토큰)에서도 확인했다. Qwen3.5 구조 + Muon에 GR을 더하면 손실이 0.026, 완전한 Flash-Next 레시피가 0.032 더 내려가 합계 0.058이었다. pre-clip gradient norm의 중앙값/p99.9는 Muon 단독 0.097/0.298, GR 추가 0.053/0.071, Flash-Next 0.043/0.066이고, Muon 단독만 clip 임계를 넘었다. 전체 학습은 loss spike나 gradient norm 이상 없이 끝났고 qk-clip이나 SwiGLU-clip을 쓰지 않았다.

사후학습. 보고서에는 없다. RL 알고리즘·보상·데이터 모두 비공개이므로 이 레슨에서는 다루지 않는다.

핵심 method 깊게 보기

1. QSA indexer를 직접

NumPy QSA indexer: 블록 압축, ReLU 점수, top-K, recall과 비용
import numpy as np
rng = np.random.default_rng(0)
n, d, H = 4096, 32, 4                  # 문맥 길이, head 차원, indexer query head 수

# 장난감 문맥: 대부분 무관한 토큰 + 몇 개의 짧은 "관련 구간"
K = rng.normal(size=(n, d))
q_true = rng.normal(size=d); q_true /= np.linalg.norm(q_true)
spans = rng.choice(n // 8 - 1, 12, replace=False) * 8 + rng.integers(0, 8, 12)
for s in spans:
    K[s:s + 3] += 3.0 * q_true         # 관련 토큰의 key는 query 방향으로 치우쳐 있다
logits = K @ q_true * 1.5
att = np.exp(logits - logits.max()); att /= att.sum()      # 진짜(dense) attention 분포 a_i

# indexer: H개 query head, 공유 key 하나 (MQA). 여기서는 q_true 근처의 잡음 섞인 head로 흉내 낸다
Qh = q_true + 0.5 * rng.normal(size=(H, d))

def qsa_select(r, K_budget):
    """query는 문맥 끝 바로 다음 위치. 완전한 블록만 채점하고 미완성 블록(tail)은 항상 포함."""
    nb = n // r
    kc = K[:nb * r].reshape(nb, r, d).mean(1)               # Eq. 13: 블록 평균으로 key 압축
    I = np.maximum(Qh @ kc.T, 0).sum(0)                     # Eq. 15: head별 ReLU 점수의 합
    tail_start = r * (n // r)
    KB = int(np.ceil(K_budget / r))                         # Eq. 16: 블록 예산
    top = np.argsort(-I)[:KB]
    idx = (top[:, None] * r + np.arange(r)[None, :]).ravel()[:K_budget]
    return np.union1d(idx, np.arange(tail_start, n)), nb

print(f"n={n}, 토큰 예산 K=256  (dense attention 질량 중 선택된 토큰이 덮는 비율)")
print(f"{'r':>3} | {'recall':>6} | indexer 점수 계산량 (dense 대비)")
for r in [1, 4, 16, 64]:
    sel, nb = qsa_select(r, 256)
    print(f"{r:>3} | {att[sel].sum():6.3f} | {nb / n:.4f}  (query 하나당 {nb}개 블록 점수)")
 

r=4r=4에서는 recall을 거의 잃지 않으면서 indexer 점수가 1/4로 줄고, 블록이 관련 구간보다 훨씬 커지면(r=64r=64, 예산 256토큰 = 블록 4개) 무너진다. 보고서의 블록 크기 ablation(Figure 5a)도 같은 모양이다. QSA는 상대 indexer 지연 0.25에서 full attention RULER 점수와 같았고, 인접 full attention 층끼리 인덱스를 공유하는 IndexShare는 0.5에서도 미치지 못했다. 하이브리드에서는 full attention 층 사이에 GDN이 3개 끼어 있어 층 간 유사도가 낮기 때문이다.

PyTorch PyTorch: QSA indexer와 dense 증류 손실 (Eq. 12–18, 참고용) 로컬에서 실행run locally (pip install torch)
import torch, torch.nn as nn, torch.nn.functional as F

def rope(x, pos, dim):
    """앞쪽 dim 차원에만 RoPE (partial RoPE). 어느 차원에 거는지는 구현마다 다르다."""
    half = dim // 2
    freqs = 1.0 / (10000 ** (torch.arange(half, device=x.device) / half))
    ang = pos[:, None].float() * freqs[None, :]                     # (n, half)
    cos, sin = ang.cos(), ang.sin()
    while cos.dim() < x.dim() - 1:                                  # x: (B, n, [H,] D) -> cos: (n, [1,] half)
        cos, sin = cos.unsqueeze(-2), sin.unsqueeze(-2)
    x1, x2 = x[..., :half], x[..., half:dim]
    return torch.cat([x1 * cos - x2 * sin, x1 * sin + x2 * cos, x[..., dim:]], -1)

class QSAIndexer(nn.Module):
    def __init__(self, d, H=4, dh=128, r=4, rope_dim=64):
        super().__init__()
        self.H, self.dh, self.r, self.rd = H, dh, r, rope_dim
        self.wq = nn.Linear(d, H * dh, bias=False)
        self.wk = nn.Linear(d, dh, bias=False)                     # MQA: key head 하나 공유
        self.qn, self.kn = nn.RMSNorm(dh), nn.RMSNorm(dh)

    def forward(self, x):                                           # x: (B, n, d)
        B, n, _ = x.shape
        nb = n // self.r
        q = self.qn(self.wq(x).view(B, n, self.H, self.dh))         # Eq. 12
        k = self.wk(x)[:, : nb * self.r].view(B, nb, self.r, self.dh)
        kc = self.kn(k.mean(2))                                     # Eq. 13: 압축 → 정규화
        pos_q = torch.arange(n, device=x.device)
        pos_b = torch.arange(nb, device=x.device) * self.r
        q, kc = rope(q, pos_q, self.rd), rope(kc, pos_b, self.rd)   # Eq. 14: 압축 뒤에 위치
        I = F.relu(torch.einsum('bihd,bjd->bhij', q, kc)).sum(1)   # Eq. 15: (B, n, nb)
        full = (pos_b[None, :] + self.r - 1) <= pos_q[:, None]       # 완전히 관찰된 블록만
        return I.masked_fill(~full, float('-inf')), full

def indexer_distill_loss(I, full, teacher_probs, r):
    """teacher_probs: (B, n, n) 모든 head의 softmax 합을 L1 정규화한 토큰 분포 a_i."""
    B, n, _ = teacher_probs.shape
    nb = I.shape[-1]
    a_bar = teacher_probs[..., : nb * r].view(B, n, nb, r).amax(-1)  # Eq. 17: max pooling
    a_bar = a_bar.masked_fill(~full, 0)
    a_hat = a_bar / a_bar.sum(-1, keepdim=True).clamp_min(1e-12)
    logp = torch.log_softmax(I.masked_fill(~full, -1e9), -1)
    kl = (a_hat * (a_hat.clamp_min(1e-12).log() - logp)).sum(-1)   # Eq. 18
    has = full.any(-1).expand(B, n)                                  # 블록이 하나라도 있는 query
    return kl[has].mean()

# warm-up: backbone은 고정, indexer만 학습 (보고서: 1,000 step, lr 1e-3, 256K × 8 시퀀스/step)
# sparse 단계: top-⌈K/r⌉ 블록 + tail로 core attention, KL은 선택 블록 위에서 재정규화해 계산 (Eq. 20)
 

2. Gated Residual의 분해를 검산하기

보고서는 GR의 분해(Eq. 35–37)가 정확하다는 것을 “각 reader의 몫의 합이 3×10−83\times10^{-8} 안에서 1”로 확인했다. 아래는 GR의 읽기·쓰기를 그대로 구현하고, block 입력 xx가 임베딩 몫과 각 block 몫의 합으로 벡터로서 정확히 재구성되는지 본다.

NumPy Gated Residual: 읽기(Eq. 30–32), 쓰기(Eq. 33–34), 기여 분해(Eq. 35–37)
import numpy as np
rng = np.random.default_rng(1)
d, nr, L = 16, 4, 6                         # hidden, branch 수, block 수
rank = d // 4

def rms(x):
    return np.sqrt((x ** 2).mean(-1, keepdims=True) + 1e-12)

sig = lambda z: 1 / (1 + np.exp(-z))
silu = lambda z: z * sig(z)
blocks = [dict(gamma=1 + 0.1 * rng.normal(size=(nr, d)),
               Wd=rng.normal(size=(rank, nr * d)) / np.sqrt(nr * d),
               Wu=rng.normal(size=(nr * d, rank)) / np.sqrt(rank),
               Ww=rng.normal(size=(nr, nr * d)) / np.sqrt(nr * d),
               F=rng.normal(size=(d, d)) / np.sqrt(d)) for _ in range(L)]

def gr_read(R, b):
    Rh = R / rms(R) * b["gamma"]                                         # Eq. 30: branch별 RMSNorm
    G = sig(b["Wu"] @ silu(b["Wd"] @ Rh.ravel() / nr)).reshape(nr, d)   # Eq. 31: 원소별 gate
    x = (G * Rh).mean(0)                                                 # Eq. 32: gate 곱해 평균
    s = 2 * sig(b["Ww"] @ Rh.ravel() / nr)                               # Eq. 33: branch별 쓰기 스칼라
    return x, s, G

emb = rng.normal(size=d)
R = np.tile(emb, (nr, 1))                     # 모든 branch를 임베딩으로 시작
writes = []                                   # (block u, 쓰기 스칼라 s^(u), 출력 y^(u))
for v, b in enumerate(blocks):
    x, s, G = gr_read(R, b)
    # 분해: block v의 입력 x = Σ_u a_{u→v} + (임베딩 몫)   (Eq. 35–36)
    scale = G * b["gamma"] / rms(R) / nr      # (nr, d): branch c의 읽기 계수
    parts = [(scale * su[:, None] * yu[None, :]).sum(0) for (_, su, yu) in writes]
    emb_part = (scale * emb[None, :]).sum(0)
    recon = emb_part + sum(parts) if parts else emb_part
    shares = np.array([np.linalg.norm(p) for p in parts])
    if v >= 1:
        pi = shares / (shares.sum() + np.linalg.norm(emb_part))
        print(f"block {v}: 재구성 오차 {np.abs(recon - x).max():.1e}  π(u→v) = {np.round(pi, 3)}")
    y = np.tanh(b["F"] @ x)                   # block 본체 F (여기선 작은 MLP 대용)
    R = R + s[:, None] * y[None, :]           # Eq. 34: 모든 branch에 s_c y를 더한다
    writes.append((v, s, y))
 

무작위 가중치에서는 몫이 앞 block들에 고르게 퍼진다. 학습된 모델에서 한 branch가 장거리 통로가 되는 것은 쓰기 스칼라 ss와 읽기 gate GG가 학습되어 그런 경로를 고른 결과이고, 위 그림의 장난감은 그 상태를 손으로 만든 것이다.

3. Muon: fused vs split

NumPy Newton–Schulz 직교화: [W_q; W_k; W_v]를 통째로 vs 쪼개서
import numpy as np
rng = np.random.default_rng(2)
def newton_schulz(G, steps=5, a=3.4445, b=-4.7750, c=2.0315):
    """Muon의 5차 NS 반복(Jordan et al. 2024 계수). 특이값을 1 근처로 민다."""
    X = G / (np.linalg.norm(G) + 1e-14)
    tr = X.shape[0] > X.shape[1]
    if tr: X = X.T
    for _ in range(steps):
        A = X @ X.T
        X = a * X + (b * A + c * A @ A) @ X
    return X.T if tr else X

def muon_update(G, steps=8):
    A_, B_ = G.shape
    return 0.2 * np.sqrt(max(A_, B_)) * newton_schulz(G, steps)   # 형태와 무관한 update RMS

dm = 64
Gq, Gk, Gv = (s * rng.normal(size=(dm, dm)) @ np.diag(rng.uniform(0.1, 1, dm)) for s in (1.0, 0.1, 3.0))
fused = muon_update(np.vstack([Gq, Gk, Gv]))                  # [W_q; W_k; W_v]를 한 행렬로
split = [muon_update(g) for g in (Gq, Gk, Gv)]
r = lambda M: np.sqrt((M ** 2).mean())
print("update RMS      q       k       v")
print("fused NS     ", "  ".join(f"{r(fused[i*dm:(i+1)*dm]):.4f}" for i in range(3)))
print("split NS     ", "  ".join(f"{r(u):.4f}" for u in split))
sv = np.linalg.svd(split[1], compute_uv=False)
print(f"split한 k 블록 update의 특이값 범위 [{sv.min():.3f}, {sv.max():.3f}]  (0.2·√64 = 1.6 근처로 모인다)")
 

fused에서는 기울기가 작은 WkW_k의 update RMS가 다른 블록의 1/10 이하로 눌린다. 직교화는 행렬 전체의 특이값을 고르게 만드는 것이라, 이어 붙인 행렬에서는 큰 블록이 특이 방향을 차지하기 때문이다. split은 각 블록에 RMS 약 0.2의 update를 준다. 보고서가 head 단위 분할로 손실과 벤치마크를 모두 개선한 이유다.

확인 문제Check yourself

Qwen3.8-Flash-Next가 MoE router에 Muon 대신 AdamW를 쓴 이유로 보고서가 든 것은?

보고서 §3.1: Muon은 router의 초기 학습 요동을 키웠고, 중·후반에 적용하면 불안정하지는 않지만 의미 있는 이득이 없었다. 출력 차원 하나가 expert 하나의 점수라 차원들이 대체로 독립이어서 직교화가 이용할 구조가 없다는 설명을 붙였다. 1차원이라 제외한 것은 GDN의 α·β 투영 쪽이다.

실험 결과

Base 모델

출처Source: 2608.30320 Table 11
Qwen3.8-Flash-Next-Base versus the previous 397B-A17B base and the same-generation dense 27B base. Tick All to see every benchmark at once as the difference from the across-model mean (points). A dash (–) means the value is not in the source. Qwen3.8-Flash-Next-Base와 직전 397B-A17B base, 같은 세대 dense 27B base. 모두를 켜면 각 벤치마크에서 모델 평균과의 차이(점)를 한 번에 본다. 값이 없는 칸(–)은 보고서에 없는 값이다.

Flash-Next-Base beats the 27B dense base on all 14 and the 397B-A17B base on 8. Of the 6 where it trails, the largest gaps are MultiPL-E, 2.59 points (79.09 vs 81.68), and MATH, 1.60. SWEBench-Pretrain is an in-house variant that gives the base model a problem description and related files, asks for a diff, and measures sequence similarity to the gold patch (not a pass rate).

Component ablations

ComparisonResultSource
QSA vs full attention (Flash-Next)8-benchmark average 75.9 → 76.8, equal or higher on 7/8Table 2
Long context (RULER 512K–1M)90.08 → 93.00Table 3
Long context (MRCR 8-needle, 512K / 1M)30.66 → 40.53 / 20.71 → 26.44Table 3
MTP accepted length (4-step)4.06 → 4.07Table 4
25B-A3B, 560B tokens: pre-norm → mHC (static) → mHC (dynamic) → GRloss 1.617 → 1.596 → 1.594 → 1.590, average 50.91 → 52.49 → 54.47 → 54.66Table 5
28 layers: Full AttnRes + GatedNorm vs GR1.758 vs 1.762Table 6
Static widening only (simple AltUp)loss about −0.01 on 25B-A3B, 400B tokens§2.2
n-gram layer position (fixed budget)none 45.44, layer 1 47.30, layer 2 47.94, layer 25 47.40, layers 2+25 47.75Table 7

Where loss and benchmarks disagreed. Growing the n-gram vocabulary from 20× to 200× the base vocabulary (250K) lowers loss monotonically, 1.553 → 1.541 → 1.534 → 1.526, but MATH actually drops, 37.38 → 37.32 → 36.98 → 35.34, and only Chinese benchmarks such as C-Eval and CMMLU keep rising (Table 9). With the total parameter count fixed — fewer experts, more n-gram — the loss optimum is at 10× (25% of parameters), yet downstream benchmarks are not clearly better than the MoE-only baseline (Table 8). The report concludes that n-gram embeddings and experts add capacity in different ways.

Post-trained model (model card)

The model card’s post-trained model reports SWE-bench Pro 62.5 (Qwen3.7-Plus 55.8, DeepSeek-V4-Flash-0731 56.0), Toolathlon Verified 73.5, IFBench 81.3, GPQA Diamond 91.7, LiveCodeBench v6 91.9 and HLE 35.9. These are outside the report, and some harnesses are in-house (CoWorkBench, JobBench, …), so they are hard to read as effects of the architecture.

Reading critically

  • An architecture report without post-training. Judgements that “surfaced after post-training” (NoPE’s endless generation, the quality drop from sparse reads) changed the design, yet that post-training recipe and evaluation are not disclosed.
  • Mixed baselines. The 1/3-tokens and 1/9-FLOPs comparison is against 397B-A17B, whose training-token count is not public, so the absolute amounts cannot be checked. Table 11’s name (Qwen3.7-Plus-Base) and the citation in the text (the Qwen3.5 blog) appear to refer to the same 397B-A17B, but this is not stated.
  • Most ablations are at 25B-A3B and a few hundred billion tokens. The only production-scale separation of components is the three-run comparison over the first 276B tokens.
  • Theoretical versus measured speed. QSA’s theoretical compute ratio at 1M is in the tens, while the measured kernels give 7.6×/4.9×. Throughput depends heavily on kernels, batch and MTP settings (the decode measurement uses batch 4 and 3 MTP steps).
  • Whose capacity do the n-grams add? Loss falls but English reasoning benchmarks saturate and only Chinese knowledge rises. If the 51B parameters mostly store surface statistics, comparing total parameter counts with other models means little.
  • SWEBench-Pretrain is a similarity score. Despite the name, it is not an execution-based pass rate.

Summary

  • Qwen3.8-Flash-Next is a 125B-A6B (+51B n-gram) hybrid MoE that matches the previous 397B-A17B base with 1/3 of the active parameters, 1/3 of the tokens and about 1/9 of the FLOPs (Table 11).
  • QSA picks blocks with an MQA indexer over keys average-compressed into blocks of rr, adds the tail, and attends sparsely. Indexer cost drops to O(n2/r)O(n^2/r); it enters in 256K CPT via max-pooled dense distillation → sparse training.
  • GR widens the residual into 4 branches, reads them through an elementwise gate, writes with per-branch scalars, and drops HresH_{\text{res}}. One branch becomes a long-range path carrying early-layer outputs to the attention layers, and the gate is central to training stability.
  • n-gram embeddings add parameters without FLOPs, but lower loss does not carry over to downstream performance one-to-one.
  • Muon on 2D linear maps only, fused matrices split, AdamW for router, low-rank and vector parameters. The new structure and Muon raised the optimal batch and LR, removed batch warmup, and showed no spikes even at 4× LR in the stress test.

Flash-Next-Base는 27B dense base를 14개 전부에서 앞서고, 397B-A17B base를 8개에서 앞선다. 뒤지는 6개 중 가장 큰 차이는 MultiPL-E 2.59점(79.09 vs 81.68), MATH 1.60점이다. SWEBench-Pretrain은 base 모델에 문제 설명과 관련 파일을 주고 diff를 생성하게 한 뒤 정답 patch와의 시퀀스 유사도를 재는 사내 변형이다(통과율이 아니다).

구성 요소별 ablation

비교결과출처
QSA vs full attention (Flash-Next)8개 벤치 평균 75.9 → 76.8, 7/8에서 같거나 높음Table 2
장문맥 (RULER 512K–1M)90.08 → 93.00Table 3
장문맥 (MRCR 8-needle, 512K / 1M)30.66 → 40.53 / 20.71 → 26.44Table 3
MTP 수락 길이 (4-step)4.06 → 4.07Table 4
25B-A3B, 560B 토큰: pre-norm → mHC(static) → mHC(dynamic) → GR손실 1.617 → 1.596 → 1.594 → 1.590, 평균 50.91 → 52.49 → 54.47 → 54.66Table 5
28층: Full AttnRes + GatedNorm vs GR1.758 vs 1.762Table 6
정적 넓힘(단순 AltUp)만25B-A3B, 400B 토큰에서 손실 약 −0.01§2.2
n-gram 층 위치 (예산 고정)없음 45.44, 층 1 47.30, 층 2 47.94, 층 25 47.40, 층 2+25 47.75Table 7

손실과 벤치마크가 어긋난 사례. n-gram 어휘를 base 어휘(250K)의 20배 → 200배로 키우면 손실은 1.553 → 1.541 → 1.534 → 1.526으로 단조 감소하지만, MATH는 37.38 → 37.32 → 36.98 → 35.34로 오히려 떨어지고 C-Eval·CMMLU 같은 중국어 벤치마크만 꾸준히 오른다(Table 9). 파라미터 총량을 고정하고 expert를 줄여 n-gram에 주면 손실 최적은 10배(파라미터의 25%)인데 하류 벤치마크는 MoE만 쓴 기준선보다 뚜렷이 낫지 않았다(Table 8). 보고서는 n-gram 임베딩과 expert가 용량을 늘리는 방식이 다르다고 결론짓는다.

사후학습 모델 (model card)

model card의 사후학습 모델은 SWE-bench Pro 62.5(Qwen3.7-Plus 55.8, DeepSeek-V4-Flash-0731 56.0), Toolathlon Verified 73.5, IFBench 81.3, GPQA Diamond 91.7, LiveCodeBench v6 91.9, HLE 35.9를 보고한다. 보고서 밖의 수치이고 평가 하니스가 일부 사내 것(CoWorkBench, JobBench 등)이라, 아키텍처의 효과로 읽기는 어렵다.

비판적으로 읽기

  • 사후학습이 없는 아키텍처 보고서. “사후학습 뒤에 드러났다”는 판단(NoPE의 끝나지 않는 생성, sparse 읽기의 품질 저하)이 설계를 바꿨는데, 그 사후학습의 레시피와 평가는 공개되지 않았다.
  • 비교 기준이 섞여 있다. 1/3 토큰·1/9 FLOPs 비교의 상대는 397B-A17B이지만 그 모델의 학습 토큰 수가 공개되지 않아 절대량을 검증할 수 없다. Table 11의 이름(Qwen3.7-Plus-Base)과 본문의 인용(Qwen3.5 블로그)도 같은 397B-A17B를 가리키는 것으로 보이지만 명시되어 있지 않다.
  • 대부분의 ablation은 25B-A3B, 수백B 토큰 규모다. 프로덕션 규모에서 각 구성 요소의 기여를 분리한 결과는 첫 276B 토큰의 세 run 비교 하나뿐이다.
  • 이론 속도와 실측 속도. QSA의 이론 연산비는 1M에서 수십 배인데 실측 커널은 7.6×/4.9×다. 처리량은 커널, 배치, MTP 설정(decode 실측은 batch 4, 3 MTP step)에 크게 좌우된다.
  • n-gram의 용량은 “누구의” 용량인가. 손실은 줄지만 영어 추론 벤치마크는 포화하고 중국어 지식만 오른다. 51B 파라미터가 주로 표면 통계를 저장하는 것이라면, 총 파라미터 수를 다른 모델과 비교하는 것은 의미가 약하다.
  • SWEBench-Pretrain은 유사도 점수다. 이름과 달리 실행 기반 통과율이 아니다.

정리

  • Qwen3.8-Flash-Next는 125B-A6B(+51B n-gram) 하이브리드 MoE로, 직전 397B-A17B base와 비슷한 성능을 활성 1/3, 토큰 1/3, FLOPs 약 1/9로 낸다(Table 11).
  • QSA는 key를 rr 블록으로 평균 압축한 MQA indexer로 블록을 고르고 tail을 더해 sparse attention을 한다. indexer 비용이 O(n2/r)O(n^2/r)로 줄고, 256K CPT에서 max-pooled dense 증류 → sparse 학습 2단계로 들어온다.
  • GR은 residual을 4갈래로 넓혀 원소별 gate로 읽고 branch별 스칼라로 쓰며 HresH_{\text{res}}를 없앤다. 한 branch가 초기 층 출력을 attention 층까지 나르는 장거리 통로가 되고, gate가 학습 안정성의 핵심이다.
  • n-gram 임베딩은 FLOPs 없이 파라미터를 늘리지만 손실 감소가 하류 성능으로 그대로 옮겨지지 않는다.
  • Muon은 2D 선형사상에만, fused 행렬은 쪼개서, router·저랭크·벡터 파라미터는 AdamW로. 새 구조와 Muon이 최적 배치·LR을 키우고 배치 warmup을 없앴으며, 4× LR stress test에서도 spike가 없었다.

더 읽을거리Further reading