Merge heads
×Concatenate the heads at each position.
- in
- [B batch, 128 heads, T positions, 128 value]
- out
- [B batch, T positions, 16384 heads × value]
Explanation
Heads are concatenated in order: head fills features .
Sources
In codeoutput_prefill.flatten(start_dim=-2)
Direct evidence
The attention output, heads flattened, is projected back to the model width by o_proj.
mla.py 244–255 ↗ · vllm-project/vllm @ 5df63a7203cd
Excerpt
attn_out = self.mla_attn(
q,
kv_c_normed,
k_pe,
output_shape=(hidden_states.shape[0], self.num_heads * self.v_head_dim),
q_dcp_replicated=q_dcp_replicated,
)
if self.g_proj is not None:
attn_out = attn_out * self.g_proj(hidden_states)[0].sigmoid()
return self.o_proj(attn_out)[0]