How LLMs Actually Work — An Interactive Explainer

I built a scrollable, animated walkthrough of what happens inside a language model — from a word becoming a number to the next token being chosen

AI
ai
llm
machine-learning
explainer
education
3 min read
AI LLMs Transformers Interactive
"It predicts the next word" is true and tells you almost nothing. The interesting part is everything that happens before the guess.

Everyone uses language models now. Almost no one has a mental model of what's happening between hitting enter and the answer streaming back. The explanations on offer split into two useless extremes: the cocktail-party version ("it's just autocomplete") and the graduate-seminar version (twelve equations and a reference to Attention Is All You Need).

I wanted the thing in the middle — a page you can scroll through in ten minutes that shows each step with a live animation, lets you poke at the parts that are interactive, and never asks you to take a leap of faith. So I built one.

Open the interactive explainer → llms.davidstancel.com

A single self-contained page. No login, no setup — just scroll.

What it walks through

The page follows one short prompt all the way through a transformer, one concept per section, each with its own animation:

  • Tokenization — how your text gets chopped into tokens, and why a token isn't always a word. (Type something and watch it split.)
  • Embeddings — how each token becomes a long list of numbers, and why "king − man + woman ≈ queen" is a real thing you can do with arrows.
  • Positional encoding — how the model knows word order, since the math otherwise treats your sentence as a bag.
  • Attention (and multi-head attention) — the actual heart of it: how each word decides which other words to "look at," shown as live scoring bars.
  • Feed-forward, residuals, and depth — the plumbing that lets these layers stack dozens deep without falling over.
  • Prediction — how it all collapses into a probability for every possible next token, and how temperature reshapes that into the word you actually see. (There's a slider.)
  • Architecture vs. weights — the distinction most people miss: the blueprint is public, the learned numbers are the moat.
10 Concepts, one scroll
3 Things you can play with live
0 Equations you're required to read

The goal was never to make you an ML engineer. It's to replace "it's magic" with a working intuition — enough that the next time a model surprises you, you have somewhere to put it.

The conceptual skeleton was inspired by this excellent explainer; the page, the animations, and the framing here are my own ELI5 take.

Working through this yourself?

I advise founders, funds, and institutions on crypto, DeFi, and multijurisdictional setups. Tell me what you're after.

Book a consultation →