How Large Language Models Actually Work
A plain-English tour of what happens between your prompt and the model's answer — prediction, training, and why LLMs sometimes get things confidently wrong.
A large language model (LLM) is, at its core, a very sophisticated next-word predictor. Given some text, it estimates the most likely continuation — one token at a time. Everything else, from writing code to explaining physics, is an emergent behavior built on top of that single idea.
Prediction, not memory
The model does not look up answers in a database. During training it saw an enormous amount of text and adjusted billions of internal parameters (weights) to get better at predicting what comes next. Those weights are the model — a compressed, statistical representation of patterns in language.
- Input text is split into tokens — roughly word fragments.
- Each token becomes a vector of numbers the model can do math on.
- Layers of attention let each token "look at" the others for context.
- The final layer outputs a probability for every possible next token.
Why it feels like it understands
To predict the next word well, the model has to encode a lot about the world — grammar, facts, reasoning steps, even coding conventions. That compression is why an LLM can hold a coherent conversation. But it is still predicting, which is why it can be fluent and wrong at the same time.
Where to go next
Once you understand prediction, the practical levers make sense: give the model better context, break work into steps, and let it use tools. The linked resources below are a good place to start experimenting.