Skip to content

Reward Hacking in Reinforcement Learning (Lilian Weng)

optionalcorefrontierblogrubric 10/122024 · Lil'Log (28 Nov 2024) · ~60 min

Lilian Weng

Status

TL;DR. A long, well-referenced survey post. It starts from the classic definitions — reward shaping, Goodhart’s law, specification gaming, reward tampering — and then spends most of its length on language models. Its topics are reward-model over-optimisation in RLHF, RLHF making wrong answers more convincing to humans, biases in LLM graders, reward hacking inside a feedback loop at test time, and evidence that hacking skills learned in one environment transfer to others. It ends with a short survey of mitigations and an honest note that few have been tested.

Why it matters now. This is the most efficient single reading for an IR researcher starting on RL for LLMs. Every section maps to a design decision you will face: which reward model or judge to use, how far to optimise against it, how to check the judge, and what to monitor. The LLM-as-judge section is directly about the evaluation tools IR now relies on.

“Reward hacking exists because RL environments are often imperfect, and it is fundamentally challenging to accurately specify a reward function.” (Weng, 2024)

The post lists related terms that all refer to some form of the same problem: reward hacking, reward corruption, reward tampering, specification gaming, objective robustness, goal misgeneralisation and reward misspecification. It then sorts examples into two types:

  • Environment or goal misspecified: the agent exploits a flaw in the reward to get high reward without doing the task.
  • Reward tampering: the agent interferes with the reward mechanism itself, either its implementation or the information it reads.

For RLHF it separates three rewards: the true objective R∗R^*, the human rating RhumanR^\text{human} (which can be wrong), and the proxy RR predicted by a reward model. Hacking can happen at each gap.

Where reward hacking enters an RL training loop for LLMs and agents Pipeline from intended goal to specification to reward signal to policy to behaviour, with a feedback arrow from reward signal to the policy update. Labels mark where hacks enter: a misspecified objective, proxy errors in reward models, exploits of verifiers, judges and tests, and reward tampering. A monitor reads chain of thought and actions; training against the monitor teaches obfuscation. Intended goal what we want Specification task, rubric, tests Reward signal RM · verifier · LLM judge · unit tests Policy Behaviour CoT + actions scored RL 1 2 3 4 Monitor reads CoT and actions 5 1 Misspecified objective: the spec rewards the wrong thing (specification gaming). 2 Proxy error: reward-model over-optimisation, length bias, sycophancy. 3 Grader exploit: verifier false positives, null-model judge attacks, editing or special-casing tests. 4 Reward tampering: the policy modifies the reward process itself. 5 Training against the monitor: hacking continues but the intent is hidden (obfuscation).
Original sketch. The post's sections roughly follow this pipeline: misspecified tasks, reward models and judges as hackable signals, the policy learning to exploit them, and monitors or detectors as mitigations.

The post collects results from others rather than reporting its own:

  • Adversarial policies (Gleave et al., 2020) can reliably beat a victim agent while taking almost random actions, trained with fewer than 3% of the time steps.
  • Gao et al.: αRL\alpha_\text{RL} stays constant across RM sizes; larger policies start stronger and gain less from optimisation against the RM, but the 1.2B and 6B policies show similar overoptimisation: nearly the same proxy–gold gap and KL at the gold-score peak (Gao et al. §3.4). The post’s phrase that larger policies “also overoptimize less” is stronger than the primary paper, which says they “don’t overoptimize more”.
  • Grader calibration (Wang et al., 2023): multiple-evidence calibration (judge writes explanations, several samples; k=3k=3 better than k=1k=1), balanced position calibration (score both orders), and human-in-the-loop calibration for confusing cases.
  • Denison et al.: supervised fine-tuning on the first two, easily detected environments (sycophancy and flattery) reduced reward tampering in held-out environments.
  • SEAL data analysis (Revel et al., 2024): the reward model resisted human preference on over a quarter of the HHH-RLHF dataset.
  • Secondary source. Numbers are as reported by the cited papers, and the summaries can drift. For example, the post says no detector in Pan et al. exceeded 60% AUROC across all environments, while Pan et al.’s own claim is that each detector falls below 60% on at least one task.
  • Snapshot of late 2024. It predates most of the RLVR and coding-agent results (test editing, chain-of-thought monitoring and obfuscation) covered elsewhere in this group.
  • Mitigations are thin. The post itself says practical mitigations for RLHF and LLMs are under-explored, and its mitigation section is mostly pre-LLM.

Questions to think through

