78 transformer blocks › 75 MoE blocks › Sparse latent attention › Sparse attention › Mix and project
Merge heads
×no parametersattn_output.reshape(batch_size, seq_length, -1)
Concatenate the heads at each position.
- in
- [B batch, 64 heads, 1 position, 256 value]
- out
- [B batch, 1 position, 16384 heads × value]
Explanation
Heads are concatenated in order: head fills features .
Codemodeling_glm_moe_dsa.py 460–462
attn_output = attn_output.reshape(batch_size, seq_length, -1).contiguous()
attn_output = self.o_proj(attn_output)
return attn_output, attn_weights, topk_indicesSources1
Direct evidence
Head outputs are flattened and projected back to the model width.
mla-output · huggingface/transformers / modeling_glm_moe_dsa.py
Pinned revision 5e4d6304de55 ↗ · lines 460–462
Read code excerpt
attn_output = attn_output.reshape(batch_size, seq_length, -1).contiguous()
attn_output = self.o_proj(attn_output)
return attn_output, attn_weights, topk_indices