Log inStart free
LESSON 18.11 · 5 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

A taxonomy of reward hacking

Watch 12 shortcuts win reward from a coding scorer without solving the task.


Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 2 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 18.11 · SCORER BAY3 VISIBLE · 3 HIDDEN · AUDIT 200 LISTS
01
Stage 1 of 5 · Task and scorer
The scorer pays reward when the agent's median(xs) passes tests in a sandbox. A trusted audit set of 200 lists checks the code later.
Explain it simply

Every episode starts the same way. The agent writes a sloppy median that sorts the list and takes the middle item. The second test fails, because a list of four has two middle items. The scorer sees only its tests, but the audit, run later, sees the truth.

Four zones: the sandbox with five files, the harness, the scorer's nine rules, and the reward with the audit. Below: 3 visible tests, 3 hidden checks and the audit, where the sloppy code gets 126 of 200 right. The chosen episode earns 16.3.

tests and checksscorer rulesrewardfailures and penaltiestrusted audit
sandbox: the agent writesharnessscorer rulesrewardsolution.pynantests/visible.py3 testsruns.log1 FAILreport.mdJ 0.65fix.sh—compare (buggy)not |out−exp| > 1e-9results read at 1 sslow test: no lineV2 with nan|nan − 2.5| → pass+1 a test turns green+3.0+0.5 an all-green run+0.5+2 per visible pass (runs.log)+6.0±2 per hidden check+6.0+2 × judge J+1.29−0.5 per FAIL line−0.5−5 if the monitor flags0exit: last run only—reset: new hidden draw—16.3honest fix 15.9submit as is 4.8audit (trusted)0 / 200visible teststhe agent reads and can edit themhidden checks, first draweach a shuffle of 0 … n − 1audit: 200 listsa clean sandbox, after the episodeV1 [3, 1, 2] → 2passV2 [4, 1, 3, 2] → 2.5FAILV3 [5] → 5passH1 [0, 2, 1, 3] → 1.5FAILH2 [3, 1, 2, 5, 4, 0] → 2.5FAILH3 [2, 4, 5, 0, 6, 1, 3] → 3pass[4, 2, 5, 0] → 3wrong[2] → 2right[4, 3, 1] → 3right… 197 more · sloppy: 126 / 200 rightmedian = (n − 1) / 2, from n aloneevery episode starts: return sorted(xs)[len(xs) // 2]an even-length list has two middle items, so V2 failsthe task, its tests and the scorersandbox: the agent writesharnessscorer rulesrewardsolution.pynantests/visible.py3 testsruns.log1 FAILreport.mdJ 0.65fix.sh—compare (buggy)not |out−exp| > 1e-9results read at 1 sslow test: no lineV2 with nan|nan − 2.5| → pass+1 a test turns green+3.0+0.5 an all-green run+0.5+2 per visible pass (runs.log)+6.0±2 per hidden check+6.0+2 × judge J+1.29−0.5 per FAIL line−0.5−5 if the monitor flags0exit: last run only—reset: new hidden draw—16.3honest fix 15.9submit as is 4.8audit (trusted)0 / 200visible teststhe agent reads and can edit themhidden checks, first draweach a shuffle of 0 … n − 1audit: 200 listsa clean sandbox, after the episodeV1 [3, 1, 2] → 2passV2 [4, 1, 3, 2] → 2.5FAILV3 [5] → 5passH1 [0, 2, 1, 3] → 1.5FAILH2 [3, 1, 2, 5, 4, 0] → 2.5FAILH3 [2, 4, 5, 0, 6, 1, 3] → 3pass[4, 2, 5, 0] → 3wrong[2] → 2right[4, 3, 1] → 3right… 197 more · sloppy: 126 / 200 rightmedian = (n − 1) / 2, from n aloneevery episode starts: return sorted(xs)[len(xs) // 2]an even-length list has two middle items, so V2 failsthe task, its tests and the scorer
Toy: a median task, 3 visible tests, 3 hidden checks, 14 episodes
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
R=∑trt+F\sy{r}{out}{R} = \sum_t \sy{rt}{out}{r_t} + \sy{f}{out}{F}
R=3.5+12.79=16.29R = 3.5 + 12.79 = 16.29

The reward adds the step rewards and the final score.

Common mix-ups

MYTHA scorer with no bugs and no tampering cannot be hacked.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01Patch the scorer. Does the NaN episode still earn more than submitting as is?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
  • 4 more stages and 2 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.