Subscribe
AI
6 min read

What Is Entropy? The 1948 Math That Measures How Surprised an AI Is

Why one number follows every language model around Every time a language model chooses the next word, it is really doing something more mechanical: assigning a probability to each candidate in its vocabulary. Out of that table of probabilities comes a single summary number, and that number quietly decides most of what you experience. It is the loss the model was trained on. It is the dial behind whether sampling feels creative or rote. It is the signal researchers use to detect when a model is

What Is Entropy? The 1948 Math That Measures How Surprised an AI Is

Why one number follows every language model around

Every time a language model chooses the next word, it is really doing something more mechanical: assigning a probability to each candidate in its vocabulary. Out of that table of probabilities comes a single summary number, and that number quietly decides most of what you experience. It is the loss the model was trained on. It is the dial behind whether sampling feels creative or rote. It is the signal researchers use to detect when a model is making things up.

That number is entropy, and it predates large language models by decades. Claude Shannon defined it in 1948 in A Mathematical Theory of Communication, the Bell System Technical Journal paper that founded information theory. Shannon also coined the unit for it: the bit, a binary digit, the amount of information that resolves one yes-or-no choice.

Entropy is expected surprise

The logic starts with a single event. If something happens with probability p, its surprise is defined as log2(1/p) bits. A coin flip that lands heads is worth 1 bit: you needed exactly one yes/no question to predict it. An event certain to happen (p = 1) carries 0 bits of surprise, and the long shot you never expected carries many.

Entropy is what you get when you average that surprise over every possible outcome, weighted by its probability. For a distribution over outcomes x with probabilities p(x), it is H = -sum p(x) log2 p(x). Two anchors make it concrete. A perfectly predictable source, which always emits the same symbol, has entropy 0. A source that picks uniformly among 26 letters has entropy log2 26, about 4.7 bits, and no source over that alphabet can exceed it. Entropy measures how spread out a distribution is, and it is exactly the quantity Cover and Thomas spend the early chapters of Elements of Information Theory building intuition around. (The textbook also records the famous anecdote that von Neumann told Shannon to name the quantity entropy because nobody knows what entropy is, so in a debate you always have the advantage.)

Two clusters of flat bars on a cream ground: seven bars of equal height on the left, one dominant tall bar beside five short bars on the right

Real language sits between the two anchors. In 1951 Shannon ran a guessing game: human subjects tried to predict successive letters of English text, one to eight letters of context at a time. With statistical effects extending over about eight letters, he measured roughly 2.3 bits per letter, against the 4.7 bits an alphabet of 26 unrelated letters would demand. From longer-range games he estimated English could be as low as 0.6 to 1.3 bits per letter. The gap is redundancy: q without u, the Zipf-shaped frequency ladder, whole phrases that are nearly free. Every compression scheme, every guesser, and every language model is fighting against that floor.

Training an LLM is minimizing entropy

A language model outputs, at each step, a probability table over its roughly 100,000-token vocabulary. Training asks a simple question: did the model assign decent probability to the token that actually came next? The score for one step is the cross-entropy, the average surprise the model would feel under its own predictions against reality. Cross-entropy equals the true entropy of the data plus one extra term, the Kullback-Leibler divergence between the model and reality, so minimizing it is the closest a model can get to matching the distribution of human text. The loss-function explainer covers the mechanics; the point here is that the entropy of a language model is not a side metric. It is the objective.

The reporting habit follows from the same math. Perplexity is just entropy converted back into an effective branching factor: 2 to the power of the cross-entropy, the number of equally likely choices the model is equivalent to being stuck between. Language modeling has been graded this way since at least Bengio et al. 2003, whose neural model beat tuned n-gram systems by double-digit perplexity margins, and the Kaplan scaling laws paper showed this same loss falling as a clean power law in model size, data, and compute. In November 2026, OpenAI research chief Jakub Pachocki published the lab internal log-perplexity curve: GPT-3.5 at about 0.99 on its main evaluation dataset, GPT-4 at about 0.91, and newer models lower still. Perplexity, one transform away from entropy, is how frontier labs measure how far they have to go.

One caveat the number carries: entropy is per token, and tokens are not words. A different tokenizer splits the same text differently and produces different entropy readings, which is why cross-lab comparisons get sticky at low perplexity. The bits-per-byte explainer works through the unit problem.

Sampling, temperature, and the creativity dial

At inference, entropy is what the sampling controls manipulate. Divide the model's logits by a temperature above 1 and the distribution flattens: entropy rises, unlikely tokens get real weight, output wanders. Push temperature toward 0 and the distribution collapses toward its single most probable token, greedy decoding, which is repetitive and degenerates over long generations, the finding that motivated nucleus (top-p) sampling in the first place. Top-k, top-p, min-p and their cousins are all ways of clipping the tail of the same probability table, and their behavior is fundamentally about how much entropy you let the model keep per step, as laid out in the decoding-strategies explainer.

The quiet control knob elsewhere in the stack

Entropy shows up anywhere a model has to spread probability around, not just over text.

In Mixture-of-Experts networks, a router assigns each token to a few of many experts, and left alone it collapses onto favorites. The standard fix is an auxiliary loss that pushes the routing distribution back toward maximum entropy, i.e., uniform expert usage. The auxiliary-loss-free recipe used by Qwen and DeepSeek models keeps the same uniformity target but adjusts router biases without touching the gradient.

A slate-blue circle at top fanning seven arrows down to a row of six squares, with the thick arrows converging on one square while the others get thin single arrows

In reinforcement learning, maximum-entropy RL adds the policy's own entropy to the reward so the agent keeps exploring instead of locking onto the first adequate strategy. The same tension shows up in LLM reasoning training: a 2025 study of RL for reasoning models found policy entropy collapsing early in runs without intervention, and fit an empirical law in which downstream performance is directly traded against remaining entropy, R = -a e^H + b. Entropy is, in that reading, the fuel that limits how far post-training can push a model.

And entropy is now a lie detector. A model that knows an answer predicts it with low entropy across re-samplings; a model confabulating scatters its answers. The catch is that many phrasings mean one thing, so counting distinct strings overstates uncertainty. Semantic entropy, introduced by Farquhar, Kossen and colleagues in Nature in 2024, clusters sampled generations by meaning first and computes entropy over the clusters. It flags confabulations better than asking the model to self-check, with no task-specific training data, and generalizes to unseen question types. The idea traces back further than LLMs: Edwin Jaynes argued in 1957 that maximum entropy is the principled way to assign probabilities consistent with what you know, and nothing more.

What entropy does not tell you

Model entropy measures the model's uncertainty, not the truth. A confidently memorized wrong fact is a low-entropy hallucination, and that is exactly why the Nature method had to measure spread over meanings rather than raw token probabilities. Entropy also depends on the tokenization, so two models counting the same text in different units are not directly comparable; the n-gram lineage and the Markov chain explainer show how one step removes context and the next restores it, changing the entropy at every stage.

Used carefully, though, entropy answers a question no benchmark does: how much the model actually has left to say. Training loss tracks the distance to the entropy floor of human text. Temperature sets how much of the model's own uncertainty survives into your chat window. Post-training consumes entropy to get capability, and researchers now measure that spending directly. A 1948 quantity from telephone engineering turned out to be the ledger every language model keeps.

Sources

AILLMeducational