FA-98411 / Token sampling filters / Open access
Token sampling: No-repeat n-gram filter bans every token seen in an n-gram · case 01
No-repeat n-gram filter bans every token seen in an n-gram.
ROOT CAUSE
Candidate membership anywhere in any n-gram is used instead of matching only the current n-1 token context.
THE FAILURE
Candidate membership anywhere in any n-gram is used instead of matching only the current n-1 token context.
Unsuccessful approach: Handling unigrams still leaves prior repeated n-grams unexamined when the matching phrase is not the most recent history window.
Case contract
Remove a candidate if appending it would repeat an n-token sequence already present in history; n<=0 disables the rule.
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(history, candidates, n):
if n<=0:return sorted(candidates)
seen=set(tuple(history[i:i+n]) for i in range(len(history)-n+1))
return sorted(t for t in candidates if not any(t in gram for gram in seen))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated bigram continuation',solve(['a','b','x','a'],['b','c'],2),['c'])
check('different context allowed',solve(['a','b','x','a'],['b','a'],2),['a'])
check('unigram repeated',solve(['a','b'],['a','c'],1),['c'])
check('disabled',solve(['a','b'],['a','b'],0),['a','b'])
check('insufficient history',solve(['a'],['a','b'],3),['a','b'])
check('empty history',solve([],['a','b'],2),['a','b'])
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| repeated bigram continuation | ['c'] | ['c'] | Passed |
| different context allowed | [] | ['a'] | Failed |
| unigram repeated | ['c'] | ['c'] | Passed |
| disabled | ['a', 'b'] | ['a', 'b'] | Passed |
| insufficient history | ['a', 'b'] | ['a', 'b'] | Passed |
| empty history | ['a', 'b'] | ['a', 'b'] | Passed |
SHA-256 / ab222ae60aecac074993720e1e01db32b1c418865d85ee2254a4d8c4c47bd507
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(history, candidates, n):
if n<=0:return sorted(candidates)
if n==1:return sorted(t for t in candidates if t not in history)
prefix=tuple(history[-(n-1):])
last=tuple(history[-n:])
return sorted(t for t in candidates if prefix+(t,)!=last)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated bigram continuation',solve(['a','b','x','a'],['b','c'],2),['c'])
check('different context allowed',solve(['a','b','x','a'],['b','a'],2),['a'])
check('unigram repeated',solve(['a','b'],['a','c'],1),['c'])
check('disabled',solve(['a','b'],['a','b'],0),['a','b'])
check('insufficient history',solve(['a'],['a','b'],3),['a','b'])
check('empty history',solve([],['a','b'],2),['a','b'])
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| repeated bigram continuation | ['b', 'c'] | ['c'] | Failed |
| different context allowed | ['a', 'b'] | ['a'] | Failed |
| unigram repeated | ['c'] | ['c'] | Passed |
| disabled | ['a', 'b'] | ['a', 'b'] | Passed |
| insufficient history | ['a', 'b'] | ['a', 'b'] | Passed |
| empty history | ['a', 'b'] | ['a', 'b'] | Passed |
SHA-256 / 6ef5ca914f524c7b681403f3100b906ff6ea117d1006efdc70a85dc299ccbbf6
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.801770+00:00.
Case digest / fc48867642297635c2ac4b9bf3cc96f60f09a3f7fbb54a677682c99f56789464