FAILURE MAP
← Case archive

FA-98476 / Beam search bookkeeping / Open access

Beam search: beam pruning ranks raw totals instead of normalized totals · case 01

beam pruning ranks raw totals instead of normalized totals.

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

ROOT CAUSE

Hypotheses of different lengths are compared before applying the declared penalty.

THE FAILURE

Hypotheses of different lengths are compared before applying the declared penalty.

Unsuccessful approach: Normalizing only the already selected raw-score winners cannot recover a pruned path.

Case contract

Rows [id,total,length]; rank by total divided by positive length, descending, with lexical ID ties.

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]))[:width]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
rows=[['short',2*N,1],['long',3*N,3]]
check('normalization changes winner',solve(rows,1),[['short',2*N,1]])
check('long wins with stronger total',solve([['s',N,1],['l',4*N,2]],1),[['l',4*N,2]])
check('tie by ID',solve([['z',N,1],['a',N,1]],1),[['a',N,1]])
check('empty rows',solve([],N),[])
check('width zero',solve(rows,0),[])
check('all fit',solve(rows,4),[['short',2*N,1],['long',3*N,3]])
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
normalization changes winner[['long', 3, 3]][['short', 2, 1]]Failed
long wins with stronger total[['l', 4, 2]][['l', 4, 2]]Passed
tie by ID[['a', 1, 1]][['a', 1, 1]]Passed
empty rows[][]Passed
width zero[][]Passed
all fit[['long', 3, 3], ['short', 2, 1]][['short', 2, 1], ['long', 3, 3]]Failed

SHA-256 / 9a98d0b13a6f1df41ccb0a4e616dc865b054940cec42ed32b511eff4926b00af

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(sorted(rows,key=lambda r:(-r[1],r[0]))[:width],key=lambda r:(-r[1]/r[2],r[0]))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
rows=[['short',2*N,1],['long',3*N,3]]
check('normalization changes winner',solve(rows,1),[['short',2*N,1]])
check('long wins with stronger total',solve([['s',N,1],['l',4*N,2]],1),[['l',4*N,2]])
check('tie by ID',solve([['z',N,1],['a',N,1]],1),[['a',N,1]])
check('empty rows',solve([],N),[])
check('width zero',solve(rows,0),[])
check('all fit',solve(rows,4),[['short',2*N,1],['long',3*N,3]])
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
normalization changes winner[['long', 3, 3]][['short', 2, 1]]Failed
long wins with stronger total[['l', 4, 2]][['l', 4, 2]]Passed
tie by ID[['a', 1, 1]][['a', 1, 1]]Passed
empty rows[][]Passed
width zero[][]Passed
all fit[['short', 2, 1], ['long', 3, 3]][['short', 2, 1], ['long', 3, 3]]Passed

SHA-256 / 70a137f46995069683b2243a0be99ad737adc6c7b1ade461b918cc463e79b683

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

Case digest / 22c126035cec2208044f8dc373e735f2053538f5f7b224f6b35a34f3f3f354f2