arXiv(opens in a new tab)cs.LGOct 2026Cited by 2 papers on PaperVantage

Manuscript Offprint

arXiv:2610.17062

Gradient Routing Localizes and Removes Unintended Behaviors in RL

Jake Ward, Shawn Hu, Aria Wong, Nathan Hu, Bryce Woodworth, Alexander Matt Turner, Alex Cloud

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Jake Ward ∗^{*}

MATS

Aria Wong

MATS

Nathan Hu

Stanford

Bryce Woodworth

MATS

Shawn Hu ∗^{*}

MATS

Alexander Matt Turner

FAR AI

Alex Cloud

Anthropic

Abstract

We propose a mitigation to reward hacking in reinforcement learning. Our setup involves a misspecified reward function that gives rise to unintended behavior, and a monitor used to detect unintended behavior. As with frontier AI systems, the monitor makes systematic errors. Consequently, using the monitor for data filtering or to apply a reward penalty fails to prevent the model from learning unintended behavior (“reward hacking”). To address this problem, we introduce GRAFT: Gradient Routing Adapter Fine Tuning. Rather than penalizing or filtering flagged samples during training, GRAFT constrains gradient updates on those samples to a sacrificial set of new parameters. This has two benefits: First, because the monitor is not part of the reward function, the model does not learn to hide misbehavior. Second, ablating the sacrificial parameters reduces or entirely stops the unintended behavior while maintaining improved performance on target tasks. We demonstrate these benefits in RL environments where reward penalties cause models to learn to reward hack in undetected ways, training models ranging from 135M to 8B parameters. Additionally, we show a similar effect at a larger scale by distilling frontier LLM trajectories containing reward hacking into Qwen3-32B, without teaching that model to reward hack. Overall, our work suggests GRAFT may be a promising approach for leveraging imperfect monitors during post-training in settings where true performance is difficult to evaluate.

Unclassified Behavior ( πR+F\pi_{R+F})

Figure

Detected Reward Hacking ( πR+F\pi_{R+F})

Forward/backward pass

Parameters frozen

Parameters updated

Anchor Environment Behavior ( πR\pi_{R})

Parameters updated

2× update

Parameters disabled

Figure 1: Gradient Routing Adapter Fine Tuning (GRAFT). Additional neurons are added to each MLP in a decoder-only Transformer; these are partitioned into a RETAIN adapter and a FORGET adapter. When training in the target environment (left and center), both adapters are enabled ( πR+F\pi_{R+F}) for the rollout phase and the actor update's forward pass. On trajectories not flagged by the monitor (left), both adapters receive gradient updates. On trajectories flagged by the monitor (center), only the FORGET adapter is updated and the gradient update to this adapter is amplified by a factor of 2. We concurrently train the model in a separate anchor environment where only the RETAIN adapter is enabled ( πR\pi_{R}) and updated (right).

Preprint.

∗^{*}Equal contribution; author order randomized.

1 Introduction

Large language models (LLMs) are often trained with reinforcement learning (RL) [1, 2]. RL environments with misspecified reward functions can lead to reward hacking, where models behave in ways that are assigned high reward despite violating developer intent. Model cards accompanying the release of recent frontier models show these models reward hack [3–8]. As model capabilities have increased, so too have the sophistication and variety of actual reward hacks [9], in some cases causing real-world incidents [10]. This limits the usefulness and reliability of AI systems, and poses safety risks: research suggests that reward hacking could generalize to dangerous misbehaviors, including violating restrictions on aiding various harmful activities, autonomously conducting cyberattacks [11], deception, and research sabotage [12].

One way to prevent reward hacking is through the introduction of monitors to the process of reinforcement learning. These monitors, which could be LLM judges or keyword detectors, read the content of trajectories generated during training and flag trajectories containing undesired behaviors. When a trajectory is flagged, a reward penalty can be assigned which prevents those behaviors from being reinforced. This is a form of reward shaping.

Reward shaping is not a panacea. In practice, perfect specification of reward functions is impossible [13–15]. Even slight misspecification in a reward function can produce arbitrarily bad behavior under optimization [16]. Moreover, monitors make systematic errors, and incorporating monitor verdicts into reward functions can reinforce monitor-exploiting policies that misbehave in ways that go undetected [17–19]. For example, policies trained against LLM judges can learn to produce hacking behaviors too subtle for the judge to catch [20], trick judges by impersonating them [21], or circumvent them by agentic means [11]. In our own experiments with programmatic judges, reward penalties prevent the hacks detected by the monitor but undetected hacks are still learned.

In this paper, we propose GRAFT, a method that uses a monitor to shape learning dynamics without changing the reward. GRAFT adapts gradient routing [22, 23] to language model post-training. At the start of post-training, we initialize two sets of additional neurons, increasing the width of the hidden layer of every MLP in the network. We refer to these as the RETAIN adapter ( θR\theta_{R}) and the FORGET adapter ( θF\theta_{F}). The RETAIN adapter's role is to represent desired behaviors, and the FORGET adapter's role is to represent undesired behaviors.

When undesired behaviors are flagged by the monitor, we zero-mask gradients to all parameters except those in the FORGET adapter (“routing” the gradients to θF\theta_{F}). Otherwise, we update both θR\theta_{R} and θF\theta_{F}. After training, we ablate the FORGET adapter to remove the undesired behavior while preserving performance on target tasks (Figure 1). Critically, we use the monitor only to decide which parameters to update, rather than to specify the reward. Thus, policies which exploit weaknesses of the monitor are not differentially reinforced. GRAFT enables the use of weak monitor supervision during training without teaching the model to exploit the monitor’s weaknesses.

In summary:

• We introduce GRAFT, a method for preventing reward hacking with weak monitors that works by localizing reward hacking to certain parameters, then ablating those parameters.

• GRAFT improves target-task performance of Qwen3-8B in the Countdown-Code [24] environment without increasing the model’s propensity to reward hack. Monitor-based reward shaping instead teaches the model to exploit the monitor and reward hack in ways that the monitor cannot detect.

• We train SmolLM2-135M in a diverse set of toy RL environments. GRAFT avoids monitor-exploiting policies in every environment. In these environments, detecting a subset of hack forms was enough to suppress undetected forms as well. (To maintain target-task performance in these environments, we use the monitor to penalize reward hacks for the policy in the deployment configuration only.)

• We apply a supervised fine-tuning (SFT)-based variant of the method by training Qwen3-32B on a multi-turn agentic coding dataset. Under prompt-based hack elicitation, the model trained with GRAFT never reward hacks and matches the solve rate of a model trained on perfectly filtered data.

References (40)