Frontier Research Engineering

Transformers, Hands-On

Socratic Tutor

Attention, masks, positional encodings and the modern transformer block, built piece by piece.

Attention by Hand

Attention From Scratch in PyTorch
12 min
Multi-Head Attention as One Big MatmulCore
12 min
Causal and Padding MasksCore
12 min

Position

Positions: Learned, Sinusoidal and RoPECore
14 min

The Model

The Modern Block: Pre-LN, RMSNorm, SwiGLU
14 min
A Decoder-Only Model, End to EndCore
15 min

Generation

Generation: Sampling and Why It's Slow
12 min
StackSweep | Engineering practice