Skip to content
Interactive explainer

How a language model actually works.

Six short steps, no math, everything on this page you can touch.

Tokens

The text becomes pieces.

A model can't read words. The sentence is chopped into tokens, and each token gets a number. That list of numbers is all the model ever sees.

Thedataneverleavesbecauseitissensitive
Embeddings

Each piece becomes a place.

Every token turns into a long list of numbers — a location on a map of meaning. Similar words end up close together. Touch a word and watch where it lives.

datarecordsfilesSeoulTokyoSingaporesecureprivatesafemodelAI

Real models use thousands of dimensions, not two — but the idea is exactly this: meaning becomes distance.

Attention

Every word looks at every other word.

The transformer’s trick. Each word scores how much every other word matters to it — watch the sentence think, or touch a word to steer. On it, the model works out that “it” means the data.

"it" pays most attention to "data".

Layers

Then it happens again. And again.

Models stack this attention step dozens of times. Early layers catch grammar, middle layers catch meaning, late layers catch what the sentence is really about. Same machinery, repeated.

The choice

All of that buys one word.

The model scores every token it knows and turns the scores into percentages. For “The data never ___” — then it samples: usually the favourite, sometimes not. That’s why the same question can come back worded differently.

leaves
62%
moves
21%
changes
9%
sleeps
1%
The loop

Pick a word, append it, start over.

The chosen word is glued onto the text and everything runs again for the next one — once per word until the answer is done. What looks like thinking is this loop, very fast:

Why this matters to my work.

Everything above runs wherever the model runs. My job is making sure that for regulated enterprises, this loop runs on infrastructure they control — so the sentence stays true: the data never leaves.