Are all AIs just predictive number generators?

Question

Are all AIs just predictive number generators?

The die is real, loaded by training and managed by the product, and the phrase hides the interesting part


The short answer

This question was asked by my colleague, MAJ Taylor Wulff-Morrison, USMC. It is a great question because, in short, no, they are not all just predictive number generators — but some actually are. I'm going to walk through the nuances below so that you can put your finger on the exact step where chance enters one of these things, switch it off in your head, and say which kinds of AI have no die in them anywhere. A chat model, an image model and a speech model each end in a number generator. What the phrase hides is everything that had to be built to load it.

There are three steps in the box: the layers compute a score for every candidate word, softmax turns those scores into shares, and a sampler picks one. Chance enters only at the last step. Nothing below needs math past arithmetic, and every term is introduced before it is used.

Tokens in, numbers out: the box is deterministic

Start with what happens when you press send. Your text is chopped into tokens, each token is looked up as a list of numbers called its embedding, and those numbers pass through a long stack of multiplications and additions. Between those linear layers sit nonlinear operations, and they are the reason a deep stack can do more than a single multiplication could. Out the far end comes one score for every entry in the model's vocabulary: a number saying how well each candidate fits as the next token.

A left-to-right pipeline of seven boxes: your tokens, embeddings, many layers of arithmetic, one score per word (logits), softmax, sampler, next token. A line above the first five boxes, ending at softmax, is labeled 'deterministic: same input, same numbers'. An amber marker points up at the softmax box, labeled 'probabilities computed here'. A red marker points up at the sampler box, labeled 'chance enters here', with 'one uniform draw' noted above it.
One red mark, and only one. The bracket runs all the way through softmax. The probabilities are computed there, by arithmetic that gives the same answer every time. The single red mark is the sampler, and it is the whole of the randomness.

Probability is computed at softmax; chance enters at the sampler. The rest of the chapter hangs on that sentence. Everything up to and including softmax is a deterministic function. Feed the same tokens in twice and the same scores, and the same shares, come out twice, to the last digit. No dice-rolling inside the layers, no noise generator, no coin.

The bends still matter. Without them a stack of linear layers collapses into a single linear layer, and the whole deep network could do no more than one multiplication can. That is why they are in there, and it is a question of its own: why are the nonlinear operations the magic? People get one thing backward here. Those curves let the network bend, and they are deterministic while they do it. They are not the source of the randomness.

A small wide plot with 'value in' running from minus 3 to 3 along the bottom and 'value out' from 0 to 3 up the side. Two curves are drawn. ReLU is flat at zero for negative inputs and then rises as a straight diagonal line. GELU follows almost the same path, dipping slightly below zero just left of the origin before joining the same diagonal.
Two curves. Each one is a single line. For any input there is one output, and reading it twice gives the same answer twice.

Scores become shares: softmax

The scores arrive with no randomness in them. Each raw score has a name: a logit. They can be any size, positive or negative, and they do not add up to anything in particular. To treat them as chances we turn them into shares of one whole.

For the rest of this chapter, pretend the entire vocabulary is three tokens. The context is "The cat sat on the" and the candidates are mat, floor and dragon, with logits 2.0, 1.0 and −1.0. Real models weigh fifty thousand candidates at once; three is the same arithmetic, checkable by hand.

The recipe is called softmax, and it has two steps. First, raise the number $e$ (about 2.718) to the power of each score, which turns any score, however negative, into a positive number, and a bigger score into a bigger number. Second, divide each of those by their total, so the results add up to one. The share of a candidate is written $p(\text{candidate})$.

Three candidates, all the arithmetic

Step one, raising $e$ to each score: $e^{2.0} = 7.389$, $e^{1.0} = 2.718$, and $e^{-1.0} = 0.368$. The negative score did not become a negative number. It became a small positive one. Their total is $7.389 + 2.718 + 0.368 = 10.475$.

Step two, divide each by that total:

$$p(\text{mat}) = \frac{7.389}{10.475} = 0.705 \qquad p(\text{floor}) = \frac{2.718}{10.475} = 0.259 \qquad p(\text{dragon}) = \frac{0.368}{10.475} = 0.035$$

In words: mat takes seventy and a half percent of the belief, floor about twenty-six percent, and dragon keeps three and a half percent. They add to 0.999, which is 1.000 with the rounding put back. That is a probability distribution, and it is the first point in the pipeline where anything deserves the word "probability."

One property tells you what the scores mean. Add 10 to every logit and the shares do not move: 12, 11 and 9 give 0.705, 0.259 and 0.035 again. Only the gaps carry information, and a score one point above its neighbor is $e$ times more likely, about 2.7 to 1. For a slower treatment of this step, see The Prediction Game.

Shares become one pick: the die and the CDF

Three shares, and the model needs one word. This is the step people mean by "number generator," and almost nobody gets shown it.

