{"abstract":"beam width is enforced independently per batch item.","category":"Beam search bookkeeping","checks":6,"contract":"Rows are [batch,score,hypothesis]; return up to width highest scores per batch, ordered by batch then descending score and hypothesis name.","contract_signature":"rows, width","evaluation_group":"beam-batch_prune","failed_approach":"Taking the first k rows per batch before sorting can discard that batch’s strongest candidates.","family":"w3-beam-search-bookkeeping-global-beam-prune","id":"FA-98451","implementations":{"attempt":{"sha256":"d83a7c7e552d1b91d33d2ab3678bbd73bda4433b9bad76e9228caece8202adca","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(rows, width):\n    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]))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nrows=[['a',N,'x'],['a',N+2,'y'],['b',N+1,'z'],['b',N+3,'w']]\ncheck('one per batch',solve(rows,1),[['a',N+2,'y'],['b',N+3,'w']])\ncheck('two per batch',solve(rows,2),[['a',N+2,'y'],['a',N,'x'],['b',N+3,'w'],['b',N+1,'z']])\ncheck('empty',solve([],N),[])\ncheck('zero width',solve(rows,0),[])\ncheck('one batch',solve([['a',1,'x'],['a',3,'y']],1),[['a',3,'y']])\ncheck('score tie name order',solve([['b',N,'z'],['b',N,'a']],2),[['b',N,'a'],['b',N,'z']])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"262541ff352548606db2038e15b42b975a4934615e0942eb48ff37ee058151a1","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(rows, width):\n    return sorted(rows,key=lambda r:(-r[1],r[0],r[2]))[:width]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nrows=[['a',N,'x'],['a',N+2,'y'],['b',N+1,'z'],['b',N+3,'w']]\ncheck('one per batch',solve(rows,1),[['a',N+2,'y'],['b',N+3,'w']])\ncheck('two per batch',solve(rows,2),[['a',N+2,'y'],['a',N,'x'],['b',N+3,'w'],['b',N+1,'z']])\ncheck('empty',solve([],N),[])\ncheck('zero width',solve(rows,0),[])\ncheck('one batch',solve([['a',1,'x'],['a',3,'y']],1),[['a',3,'y']])\ncheck('score tie name order',solve([['b',N,'z'],['b',N,'a']],2),[['b',N,'a'],['b',N,'z']])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w3-beam-search-bookkeeping-global-beam-prune","generated_at":"2026-09-30T16:48:13.239232+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Beam decoders rely on consistent hypothesis state while expanding and ranking candidates.","root_cause":"Candidates from separate requests compete for one global top-k.","sha256":"17b89b1b6eb4058cff1c4018a78f87f82abc8c922f3e4f4d4279eb71c777ae64","title":"Beam search: beam width is enforced independently per batch item · case 01","variant":1,"variant_policy":"The fixture code references N, supplied as 1 through 5. Fixed boundary checks may repeat. These records share one mechanism and must remain together in evaluation splits.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":26.922,"exit_code":1,"observations":[{"actual":[["a",1,"x"],["b",2,"z"]],"check":"one per batch","expected":[["a",3,"y"],["b",4,"w"]],"passed":false},{"actual":[["a",3,"y"],["a",1,"x"],["b",4,"w"],["b",2,"z"]],"check":"two per batch","expected":[["a",3,"y"],["a",1,"x"],["b",4,"w"],["b",2,"z"]],"passed":true},{"actual":[],"check":"empty","expected":[],"passed":true},{"actual":[],"check":"zero width","expected":[],"passed":true},{"actual":[["a",1,"x"]],"check":"one batch","expected":[["a",3,"y"]],"passed":false},{"actual":[["b",1,"a"],["b",1,"z"]],"check":"score tie name order","expected":[["b",1,"a"],["b",1,"z"]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"one per batch\", \"actual\": [[\"a\", 1, \"x\"], [\"b\", 2, \"z\"]], \"expected\": [[\"a\", 3, \"y\"], [\"b\", 4, \"w\"]], \"passed\": false}, {\"check\": \"two per batch\", \"actual\": [[\"a\", 3, \"y\"], [\"a\", 1, \"x\"], [\"b\", 4, \"w\"], [\"b\", 2, \"z\"]], \"expected\": [[\"a\", 3, \"y\"], [\"a\", 1, \"x\"], [\"b\", 4, \"w\"], [\"b\", 2, \"z\"]], \"passed\": true}, {\"check\": \"empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"zero width\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"one batch\", \"actual\": [[\"a\", 1, \"x\"]], \"expected\": [[\"a\", 3, \"y\"]], \"passed\": false}, {\"check\": \"score tie name order\", \"actual\": [[\"b\", 1, \"a\"], [\"b\", 1, \"z\"]], \"expected\": [[\"b\", 1, \"a\"], [\"b\", 1, \"z\"]], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":27.895,"exit_code":1,"observations":[{"actual":[["b",4,"w"]],"check":"one per batch","expected":[["a",3,"y"],["b",4,"w"]],"passed":false},{"actual":[["b",4,"w"],["a",3,"y"]],"check":"two per batch","expected":[["a",3,"y"],["a",1,"x"],["b",4,"w"],["b",2,"z"]],"passed":false},{"actual":[],"check":"empty","expected":[],"passed":true},{"actual":[],"check":"zero width","expected":[],"passed":true},{"actual":[["a",3,"y"]],"check":"one batch","expected":[["a",3,"y"]],"passed":true},{"actual":[["b",1,"a"],["b",1,"z"]],"check":"score tie name order","expected":[["b",1,"a"],["b",1,"z"]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"one per batch\", \"actual\": [[\"b\", 4, \"w\"]], \"expected\": [[\"a\", 3, \"y\"], [\"b\", 4, \"w\"]], \"passed\": false}, {\"check\": \"two per batch\", \"actual\": [[\"b\", 4, \"w\"], [\"a\", 3, \"y\"]], \"expected\": [[\"a\", 3, \"y\"], [\"a\", 1, \"x\"], [\"b\", 4, \"w\"], [\"b\", 2, \"z\"]], \"passed\": false}, {\"check\": \"empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"zero width\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"one batch\", \"actual\": [[\"a\", 3, \"y\"]], \"expected\": [[\"a\", 3, \"y\"]], \"passed\": true}, {\"check\": \"score tie name order\", \"actual\": [[\"b\", 1, \"a\"], [\"b\", 1, \"z\"]], \"expected\": [[\"b\", 1, \"a\"], [\"b\", 1, \"z\"]], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}