Loading lesson page...
AI From Scratch/Lesson 04/~45 minutes
Positional Encoding — Sinusoidal, RoPE, ALiBi
Attention is permutation-invariant. "The cat sat on the mat" and "mat the on sat cat the" produce the same output without positional signal. Three algorithms fix it — each with a different bet on what "position" means.
BuildPythonNo prerequisites