inference/research
verifiedhigh · 0.90updated 2026-10-03

HuggingFace Transformers reference implementations (glm4_moe, glm4_moe_lite, glm_moe_dsa)

repo

Fields

id
sources/model-cn-hf-transformers-ref-impls
Publisher
HuggingFace
Kind
repo
Accessed
2026-10-03
notes
Used to settle a contested point that config.json alone cannot: whether GLM-4.5/4.6 use MLA. modeling_glm4_moe.py Glm4MoeAttention is plain GQA (uses config.num_key_value_heads, has no kv_lora_rank, no kv_a_proj_with_mqa) - so GLM-4.5 and 4.6 cache full per-head K/V, NOT a latent. By contrast modeling_glm4_moe_lite.py Glm4MoeLiteAttention is documented 'Multi-headed Latent Attention (MLA) from Deepseek V2' and builds kv_a_proj_with_mqa plus kv_b_proj, and modeling_glm_moe_dsa.py GlmMoeDsaAttention adds a sparse indexer (index_topk). This matches the configs: GLM-4.5 and GLM-4.6 have num_key_value_heads and no kv_lora_rank; GLM-4.7-Flash has kv_lora_rank 512; GLM-5.2/5.3 have kv_lora_rank 512 plus index_topk.

Notes

Used to settle a contested point that config.json alone cannot: whether GLM-4.5/4.6 use MLA. modeling_glm4_moe.py Glm4MoeAttention is plain GQA (uses config.num_key_value_heads, has no kv_lora_rank, no kv_a_proj_with_mqa) - so GLM-4.5 and 4.6 cache full per-head K/V, NOT a latent. By contrast modeling_glm4_moe_lite.py Glm4MoeLiteAttention is documented 'Multi-headed Latent Attention (MLA) from Deepseek V2' and builds kv_a_proj_with_mqa plus kv_b_proj, and modeling_glm_moe_dsa.py GlmMoeDsaAttention adds a sparse indexer (index_topk). This matches the configs: GLM-4.5 and GLM-4.6 have num_key_value_heads and no kv_lora_rank; GLM-4.7-Flash has kv_lora_rank 512; GLM-5.2/5.3 have kv_lora_rank 512 plus index_topk.

Cross-references

This record references no other records.