The Confident Machine

An interactive AI explainable · VISxAI at IEEE VIS 2026

Contents

Part I: Foundations · Page 3 of 14

Rolling the Dice

A language model samples from a probability distribution at every step. Before sampling, decoding settings can change how concentrated those probabilities are and how many tokens remain available to be chosen.

Two common controls are temperature, which reshapes the distribution, and top-k / top-p, which narrow the candidate pool.

Shaping the distribution

Sometimes one or two tokens dominate; other times probability is spread across many alternatives. Lower temperatures concentrate more probability on the leading tokens. Higher temperatures flatten the distribution, giving lower-ranked alternatives more weight.

Move the slider to reshape the same recorded next-token distribution. The bars show the leading candidates; Other represents the rest of the vocabulary.

Loading recorded question...

More concentratedMore spread out
Next tokenProbability
Other
0.00%

Loading recorded probabilities...

Prototype · Qwen2.5-3B-Instruct · TruthfulQA

In this recorded example, increasing temperature from 1.0 to 1.5 reduces the leading token's probability from 18.4% to 6.7%, spreading more probability across the remaining vocabulary.

Small choices add up

Generation repeats this process token after token. Changing the distribution can alter the sampled token, which becomes context for every step that follows. Across a full response, those differences accumulate. We examined this with five creative prompts at ten temperatures, with five runs at each setting.

Choose a prompt and compare recorded responses at low, moderate, and higher temperature. Show another set cycles through the five runs.

Set 1 of 5 · repetition 1 in every column

Loading recorded responses...

Recorded · Qwen2.5-3B-Instruct · creative prompts

Across our runs, lower temperatures often repeated similar wording and structure. Higher temperatures produced a wider range of continuations, and the highest settings sometimes produced less coherent text. The point where this happened varied by prompt.

Experiment note: The model outputs and token probabilities shown on this page were generated and recorded by us using Qwen2.5-3B-Instruct. TruthfulQA supplies the factual questions; the creative prompts were used for our separate temperature experiment.

Implementation note

TruthfulQA collection: 50 fixed random questions, 10 runs each, temperature 1.0, full-vocabulary sampling. The token example uses all 151,936 recorded logits at the first answer position of the selected question, with an empty assistant prefix and the official Qwen chat template. Model revision: .

Temperature applies softmax(logits / T): p_i = exp(z_i / T) / sum_j exp(z_j / T). Both token charts use the same recorded logits, with independent temperature sliders. The filtering chart applies its own temperature, either top-k or top-p, then renormalizes before local weighted sampling. Top-p includes the token crossing the threshold. Other is an aggregate whose surviving tokens are sampled individually. Local draws produce one token.

Whole-response experiment: our five creative prompts, ten temperatures from 0.2 to 2.0, five repetitions each. The comparison displays 0.4, 0.8 and 1.2. Each column is a separate generation using the same repetition index and paired seed across temperatures; columns are statistically paired. Prompt and model stay fixed, with no top-k or top-p filtering. All outputs remain in the collection, including malformed ones.

EOS means the model emitted an end token. Token cap means recording stopped at 192 generated tokens. Neither assesses quality. Word counts split on whitespace; the 60-90 range applies only to prompts requesting it. Cards clip long text for layout; Show full response reveals the unchanged output.

The aggregate bars calculate top-p survivor counts from each of the 50 recorded first-answer distributions. Every context has equal weight; each bar totals 100%. Categories are 1, 2-5, 6-20 and 21+ tokens. These are recalculations from logits, with no simulated generations.

Narrowing the candidate pool

Temperature changes relative probabilities while many tokens remain possible. Filtering reduces that choice set: top-k keeps a fixed number of the highest-probability tokens;[4] top-p keeps as many leading tokens as needed to reach a chosen cumulative probability.[5]

Choose top-k or top-p and adjust its setting. Removed tokens fade out. Rescale the surviving probabilities to 100%, then sample from the resulting distribution.

Loading recorded question...

More concentratedMore spread out
Next tokenProbability
Other
Removed

Loading recorded probabilities...

Qwen2.5-3B-Instruct

With top-k = 5 and temperature 1.0 in this recorded distribution, the surviving tokens originally contain 41.7% of the probability mass. After rescaling, those same five tokens make up the full sampling distribution.

One threshold, different candidate pools

Top-p depends on cumulative probability, so the number of tokens it retains depends on how spread out the distribution is. Temperature therefore affects how many tokens are needed to reach the same threshold.

Move the top-p slider to compare the same 50 recorded contexts at three temperatures.

Same threshold, different candidate pools

T=0.5
T=1.0
T=1.5
  • 1 token
  • 2–5 tokens
  • 6–20 tokens
  • 21+ tokens

At top-p = 0.90, 38 of 50 contexts at temperature 0.5 need only one token to reach the threshold. At temperature 1.5, that drops to 9 of 50. Flatter distributions require larger candidate pools to reach the same cumulative probability.