Contents14 of 15
Download the PDF (892 KB)Before You Blame the ModelBonus · The trap under all the others
Bonus chapterEvals
Teaching to the test
My harness was acing my tests because it had quietly learned the answers.
I tuned my agent on the same small set of tasks, over and over. A change that moved the pass rate stayed. A change that didn't got cut. That's how almost everyone tunes a harness, and it felt like progress, because the number kept going up. The best result was a comparison I wanted on my website: my agent passed 14 of 22 tasks, and the agent I was comparing it against passed 7 of 21.
Then I found a file. Over several releases, a helper had grown inside my harness that loaded hand-written checklists of what a task needed, looked up by the task's name. Every one of those names was a task from my tuning set. It was switched on by default. The run logs settled it: every run on the tuning set had loaded a checklist, and not one run on my held-out tasks had.
Nobody set out to cheat. Each checklist was written to fix a real failure on a real task. Together they turned my harness into a machine that was very good at those tasks and no better at anything else. The comparison never made it onto the website. From that day I only quote held-out numbers, and the harness now refuses to load anything keyed to a task's name.
If a change only helps on tasks you've already seen, it isn't a feature. It's an answer key.
#How a harness learns the test
Benchmark gaming usually means someone cheating on purpose. This is the quieter version, where an honest tuning loop does it for you. The shapes I've caught:
- Answer keys by another name. A rule, an example, a checklist or a retry policy that's tied to one task, repository, file or test name. The test: if renaming the task would break your improvement, it was an answer key.
- Tuning on the scoreboard. Keeping whatever moves the number on twenty tasks is a search over your eval. Run that loop long enough and you fit the eval, even when no single change looks suspicious.
- Writing for the grader. When a model judges the output, the harness drifts toward whatever that judge rewards. Chapter 11 showed how easily a judge's verdict moves on things that have nothing to do with quality.
- Checks that test the shape. On a different project, a generator had 500 passing tests. When I ran it on real inputs and printed what came out, 0 of 3 were usable, and the printouts turned up about a dozen more defects. The tests had been written from the same assumptions as the code.
- Lab tasks that are kinder than real ones. The code index in Chapter 10 found the right place to edit 36 times out of 37 in the lab, and 9 out of 20 on real runs.
- Many tries reported as one. A loop that keeps retrying until the tests go green will make a weak agent look like a passing one. Report attempts next to passes, every time.
#Keep a held-out set that stays held out
When I started worrying that I was fitting a handful of tasks, I built a sealed batch from real bug fixes and gave myself one hard rule: I never read those tasks, and I never tune on them. Building them was a lesson of its own. Each candidate had to survive repeat runs, a different correct fix that should also pass, and a wrong fix that should fail. An outside review found real flaws in the graders every single time, mostly in tests copied straight from the original fix. One candidate got thrown out because its environment was missing a library it needed. A held-out set full of broken tasks is just a slower way to fool yourself.
Two more habits keep the loop honest. Read real outputs every week, all the way through, ignoring the score. And stretch the bar from the front of this book: if a trick doesn't carry over to a different task set, or to a different model, assume it's fitting the test until a held-out run says otherwise.
# 1. your harness should never know which task it's on
for task in eval_tasks:
for needle in (task.id, task.repo, *task.test_names):
hits = search(harness_files, needle) # prompts, rules, config, code
assert not hits, f"possible answer key: {needle} in {hits}"
# 2. a gain counts only if it shows up where you didn't tune
def verdict(tune_gain, holdout_gain, noise): # noise: spread across repeat runs
if tune_gain <= noise: return "no real gain"
if holdout_gain <= noise: return "fits the tuning set only"
return "keep it"