Debug Foundry

The model scores every next word at once. Something has to pick one.

Turn it, pause it, drag through the steps. Then move the temperature and roll the die yourself.

Not a video. A small simulation of decoding — raw scores become shares, shares become a strip of intervals, and one drawn number picks the token.

Drag to turn · scroll or pinch to zoom

Finished state of the sampling simulation

Candidates scored
6 at once

1/8First step sentence

    0.0s
    Replay the ending with
    Temperature
    T = 1.0
    One filter

    What it's for

    Good to know

    The bars here come from six declared, fixed toy logits — the complete toy candidate set, not a production vocabulary of tens of thousands. The order of operations is fixed and shown: temperature divides the logits first, softmax makes shares, an optional top-p cut keeps the smallest set of candidates covering 90% (including the token that crosses the threshold), the survivors are rescaled to sum to 1, and only then is u drawn. Greedy bypasses all of it: it is argmax, the cold limit as T shrinks — never a roll. Tied top scores would break toward the lower id; this toy never needs the rule. Temperature reshapes the decoder's distribution for fixed logits; it does not retrain the model, though the token it picks becomes context and changes the next step's scores.

    How it works, step by step

      Why the steps go in this order

      Before you rely on it

      A cut candidate is not impossible under the original distribution — the filter removes it and rescales the rest, and different filters or a different order change the result. Higher temperature is not universally more creative or more accurate; it approaches uniform over the unmasked candidates, no more. Real services' shares differ with the model version, settings and context, so the same prompt does not promise the same distribution. The six candidates, logits, shares and draws on this page are a declared toy; the mechanism is exactly as shown: stable softmax over z/T, one uniform draw, cumulative intervals that match the printed numbers.

      References