Merge heads
×Concatenate the 128 heads into 16,384 features.
- in
- [B batch, 128 heads, T positions, 128 value d_h]
- out
- [B batch, T positions, 16384 heads × d_h]
Explanation
Heads are concatenated in order: head fills features .
Sources
In codecore_attn_out.reshape(batch_size, seq_len, -1) · 648
Direct evidence
The kernel’s output passes the gated RMSNorm, gated by z, head by head, is flattened and projected to the model width.
modeling_qwen3_5_moe.py 644–651 ↗ · huggingface/transformers @ 18329f106538
Excerpt
# reshape input data into 2D tensor
core_attn_out = core_attn_out.reshape(-1, self.head_v_dim)
z = z.reshape(-1, self.head_v_dim)
core_attn_out = self.norm(core_attn_out, z)
core_attn_out = core_attn_out.reshape(batch_size, seq_len, -1)
output = self.out_proj(core_attn_out)
return output