How AI works
How Large Language Models Work: Tokens, Attention and Sampling
A plain-language walkthrough of how LLMs work, with three worked examples you can check by hand: tokens and cost, attention, and temperature and top-p sampling.
Beginner18 min readUpdated 6 November 2026