Lay the three shares end to end along a strip running from 0 to 1. Mat gets 0 to 0.705. Floor starts where mat stopped and runs to $0.705 + 0.259 = 0.964$. Dragon takes the last sliver, 0.964 to 1.000. Those cut points, 0.705, 0.964 and 1.000, are the cumulative distribution, usually shortened to CDF. It is a running total, and it is what makes the strip possible: each candidate owns a piece of the line as wide as its share.

Then the machine asks its computer for a uniform draw, written $u$: a value between 0 and 1 with every part of the range equally likely. Whichever stretch $u$ lands in wins. Said as a rule: walk the running totals from the left and take the first candidate whose total is bigger than $u$. The running total is what makes this work. It turns three widths into three cut points that a single number can be compared against.

Three rolls on the same strip

$u = 0.31$. That is below 0.705, so it is still inside mat's stretch. The answer is mat.

$u = 0.80$. Past 0.705, not yet 0.964, so it is inside floor's stretch. The answer is floor.

$u = 0.97$. Past 0.964. The answer is dragon. The cat sat on the dragon.

In words: because $u$ is equally likely to land anywhere on the line, each candidate wins as often as its share is wide. Mat wins about seven times in ten. Dragon wins about once in twenty-nine, which is rare and is not never. The third roll above is there to show the tail is real.

Probability is computed at softmax; chance enters at the sampler, and that one uniform draw is the only random number in the reply. One draw per token, and everything else is fixed arithmetic. A thousand tokens is a thousand rolls, about seven hundred words of English, each roll on a die whose faces were computed fresh for it.

The off switch: temperature, and T = 0

Before softmax divides, the scores pass one dial: temperature, written $T$. Divide every score by $T$, then run softmax as before. Small $T$ stretches the gaps and sharpens the result; large $T$ shrinks them and flattens it.

$$p_i = \frac{e^{z_i / T}}{\sum_j e^{z_j / T}}$$

In words: divide candidate $i$'s score by the temperature, raise $e$ to that, and divide by the same quantity summed over every candidate. The symbol $\sum_j$ is just "add this up over all the candidates," and $z$ is the score we called a logit.

The same three scores (2.0, 1.0, −1.0) at five temperatures. Spread is measured in bits, explained in the next section.
Temperature $T$matfloordragonSpread
0.5 (cold)0.8790.1190.0020.55 bits
1 (as scored)0.7050.2590.0351.03 bits
2 (warm)0.5470.3310.1221.37 bits
heading to 01000 bits
heading to infinity⅓⅓⅓1.58 bits

Read the bottom row again, because it answers the question in the title. As $T$ heads to zero, softmax collapses onto the single highest score, the argmax. The die becomes a strip with one stretch in it, from 0 to 1, belonging to mat. Wherever the draw lands, mat wins, and the sampler has turned into a lookup. Same input, same output, every time. So "is it random?" is a setting you choose. The weights never changed; the die was trimmed to one face.

That is the off switch. The rest is management. The product sets $T$ for you: chat assistants run warm, code completion and extraction run cold. It also trims the tail before rolling, keeping only the few highest candidates (top-k) or the shortest leading group whose shares reach a set total such as 0.9 (top-p). Training loads the die, the serving software trims it, and only then is it rolled. For the desk version of these settings see How the model decides, and for a slower treatment of chance itself, Chance and Choice.

See it move

Watch (18:24): what to notice — the box being built piece by piece and the same three scores coming out of it twice, then the shares folding into one strip from 0 to 1, then the marker landing on dragon at 0.97, and finally the dial going to zero and five draws in a row giving the same word.

Why keep the randomness at all?

If it can be switched off, why is it on? Because of what the die looks like, which depends entirely on the context.

Two bar charts side by side, both measuring share of the next-token die from 0 to 1. The left chart, under the context 'The capital of France is', has one tall bar at Paris of 0.98 and two almost invisible bars at Lyon and other of 0.01 each; it is marked spread 0.16 bits. The right chart, under the context 'My favorite color is', has five moderate bars of 0.30, 0.25, 0.20, 0.15 and 0.10; it is marked spread 2.23 bits.
Same machine, two contexts. The die is nearly certain where the language has one right continuation, and spread where the language is free. Nobody adjusted a setting between these two pictures.

Those two numbers under the charts are entropy, in bits. One bit is one fair coin's worth of not-knowing. Near zero means nearly certain; bigger means undecided. The next chapter is about that number; here it is a label for what your eye already sees.

The randomness lives where the language is free. Where there is one right answer, training has loaded the die so heavily that the roll barely matters: Paris wins ninety-eight times in a hundred. Nobody set that per question; it fell out of the training text saying Paris over and over.

Three reasons to leave the die rolling. First, most of language has many right continuations, and a machine insisting on one would be lying about it. Second, a model pinned at $T = 0$ degenerates. It finds a phrasing it likes, and because that phrasing is now in the context, the pattern-copying machinery inside makes it the top-scoring continuation again:

The plan is to improve readiness. The plan is to improve readiness.
The plan is to improve readiness. The plan is to improve readiness.

Every one of those words was the most likely token given everything before it, which is the problem. A little warmth breaks the cycle on the first roll. Third, a warm die is why asking for three drafts gives you three drafts instead of the same paragraph three times. The reason to turn it down is the opposite one: facts, code, extraction, anything where "different each time" is a defect.

