The one-paragraph version
A large language model is a function that takes a sequence of tokens and returns a probability distribution over the next token. Training adjusts billions of numeric weights so that this distribution matches real text. Generation runs the function repeatedly, appending each chosen token to the input. Everything else that people associate with LLMs, from answering questions to writing code to refusing a request, emerges from that loop plus a relatively small amount of later tuning.
The important consequence is that an LLM has no separate knowledge base, no query engine and no symbolic reasoning module. Its knowledge is distributed across the weights as statistical associations, and its behaviour at any moment is determined by the weights plus whatever text is currently in its context.
What makes a model large
Three quantities scale together: parameters, training tokens and compute. Parameters are the learned weights, typically between one billion and a few hundred billion for models in wide use. Training tokens are the amount of text the model reads during training, now commonly in the trillions. Compute is the total arithmetic performed, usually reported in floating-point operations, and it is roughly proportional to parameters multiplied by tokens.
Scaling research found that loss falls predictably as these quantities grow, which is why the field pushed size so hard. Later work showed that most early large models were badly imbalanced: they were too big for the amount of data they saw. The compute-optimal ratio turned out to be on the order of twenty training tokens per parameter, meaning a 7B model should see well over a hundred billion tokens to be worth its size. Modern releases often train far beyond that ratio deliberately, because a smaller model trained on more data is cheaper to serve at the same quality. That trade, training cost against inference cost, is one of the central engineering decisions in the field.
Training happens in stages
Pretraining is the expensive stage. The model reads trillions of tokens of web pages, books, code and curated corpora, and learns to predict the next token. This is where grammar, facts, style and a great deal of latent reasoning ability come from. It is also where most of the compute goes: months on thousands of accelerators, with data pipelines, filtering and deduplication doing as much work as the training loop itself.
Supervised fine-tuning comes next. The pretrained model is trained on a much smaller set of curated instruction-response pairs, teaching it the shape of a helpful answer: follow the instruction, adopt the format, admit uncertainty. This stage is cheap relative to pretraining and has an outsized effect on how usable the model feels.
Preference optimisation comes third. Humans, or a strong model acting as a judge, rank pairs of responses. A reward model learns those preferences, and the policy is optimised against it, through reinforcement learning from human feedback or the simpler direct preference optimisation objective. This is what makes a model concise, well formatted and inclined to decline certain requests. A final round of distillation or rejection sampling often follows, where the model is retrained on its own best outputs filtered by a verifier.
The stages explain a common confusion. Base models, which have only been pretrained, are not assistants. Ask a base model a question and it may continue with more questions, because that is what the text it read usually did. The assistant behaviour is a thin layer of tuning on top.
Tokens, not words
Models do not read characters or words. A tokenizer splits text into subword units drawn from a fixed vocabulary, typically between thirty thousand and two hundred thousand entries. Common words become single tokens. Rare words split into pieces. Numbers, punctuation and whitespace each get their own treatment, and code and non-Latin scripts are often tokenised less efficiently than English prose.
This has practical consequences that surprise people. Billing is per token, so a page of English is roughly 700 to 800 tokens while the same content in Hindi or Thai may cost two or three times as much. Context limits are measured in tokens, so a file that fits in 100,000 characters may not fit in a 32K window. Tasks that require character-level manipulation, such as counting letters, reversing a string or checking a checksum, are genuinely hard for a model whose smallest unit is a subword chunk. And a trailing space can change the token sequence, which is why prompt formatting bugs sometimes produce wildly different outputs.
Parameters are where the knowledge lives
The parameters are the model's long-term memory, in a loose sense. During pretraining the network compresses an enormous amount of text into a few billion numbers. Facts, stylistic patterns, translations, code idioms and something like reasoning procedures are all encoded in the same weights, superimposed rather than stored in separate slots. This is why the model can generalise to a question it has never seen but cannot reliably cite where an answer came from.
Superposition has a cost. Because many patterns share the same weights, updating one association can disturb another. It also means the model's knowledge has no timestamps and no provenance. It cannot distinguish a fact it saw ten thousand times from one it saw once, and it will fill gaps with whatever continuation is statistically plausible. That is the mechanism behind hallucination: the model is optimised to produce likely text, not to produce true text, and those objectives coincide most of the time but not always.
Context is the working memory
The context window is the number of tokens the model can attend to in a single forward pass: 8K, 32K, 128K and, on some systems, a million or more. Context is not memory in the human sense. It is the text supplied with this request, and it disappears when the request ends unless the application stores it and sends it again.
Parameters and context do different jobs, and confusing them causes bad design. Parameters hold general capability and background knowledge, updated only by retraining. Context holds the specifics of the current task: the document to summarise, the conversation so far, the retrieved passages, the tool definitions. Anything the model must know about your business belongs in context, either retrieved per request or injected as instructions.
Larger context is useful but not free. Attention cost grows quadratically with sequence length, so a 128K prompt costs far more than four 32K prompts. Quality also degrades over long inputs: models attend more reliably to the beginning and end of a context than to the middle, a pattern documented as lost-in-the-middle. Practical systems therefore retrieve a focused set of passages rather than dumping an entire corpus into the window.
Inference is a loop
At inference the weights are frozen. The prompt is tokenised, passed through the network, and turned into a score for every token in the vocabulary. A sampling rule picks one, appends it, and the process repeats until a stop condition is met: an end-of-sequence token, a maximum length, or a matching stop string.
Two settings dominate the feel of the output. Temperature rescales the distribution before sampling; low values make the model pick the most likely continuation almost every time, high values flatten the distribution and produce variety along with mistakes. Top-p restricts sampling to the smallest set of tokens whose probabilities sum to a threshold, which cuts off implausible tails while leaving genuine choice. For extraction and classification, temperature near zero is usually right. For drafting and brainstorming, a moderate value helps. Setting temperature to zero does not guarantee identical output across runs, because batching and floating-point arithmetic introduce small differences.
What an LLM is not
- It is not a database. There is no lookup of a stored answer, and it cannot tell you which document a fact came from.
- It does not automatically know whether an answer is true. Fluency and accuracy are separate properties.
- It does not remember previous chats unless the application sends the history back or stores it in an external memory layer.
- It does not execute code, browse the web or read files unless a tool is wired up to do that on its behalf.
- It does not improve from your corrections unless someone fine-tunes it or the correction is fed back into context.
- It is not deterministic in the way ordinary software is, so tests must tolerate variation.
- A larger model is not automatically better for your task. Latency, cost, licence and domain fit often matter more than a benchmark gap.
- It has no concept of when its knowledge ends, so it will answer confidently about events after its training cutoff.
Capability and reliability are different things
Benchmarks measure capability on a fixed set of tasks. A model that scores well on a reasoning benchmark may still fail on your documents, because benchmarks are curated, clean and English-heavy while production inputs are messy and specific. Contamination makes the picture worse: public test sets leak into training corpora, so some scores reflect memorisation rather than skill.
Reliability is what a product needs, and it is measured differently. Sample a few hundred real inputs, define what a correct output looks like, and measure the rate. Then look at the failures. If a model is right ninety-five percent of the time on classification but wrong in a systematic way on one document type, that pattern matters more than the aggregate number. Run the same evaluation after every model or prompt change, because improvements on general benchmarks sometimes arrive with regressions on your narrow task.
Sizes and deployment shapes
Model size is a deployment decision as much as a quality decision. A 7B model fits on a single consumer GPU when quantised, runs cheaply, and handles drafting, extraction, summarisation and routine coding well. A 70B model needs serious hardware or a hosted endpoint, is noticeably stronger on multi-step reasoning and rare knowledge, and costs several times more per token. Frontier hosted models are larger still and are usually accessed through an API rather than owned.
The three common shapes are: a hosted API from a model provider, where you trade control and data residency for zero operations; a self-hosted open-weight model on your own GPUs, where you trade operational burden for control and predictable cost; and a hybrid, where routine traffic goes to a small self-hosted model and hard cases escalate to a frontier API. The hybrid is increasingly the default for products with meaningful volume, because most requests are easy and the cost difference between a small and a large model is an order of magnitude.
How to choose a model
- Measure on your own evaluation set first, then read public benchmarks as context rather than evidence.
- Check the licence for commercial use, redistribution and acceptable-use restrictions before you build a business on it.
- Price the full workload: input tokens, output tokens, retries, and the context you resend on every turn.
- Measure latency at the tail, not the median. A chat product feels the slowest request, not the average one.
- Confirm the context window you need after tokenising real documents, not after counting words.
- Check tool-calling and structured-output support if the workflow depends on them; the quality gap between models here is large.
- For self-hosting, verify the quantised variant you can afford, not the benchmark numbers from the full-precision release.
- Prefer a model you can replace. Keep prompts, evaluation sets and output parsing independent of one vendor's quirks.
From model to assistant
A base model that predicts tokens is not yet a product. Turning it into an assistant takes a system prompt that sets role and constraints, a chat template that formats turns correctly, and a decoding configuration. On top of that, most products add retrieval so the model can quote your documents, tool definitions so it can search or call an API, and a memory layer that stores facts between sessions, because the model itself does not.
This is why the same model can feel excellent in one product and poor in another. If retrieval returns irrelevant passages, the assistant will answer confidently from them. If the system prompt has accumulated a year of rules, the model will follow some and quietly ignore others. If the chat template is wrong, quality collapses in a way that looks like a bad model rather than a bad wrapper. Evaluate the whole assembly, and change one component at a time so you know what caused the difference.
The assembly also dominates cost. A system prompt of two thousand tokens is resent on every turn, so a long conversation pays for it dozens of times. Retrieval adds latency before the first token is generated. Conversation history grows until it is truncated or summarised. Teams that tune the prompt without watching token counts often find that the model was never the expensive part.
Key points
- An LLM is a next-token predictor; conversation is an application pattern on top of it.
- Parameters store compressed patterns, context carries the specifics of the current request.
- Pretraining, instruction tuning and preference optimisation produce different behaviours.
- Tokenisation, not word count, determines cost, limits and some surprising failure modes.
- Sampling settings change the character of output and belong in your test plan.
- Capability benchmarks do not transfer automatically; reliability has to be measured on your data.