Rule Based Rewards for Language Model Safety

Tong Mu, Alec Helyar, Johannes Heidecke, Joshua Achiam, Andrea Vallone +5 more
2/3/2026

No official code found. Best implementation: openai/safety-rbr-code-and-data (209 stars, MIT, last commit 2024-07-19).

Abstract

Reinforcement learning based fine-tuning of large language models (LLMs) on human preferences has been shown to enhance both their capabilities and safety behavior. However, in cases related to safety, without precise instructions to human annotators, the data collected may cause the model to become overly cautious, or to respond in an undesirable style, such as being judgmental. Additionally, as model capabilities and usage patterns evolve, there may be a costly need to add or relabel data to modify safety behavior. We propose a novel preference modeling approach that utilizes AI feedback and only requires a small amount of human data. Our method, Rule Based Rewards (RBR), uses a collection of rules for desired or undesired behaviors (e.g. refusals should not be judgmental) along with a LLM grader. In contrast to prior methods using AI feedback, our method uses fine-grained, composable, LLM-graded few-shot prompts as reward directly in RL training, resulting in greater control, accuracy and ease of updating. We show that RBRs are an effective training method, achieving an F1 score of 97.1, compared to a human-feedback baseline of 91.7, resulting in much higher safety-behavior accuracy through better balancing usefulness and safety.

View on arXivView PDF

Code Implementations(1)

MIT

Code and example data for the paper: Rule Based Rewards for Language Model Safety

20923Python, Jupyter NotebookJul 19, 20242 years agoMIT

Similar Papers

Cite this paper

@article{mu2026rule,
  title  = {Rule Based Rewards for Language Model Safety},
  author = {Tong Mu and Alec Helyar and Johannes Heidecke and Joshua Achiam and Andrea Vallone and Ian Kivlichan and Molly Lin and Alex Beutel and John Schulman and Lilian Weng},
  year   = {2026},
  eprint = {2411.01111},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2411.01111},
  url    = {https://arxiv.org/abs/2411.01111},
  journal = {NEURIPS 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2411.01111.svg)](https://codeofpaper.com/paper/2411.01111)

Discussion