rhscope¶
Activation probes for reward hacking in LLM RL post-training.
rhscope catches reward hacking during LLM RL post-training. Train a cheap linear probe on your policy’s hidden states, use it as a reward-penalty monitor inside GRPO/PPO/DPO, and tell genuine reform apart from monitor evasion when you train against it.
How rhscope fits together¶
Three pieces, one workflow:
Probe- a linear direction in hidden-state space, trained from a few hundred labelled(prompt, response, is_hack)examples. Training takes seconds-to-minutes on a modest GPU; scoring is one dot product per rollout.HackMonitor- wraps a trained probe (or any customDetector) and exposes the surface that the TRL / verl / DPO adapters consume.EvasionDetector- the research contribution: tracks probe-subspace drift at each eval step so a policy that looks like it stopped hacking can be distinguished from one that just rotated its activation signature out of the probe’s direction.
Labelled training data comes from either (a) an RH-Detect-style JSONL
you already have, or (b) rhscope’s built-in
CodeShortcutEnv - an MBPP-based coding
environment with a weak/strong test split that labels each rollout as
hacking or not via a sandbox-verified oracle.
Start here¶
New to rhscope? Introduction - the mental model, the trade-offs, the probes we ship.
Want to try it? Quickstart - install to first score in ten minutes.
Looking for runnable code? Examples - five self-contained scripts covering the common workflows.
Hunting a specific symbol? API overview for the hand-curated tour, or API reference for the auto-generated per-module reference.
Why this exists¶
Reward hacking is when a policy maximises its reward signal through shortcuts the reward function did not intend: hardcoding test answers, padding verbose responses, deleting tests, admitting the shortcut in a comment. Left unchecked, it quietly corrupts a training run - loss curves look healthy while the policy learns something you did not ask for.
Probes catch it at ~1000x less compute than an LLM-judge monitor and read the model’s internal representation of what it is doing rather than just the output text. See related work for how rhscope positions against the activation-probe and monitor-evasion literature.
Research contributions¶
Beyond the standard probe-library surface, rhscope ships four first-class research pieces:
EvasionDetector- distinguishes genuine reform from monitor obfuscation by tracking probe-subspace drift on held-out activations at every eval step.RefDeltaDetector- scores hacking as a per-token log-probability delta between the trained policy and its frozen reference model. Near-zero marginal cost during RL rollouts since both models are already loaded for the KL penalty.OnlineProbe- DoM probe withpartial_fitsupport for long training runs; snapshots to a frozenDoMProbeon demand.MLPProbe- shallow non-linear probe for concepts the DoM / logistic probes cannot linearly separate.