A language model answers without knowing whether the answer is correct. This apparent contradiction disappears once it becomes clear what actually happens internally: no database lookup, no searching for information, but a computation. The following five concepts are much more closely connected than they may seem at first glance.
Neural networks are mathematical functions with trainable weights
A neural network transforms input text into output text through millions of mathematical computations. Each computation multiplies input values by weights and adds bias values. The weights determine which input patterns lead to which output patterns—training adjusts these weights using example data.
Language models process text as sequences of numbers. Every word or word fragment is encoded as a unique number (token). The neural network calculates probabilities for every possible next token. The token with the highest probability is generated, and this process repeats until a stop signal is produced.
What self-attention actually computes
Modern Transformer models use self-attention mechanisms that relate every token to all previous tokens. As a simplified illustration, consider the sentence “The bank by the river was flooded.” For the word “bank,” the model computes an attention weight relative to every other word in the sentence. “River” receives a high weight, and so does “flooded”—both words contribute to the meaning of “bank,” steering the interpretation away from “financial institution” toward “riverbank.”
This weighting is not hard-coded but is itself the result of training. The model has learned that words such as “river” and “flooded” shift the meaning of “bank” in a particular way because this combination frequently appeared in similar contexts during training. This mechanism—deriving meaning from relationships between tokens rather than from an individual token alone—is what enables contextual understanding across long sequences of text.
Parameters are trainable numerical values within a neural network
The designation “2B” or “8B” refers to the number of billions of parameters in the model. A parameter is a single trainable numerical value—a 2-billion-parameter model contains 2,000,000,000 individually trained values. These parameters store the model’s entire “knowledge” in numerical form.
Why parameters are not a dictionary
A common misconception is that parameters store sentences, facts, or definitions as retrievable entries. When generating an answer, a model does not search a table of stored responses—there is no row that says “Capital of France → Paris.”
Instead, parameters encode statistical relationships between tokens, distributed across millions of weights simultaneously. After training, the word “Paris” has a high computed probability of following “The capital of France is” not because it was stored in one specific location, but because this sequence has been distributed across countless weights throughout the entire network. An individual parameter carries no recognizable meaning by itself—only the interaction of all parameters produces a meaningful prediction.
What more parameters actually change
More parameters do not mean “more stored knowledge” in the sense of more facts. They mean greater capacity to distinguish between similar patterns. A smaller model must simplify technical terms, relationships, or grammatical rules more aggressively because fewer weights are available to represent nuances. A larger model can represent finer distinctions between similar but not identical concepts in its weights—for example, the difference between technically precise terminology and an approximate everyday expression.
This additional capacity comes at a cost: every parameter must participate in every computation. More parameters mean proportionally more computation for every generated token. The relationship between model size and language capability is therefore not a pure gain but a trade-off.
Training adjusts parameters using example data
Training presents the model with millions of text examples and adjusts its parameters so that correct predictions become more likely. The model sees the beginning of a text and attempts to predict the next word. Incorrect predictions lead to parameter adjustments that improve that prediction the next time.
The training process requires massive computational resources and typically runs on GPU clusters for weeks or months. Base models learn general language knowledge from internet text, books, and code repositories.
Why simple prediction becomes meaningful responses
At first glance, the training task sounds trivial: predict the next word. That this produces a system capable of answering questions, writing code, or summarizing text does not initially seem inevitable.
The reason lies in the sheer volume and diversity of examples. To correctly predict the next word in an explanation, a dialogue, or a set of instructions, the model must implicitly capture the structure of these types of text: how a dialogue is organized, how an explanation progresses logically, how code remains syntactically valid, and how a question is typically answered. The prediction task itself is simple to formulate, but the amount of structure required to solve it reliably is not. Meaningful responses are a byproduct of highly accurate text prediction, not the direct objective of training.
This also explains why training data influences quality more strongly than model size alone: a large model trained on biased or flawed data learns those patterns just as reliably as a small model trained on clean data—only with greater capacity to reinforce them. The number of parameters determines the capacity to learn; the training data determines what is learned.
Fine-tuning further adapts a pre-trained model to specific tasks or styles. Instead of billions of examples, thousands of specialized examples are used. The general knowledge acquired during base training remains largely intact, while the model’s response behavior shifts in a particular direction.
Inference generates responses without further parameter changes
After training, the parameters are fixed—the model can no longer learn new information. Inference uses the trained parameters to generate new text without modifying the model. Every generated response passes through all layers of the neural network without any training taking place.
Generation stops when special end-of-sequence tokens or configured length limits are reached. Each token is generated individually based on all previous tokens in the context—including the tokens already generated as part of the current response.
Why the same question can receive different answers
At every generation step, the model computes a probability distribution over all possible next tokens—not just a single most likely candidate. In many cases, several tokens have very similar probabilities. As a simplified illustration, the candidates for the next word at the beginning of a sentence might be distributed as follows: “The” with 34 percent, “This” with 29 percent, and “A” with 18 percent. Which token is ultimately selected depends on the configured sampling method—more on that in the article about prompts.
The important point for understanding the fundamentals is this: two requests with identical wording can therefore produce different (but still plausible) answers whenever the sampling method is not configured to be deterministic. This is not a flaw in the system but a direct consequence of selecting tokens from a computed probability distribution—the same distribution can produce multiple plausible continuations.
A second effect follows from this: because every token is calculated based on the tokens already generated, an early decision influences the rest of the response. If the first generated word leads in a particular direction, the remainder of the response follows that path. A different first word would have produced a different, but equally coherent, continuation.
Language models hallucinate because they generate probabilities instead of retrieving facts
Language models have no conceptual understanding of truth or facts. The model computes which token is statistically most likely to follow the current context. A high probability does not mean the information is correct—it only means that it frequently occurred together in the training data.
Hallucinations occur when the model generates information that sounds plausible but is factually incorrect. The mathematical structure produces coherent text regardless of its factual accuracy.
Why an incorrect answer can still sound convincing
The model generates every token according to the same rules, regardless of whether the sentence generated so far is factually correct or not. There is no internal mechanism that recognizes an incorrect statement once it has begun and then changes the tone accordingly or qualifies it. Linguistic confidence and factual correctness are two separate properties of the generated text—the model consistently optimizes for linguistic coherence, not for truthfulness. A confident, authoritative tone is therefore not a reliable indicator of correctness.
This is directly related to the effect described earlier: once the generation process has committed to an incorrect fact—such as an invented name or an incorrect year—every subsequent token consistently follows that path because it is computed based on the already generated (incorrect) context. The consistency of the text creates the impression of reliability where none exists.
Smaller models tend to hallucinate more frequently than larger models for the same reason they are generally less precise: fewer parameters mean less capacity to distinguish rare but correct patterns from common but inappropriate ones.
The context window limits the amount of usable input
Every model has a maximum context window that limits the number of tokens it can process simultaneously. A 4K-token context window can process approximately 3,000 words—longer inputs are truncated or divided into smaller segments. All computations are based exclusively on the tokens that fit within the context window.
The model completely “forgets” information outside the context window—not gradually or approximately, but entirely and without transition. Chat systems resend the complete conversation history with every new message. Once the conversation reaches the context window limit, the oldest messages are removed without the model itself noticing that this information has been lost.
Why larger context windows cannot simply be added later
As described above, self-attention relates every token to every other token within the context window. If the window size doubles, the computational effort required for these pairwise comparisons increases by a factor of four—the relationship is quadratic, not linear. A context window of 32,000 tokens therefore requires far more than twice the computational power of an 8,000-token window. A larger context window is therefore not merely a configuration option but is directly tied to the available computational resources—the same trade-off between capacity and computational cost that already appears with the number of parameters.
How everything fits together
The five concepts are closely interconnected: a neural network consists of parameters that are adjusted using example data during training. Inference uses these fixed parameters to calculate a response one token at a time, while the context window limits how much previous text the model can consider during that process. Hallucinations are not a separate malfunction but a direct consequence of inference always extending probabilities, regardless of whether the current context is factually correct.
These concepts apply regardless of which software is later used to run a model. The following articles in this series build on this foundation: Local Models covers memory requirements and quantization, while Prompts explains temperature, sampling methods, and instruction processing.