NumPy allowed · plain Python earns 10 bonus points
Q · Kᵀ / √d scores normalized with softmax
Reshape and permute token hidden representations to isolate parallel multi-head attention streams.
Implement split_multi_head_projections(hidden_states, num_heads, head_dim): transform a 3D tensor of shape (B, S, num_heads * head_dim) into a 4D tensor of shape (B, num_heads, S, head_dim) by splitting the last dimension into heads and swapping sequence and head dimensions.
split_multi_head_projections(hidden_states: list[list[list[float]]], num_heads: int, head_dim: int) -> list[list[list[list[float]]]]