Multi-Head Causal Attention

Split Q/K/V into heads, apply scaled causal attention, and merge the heads. A free ML coding interview task on NudgeCode: write it in Python and check it with tests in your browser. Medium · Attention, Multi-Head, Causal Mask.

Implement multi-head causal attention for Q/K/V shaped (B,T,D). Split into heads, compute scaled dot-product attention, mask future tokens, and merge back to (B,T,D). Do not call fused SDPA.