FA-98481 / Beam search bookkeeping / Open access
Beam search: length penalty counts prompt tokens as generated output · case 01
length penalty counts prompt tokens as generated output.
ROOT CAUSE
The length field includes a fixed prompt prefix that is shared by all candidates.
THE FAILURE
The length field includes a fixed prompt prefix that is shared by all candidates.
Unsuccessful approach: Subtracting one token regardless of prompt size leaves the penalty distorted.
Case contract
Rows [id,score,total_length]; normalize by max(1,total_length-prompt_length) and return scores by ID.
Why this case matters
Beam decoders rely on consistent hypothesis state while expanding and ranking candidates.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(rows, prompt_length):
return {r[0]:r[1]/r[2] for r in rows}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shared prompt removed',solve([['a',N,N+2]],N),{'a':N/2})
check('prompt only floor',solve([['a',N,N]],N),{'a':float(N)})
check('two generated',solve([['b',2*N,N+2]],N),{'b':float(N)})
check('empty input',solve([],N),{})
check('zero prompt',solve([['c',N,2]],0),{'c':N/2})
check('long prefix',solve([['d',2*N,3*N]],2*N),{'d':2.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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| shared prompt removed | {'a': 0.3333333333333333} | {'a': 0.5} | Failed |
| prompt only floor | {'a': 1.0} | {'a': 1.0} | Passed |
| two generated | {'b': 0.6666666666666666} | {'b': 1.0} | Failed |
| empty input | {} | {} | Passed |
| zero prompt | {'c': 0.5} | {'c': 0.5} | Passed |
| long prefix | {'d': 0.6666666666666666} | {'d': 2.0} | Failed |
SHA-256 / f78ce5141068858b2603d384bbd1f535f8cb34cf759dea0015905b74b4076800
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(rows, prompt_length):
return {r[0]:r[1]/max(1,r[2]-1) for r in rows}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shared prompt removed',solve([['a',N,N+2]],N),{'a':N/2})
check('prompt only floor',solve([['a',N,N]],N),{'a':float(N)})
check('two generated',solve([['b',2*N,N+2]],N),{'b':float(N)})
check('empty input',solve([],N),{})
check('zero prompt',solve([['c',N,2]],0),{'c':N/2})
check('long prefix',solve([['d',2*N,3*N]],2*N),{'d':2.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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| shared prompt removed | {'a': 0.5} | {'a': 0.5} | Passed |
| prompt only floor | {'a': 1.0} | {'a': 1.0} | Passed |
| two generated | {'b': 1.0} | {'b': 1.0} | Passed |
| empty input | {} | {} | Passed |
| zero prompt | {'c': 1.0} | {'c': 0.5} | Failed |
| long prefix | {'d': 1.0} | {'d': 2.0} | Failed |
SHA-256 / 2834ace972badf0f4fc8b8ca4e9d322c263c79ad7a2909c2d81b55ac716fe37b
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
This is a finite toy beam-state contract and makes no claim about neural model quality or production decoding. 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:13.668688+00:00.
Case digest / 8f04ea2cca9cde5bb8c9d5448add0a9fb2c8ab14b9611f251b4ef3aecaf5fcd2