{"abstract":"No-repeat n-gram filter bans every token seen in an n-gram.","category":"Token sampling filters","checks":6,"contract":"Remove a candidate if appending it would repeat an n-token sequence already present in history; n<=0 disables the rule.","contract_signature":"history, candidates, n","evaluation_group":"w3-tsf-no-repeat-ngram-next","failed_approach":"Handling unigrams still leaves prior repeated n-grams unexamined when the matching phrase is not the most recent history window.","family":"w3-token-sampling-filters-no-repeat-ngram-next","id":"FA-98411","implementations":{"attempt":{"sha256":"6ef5ca914f524c7b681403f3100b906ff6ea117d1006efdc70a85dc299ccbbf6","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(history, candidates, n):\n    if n<=0:return sorted(candidates)\n    if n==1:return sorted(t for t in candidates if t not in history)\n    prefix=tuple(history[-(n-1):])\n    last=tuple(history[-n:])\n    return sorted(t for t in candidates if prefix+(t,)!=last)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('repeated bigram continuation',solve(['a','b','x','a'],['b','c'],2),['c'])\ncheck('different context allowed',solve(['a','b','x','a'],['b','a'],2),['a'])\ncheck('unigram repeated',solve(['a','b'],['a','c'],1),['c'])\ncheck('disabled',solve(['a','b'],['a','b'],0),['a','b'])\ncheck('insufficient history',solve(['a'],['a','b'],3),['a','b'])\ncheck('empty history',solve([],['a','b'],2),['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":"ab222ae60aecac074993720e1e01db32b1c418865d85ee2254a4d8c4c47bd507","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(history, candidates, n):\n    if n<=0:return sorted(candidates)\n    seen=set(tuple(history[i:i+n]) for i in range(len(history)-n+1))\n    return sorted(t for t in candidates if not any(t in gram for gram in seen))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('repeated bigram continuation',solve(['a','b','x','a'],['b','c'],2),['c'])\ncheck('different context allowed',solve(['a','b','x','a'],['b','a'],2),['a'])\ncheck('unigram repeated',solve(['a','b'],['a','c'],1),['c'])\ncheck('disabled',solve(['a','b'],['a','b'],0),['a','b'])\ncheck('insufficient history',solve(['a'],['a','b'],3),['a','b'])\ncheck('empty history',solve([],['a','b'],2),['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-no-repeat-ngram-next","generated_at":"2026-09-30T16:48:12.801770+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":"Candidate membership anywhere in any n-gram is used instead of matching only the current n-1 token context.","sha256":"fc48867642297635c2ac4b9bf3cc96f60f09a3f7fbb54a677682c99f56789464","title":"Token sampling: No-repeat n-gram filter bans every token seen in an n-gram · 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.36,"exit_code":1,"observations":[{"actual":["b","c"],"check":"repeated bigram continuation","expected":["c"],"passed":false},{"actual":["a","b"],"check":"different context allowed","expected":["a"],"passed":false},{"actual":["c"],"check":"unigram repeated","expected":["c"],"passed":true},{"actual":["a","b"],"check":"disabled","expected":["a","b"],"passed":true},{"actual":["a","b"],"check":"insufficient history","expected":["a","b"],"passed":true},{"actual":["a","b"],"check":"empty history","expected":["a","b"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"repeated bigram continuation\", \"actual\": [\"b\", \"c\"], \"expected\": [\"c\"], \"passed\": false}, {\"check\": \"different context allowed\", \"actual\": [\"a\", \"b\"], \"expected\": [\"a\"], \"passed\": false}, {\"check\": \"unigram repeated\", \"actual\": [\"c\"], \"expected\": [\"c\"], \"passed\": true}, {\"check\": \"disabled\", \"actual\": [\"a\", \"b\"], \"expected\": [\"a\", \"b\"], \"passed\": true}, {\"check\": \"insufficient history\", \"actual\": [\"a\", \"b\"], \"expected\": [\"a\", \"b\"], \"passed\": true}, {\"check\": \"empty history\", \"actual\": [\"a\", \"b\"], \"expected\": [\"a\", \"b\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":26.716,"exit_code":1,"observations":[{"actual":["c"],"check":"repeated bigram continuation","expected":["c"],"passed":true},{"actual":[],"check":"different context allowed","expected":["a"],"passed":false},{"actual":["c"],"check":"unigram repeated","expected":["c"],"passed":true},{"actual":["a","b"],"check":"disabled","expected":["a","b"],"passed":true},{"actual":["a","b"],"check":"insufficient history","expected":["a","b"],"passed":true},{"actual":["a","b"],"check":"empty history","expected":["a","b"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"repeated bigram continuation\", \"actual\": [\"c\"], \"expected\": [\"c\"], \"passed\": true}, {\"check\": \"different context allowed\", \"actual\": [], \"expected\": [\"a\"], \"passed\": false}, {\"check\": \"unigram repeated\", \"actual\": [\"c\"], \"expected\": [\"c\"], \"passed\": true}, {\"check\": \"disabled\", \"actual\": [\"a\", \"b\"], \"expected\": [\"a\", \"b\"], \"passed\": true}, {\"check\": \"insufficient history\", \"actual\": [\"a\", \"b\"], \"expected\": [\"a\", \"b\"], \"passed\": true}, {\"check\": \"empty history\", \"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."}}