Free explainer · From the world of the book

How do LLMs work? A plain-English explanation

Updated July 2026 · 9-minute read · By Alexander Lazutin

You type a question. Two seconds later, a machine replies in fluent, well-organised English. What happened in between?

Most explanations either drown you in linear algebra or wave it away as "magic AI". This one does neither. Five steps, everyday analogies, and by the end you'll have the same mental model that runs through the book, the one that makes AI's strengths and its famous failures suddenly make sense.

In one sentence A large language model is a machine trained on a vast amount of text to predict the next token, and a chatbot is that prediction run over and over, one token at a time, until the answer is complete.

Step 1: Your words become tokens

The model doesn't read words. It reads tokens: chunks of text from a fixed vocabulary of tens of thousands of pieces. Common words like "the" are a single token. Rarer words get split: "unbelievable" might become un believ able.

This sounds like a boring implementation detail. It isn't. It explains real behaviour. Ask a model to count the R's in "strawberry" and it often fails, because it never sees the letters: it sees something like straw berry. Asking it to count letters is like asking you to count the brushstrokes in a photo of a painting.

Step 2: Tokens become coordinates of meaning

Each token is converted into a long list of numbers called an embedding. Think of it as coordinates on a gigantic map of meaning. On this map, "king" sits near "queen", "Paris" near "France", and "bank" starts somewhere between riverbanks and finance until context pins it down.

Nobody drew this map by hand. The model discovered it during training, because placing related concepts near each other makes the next token easier to predict. This is how a pattern-matching machine ends up with something that behaves like knowledge of what words mean.

Step 3: Attention, every word looks at every other word

The breakthrough behind modern AI is a mechanism called attention, from the 2017 paper that introduced the transformer architecture. The idea, minus the maths: as the model processes your text, every token gets to "look at" every other token and decide which ones matter for its meaning.

In "The trophy didn't fit in the suitcase because it was too big", attention is what lets the model work out that it means the trophy, not the suitcase. Stack dozens of attention layers on top of each other and the model builds progressively richer readings of the text: grammar in the early layers, meaning and relationships in the middle, task-level intent near the top.

Step 4: The model predicts the next token, then does it again

All of that machinery exists to answer one question: given everything so far, what token comes next? The model's output is a probability for every token in its vocabulary: 41% Paris, 3% the, 0.001% banana, from which one token is chosen.

Then the whole process repeats with that new token included, and again, and again, until the answer is finished. There is no plan drafted in advance and no answer retrieved from a database, just prediction, thousands of times, at extraordinary speed. A little controlled randomness in the choice (called sampling) is why you can ask the same question twice and get two different answers.

Step 5: Where the "knowledge" came from, training

Where do the probabilities come from? Pre-training: the model reads a colossal amount of text (much of the public internet, books and code) and plays a guessing game trillions of times: hide the next token, predict it, measure the error, nudge billions of internal dial-settings (parameters) to be slightly less wrong. Repeat for months on warehouse-scale computers.

To get good at this game, the model is forced to internalise grammar, facts, styles, and reasoning patterns, not because anyone programmed them in, but because they're what make prediction accurate. The result is often described as a lossy compression of the internet: astonishingly broad, genuinely deep in places, and frozen at the date the training data ends.

Raw pre-trained models are then shaped by fine-tuning and human feedback (RLHF): humans rating outputs so the model learns to be helpful, follow instructions, and decline harmful requests. That's the difference between an engine and a usable assistant.

So is it "just autocomplete"?

Mechanically, yes, and the word "just" is doing a lot of dishonest work. Predicting text well at this scale requires absorbing how the world is described: what follows "the boiling point of water is", how a polite refusal is phrased, how a Python function ends. Calling an LLM "just autocomplete" is like calling a grandmaster "just someone who picks moves". True, and it explains nothing about the skill.

But the mechanism matters, because it draws the boundary of trust. A predictor has no built-in concept of truth, which is why fluent, confident, wrong answers are a permanent feature, not a passing bug. That's the subject of our companion explainer: why do LLMs hallucinate?

The five ideas to remember

How much of that did you already know? Find out in the 2-minute AI knowledge quiz.

How LLMs Actually Work book cover

Want the full picture?

How LLMs Actually Work expands each of these steps into a chapter, with the analogies, stories and practical judgement that turn "I roughly get it" into "I can explain it to anyone".