The Confident MachinePre-print

Part I: Foundations · Page 3 of 14

Rolling the Dice

Turning a ranked list of candidate tokens into one actual token is sampling. How boldly it plays the odds is governed by a single parameter: temperature.

Temperature

Temperature rescales the gaps between candidate scores before sampling, dividing every logit by TT, then taking softmax. As T0T \to 0, probability mass collapses onto the single highest-scoring candidate; as TT grows past 1, the gaps shrink and more of the list becomes reachable.

Live · temperature sampling
ReadyGoogle·
Prompt

Describe a quiet street at night when something unexpected happens.

Low temperature

T 0.30

Click Generate to see this temperature’s output.

Your temperature

T 1.00

Click Generate to see this temperature’s output.

High temperature

T 1.70

Click Generate to see this temperature’s output.

Live: each panel is a real call to Gemini at its own temperature.

Same prompt, three temperatures: two fixed, one yours. Each panel is its own live generation.

The formula

pi=ezi/Tjezj/Tp_i = \frac{e^{z_i / T}}{\sum_j e^{z_j / T}}

ziz_i is candidate ii's raw score. Temperature TT changes the contrast between scores before softmax. A lower TT enlarges the gaps, making the leading candidate more dominant, while a higher TT compresses them, giving alternatives more probability. The exponential converts the adjusted scores into positive weights, and the denominator scales those weights so the final probabilities sum to 1.

Temperature isn't the only rule

Two more parameters trim the candidate list before sampling, rather than reweighting it. Top-k keeps only the kk most likely candidates.[4] Top-p (nucleus sampling) keeps the smallest set whose probabilities sum to pp, so the cutoff shrinks when the model is confident and widens when it's unsure.[5]

Live · top-k vs. top-p
ReadyGoogle·

She opened the letter she’d been avoiding all month and read that

TemperatureT 1.00
predictablevaried

Top-k (k=3)

Top-kk=3
narrowwide

Click Generate to see this rule diverge.

Top-p (p=0.75)

Top-pp=0.75
narrowwide

Click Generate to see this rule diverge.

Live, but self-reported: each step's logit is Gemini's own confidence estimate.

Same shared distribution at each step, two cutoff rules. Struck-through candidates are excluded before sampling.

A fixed kk can't tell confidence from a toss-up, so it drags along implausible candidates when the model is certain and excludes near-equal options when it isn't. Top-p adapts to how peaked the distribution actually is at each step.

The limit of decoding

Temperature, top-k, and top-p all reshape a distribution the model already computed. None can introduce a candidate that wasn't already assigned probability, or correct a distribution that was wrong to begin with, since decoding only selects among existing candidates and never evaluates whether any of them are true.