How Large Language Models Work: A Plain-English Guide for 2026 | AI Product Leadership
Home/ Fluency/ How large language models work
Fluency track / Foundations

How large language models actually work

One capability explains everything an LLM does: it predicts the next token. This is a plain-English, hands-on walk through the machine underneath GPT, Gemini and Claude, written for people who ship with AI rather than train it.

4 steps per token ~100k token vocabulary 1T+ parameters at the frontier no lookup table, a statistical map
The one idea, live
See the four steps →

An LLM reads your input, converts it to numeric tokens, passes those tokens through many stacked layers of transformer calculations, and outputs the most statistically likely next token. Then it does that again, and again, until the response is complete.

The result is not a database of facts. It is a dense statistical map of how language is structured, which concepts sit near each other, and which responses people found useful. Understanding that one sentence is most of the way to understanding why LLMs are so capable, and exactly where they break.

The core mechanism

Four steps, every single time you hit send

These run in strict sequence for every token the model produces. Tap a step to open it up.

Step 1, hands-on

The model never sees your words

It sees integers. Text is split into subword fragments (tokens), and each fragment maps to a number. Type anything and watch it happen.

Illustrative. This is a simplified subword splitter with made-up IDs to show the idea. A real tokeniser like GPT's uses a fixed algorithm with roughly one hundred thousand learned token IDs. Subword splitting is what lets one model handle English, Hindi, Python and SQL with the same system.
Steps 2 and 3

From numbers to meaning, then to context

Each token ID becomes an embedding, a long vector that places it in a semantic space where "doctor", "physician" and "surgeon" land close together. Positional encoding is added so "the cat sat on the mat" is not confused with "the mat sat on the cat".

Then comes the transformer. Older networks read one word at a time, so linking a pronoun in sentence ten back to a noun in sentence two was hard. The transformer processes every token in parallel, and every token attends to every other token at once through self-attention. For each token the model builds three vectors:

Q

Query

What this token is looking for in the sequence.

K

Key

What this token offers to the others.

V

Value

The information this token contributes if attended to.

The model scores each query against every key, turns those scores into attention weights, and blends the values accordingly. A frontier model runs dozens of attention heads across dozens of layers. One head might track subject-verb agreement, another coreference, another position. Attention handles structure and context. The feedforward layers that follow are where most factual knowledge lives.

Step 5, hands-on

Temperature is the precision dial

After the layers run, the model has a probability for every possible next token. Temperature decides how it picks. Slide it, watch the distribution reshape, then generate a token.

The capital of France is ___
temperature 0.30 focused
picks: Paris
At temperature 0 the model always takes the top token, so it is deterministic and repeatable. Raise it and the distribution flattens, so the model starts sampling less likely tokens. Low for extraction and classification, higher for brainstorming. Most production pipelines sit at 0 to 0.2.
Where the ability comes from

Three stages of training

Pre-training builds a model that can continue text. The next two stages make it a useful assistant.

Stage 1

Pre-training

Predict the next token across trillions of tokens from web text, books, code and papers. Every wrong guess adjusts hundreds of billions of weights. Weeks to months on tens of thousands of GPUs.

over 90% of total compute
Stage 2

Supervised fine-tuning

Human trainers write example conversations. The model learns the instruction-following format from thousands of them.

days, not months
Stage 3

RLHF

Human raters compare pairs of answers. A reward model learns their preferences, and the LLM optimises for outputs that score well. This is what turns raw text prediction into genuinely helpful behaviour.

days, high leverage
Why this replaced the old approach

Traditional AI versus large language models

The shift from many narrow models to one foundation model changed the economics of building with AI. Prompt engineering became the configuration layer.

 Traditional AILarge language models
TrainingTask-specific, labelled datasetsGeneral pre-training on web-scale data
FlexibilityOne model per taskOne foundation model, many tasks
ArchitectureSVM, LSTM, CNN, rule-basedTransformer, decoder or encoder-decoder
ScaleMillions of parametersBillions to trillions of parameters
InstructionsStructured input, fixed outputNatural language instructions
Knowledge updateRetrain on new dataRetrieval or fine-tuning
The product question

Can an LLM own this task?

Reliability tracks one thing: how many similar examples sat in the training data, and how clearly you can check the output. Pick a task.

Know before you ship

Three failure modes that are structural

These are not prompt bugs. They come from how the machine is built, so you design around them rather than fixing them away.

Hallucination

Confident, plausible, and wrong. The model predicts what fits the pattern of an authoritative answer even when it does not know.

Mitigate: RAG, output verification, lower temperature

Knowledge cutoff

Training data ends on a fixed date. Anything after it is unknown unless you fetch it in at query time.

Mitigate: live search tools, real-time RAG

Context confusion

In long threads, early instructions lose influence as the window fills. The model leans on recent tokens.

Mitigate: shorter contexts, restate key constraints
For product leaders

What actually matters when you build with this

Less about the mathematics, more about the constraints that shape your decisions.

01

Context window is working memory

Everything inside is visible, everything outside is gone. In your architecture it is a real cost line, not a footnote.

02

Hallucination is structural

There is no fact-checker at inference. Decide where human review is mandatory before you ship, not after.

03

Prompt before you fine-tune

A few good examples get most of the benefit at a fraction of the cost. Fine-tune only when you need consistent format at scale.

04

Temperature is a dial you own

0 to 0.2 for extraction and classification, higher for ideation. It is a product decision, not a default.

Questions people ask

Frequently asked