FAILURE MAP
← Case archive

FA-98416 / Token sampling filters / Open access

Token sampling: Adaptive top-a uses an absolute rather than relative gap · case 01

Adaptive top-a uses an absolute rather than relative gap.

Verified by executionVariant 1 · 6 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The acceptance window is treated as a raw logit distance instead of scaling by the best-second gap.

THE FAILURE

The acceptance window is treated as a raw logit distance instead of scaling by the best-second gap.

Unsuccessful approach: The attempted strict comparison drops candidates exactly at the scaled boundary, including the sole candidate when the gap is zero.

Case contract

Sort descending with lexical ties; retain the best token and following tokens while their logit is within a times the best-to-second-best gap. a<=0 retains only the best; singleton and empty inputs are handled.

Why this case matters

A finite, deterministic token-selection contract isolates one decoding operation from model inference and runtime behavior.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(scores, a):
    ranked=sorted(scores,key=lambda t:(-scores[t],t))
    if not ranked:return []
    gap=scores[ranked[0]]-(scores[ranked[1]] if len(ranked)>1 else scores[ranked[0]])
    return [t for t in ranked if scores[ranked[0]]-scores[t]<=a]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('relative gap',solve({'a':10.0,'b':9.0,'c':8.0},2),['a','b','c'])
check('scaled scores',solve({'a':100.0,'b':90.0,'c':80.0},2),['a','b','c'])
check('zero factor',solve({'a':N,'b':N-1},0),['a'])
check('singleton',solve({'x':N},3),['x'])
check('empty',solve({},2),[])
check('lexical best tie',solve({'z':N,'a':N},1),['a','z'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
relative gap['a', 'b', 'c']['a', 'b', 'c']Passed
scaled scores['a']['a', 'b', 'c']Failed
zero factor['a']['a']Passed
singleton['x']['x']Passed
empty[][]Passed
lexical best tie['a', 'z']['a', 'z']Passed

SHA-256 / f1264d7f821c353a83bc763118833282e72a40b289b321643df4d230e87ad3bc

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(scores, a):
    ranked=sorted(scores,key=lambda t:(-scores[t],t))
    if not ranked:return []
    gap=scores[ranked[0]]-(scores[ranked[1]] if len(ranked)>1 else scores[ranked[0]])
    return [t for t in ranked if scores[ranked[0]]-scores[t]<max(0,a)*gap]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('relative gap',solve({'a':10.0,'b':9.0,'c':8.0},2),['a','b','c'])
check('scaled scores',solve({'a':100.0,'b':90.0,'c':80.0},2),['a','b','c'])
check('zero factor',solve({'a':N,'b':N-1},0),['a'])
check('singleton',solve({'x':N},3),['x'])
check('empty',solve({},2),[])
check('lexical best tie',solve({'z':N,'a':N},1),['a','z'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
relative gap['a', 'b']['a', 'b', 'c']Failed
scaled scores['a', 'b']['a', 'b', 'c']Failed
zero factor[]['a']Failed
singleton[]['x']Failed
empty[][]Passed
lexical best tie[]['a', 'z']Failed

SHA-256 / c90beb568e02f03fd4974dc7e4998dcb22f41279e359173a36fb589d86edf530

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 6 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

These are toy finite-vocabulary contracts with supplied scores, histories, and draws; they do not claim production model quality or compatibility. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-30T16:48:12.801773+00:00.

Case digest / 10e70411b37d7e8760c0fa3744db3bdf71038ff1c75eeb62e6b231a34e23dbf2