How Large Language Models Work

Open the black box of large language models: how they predict text, why they sometimes make things up, and the handful of settings that change how they answer.

Prediction, tokens, and training

An LLM is a next-token prediction machine Strip away the marketing and a large language model does one deceptively simple thing: it looks at the text so far and predicts the most likely next token — a chunk that is often a word or part of a word. Then it adds that token to the […]

Why LLMs sometimes make things up

Fluent does not mean correct Because a language model works by predicting plausible continuations, it is very good at producing text that reads as right. Unfortunately, plausible and true are not the same thing. When the model does not actually “know” something, it does not stop — it predicts the most likely-sounding answer anyway and […]

What the model can and cannot see

Everything the model knows right now is in one buffer An LLM has no memory between requests. Everything it can consider — the system prompt, the conversation so far, anything you pasted, and its own reply as it forms — occupies a single fixed buffer called the context window. Nothing outside it exists for this […]

Tools, functions, and agents

Giving a text predictor a way to act A model that only produces text cannot look anything up, do arithmetic reliably, or change anything in your systems. Tool use — also called function calling — closes that gap, and it is the single idea behind most of what gets marketed as an “AI agent”. How […]