Expand description
2026-09-25: The GLM-5.3-Flash KDA attention block: one bound self_attn block per KDA layer.
Owner: model-arch (GLM-5.3-Flash KDA). Invariants:
Glm5NextKdaLayer::newandGlm5NextKdaWorkspace::newrefuse a config that failsGlm5NextKdaConfig::validate.- The forward calls (
decode,decode_k,prefill) allocate nothing: they write into the caller’sGlm5NextKdaWorkspaceandKdaSeqState.
q|k|v_proj -> pack -> conv1d + SiLU -> L2(q,k only) -> kda_gate / sigmoid(b_proj)
-> kda_chunk (prefill) | kda_recurrent (decode)
-> sigmoid-gated RMSNorm(o_norm, g_b(g_a(h))) -> o_proj- The binder accepts only BF16 and F32 tensors (
binding::KDA_TENSORS), and every projection runs a BF16 kernel, so there is no dequantisation on this path. - The checkpoint stores
q_conv1d/k_conv1d/v_conv1dseparately; the binder concatenates them in q, k, v order, the orderfront_endpacks the projections in. o_normgates with a sigmoid, not SiLU, so it runskda_o_norm_gated_bf16(kernels/gb10/common/kda_layer_ops.cu) rather thangated_rms_norm.dense_mm_bf16andcublas_bf16_proj_densetake no output row stride, so the three q/k/v projections go to separate[T, qkv]buffers andkda_pack_qkv_bf16interleaves them.- The conv state keeps
conv_kernelslots and the conv kernels shift left before convolving; seeKdaSeqState. - Decode fuses conv, SiLU and L2 in one kernel; prefill runs a separate
l2_norm_bf16over the q|k channels. V is never normalised.
Modules§
- binding
- 2026-09-25: Typed weight binding for the GLM-5.3-Flash KDA attention blocks.
- tp
- 2026-09-25: GLM-5.3-Flash KDA tensor-parallel shard plan: head-parallel, one all-reduce after
o_proj. - tp_bind
- 2026-09-25: Applies a
super::tp::KdaTpPlan: slices each KDA tensor to this rank before the binder sees it.
Structs§
- Glm5
Next KdaConfig - 2026-09-25: KDA geometry and the two numeric config values the block uses. The loader fills
every field from
ModelConfigexceptl2_epsandchunk; there is noDefault. - Glm5
Next KdaKernels - Glm5
Next KdaLayer - 2026-09-25: One bound KDA attention block.
- Glm5
Next KdaWeights - 2026-09-25: One KDA block’s device weights. Torch
Linearlayout[out, in], BF16, except the two F32 gate parameters. There is noZtensor; the output gate is low-rankg_a/g_b. - Glm5
Next KdaWorkspace - 2026-09-25: Scratch for the forward path, sized once for
max_tokens(prefill buffers padded to a whole number of chunks). The loader shares one workspace across the KDA layers. - KdaSeq
State - 2026-09-25: The per-sequence state a KDA layer carries. The kernels update both buffers in place.
Constants§
- SMEM_
CEILING - 2026-09-25: Largest shared memory a prefill chunk may need.
Glm5NextKdaConfig::validaterefuses achunkwhosesmem_prepareorsmem_scanexceeds it.