Module binding

Module binding 

Source
Expand description

2026-09-25: The tensor contract of one GLM-5.3 DSA block: the 14 self_attn tensors dsa_tensor_specs lists, their dtype and unsharded shape, and a verifier.

Owner: model-arch (GLM-5.3 DSA). Invariants:

  • verify_dsa_block returns Ok only when every spec tensor is present with the spec’s dtype, shape and BF16 byte length, and the source holds no other self_attn.* tensor.

It uses the tensor types of crate::glm5next_kda::binding. Shapes are computed from Glm5NextDsaConfig.

§What the table catches

  • indexer.k_norm is a LayerNorm with a bias, and the bias is a spec entry, so a checkpoint without it fails the bind.
  • index_kpool_compress_ape is [index_kpool, index_head_dim], indexed by pool slot.
  • q_b_proj has qk_head_dim rows per head and kv_b_proj has qk_nope_head_dim + v_head_dim (256 and 512 on GLM-5.3). Both are [heads * w, lora], so only the shape check tells a swapped width apart.
  • NoPE: kv_a_proj_with_mqa has kv_cache_dim() rows, which is kv_lora_rank (512), not 512 + a rope section.

Structs§

DsaBindReport
2026-09-25: What a successful bind saw.
DsaSpec
2026-09-25: One expected tensor: layer-relative name, dtype, and full (unsharded) shape.

Functions§

dsa_tensor_specs
2026-09-25: Every self_attn tensor a DSA block has, and the only ones it may have. full_heads is the unsharded head count: shapes are checked against the full tensors, which build::build_dsa_weights shards afterwards.
verify_dsa_block
2026-09-25: Verify one DSA block against the spec table.