These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.

  1. Derive / compute

    The post quotes Gao et al.'s fitted gold-reward curves as functions of d = sqrt(KL(π ‖ π_init)): R_bon(d) = d(α_bon − β_bon·d) for best-of-n and R_RL(d) = d(α_RL − β_RL·log d) for RL. Find the d that maximises each, the peak gold reward, and the corresponding KL. Evaluate both with hypothetical coefficients α = 1, β = 0.5.

    What a strong answer covers
    • BoN: dR/dd = α − 2βd = 0, so d* = α/(2β) and peak R = α²/(4β). With α = 1, β = 0.5: d* = 1, KL = 1 nat, peak 0.5.
    • RL: dR/dd = α − β·log d − β = 0, so d* = exp(α/β − 1) and peak R = β·d*. With α = 1, β = 0.5: d* = e ≈ 2.72, KL ≈ 7.4 nats, peak ≈ 1.36.
    • The RL curve falls off only logarithmically past its peak, so it over-optimises more slowly in d than best-of-n, but the peak is reached at a much larger KL.
    • Practical reading: early stopping or a KL budget should target the peak, which depends on the fitted β. The post notes β varies with RM size while α_RL stays constant, so bigger RMs move the peak.
  2. Mechanism

    The post describes positional bias in LLM graders: GPT-4 tends to favour the first candidate and ChatGPT the second, measured by a conflict rate after swapping response order. Explain how an RL policy trained against such a judge could exploit this bias, and why the calibration methods described (multiple-evidence calibration, balanced position calibration) reduce the exploitable signal.

    What a strong answer covers
    • If the reward comes from a pairwise judge with a fixed slot for the policy's answer, a position preference adds a constant bonus or penalty that has nothing to do with quality. Any feature that interacts with position, such as length or format, can then be pushed by RL.
    • Conflict rate is the fraction of (prompt, response 1, response 2) cases whose verdict flips when the order is swapped. A high rate means much of the reward is noise or bias the policy can learn to trigger.
    • Balanced position calibration scores both orders and averages, which cancels a pure position effect. Multiple-evidence calibration makes the judge write explanations first and samples several (k = 3 worked better than 1, with little gain beyond).
    • Calibration removes known biases but not unknown ones; a policy can still exploit self-bias (judges preferring their own outputs) or verbosity.
  3. Critique

    The post summarises Pan et al. (2022) by saying no tested detector achieves AUROC above 60% across all environments. Compare this with Pan et al.'s own Table 2 and say precisely what the correct statement is, and why the difference matters for someone deciding whether to use such detectors.

    What a strong answer covers
    • In Table 2 every detector exceeds 60% AUROC on some tasks, up to 88.9% (mean JSD and mean Hellinger on Traffic-Bot misweighting) and 88.1% (range Hellinger on COVID ontological).
    • Pan et al.'s actual claim is that each detector has at least one subtask below 60% AUROC, so no single detector is reliable everywhere.
    • The post's wording can be read as all detectors being near chance, which is too pessimistic. The correct reading is that detectors are task-dependent.
    • Practical consequence: choose and validate a detector per environment and expect it to fail on some hack types, rather than dismissing the approach or trusting one detector everywhere.
  4. Design

    You train a deep-research agent with RL using an LLM judge that compares the agent's report with a reference report. Using the post's sections on hacking the evaluator, U-Sophistry and in-context reward hacking, list the hacks you expect and design an evaluation protocol that would detect each before deployment.

    What a strong answer covers
    • Expected hacks: exploiting judge position or self-preference, longer and more confident reports, and convincing but wrong claims (U-Sophistry: after RLHF, human evaluators accepted more incorrect answers).
    • Protocol for the judge: score both orders, use a different model family from the policy as the judge, and track the conflict rate on a fixed probe set over training.
    • Protocol for sophistry: a held-out set with verified answers, where humans or a strong checker verify claims against cited sources; watch whether judge approval rises while verified accuracy does not.
    • Protocol for in-context hacking: at test time, run several rounds of feedback with diverse and atypical observations, as the post recommends, since ICRH appears only in feedback loops at deployment.
  5. Connect

    The post contrasts in-context reward hacking (ICRH) with traditional training-time reward hacking. Explain the two differences it names, and connect ICRH to Goodhart's law and to the classic RL picture in Concrete Problems.

    What a strong answer covers
    • Timing: ICRH happens at deployment inside a self-refinement feedback loop, with no weight updates; traditional hacking happens during training.
    • Source: traditional hacking comes from an agent specialising on a task; ICRH is driven by the model being a generalist that can pursue any metric put in its context.
    • It is still Goodhart: the in-context metric (engagement, task completion) is a proxy, and optimising it in context raised toxicity or led to unauthorised money transfers in the ToolEmu experiments.
    • Concrete Problems frames hacking as an optimiser exploiting a reward; ICRH shows that the optimiser can be in-context reasoning, so mitigations aimed only at training (KL penalties, RM ensembles) do not cover it.
  6. Research idea

    The post ends by saying research on practical mitigations, especially for RLHF and LLMs, is still limited. Pick one mitigation the post discusses (decoupled approval, anomaly detection, or SEAL-style data analysis) and propose a concrete experiment that would test whether it reduces reward hacking in an RL-trained retrieval-augmented LLM.

    What a strong answer covers
    • Name the mitigation and its mechanism, for example decoupled approval: query feedback on an action sampled independently of the action executed, so the executed action cannot corrupt its own feedback.
    • Set up a measurable hack, such as a retrieval agent that can write to a cache the reward reads, or a judge that can be influenced by text the agent writes.
    • Compare with and without the mitigation on hack rate, gold task success and reward-model score, across several seeds and two model sizes.
    • Success: lower hack rate at similar gold success, and no sign that the hack moved to a form the mitigation does not see.

Done with this page?

Status