{"abstract":"Bad-word sequence filter checks only the final token.","category":"Token sampling filters","checks":6,"contract":"Remove a candidate when prefix plus that candidate ends with any complete banned token sequence.","contract_signature":"prefix, candidates, banned_sequences","evaluation_group":"w3-tsf-bad-word-sequence-suffix","failed_approach":"Checking only the immediately previous prefix token misses banned sequences with longer prefixes.","family":"w3-token-sampling-filters-bad-word-sequence-suffix","id":"FA-98406","implementations":{"attempt":{"sha256":"b622aa523f15d7e666066ac31582bb514c609f3cfe34ce606c90ce7c26069fd6","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(prefix, candidates, banned_sequences):\n    return sorted(t for t in candidates if not any(seq and prefix[-1:]+[t]==seq for seq in banned_sequences))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('multi token ban',solve(['a','b'],['c','x'],[['a','b','c']]),['x'])\ncheck('unrelated same end',solve(['q'],['c'],[['a','b','c']]),['c'])\ncheck('single token ban',solve([],['x','y'],[['x']]),['y'])\ncheck('empty candidate',solve(['a'],[],[['a','b']]),[])\ncheck('empty ban rule',solve([],['x'],[[]]),['x'])\ncheck('prefix longer',solve(['u','a','b'],['c'],[['a','b','c']]),[])\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":"f02d44aef5546621d266b2c9e2c2499002f1e4384c8e1cc6ab98eb35be05ddc3","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(prefix, candidates, banned_sequences):\n    return sorted(t for t in candidates if not any(seq and t==seq[-1] for seq in banned_sequences))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('multi token ban',solve(['a','b'],['c','x'],[['a','b','c']]),['x'])\ncheck('unrelated same end',solve(['q'],['c'],[['a','b','c']]),['c'])\ncheck('single token ban',solve([],['x','y'],[['x']]),['y'])\ncheck('empty candidate',solve(['a'],[],[['a','b']]),[])\ncheck('empty ban rule',solve([],['x'],[[]]),['x'])\ncheck('prefix longer',solve(['u','a','b'],['c'],[['a','b','c']]),[])\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-bad-word-sequence-suffix","generated_at":"2026-09-30T16:48:12.801555+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 candidate identity is compared with the final element, without matching the preceding prefix.","sha256":"faa4b24f62c90f3efbdcfc6d92b0a54a67dd157a1291bce0e70e531509be78fa","title":"Token sampling: Bad-word sequence filter checks only the final token · case 01","variant":1,"variant_policy":"The same explicitly authored fixtures repeat across all five numbered records; runtime N is unused. These records share one mechanism and must remain together in evaluation splits.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":27.321,"exit_code":1,"observations":[{"actual":["c","x"],"check":"multi token ban","expected":["x"],"passed":false},{"actual":["c"],"check":"unrelated same end","expected":["c"],"passed":true},{"actual":["y"],"check":"single token ban","expected":["y"],"passed":true},{"actual":[],"check":"empty candidate","expected":[],"passed":true},{"actual":["x"],"check":"empty ban rule","expected":["x"],"passed":true},{"actual":["c"],"check":"prefix longer","expected":[],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"multi token ban\", \"actual\": [\"c\", \"x\"], \"expected\": [\"x\"], \"passed\": false}, {\"check\": \"unrelated same end\", \"actual\": [\"c\"], \"expected\": [\"c\"], \"passed\": true}, {\"check\": \"single token ban\", \"actual\": [\"y\"], \"expected\": [\"y\"], \"passed\": true}, {\"check\": \"empty candidate\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"empty ban rule\", \"actual\": [\"x\"], \"expected\": [\"x\"], \"passed\": true}, {\"check\": \"prefix longer\", \"actual\": [\"c\"], \"expected\": [], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":27.259,"exit_code":1,"observations":[{"actual":["x"],"check":"multi token ban","expected":["x"],"passed":true},{"actual":[],"check":"unrelated same end","expected":["c"],"passed":false},{"actual":["y"],"check":"single token ban","expected":["y"],"passed":true},{"actual":[],"check":"empty candidate","expected":[],"passed":true},{"actual":["x"],"check":"empty ban rule","expected":["x"],"passed":true},{"actual":[],"check":"prefix longer","expected":[],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"multi token ban\", \"actual\": [\"x\"], \"expected\": [\"x\"], \"passed\": true}, {\"check\": \"unrelated same end\", \"actual\": [], \"expected\": [\"c\"], \"passed\": false}, {\"check\": \"single token ban\", \"actual\": [\"y\"], \"expected\": [\"y\"], \"passed\": true}, {\"check\": \"empty candidate\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"empty ban rule\", \"actual\": [\"x\"], \"expected\": [\"x\"], \"passed\": true}, {\"check\": \"prefix longer\", \"actual\": [], \"expected\": [], \"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."}}