Merge heads
×Join all retrieved head features into the model-width field.
- in
- [B batch, 32 q heads, T positions, 128 d_h]
- out
- [B batch, T positions, 4096 d]
Explanation
Heads are concatenated in order: head fills features .
Sources
In codeoutput.transpose(1, 2).contiguous().view(bsz, seqlen, -1)
Direct evidence
The head output is transposed and reshaped into the full model-width field.
model.py 188–189 ↗ · meta-llama/llama3 @ a0940f9cf706
Excerpt
output = torch.matmul(scores, values) # (bs, n_local_heads, seqlen, head_dim)
output = output.transpose(1, 2).contiguous().view(bsz, seqlen, -1)