
For AI labs
Five hidden-test patterns that can't be gamed
Berkeley's checklist for trustworthy agent benchmarks says to isolate the grader, zero the null agent and lock the test files. That is the harness. This is the other half: how to write the tests themselves so a determined model cannot pass them without doing the task.
Prashant Kumar Singh · · 4 min read
In short
- A visible test is a hint; a hidden test is a measurement. If the agent can read the expected output, it will match it.
- Five patterns: hidden inputs generated at grading time, final-state checks instead of transcript checks, property tests that must hold for any input, a second valid solution that must pass, and a grader that runs outside the agent's reach.
- The tests are the product. A task with a good spec and weak tests measures nothing.
In April 2026 Berkeley's RDI group published a checklist for trustworthy agentic benchmarks after finding harness exploits that let an agent score 100% without solving a single task. The checklist covers the harness: isolate the grader, run the null agent, lock the test files, check that success cannot be signalled directly. Every task programme should run it.
The harness is necessary and not sufficient. A perfectly isolated grader running a weak test still passes a shortcut. These are the five patterns I use for the tests themselves, in the order I apply them.
1. Hidden inputs, generated at grading time
The agent sees the specification and the sample data. The grader runs on inputs it generates or mounts at grading time, drawn from the same distribution but never present in the task directory. Special-casing the sample becomes useless because the sample is not what is graded. For data tasks this means a different file; for code tasks, a different set of arguments; for agentic tasks, a different starting state.
2. Final state, not transcript
Grade what is true at the end: the files on disk, the rows in the table, the output of running the program. Never grade the agent's own account of what it did, and never grade a log line it could have printed. The model that writes "All tests passed" to stdout should score exactly the same as the model that writes nothing.
3. Property tests
Instead of asserting one expected output, assert a property that must hold for any input: the function is idempotent, the total is preserved, the sort is stable, the parser round-trips. Then run it on a few hundred random inputs. A property test catches the solution that works on the three cases the author thought of and nothing else, which is the most common shape of a wrong answer.
4. A second valid solution must pass
Before a task ships, write a second correct solution that takes a different approach, and confirm the tests pass it. SWE-bench Verified filtered out tasks whose tests only accepted one implementation; those tests graded the path instead of the outcome and failed correct answers. If a second solution fails your tests, the tests are over-specific and the task will be rejected at review or, worse, accepted and then wrong.
5. The grader runs out of reach
This one is from the Berkeley list, and it belongs here because test patterns are worthless without it. The grader runs in a separate container, the test files are mounted read-only after the agent's turn ends, and the result is written somewhere the agent cannot touch. The agent's environment should contain nothing that, if modified, changes the score.
| Pattern | Defeats |
|---|---|
| Hidden inputs at grading time | Special-casing the sample |
| Final-state checks | Printing success, lying in the summary |
| Property tests | Solutions that fit three cases |
| Second valid solution passes | Over-specific tests that fail correct answers |
| Grader out of reach | Editing or replacing the tests |
Why this is worth the time
A task takes hours to write. The tests take a fraction of that and decide whether the hours measured anything. Terminal-Bench 2.0 accepted about 39% of submitted tasks after roughly three reviewer-hours each; most of what was rejected failed on exactly the problems these patterns prevent. Writing the tests this way is how a task clears review the first time.




Questions people ask
- What is a hidden test in a coding benchmark?
- A test the agent cannot see or modify, run on inputs generated or mounted at grading time, checking the final state of the environment rather than anything the agent printed or claimed.
- How do you stop an AI agent from gaming benchmark tests?
- Generate inputs at grading time, check final state not transcripts, use property tests across many inputs, confirm a second valid solution passes, and run the grader in a separate container with read-only test files.
- What is a property test?
- A test that asserts a property which must hold for any input, such as idempotence or a preserved total, and runs it over many random inputs rather than checking one expected output.
If you're a founder
Your AI feature's evaluation has the same weakness: if the test set is the demo set, the feature will look good in the demo. Hold out real inputs the team has never seen.
If you run an AI lab or data team
Send one task with its tests and the free review will apply all five patterns and tell you which the task fails.
Sources