IR: Contrastive Inverse Reinforcement Learning for Interpretable Detection and Mitigation of Reward Hacking
Organizations: UC Davis · Virginia Tech · Salesforce · Meta AI
Abstract
Reinforcement Learning from Human Feedback (RLHF) enables powerful LLM alignment but can introduce reward hacking - models exploit spurious correlations in proxy rewards without genuine alignment. Compounding this, the objectives internalized during RLHF remain opaque, making hacking behaviors difficult to detect or correct. We introduce IR3 (Interpretable Reward Reconstruction and Rectification), a framework that reverse-engineers, interprets, and surgically repairs the implicit objectives driving RLHF-tuned models. We propose Contrastive Inverse Reinforcement Learning (C-IRL), which reconstructs the implicit reward function by contrasting paired responses from post-alignment and baseline policies to explain behavioral shifts during RLHF. We then decompose the reconstructed reward via sparse autoencoders into interpretable features, enabling identification of hacking signatures through contribution analysis. Finally, we propose mitigation strategies - clean reward optimization, adversarial shaping, constrained optimization, and feature-guided distillation - that target problematic features while preserving beneficial alignment. Experiments across multiple reward model configurations show that IR3 achieves 0.89 correlation with ground-truth rewards, identifies hacking features with over 90% precision, and significantly reduces hacking behaviors while maintaining capabilities within 3% of the original model.
Figures & tables
| RM | Spearman | Pearson | Acc. | Top10 |
| RM-HH | 0.87 .01 | 0.89 .01 | 86.2 0.6 | 91.4 0.8 |
| RM-Ultra | 0.89 .01 | 0.91 .01 | 87.8 0.5 | 93.2 0.7 |
| RM-Safe | 0.86 .01 | 0.88 .01 | 85.5 0.7 | 90.8 0.9 |
| Helpsteer2 | 0.88 .01 | 0.90 .01 | 87.1 0.5 | 92.5 0.7 |
| ArmoRM-8B | 0.81 .02 | 0.86 .02 | 83.8 0.7 | 88.9 0.9 |
| Avg | 0.865 | 0.885 | 85.8 | 91.1 |
| RM | Gap | Win% | MMLU | GSM8K | |
| RM-HH | 0.025 .03 | 0.13 | 48.5 2.2 | 53.8 / 54.1 | 42.5 / 42.8 |
| RM-Ultra | 0.021 .02 | 0.06 | 49.2 1.9 | 54.2 / 54.3 | 43.1 / 43.2 |
| RM-Safe | 0.028 .03 | 0.16 | 47.8 2.3 | 53.5 / 53.9 | 42.0 / 42.4 |
| HelpSteer2 | 0.023 .02 | 0.10 | 48.9 2.0 | 54.0 / 54.2 | 42.8 / 43.0 |
| ArmoRM-8B | 0.034 .04 | 0.26 | 45.8 2.5 | 53.2 / 53.8 | 41.5 / 42.1 |
| Avg | 0.026 | 0.14 | 48.0 | 53.7 / 54.1 | 42.4 / 42.7 |
| Method | Win% | ||
| (baseline) | 0.0458 | 2.15 | 18.2 |
| Imitation Learning | 0.0442 | 3.78 | 38.5 |
| C-IRL (Ours) | 0.024 | 4.41 | 48.1 |
| DPO | 0.018 | 4.52 | 49.6 |
| (oracle) | 0.00 | 4.55 | 50.0 |
| Regime | #Cl. | Ovrlp.% | Templates | |
| OA Length | 22 | 4 | 8.5 | verbosity; restatement; caveats; padding |
| HH Harmless | 19 | 3 | 11.2 | refusal templates; hedging; safety phrases |
| Regime | Proxy | Heur. | AUPRC | |
| Synth. Goodhart | 0.72 | 0.58 | 0.91 | 0.84 |
| OA Length | 0.68 | 0.79 | 0.88 | 0.81 |
| HH Harmless | 0.71 | 0.63 | 0.86 | 0.78 |
| Method | Gap | Dom. | Win | Ref. | Safe | |
| PPO on | 3.52 | 1.86 | 0.42 | 50.0% | 23.4% | 89.8% |
| KL Regularization ( ) | 3.78 | 1.42 | 0.35 | 54.8% | 18.2% | 88.2% |
| PPO Clipping ( ) | 3.68 | 1.55 | 0.38 | 52.5% | 20.1% | 89.5% |
| Reward Clipping ( ) | 3.72 | 1.48 | 0.36 | 53.8% | 19.5% | 89.2% |
| Length Penalty ( ) | 3.85 | 1.32 | 0.32 | 56.2% | 16.8% | 89.0% |
| InfoRM | 3.95 | 1.08 | — | — | 14.5% | 90.5% |
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
| Spearman | Rank Acc. | Forward KL | Grad. Var. | Train Time | |
| 1 | 0.86 .02 | 85.2% | 0.032 | 1.0 | 1.0 |
| 2 | 0.87 .01 | 86.1% | 0.028 | 1.4 | 1.9 |
| 4 | 0.89 .01 | 87.8% | 0.021 | 1.8 | 3.7 |
| 8 | 0.89 .01 | 87.9% | 0.020 | 2.6 | 7.2 |
| 16 | 0.90 .01 | 88.2% | 0.019 | 3.1 | 14.1 |
| Dataset Size | Spearman | Rank Acc. | Forward KL |
| 5K | 0.79 .03 | 80.2% | 0.058 |
| 10K | 0.84 .02 | 84.1% | 0.038 |
| 25K | 0.87 .01 | 86.5% | 0.26 |
| 50K | 0.89 .01 | 87.8% | 0.021 |
| 100K | 0.89 .01 | 88.1% | 0.020 |
| Hidden Dim. | Depth | Params | Spearman | Forward KL |
| 512 | 2 | 24M | 0.78 | 0.52 |
| 1024 | 4 | 46M | 0.85 | 0.35 |
| 2048 | 8 | 98M | 0.89 | 0.21 |
| 4096 | 12 | 210M | 0.89 | 0.20 |
| Backbone | Params | Spearman | Rank Acc. | Forward KL |
| Llama-2-7B | 7B | 0.89 | 87.8% | 0.021 |
| Mistral-7B | 7B | 0.88 | 87.2% | 0.023 |
| Llama-3-8B | 8B | 0.89 | 88.1% | 0.020 |
| Hyperparameter | Value |
| Number of negatives ( ) | 4 |
| Contrastive dataset size | 50K pairs |
| Reward network hidden dim | 2048 |
| Reward network depth | 8 layers |
| Reward network params | 98M |
| Learning rate |