Merge heads
×Concatenate the 96 heads into 12,288 features.
- in
- [B batch, 96 heads, T positions, 128 value d_h]
- out
- [B batch, T positions, 12288 heads × value d_h]
Explanation
Heads are concatenated in order: head fills features .
Sources
In codeattn_output.reshape(batch_size, seq_length, -1) · 468–469
Direct evidence
Head outputs are flattened, multiplied by the sigmoid of a full-rank projection of the layer’s input, and projected back to the model width.
modeling_kimi_linear.py 468–474 ↗ · moonshotai/Kimi-K3 @ f831ab668142
Excerpt
attn_output = attn_output.reshape(
batch_size, seq_length, -1).contiguous()
if self.use_output_gate:
g = self.g_proj(hidden_states).sigmoid()
attn_output = attn_output * g
attn_output = self.o_proj(attn_output)
return attn_output