Expand description
Glm5NextDsaLayer โ the DSA block: NoPE MLA attention over indexer-selected tokens.
Decode, end to end:
hidden โโฌโ q_a_proj โ RMSNorm โโฌโ q_absorb โโโโโโโโโโโโโโ Q (latent space)
โ โโ indexer.wq_b โโโโโโโโโโ q_idx โโ
โโ indexer.wk โ LayerNorm(w,b) โ state.k_normed โโโโโโโโโโโค
โโ compress_gate โโโโโโโโโโโโโโโ state.gate โโโโโโโโโโโโโโโผโ select_tokens
โโ weights_proj โโโโโโโโโโโโโโโโ head weights โโโโโโโโโโโโโ โ
โโ kv_a_proj โ RMSNorm โ FP8 โโโ paged latent cache โ
โผ
glm5next_dsa_mla_decode_fp8 (gather)ยง๐ชค Four silent-wrong-answer traps this file exists to hold
- Two RMSNorm kernels differ only by a
+1.rms_normcomputesx * rms * (1 + w);rms_norm_vanillacomputesx * rms * w. Same signature, same shapes. GLM is plain, so every norm here takes the vanilla entry point. indexer.k_normis annn.LayerNormwith a bias, not an RMSNorm at all โ mean subtraction plus a bias term. It takesnllb_layernorm_bf16(x, w, b, โฆ).weights_projoutput must already carryindex_heads^-0.5.dsa_index_scoresdoes not apply it. Folded into the weight at load โ seeGlm5NextDsaWeights.- Q must be absorbed into latent space before it reaches the decode kernel. The
kernel dots Q against the 512-dim latent directly, so
q_absorbisq_b_projpre-multiplied bykv_b_projโs K half. A rawq_b_projis the right shape per head (256 vs 512 is not) but the wrong space.
Structsยง
- Glm5
Next DsaLayer - Glm5
Next DsaLayer Kernels - Every kernel a DSA block launches, beyond the selection set.
- Glm5
Next DsaWeights - One DSA blockโs weights, already sharded for this rank.
- Glm5
Next DsaWorkspace - Scratch reused across decode steps. Allocated once per layer.