{"abstract":"Nucleus threshold is applied to unnormalized weights.","category":"Token sampling filters","checks":6,"contract":"Normalize nonnegative weights by their total, then retain the shortest descending-weight prefix reaching p; empty or zero-total inputs return empty.","contract_signature":"weights, p","evaluation_group":"w3-tsf-nucleus-normalization","failed_approach":"Normalizing weights but retaining a strict threshold mishandles an exact cumulative boundary.","family":"w3-token-sampling-filters-nucleus-normalization","id":"FA-98351","implementations":{"attempt":{"sha256":"ca3ae74f7b4741d55d72c1930a6040deedf6991c78d6be08989723054952240d","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(weights, p):\n    total=sum(weights.values()); ranked=sorted(weights,key=lambda t:(-weights[t],t)); out=[]; mass=0\n    for t in ranked:\n        mass+=weights[t]/total if total else 0; out.append(t)\n        if mass>p: break\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('scaled weights',solve({'a':6*N,'b':3*N,'c':N},.8),['a','b'])\ncheck('exact first mass',solve({'a':N,'b':N},.5),['a'])\ncheck('zero target',solve({'a':N},0),[])\ncheck('empty',solve({},.5),[])\ncheck('zero total',solve({'a':0,'b':0},.5),[])\ncheck('threshold above one',solve({'a':N,'b':N},1.1),['a','b'])\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":"d5c312ad0a2a734bb6755997c15ce7dba37d4d8bb57f9491595f96b225653397","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(weights, p):\n    ranked=sorted(weights,key=lambda t:(-weights[t],t)); out=[]; mass=0\n    for t in ranked:\n        mass+=weights[t]; out.append(t)\n        if mass>=p: break\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('scaled weights',solve({'a':6*N,'b':3*N,'c':N},.8),['a','b'])\ncheck('exact first mass',solve({'a':N,'b':N},.5),['a'])\ncheck('zero target',solve({'a':N},0),[])\ncheck('empty',solve({},.5),[])\ncheck('zero total',solve({'a':0,'b':0},.5),[])\ncheck('threshold above one',solve({'a':N,'b':N},1.1),['a','b'])\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-nucleus-normalization","generated_at":"2026-09-30T16:48:11.933257+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 comparison is against raw cumulative weight rather than normalized probability.","sha256":"abf3a76c028ac954017f3f473ede52013673600a8ce99802077b5dd3899f116a","title":"Token sampling: Nucleus threshold is applied to unnormalized weights · 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":28.638,"exit_code":1,"observations":[{"actual":["a","b"],"check":"scaled weights","expected":["a","b"],"passed":true},{"actual":["a","b"],"check":"exact first mass","expected":["a"],"passed":false},{"actual":["a"],"check":"zero target","expected":[],"passed":false},{"actual":[],"check":"empty","expected":[],"passed":true},{"actual":["a","b"],"check":"zero total","expected":[],"passed":false},{"actual":["a","b"],"check":"threshold above one","expected":["a","b"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"scaled weights\", \"actual\": [\"a\", \"b\"], \"expected\": [\"a\", \"b\"], \"passed\": true}, {\"check\": \"exact first mass\", \"actual\": [\"a\", \"b\"], \"expected\": [\"a\"], \"passed\": false}, {\"check\": \"zero target\", \"actual\": [\"a\"], \"expected\": [], \"passed\": false}, {\"check\": \"empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"zero total\", \"actual\": [\"a\", \"b\"], \"expected\": [], \"passed\": false}, {\"check\": \"threshold above one\", \"actual\": [\"a\", \"b\"], \"expected\": [\"a\", \"b\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":26.383,"exit_code":1,"observations":[{"actual":["a"],"check":"scaled weights","expected":["a","b"],"passed":false},{"actual":["a"],"check":"exact first mass","expected":["a"],"passed":true},{"actual":["a"],"check":"zero target","expected":[],"passed":false},{"actual":[],"check":"empty","expected":[],"passed":true},{"actual":["a","b"],"check":"zero total","expected":[],"passed":false},{"actual":["a","b"],"check":"threshold above one","expected":["a","b"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"scaled weights\", \"actual\": [\"a\"], \"expected\": [\"a\", \"b\"], \"passed\": false}, {\"check\": \"exact first mass\", \"actual\": [\"a\"], \"expected\": [\"a\"], \"passed\": true}, {\"check\": \"zero target\", \"actual\": [\"a\"], \"expected\": [], \"passed\": false}, {\"check\": \"empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"zero total\", \"actual\": [\"a\", \"b\"], \"expected\": [], \"passed\": false}, {\"check\": \"threshold above one\", \"actual\": [\"a\", \"b\"], \"expected\": [\"a\", \"b\"], \"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."}}