A school notebook of probability diagrams, dice, a coin and a bag of coloured balls, whose dots and lines flow rightwards into streams of coloured tokens and then into chat bubbles on a screen.
// coins, dice and coloured balls → tokens → a conversation.

What if I told you that an LLM is, in some ways, one more maths problem we all tried to avoid?

Remember those chapters on probability and statistics? The ones many of us quietly hoped would remain optional — or at least would not appear in the exam?

Questions like:

If this happened, what is most likely to happen next?

At school, these questions came with coins, dice and bags full of coloured balls. They seemed like tidy classroom puzzles, each with an answer waiting somewhere at the back of the book.

Then that same kind of question met enormous amounts of text and computing power.

Something surprising happened.

The answer began to talk back.

You could ask it to explain gravity to a ten-year-old, turn that explanation into a bedtime story and then translate the story into another language — all in the same conversation.

There is no tower of if–else

And no, that is not because someone wrote:

if user_asks_about_gravity:
    explain_gravity()
else if user_asks_for_a_story:
    add_a_dragon()

There is no gigantic tower of if–else instructions hiding behind the chat window, with an exhausted programmer adding one more branch for every possible question.

The idea that probability simply “learned to talk” is a playful simplification, of course, but it points towards something real. At the heart of an LLM is a surprisingly familiar task: look at what has already appeared and calculate what is most likely to come next.

Technically, an LLM predicts a token — a small unit of text that might be a word, part of a word or even a punctuation mark. But the basic idea remains the same.

You already do this

If I write:

Twinkle, twinkle, little…

If I say:

Once upon a…

// tap the blurred word — you had already predicted it.

You did not search through every sentence you have ever heard. You recognised a pattern and made a prediction.

An LLM begins with a similar kind of challenge — although it performs it through mathematics and at an enormous scale. It looks at the words so far and estimates what should follow. Then it does that again. And again. One small prediction at a time.

It does not see a single inevitable answer. It sees possibilities.

If the sentence begins The cat sat on the…, words such as mat, floor, sofa and bed might all be possible. The words that came before shift the probabilities, making some continuations more likely than others.

Once a continuation is selected, it becomes part of the context for the next prediction. The process then repeats. What appears to us as a complete sentence — or even a complete explanation — is assembled through a long chain of these tiny decisions.

But who decides that mat should be more likely than moon?

Nobody sits down and assigns every word a probability by hand. The model learns by practising on enormous amounts of text.

Imagine that we catch a very young model during one of its early lessons. It is shown The cat sat on the… and its possibilities look something like this — and the sentence in the training text actually ends with mat.

Prediction · step 0 wrong — mat was too unlikely

The cat sat on the ?

one correction changes almost nothing. keep pressing.

// these numbers are only an illustration — but they show what the model is doing.

The model got it wrong — not completely, because it considered mat possible, but it did not consider it likely enough.

So the training process makes a tiny adjustment. Not a new rule saying, “after these exact words, always choose mat.” Just a slight mathematical nudge that makes predictions like mat a little more likely in similar situations.

Then another example arrives.

The dog slept on the…
The book fell onto the…
She wiped her feet on the…

With every attempt, the model predicts. The text reveals what actually came next. The difference between the two becomes a lesson.

Predict Compare Adjust Repeat

One correction changes almost nothing. But repeat this process across an enormous collection of text and the tiny adjustments begin to accumulate.

The model is not merely learning that cats sit on mats. It is gradually encountering larger patterns: animals can sit, objects can support other objects, certain words tend to appear together, and sentences have structures that repeat even when their subjects change.

The probabilities are not written into the model.
They are learned from its mistakes.

The part of the trick we keep missing

This is where things become genuinely curious. If predicting the next word is all it does:

  • How can it explain gravity, write code, translate a poem or help plan a holiday?
  • How can such a small task produce such surprisingly broad abilities?
  • And why, when it makes a mistake, does the mistake often sound so wonderfully convincing?

Perhaps we have been looking at the wrong part of the trick. The interesting thing is not simply that an LLM can predict the next word. It is what the model must discover about language — and about the world described by language — to keep getting that prediction right.

Somewhere between the coloured balls in our school textbooks and the chatbot on our screens, probability became much more interesting than we expected.

Maybe that “optional” chapter was quietly introducing us to the future.