FAILURE MAP
← Case archive

FA-98451 / Beam search bookkeeping / Open access

Beam search: beam width is enforced independently per batch item · case 01

beam width is enforced independently per batch item.

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

ROOT CAUSE

Candidates from separate requests compete for one global top-k.

THE FAILURE

Candidates from separate requests compete for one global top-k.

Unsuccessful approach: Taking the first k rows per batch before sorting can discard that batch’s strongest candidates.

Case contract

Rows are [batch,score,hypothesis]; return up to width highest scores per batch, ordered by batch then descending score and hypothesis name.

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, width):
    return sorted(rows,key=lambda r:(-r[1],r[0],r[2]))[:width]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
rows=[['a',N,'x'],['a',N+2,'y'],['b',N+1,'z'],['b',N+3,'w']]
check('one per batch',solve(rows,1),[['a',N+2,'y'],['b',N+3,'w']])
check('two per batch',solve(rows,2),[['a',N+2,'y'],['a',N,'x'],['b',N+3,'w'],['b',N+1,'z']])
check('empty',solve([],N),[])
check('zero width',solve(rows,0),[])
check('one batch',solve([['a',1,'x'],['a',3,'y']],1),[['a',3,'y']])
check('score tie name order',solve([['b',N,'z'],['b',N,'a']],2),[['b',N,'a'],['b',N,'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
one per batch[['b', 4, 'w']][['a', 3, 'y'], ['b', 4, 'w']]Failed
two per batch[['b', 4, 'w'], ['a', 3, 'y']][['a', 3, 'y'], ['a', 1, 'x'], ['b', 4, 'w'], ['b', 2, 'z']]Failed
empty[][]Passed
zero width[][]Passed
one batch[['a', 3, 'y']][['a', 3, 'y']]Passed
score tie name order[['b', 1, 'a'], ['b', 1, 'z']][['b', 1, 'a'], ['b', 1, 'z']]Passed

SHA-256 / 262541ff352548606db2038e15b42b975a4934615e0942eb48ff37ee058151a1

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(rows, width):
    return sorted([r for b in sorted({r[0] for r in rows}) for r in sorted([x for x in rows if x[0]==b],key=lambda x:x[1])[:width]],key=lambda r:(r[0],-r[1],r[2]))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
rows=[['a',N,'x'],['a',N+2,'y'],['b',N+1,'z'],['b',N+3,'w']]
check('one per batch',solve(rows,1),[['a',N+2,'y'],['b',N+3,'w']])
check('two per batch',solve(rows,2),[['a',N+2,'y'],['a',N,'x'],['b',N+3,'w'],['b',N+1,'z']])
check('empty',solve([],N),[])
check('zero width',solve(rows,0),[])
check('one batch',solve([['a',1,'x'],['a',3,'y']],1),[['a',3,'y']])
check('score tie name order',solve([['b',N,'z'],['b',N,'a']],2),[['b',N,'a'],['b',N,'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
one per batch[['a', 1, 'x'], ['b', 2, 'z']][['a', 3, 'y'], ['b', 4, 'w']]Failed
two per batch[['a', 3, 'y'], ['a', 1, 'x'], ['b', 4, 'w'], ['b', 2, 'z']][['a', 3, 'y'], ['a', 1, 'x'], ['b', 4, 'w'], ['b', 2, 'z']]Passed
empty[][]Passed
zero width[][]Passed
one batch[['a', 1, 'x']][['a', 3, 'y']]Failed
score tie name order[['b', 1, 'a'], ['b', 1, 'z']][['b', 1, 'a'], ['b', 1, 'z']]Passed

SHA-256 / d83a7c7e552d1b91d33d2ab3678bbd73bda4433b9bad76e9228caece8202adca

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

Case digest / 17b89b1b6eb4058cff1c4018a78f87f82abc8c922f3e4f4d4279eb71c777ae64