r/reinforcementlearning • u/kyotonakamura • 1h ago
Reward bugs in coding-RL graders: a wrong answer gets reward 1 on Terminal-Bench 2, and a conftest.py hack passes SWE-bench Verified
If you use benchmark tests as an RL reward, a test that accepts a wrong answer is a reward bug, and a policy will find it.
Two I found and filed this week:
- Terminal-Bench 2, constraints-scheduling (https://github.com/harbor-framework/terminal-bench-2/issues/107). Two of three tests read the first DTSTART in the output file, not the scheduled meeting. Put a decoy event at the right time first and book the real meeting at a clashing slot: 3/3 tests, reward 1, in the official image.
- SWE-bench Verified (https://github.com/SWE-bench/SWE-bench/issues/733). With the official harness, a patch that only adds a root conftest.py hooking pytest_runtest_makereport to mark every test passed is graded resolved in 4 repos (pytest, sphinx, scikit-learn, xarray). That's the classic reward hack, and it gets past the exit-code check added for the earlier report #631 because pytest exits 0. Separately, wrong or incomplete patches graded resolved on 9 instances.
I built Aethens (Apache-2.0, v0.1.0 out now) to check this kind of thing before training. It runs a task's tests in Docker against the gold, labelled-wrong answers, mutants of the gold, and reward-hack probes (exit-zero, atexit, framework patching, sitecustomize, always-equal objects, lookup tables of visible answers). Every finding has a one-line repro. No LLM judge.
Limits: Python tasks in its own format only. The TB2 and SWE-bench converters I used aren't released yet. It doesn't probe conftest.py hooks yet; that's next. On its own planted-defect bench (34 tasks) it scores precision 1.0, recall 1.0 (20/20) and 116/116 reward-hack probes, which only shows it catches what I planted. On HumanEval judged by HumanEval+, the mutation check's precision is 0.8158 (31/38).
pipx install aethens · https://github.com/beastrog/aethens/
If you train on coding environments: which reward hacks have you seen policies find that a tool like this wouldn't probe?