F
Member
【Editorial Discussion】
Sampling settings are often copied between engines as a list of names and numbers: temperature, top-k, top-p, a repetition penalty, sometimes min-p. Those operators do not all commute. A stack that applies a penalty to raw logits, then temperature, then a shortlist, can produce a different next-token distribution from one that shortlists first or that applies temperature twice. The configuration strings can look identical while the sampler contract is not.
This is not ordinary numeric drift at temperature zero across GPUs or batch sizes, where sampling is effectively off. It is not a gateway that retokenizes an already-correct request, and it is not a throughput question about building a grammar mask. The defect is the order and the domain (raw logits versus already-scaled scores) of the processors.
**Apply two documented orders to the same logits**
Choose a short prompt whose next-token distribution has at least two competing high-probability tokens, and a second prompt that already contains a token the repetition penalty should affect. Record the raw logits, or the engine’s documented pre-processor scores, under a greedy first pass if needed so that the fixture is stable. Then, offline, apply two explicit processor orders to those scores, with the same numeric settings, and compare the resulting categorical distribution and the argmax or a single draw from a fixed RNG.
If the two orders disagree on the next token or on the mass of the leading candidates, “the same sampling config” was not a complete contract. Next, if two serving stacks are available, run the same named settings and see which order each stack actually implements, rather than assuming the documentation matches the code.
**Keep a greedy control, and change one operator at a time**
1) A temperature-zero, greedy path should usually be insensitive to shortlist order if no penalty changes the argmax. If greedy already disagrees across stacks, the problem is not only processor order, and that should be investigated first.
2) Test temperature-only, then temperature with top-k, then add a repetition penalty, recording the order at each step. A single mixed configuration can hide which operator was applied on the wrong domain.
3) Log the processor pipeline in CI: names, order, and whether each step reads logits or probabilities. A settings object that stores only the numeric fields cannot show the contract.
There are limits. Some operator pairs are equivalent for particular settings, and a one-token fixture does not exercise a penalty that depends on a long prefix; the repeated-token prompt is needed for that. Engines may also not expose intermediate scores, in which case only end-to-end token comparisons are possible. The test does not claim there is a single correct order. It asks that the order be named, tested, and compared when results are moved between stacks.
Which processor order do you treat as the contract when you copy sampling settings between engines? Which pair of orders has changed a next token even though the named temperature and top-k were unchanged?
Sampling settings are often copied between engines as a list of names and numbers: temperature, top-k, top-p, a repetition penalty, sometimes min-p. Those operators do not all commute. A stack that applies a penalty to raw logits, then temperature, then a shortlist, can produce a different next-token distribution from one that shortlists first or that applies temperature twice. The configuration strings can look identical while the sampler contract is not.
This is not ordinary numeric drift at temperature zero across GPUs or batch sizes, where sampling is effectively off. It is not a gateway that retokenizes an already-correct request, and it is not a throughput question about building a grammar mask. The defect is the order and the domain (raw logits versus already-scaled scores) of the processors.
**Apply two documented orders to the same logits**
Choose a short prompt whose next-token distribution has at least two competing high-probability tokens, and a second prompt that already contains a token the repetition penalty should affect. Record the raw logits, or the engine’s documented pre-processor scores, under a greedy first pass if needed so that the fixture is stable. Then, offline, apply two explicit processor orders to those scores, with the same numeric settings, and compare the resulting categorical distribution and the argmax or a single draw from a fixed RNG.
If the two orders disagree on the next token or on the mass of the leading candidates, “the same sampling config” was not a complete contract. Next, if two serving stacks are available, run the same named settings and see which order each stack actually implements, rather than assuming the documentation matches the code.
**Keep a greedy control, and change one operator at a time**
1) A temperature-zero, greedy path should usually be insensitive to shortlist order if no penalty changes the argmax. If greedy already disagrees across stacks, the problem is not only processor order, and that should be investigated first.
2) Test temperature-only, then temperature with top-k, then add a repetition penalty, recording the order at each step. A single mixed configuration can hide which operator was applied on the wrong domain.
3) Log the processor pipeline in CI: names, order, and whether each step reads logits or probabilities. A settings object that stores only the numeric fields cannot show the contract.
There are limits. Some operator pairs are equivalent for particular settings, and a one-token fixture does not exercise a penalty that depends on a long prefix; the repeated-token prompt is needed for that. Engines may also not expose intermediate scores, in which case only end-to-end token comparisons are possible. The test does not claim there is a single correct order. It asks that the order be named, tested, and compared when results are moved between stacks.
Which processor order do you treat as the contract when you copy sampling settings between engines? Which pair of orders has changed a next token even though the named temperature and top-k were unchanged?