"Number generator" says nothing about what was built

"Predicts the next token" describes the exam the model was graded on and the shape of its output. It says nothing about what the network had to build to pass that exam.

Two examples. To predict the closing bracket in a page of code, something in there is keeping count of how many are open. To predict "she" rather than "he" three sentences after a name, something is tracking who is being talked about. Neither is a lookup. Both are structure that prediction pressure forced into existence, because there was no other way to score well.

This has been opened up and measured. Researchers at Anthropic described induction heads: small circuits that spot a repeat of something earlier in the context and copy what came after it. That is a large part of how a model learns a pattern from your prompt on the fly (Olsson et al., In-context Learning and Induction Heads, Transformer Circuits Thread, 2022). A team led from Harvard trained a model on nothing but lists of Othello moves, with no board, no rules and no pictures. They then read a picture of the board out of the model's internal numbers, and edited that picture to change the moves it proposed (Li et al., Emergent World Representations, ICLR 2023).

One analogy, then I will stop. You could describe a sonar operator as "someone who classifies waveforms." That is the whole job description, and it tells you nothing about what they had to learn to do it.

The phrase hides a second thing. These models are not archives of numbers to be queried. The weights encode how language connects, words to phrases to sentences to ideas, and facts fall out of that compression as a side effect, produced by the same sampling step as everything else. Recall is generation. Nothing is looked up.

The other AIs

Back to the first word of the question: all. Plenty of working AI has no learned distribution in it anywhere, and some has its chance somewhere else entirely.

Where the chance sits, by kind of system
KindWhat it computesWhere the chance isYou have met it
Search and planningA best path or schedule under hard constraintsNoneRoute planners, delivery scheduling
Solvers and proversAn assignment that satisfies every stated ruleNone, unless random restarts are usedCrew rostering, chip verification
Rule-based expert systemsConclusions from written-down rulesNoneTax software, triage checklists
Trained classifiersOne label, or a probability plus a cutoffTraining only; answering is fixedSpam filters, credit scoring
Reinforcement learning with searchA move, chosen by a tree search a network guidesExploration during self-play; the played move is the most-visited oneChess and Go engines
Evolutionary methodsA good design found by mutate-and-selectIn the search, not in reading out the answerAntenna and wing shape optimization
Diffusion image modelsThe noise to subtract, as a list of numbersIn the sampler, which can be made repeatableImage generators
Bayesian methodsA distribution, on purpose, as the answerProbability is the representation, not a defectForecast cones, sensor fusion
A two-by-two map. The horizontal axis is 'chance when it answers you', running from none to a lot; the vertical axis is 'chance while it was built', running from none to a lot. In the bottom-left quadrant sit route planner, rule-based expert system, and Bayesian model, which answers with a distribution. Bottom-right: solver with random restarts. Top-left: trained classifier, evolutionary search, AlphaZero-style play, and chat model at T equals 0. Top-right: diffusion image model and chat model at T equals 1.
Two different questions. The left-hand column is the large one. Most working AI has no chance in it at the moment it answers you, whatever went on while it was built.

The same chat model appears twice, once in each column, separated only by a setting.

Where the description bites

The phrase is unfair about what was built, and right about one thing: a next-token predictor has no built-in notion of truth, only of plausibility under its training text. Fluent and false score the same at the draw.

That is the root of hallucination, of telling you what you wanted to hear (sycophancy), and of the confident fabricated citation. It is a big enough subject for its own chapter: Why It Makes Things Up, with the desk version in Trust and limits.

What you now know

  • Everything from your tokens to the raw scores is fixed arithmetic: same input, same scores, every time.
  • Probability is computed at softmax, which is arithmetic with a temperature dial and no chance in it; chance enters at the sampler, and nowhere else.
  • The sampler stacks the shares along a strip from 0 to 1 using their running totals and takes whichever stretch one uniform draw lands in. That is one draw per token, and it is the only random number in the reply.
  • Setting the temperature to zero collapses the die onto the highest-scoring candidate, which makes the whole system deterministic. Whether it is random is a setting you choose.
  • The randomness is managed: training loads the die nearly certain wherever the language has one right continuation, and the product trims the tail before rolling.
  • "Predicts the next token" names the objective and the output, and says nothing about the mechanism. The model is a language processor rather than an archive, and recall comes out of the same draw as everything else.
  • Most AI is not this at all: planners, solvers, rule systems and trained classifiers answer with no chance in them anywhere.

Where we're headed

If you can say that in your own words, you can answer the question at the top: it is a die, loaded by training and trimmed by the product, and the interesting object is whatever loaded it. One word slipped past. I put "0.16 bits" and "2.23 bits" under two pictures, called it spread, and moved on. That word, entropy, is borrowed from thermodynamics, and so is "temperature," and so is "diffusion." Three borrowed words in one field is either sloppy marketing or one idea showing up three times. The next question is which. They are the same equations, borrowed three times.