Evaluation Governance › Gaming: Detection and Disclosure
Language AI HandbookAll chapters Gaming is the deliberate or emergent optimization of a metric in ways that do not reflect the capability the metric claims to measure. It is the evaluation-face of Reward Hacking, and it takes many forms. Governance distinguishes them because each needs a different control.
- Contamination: test items are in the training data. Detected by overlap tests, canary strings, and held-out pools (see Benchmark Contamination).
- Tuning to the test set: repeated submissions, or prompt selection after peeking at results. Detected by submission budgets and prompt pre-registration.
- Grader exploitation: exploiting a heuristic or an LLM judge, for example formatting tricks that satisfy the pass filter without solving the task. Detected by adversarial probes and human spot checks (see LLM-as-Judge and Judge Calibration).
- Selective reporting: running many configurations and publishing the best. Detected by mandatory reporting of all attempted runs from a registered config.
Treat an exact overlap as a lead. Investigate whether it reached training, decide which claims are affected, then version a corrected item set or retire the benchmark when the affected scope cannot be repaired. Pre-register the prompt to manage test-set tuning. Probe graders and publish submission counts to expose different forms of selection.
A useful governance primitive is the prompt pre-registration check: the prompt template used at test time must match what was registered before scoring, and the submission must record it. Combined with gaming_flags, this makes selective reporting visible. Let's implement two simple, honest detectors that illustrate the pattern. First, an exact-overlap contamination check (a proxy; real detection goes further). Second, a "same config, many submissions" counter that flags repeated tuning against the test set.
PythonIn [13]Expand
def contamination_flag(
test_items: list[dict], training_note_texts: list[str]
) -> list[dict]:
"""Flag test items whose prompt appears verbatim in a (synthetic) train log."""
training_records = [note.casefold() for note in training_note_texts]
flags = []
for it in test_items:
prompt = it["prompt"].strip().casefold()
if prompt and any(prompt in note for note in training_records):
flags.append({"kind": "exact_overlap", "item_id": it["item_id"]})
return flags
def tuning_flag(
config_fingerprint: str, submission_log: list[dict], threshold: int = 3
) -> list[dict]:
"""Flag if the same model+benchmark+config was submitted too many times."""
n = sum(
1
for s in submission_log
if s["config_fingerprint"] == config_fingerprint
)
if n >= threshold:
return [{"kind": "repeat_submissions", "count": n}]
return []The toy checks for a nonempty prompt within a single case-folded log record. This is a signal for review. The procedure may exclude a known overlap in a versioned item set, invalidate an affected result, or retire a benchmark with wider exposure.
Each flag has a kind and the evidence needed to review it, such as an item ID or submission count. Attached flags are active at this toy gate. A metadata correction cannot clear them. In the later walkthrough, a revised item snapshot is rescored and reviewed before the new release can carry its own findings.
Let's run both detectors on synthetic data designed to trip one of them.
PythonIn [14]Expand
items = synthetic_items()
train_logs = [
"User asked: add 3 and 4. Assistant answered 7. (synthetic log)",
"Filler line 2",
"Filler line 3",
]
contam = contamination_flag(items, train_logs)
sublog = [
{"config_fingerprint": "cfg-aaa"},
{"config_fingerprint": "cfg-aaa"},
{"config_fingerprint": "cfg-aaa"},
{"config_fingerprint": "cfg-bbb"},
]
tune = tuning_flag("cfg-aaa", sublog)ConsoleOut [15]Expand
contamination flags: [{'kind': 'exact_overlap', 'item_id': 'syn-001'}]
tuning flags: [{'kind': 'repeat_submissions', 'count': 3}]The item "Add 3 and 4." is flagged as an exact overlap, and the config submitted three times is flagged for repeat submissions. These flags will be attached to the release and will constrain what the reporting gate permits. The flags are evidence, not verdicts; a human decides whether an overlap is an innocent coincidence or a leak. What governance guarantees is that the decision is recorded and the claim cannot be made as if the flag didn't exist.
These detectors produce clues and miss cases. Record the evidence and who resolved each flag. An unresolved flag can hold a release for inspection even when its cause turns out to be an innocent repeat.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!