How LLMs Actually Work

a from-scratch explainer

How LLMs Actually Work

From your first vector to attention, training, and LoRA โ€” no math background needed.

Start with Chapter 1 โ†’

Hi โ€” I'm Sean Egan. Somewhere along the way I fell completely for AI and machine learning. I built this site for a friend who asked me, over a drink, how ChatGPT actually works โ€” not the hand-wavy version, the real one. If you've ever asked the same question, this is for you too.

Here's my promise: you need zero math background. Not algebra-class memories, not calculus, nothing. Part I teaches every mathematical idea we use, from scratch, with pictures and things you can drag. By the end you won't just have a vague feel for what a language model does โ€” you'll be able to follow the actual equations, and check some of them by hand.

Take it slowly. Watch the videos. Play with the interactive bits โ€” they're not decorations, they're the point. And if a chapter feels dense, that's the material, not you. We go one honest step at a time.

How to read this site

The chapters build on each other like floors of a building โ€” Part I is the foundation, and everything after stands on it. If you're new to all of this, go in order; each chapter opens with a short list of the ideas it needs, linked back to where they were taught. If you already know some linear algebra, you can start at Part II and treat Part I as a reference.

Coming from AI/ML from the Ground Up? Its Math Toolkit chapter covered Part I in brief โ€” vectors, dot products, matrices, curves, slopes, probability. The six chapters here are that same material at walking pace, with the pictures and the pencil work. Skim them as reinforcement, or go straight to Part II and come back when a symbol stops being obvious. Nothing later needs you to have read them twice.

Three kinds of things appear alongside the text: videos (short, narrated animations of the key ideas โ€” watch them, they carry real weight), interactives (drag things, break things, get a feel), and worked examples (small numbers you can verify with a pencil โ€” I mean it: get a pencil). When you finish, there are two more sites to climb into: AI/ML from the Ground Up zooms out from language models to the whole field, and How AI Makes Images โ€” the third and newest โ€” points the same machinery at pictures and builds an image generator from pure static. The math you learn here carries into both.