32/42
Part 5 of 6 · The check and the projectionWatch
Watch · 17 min

Raschka codes the batched version line by line in PyTorch, from view and transpose into heads to a mask buffer sliced to the sequence, then the transpose back and the output projection. He uses separate q, k and v layers instead of one fused layer, with the same shapes.

Build an LLM from Scratch 3: Coding attention mechanisms · Sebastian Raschka · Mar 2025YouTube