FAILURE MAP
← Case archive

FA-98381 / Token sampling filters / Open access

Token sampling: Frequency penalty counts only distinct history tokens · case 01

Frequency penalty counts only distinct history tokens.

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

ROOT CAUSE

Only membership is used, losing repeated-token frequency.

THE FAILURE

Only membership is used, losing repeated-token frequency.

Unsuccessful approach: Charging once to unseen candidates penalizes tokens absent from history.

Case contract

Subtract penalty times the number of occurrences of each token in history from that token score.

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, history, penalty):
    seen=set(history)
    return {t:v-penalty*(1 if t in seen else 0) for t,v in scores.items()}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated token',solve({'a':8.0,'b':4.0},['a']*(N+1),1),{'a':8.0-(N+1),'b':4.0})
check('single token',solve({'a':N},['a'],2),{'a':N-2})
check('empty',solve({'a':N},[],1),{'a':N})
check('unseen remains',solve({'b':3.0},['a','a'],4),{'b':3.0})
check('signed penalty',solve({'a':2.0},['a','a'], -1),{'a':4.0})
check('mixed counts',solve({'a':9.0,'b':5.0},['a','b','a'],2),{'a':5.0,'b':3.0})
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
repeated token{'a': 7.0, 'b': 4.0}{'a': 6.0, 'b': 4.0}Failed
single token{'a': -1}{'a': -1}Passed
empty{'a': 1}{'a': 1}Passed
unseen remains{'b': 3.0}{'b': 3.0}Passed
signed penalty{'a': 3.0}{'a': 4.0}Failed
mixed counts{'a': 7.0, 'b': 3.0}{'a': 5.0, 'b': 3.0}Failed

SHA-256 / 940857bdfee19aa16ec64c01492968ed61cdb973dd4cbdad2727322a5f7dd566

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(scores, history, penalty):
    from collections import Counter
    c=Counter(history)
    return {t:v-penalty*(c[t] if c[t] else 1) for t,v in scores.items()}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated token',solve({'a':8.0,'b':4.0},['a']*(N+1),1),{'a':8.0-(N+1),'b':4.0})
check('single token',solve({'a':N},['a'],2),{'a':N-2})
check('empty',solve({'a':N},[],1),{'a':N})
check('unseen remains',solve({'b':3.0},['a','a'],4),{'b':3.0})
check('signed penalty',solve({'a':2.0},['a','a'], -1),{'a':4.0})
check('mixed counts',solve({'a':9.0,'b':5.0},['a','b','a'],2),{'a':5.0,'b':3.0})
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
repeated token{'a': 6.0, 'b': 3.0}{'a': 6.0, 'b': 4.0}Failed
single token{'a': -1}{'a': -1}Passed
empty{'a': 0}{'a': 1}Failed
unseen remains{'b': -1.0}{'b': 3.0}Failed
signed penalty{'a': 4.0}{'a': 4.0}Passed
mixed counts{'a': 5.0, 'b': 3.0}{'a': 5.0, 'b': 3.0}Passed

SHA-256 / c37d3a47f27a075e69af2997164cc7c0c2ac6dc564c9ada64d044b5edc7b17c5

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.372518+00:00.

Case digest / 6471e58d85d6f541d2b80f9e16f3b8c5c523635643fd8eeaeec52aaf299bb54e