{"abstract":"Token bias is applied after repetition adjustment.","category":"Token sampling filters","checks":6,"contract":"Add per-token bias to base logits first, then apply the sign-aware repetition transform to seen tokens.","contract_signature":"scores, bias, seen, penalty","evaluation_group":"w3-tsf-logit-bias-before-penalty","failed_approach":"Dividing biased scores regardless of sign mishandles a bias that makes a negative logit remain negative.","family":"w3-token-sampling-filters-logit-bias-before-penalty","id":"FA-98401","implementations":{"attempt":{"sha256":"bb293246d63ec4c17fad2e2e26aeffc77a57017054c4565d54402466d8b64a22","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(scores, bias, seen, penalty):\n    out={}\n    for t,v in scores.items():\n        b=v+bias.get(t,0); out[t]=(b/penalty if t in seen else b)\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('bias changes sign branch',solve({'a':-2.0},{'a':5.0},['a'],2),{'a':1.5})\ncheck('unseen bias',solve({'a':N},{'a':3.0},[],2),{'a':N+3.0})\ncheck('negative biased logit',solve({'a':-5.0},{'a':1.0},['a'],3),{'a':-12.0})\ncheck('no bias',solve({'a':4.0},{},['a'],2),{'a':2.0})\ncheck('empty',solve({}, {'a':N},['a'],2),{})\ncheck('zero score bias',solve({'a':0.0},{'a':2.0},['a'],2),{'a':1.0})\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":"33328b4428d82f4ce7a795b2a2289bca70837528a439991184301d5f16350be2","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(scores, bias, seen, penalty):\n    return {t:((v/penalty if v>=0 else v*penalty) if t in seen else v)+bias.get(t,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('bias changes sign branch',solve({'a':-2.0},{'a':5.0},['a'],2),{'a':1.5})\ncheck('unseen bias',solve({'a':N},{'a':3.0},[],2),{'a':N+3.0})\ncheck('negative biased logit',solve({'a':-5.0},{'a':1.0},['a'],3),{'a':-12.0})\ncheck('no bias',solve({'a':4.0},{},['a'],2),{'a':2.0})\ncheck('empty',solve({}, {'a':N},['a'],2),{})\ncheck('zero score bias',solve({'a':0.0},{'a':2.0},['a'],2),{'a':1.0})\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-logit-bias-before-penalty","generated_at":"2026-09-30T16:48:12.802654+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":"The repeated-token transform branches on the raw logit and bias is added afterward.","sha256":"d31f4575878b53ac07fd269e1d7be2517c4cb908d42745720c359ab830287374","title":"Token sampling: Token bias is applied after 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.868,"exit_code":1,"observations":[{"actual":{"a":1.5},"check":"bias changes sign branch","expected":{"a":1.5},"passed":true},{"actual":{"a":4.0},"check":"unseen bias","expected":{"a":4.0},"passed":true},{"actual":{"a":-1.3333333333333333},"check":"negative biased logit","expected":{"a":-12.0},"passed":false},{"actual":{"a":2.0},"check":"no bias","expected":{"a":2.0},"passed":true},{"actual":{},"check":"empty","expected":{},"passed":true},{"actual":{"a":1.0},"check":"zero score bias","expected":{"a":1.0},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"bias changes sign branch\", \"actual\": {\"a\": 1.5}, \"expected\": {\"a\": 1.5}, \"passed\": true}, {\"check\": \"unseen bias\", \"actual\": {\"a\": 4.0}, \"expected\": {\"a\": 4.0}, \"passed\": true}, {\"check\": \"negative biased logit\", \"actual\": {\"a\": -1.3333333333333333}, \"expected\": {\"a\": -12.0}, \"passed\": false}, {\"check\": \"no bias\", \"actual\": {\"a\": 2.0}, \"expected\": {\"a\": 2.0}, \"passed\": true}, {\"check\": \"empty\", \"actual\": {}, \"expected\": {}, \"passed\": true}, {\"check\": \"zero score bias\", \"actual\": {\"a\": 1.0}, \"expected\": {\"a\": 1.0}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":28.867,"exit_code":1,"observations":[{"actual":{"a":1.0},"check":"bias changes sign branch","expected":{"a":1.5},"passed":false},{"actual":{"a":4.0},"check":"unseen bias","expected":{"a":4.0},"passed":true},{"actual":{"a":-14.0},"check":"negative biased logit","expected":{"a":-12.0},"passed":false},{"actual":{"a":2.0},"check":"no bias","expected":{"a":2.0},"passed":true},{"actual":{},"check":"empty","expected":{},"passed":true},{"actual":{"a":2.0},"check":"zero score bias","expected":{"a":1.0},"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"bias changes sign branch\", \"actual\": {\"a\": 1.0}, \"expected\": {\"a\": 1.5}, \"passed\": false}, {\"check\": \"unseen bias\", \"actual\": {\"a\": 4.0}, \"expected\": {\"a\": 4.0}, \"passed\": true}, {\"check\": \"negative biased logit\", \"actual\": {\"a\": -14.0}, \"expected\": {\"a\": -12.0}, \"passed\": false}, {\"check\": \"no bias\", \"actual\": {\"a\": 2.0}, \"expected\": {\"a\": 2.0}, \"passed\": true}, {\"check\": \"empty\", \"actual\": {}, \"expected\": {}, \"passed\": true}, {\"check\": \"zero score bias\", \"actual\": {\"a\": 2.0}, \"expected\": {\"a\": 1.0}, \"passed\": false}], \"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."}}