The Improviser · Lesson 6 — The Maths ← Course
optional · the maths

Why a guess always comes out.

The phantom note isn't a glitch. It falls straight out of the same softmax you met in Lesson 5 — here's the arithmetic that guarantees it.

Every step, the model turns its raw scores — logits — into probabilities with softmax, then picks. The catch: softmax divides by the total, so the numbers always add up to 1. There is no "none of these" option. When the model truly knows, one note takes almost all of that 1 — a tall, lonely spike. When it doesn't, the same 1 gets smeared thinly across many notes, and the tallest still wins, on maybe 20%. That low, hollow winner is a hallucination in numbers.

Two traps follow. First, the winning height is the model's confidence, not its correctness — the two are only loosely linked, so a wrong note can still stand tall. Second, temperature (Lesson 5) reshapes how peaked the curve is, but never changes which note tops it. Cool a wrong answer down and you haven't fixed it — you've only made it sound more certain.

Flip between a note the model learned, one it never did, and the same unknown with the chart in context — then drag temperature and watch what it can and can't change.

Same softmax, three situations. Watch where the probability goes.
1.0

The three lines of maths.

Nothing new since Lesson 5 — the same softmax, read for what it says about knowing and not knowing.

1 · Softmax always sums to 1
Whatever the logits are, the probabilities are forced to total one. So a pick always exists — even when nothing deserves to win.
pi = e(zi / T) / Σj e(zj / T)
zi the logit for note i · T temperature · Σ the sum over every candidate — the divisor that forces the total to 1.
the phantomFlat logits → every pi near 1/5 = 0.2. The tallest still wins, on ~20%. Nothing earned it, but softmax hands you a winner anyway.
2 · Confidence is the top bar, not the truth
The model's "confidence" is just the height of the winning probability. It measures how peaked the guess is — not whether it's right. The two are only loosely calibrated.
confidence = maxi pi
A tall bar can sit on a wrong note. High confidence means "one option dominates the others", never "this is correct".
why it fools youA fabricated note can carry a 0.85 — reading every bit as sure as a true 0.85. Tone and height tell you nothing about truth.
3 · Temperature can't move the winner
Dividing every logit by T sharpens or flattens the curve, but the largest logit stays largest. The argmax is fixed — cooling only changes how certain the same pick looks.
argmaxi (zi / T) = argmaxi zi
Lower T → the top bar climbs toward 1.0. But if that top bar is the wrong note, low T just makes the wrong note look more certain.
the real cureOnly changing the logits — feeding the model the actual chart — moves mass onto the right note. That's retrieval, the next lesson.

The phantom is baked into the pick.

A model has no way to answer "none of these". Softmax spends its whole budget of 1 every single step, so when the truth is absent, the budget lands on the least-bad impostor — confidently, because confidence is only ever the top bar's height. That's the phantom note, straight from the equation.

And notice what does not help: temperature can sharpen the curve but never moves the winner, so it can't rescue a wrong pick. The only lever that reshapes the logits themselves is grounding — putting the real material in context — which is exactly why retrieval, next, is the true cure.

Go deeper — calibration, and the "I don't know" that isn't there optional

What calibration means

A model is well-calibrated if, across all the times it says 0.7, it's right about 70% of the time. Real models drift from this — often overconfident, sometimes on exactly the questions they should be least sure about. So you can't read the top probability as a probability of being correct; it's a rough, uncalibrated proxy at best.

There is no abstain token

Softmax runs over the vocabulary of notes the model can play. "I don't actually know" is not one of them, so the distribution can never place its mass there. Letting the model say "not sure" works by adding that option back into the space of things it's allowed to output — giving the probability somewhere honest to go.

Why grounding beats every dial

Temperature, top-k and top-p all operate on a distribution that's already wrong when the answer is missing — they trim or reshape it, but the correct note simply isn't in there to be found. Retrieval changes the logits at the source by putting the real text in the context, so the right note finally has the score to win. Different lever, real fix.