{"abstract":"Prompt history is included in repetition adjustment.","category":"Token sampling filters","checks":6,"contract":"The penalty history is prompt followed by generated tokens; apply the presence penalty once to every scored token in that combined history.","contract_signature":"scores, prompt, generated, penalty","evaluation_group":"w3-tsf-penalty-history-boundary","failed_approach":"Dropping multiply occurring history tokens loses candidates that still need a one-time presence adjustment.","family":"w3-token-sampling-filters-penalty-history-boundary","id":"FA-98436","implementations":{"attempt":{"sha256":"8e1e758f3831ff92b8930f391affb347eadfe39ab17a291af47aaa00b05a361c","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(scores, prompt, generated, penalty):\n    seen=set(prompt+generated)\n    return {t:v-penalty*(1 if t in seen else 0) for t,v in scores.items() if t not in seen or (prompt+generated).count(t)==1}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('prompt token penalized',solve({'a':4.0,'b':3.0},['a'],[],1),{'a':3.0,'b':3.0})\ncheck('generated token penalized',solve({'b':N},[],['b'],2),{'b':N-2})\ncheck('both sources',solve({'a':5.0,'b':5.0},['a'],['b'],1),{'a':4.0,'b':4.0})\ncheck('empty histories',solve({'x':N},[],[],1),{'x':N})\ncheck('repeated prompt still once',solve({'a':N},['a','a'],[],1),{'a':N-1})\ncheck('unknown history',solve({'x':N},['y'],[],2),{'x':N})\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":"cc3775fbc239de61f8cf47cb26238da6c3bcc2d40f18deeb98f339deb22a37a0","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(scores, prompt, generated, penalty):\n    seen=set(generated)\n    return {t:v-(penalty if t in seen else 0) for t,v in scores.items()}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('prompt token penalized',solve({'a':4.0,'b':3.0},['a'],[],1),{'a':3.0,'b':3.0})\ncheck('generated token penalized',solve({'b':N},[],['b'],2),{'b':N-2})\ncheck('both sources',solve({'a':5.0,'b':5.0},['a'],['b'],1),{'a':4.0,'b':4.0})\ncheck('empty histories',solve({'x':N},[],[],1),{'x':N})\ncheck('repeated prompt still once',solve({'a':N},['a','a'],[],1),{'a':N-1})\ncheck('unknown history',solve({'x':N},['y'],[],2),{'x':N})\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":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w3-token-sampling-filters-penalty-history-boundary","generated_at":"2026-09-30T16:48:12.801737+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A finite, deterministic token-selection contract isolates one decoding operation from model inference and runtime behavior.","root_cause":"Only generated tokens are considered, omitting prompt tokens from the repetition history.","sha256":"2814a5dd466b246137a0213feaeb69bf16f3c2f93e459872462457ad88f3e546","title":"Token sampling: Prompt history is included in repetition adjustment · 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.797,"exit_code":1,"observations":[{"actual":{"a":3.0,"b":3.0},"check":"prompt token penalized","expected":{"a":3.0,"b":3.0},"passed":true},{"actual":{"b":-1},"check":"generated token penalized","expected":{"b":-1},"passed":true},{"actual":{"a":4.0,"b":4.0},"check":"both sources","expected":{"a":4.0,"b":4.0},"passed":true},{"actual":{"x":1},"check":"empty histories","expected":{"x":1},"passed":true},{"actual":{},"check":"repeated prompt still once","expected":{"a":0},"passed":false},{"actual":{"x":1},"check":"unknown history","expected":{"x":1},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"prompt token penalized\", \"actual\": {\"a\": 3.0, \"b\": 3.0}, \"expected\": {\"a\": 3.0, \"b\": 3.0}, \"passed\": true}, {\"check\": \"generated token penalized\", \"actual\": {\"b\": -1}, \"expected\": {\"b\": -1}, \"passed\": true}, {\"check\": \"both sources\", \"actual\": {\"a\": 4.0, \"b\": 4.0}, \"expected\": {\"a\": 4.0, \"b\": 4.0}, \"passed\": true}, {\"check\": \"empty histories\", \"actual\": {\"x\": 1}, \"expected\": {\"x\": 1}, \"passed\": true}, {\"check\": \"repeated prompt still once\", \"actual\": {}, \"expected\": {\"a\": 0}, \"passed\": false}, {\"check\": \"unknown history\", \"actual\": {\"x\": 1}, \"expected\": {\"x\": 1}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":26.826,"exit_code":1,"observations":[{"actual":{"a":4.0,"b":3.0},"check":"prompt token penalized","expected":{"a":3.0,"b":3.0},"passed":false},{"actual":{"b":-1},"check":"generated token penalized","expected":{"b":-1},"passed":true},{"actual":{"a":5.0,"b":4.0},"check":"both sources","expected":{"a":4.0,"b":4.0},"passed":false},{"actual":{"x":1},"check":"empty histories","expected":{"x":1},"passed":true},{"actual":{"a":1},"check":"repeated prompt still once","expected":{"a":0},"passed":false},{"actual":{"x":1},"check":"unknown history","expected":{"x":1},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"prompt token penalized\", \"actual\": {\"a\": 4.0, \"b\": 3.0}, \"expected\": {\"a\": 3.0, \"b\": 3.0}, \"passed\": false}, {\"check\": \"generated token penalized\", \"actual\": {\"b\": -1}, \"expected\": {\"b\": -1}, \"passed\": true}, {\"check\": \"both sources\", \"actual\": {\"a\": 5.0, \"b\": 4.0}, \"expected\": {\"a\": 4.0, \"b\": 4.0}, \"passed\": false}, {\"check\": \"empty histories\", \"actual\": {\"x\": 1}, \"expected\": {\"x\": 1}, \"passed\": true}, {\"check\": \"repeated prompt still once\", \"actual\": {\"a\": 1}, \"expected\": {\"a\": 0}, \"passed\": false}, {\"check\": \"unknown history\", \"actual\": {\"x\": 1}, \"expected\": {\"x\": 1}, \"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."}}