Reward Models · Chapter 14
Hybrid rewards: rules where you can, a model where you must
1. Two kinds of reward
A rule checks. A learned reward model judges.
Every chapter so far has trained a network to imitate human or AI judgements. That is necessary when quality is a matter of judgement. But for many prompts the right answer is known in advance. "What is \(17\times 23\)?" has one correct answer, and a program can compare the model's answer with it.
A program has two advantages over a learned model. It does not drift as the policy changes, and it cannot be talked into a high score by confident prose. It also has one large disadvantage: it only sees what it was written to check. A hybrid reward uses each kind of signal for the part of the job it does well.
2. Rule-based rewards
A rule-based reward is a fixed program \(r_{\text{rule}}(x,y)\) that reads the prompt \(x\), the response \(y\) and any reference data attached to the prompt (an answer key, test cases, a format specification), and returns a number without any learned parameters. When the program decides whether the response is correct, the reward is called verifiable.
The most common rule is exact match. Extract the final answer from the response, normalise it (strip spaces, simplify fractions, unify number formats), and compare it with the key \(a^\star(x)\):
For code, the rule runs the program. With \(K\) unit tests, the fraction that pass gives a reward with partial credit:
Other rules in common use:
- Compiler or parser. 1 if the code compiles or the JSON parses, 0 otherwise.
- Format check. A regular expression confirms that the reasoning sits inside <think> tags and the answer inside \(\boxed{\cdot}\).
- Instruction constraints. "Answer in fewer than 100 words" or "use exactly three bullet points" can be counted.
- Length limit. A penalty that grows once the response exceeds a token budget.
A rule is only as good as its extractor. If the answer is \(\tfrac12\) and the response writes \(0.5\), a careless normaliser marks a correct response wrong.
3. RL with verifiable rewards
Reinforcement learning with verifiable rewards (RLVR) replaces the learned reward model with a verifier on prompts where one exists. The Tülu 3 recipe applied it to math problems with known answers and to instructions with checkable constraints. The verifier gives a constant reward \(\alpha>0\) when the check passes and zero otherwise, and the usual KL penalty keeps the policy near its reference:
Compared with standard RLHF, where the reward is a scalar RM, only the reward has changed. The optimiser (PPO, GRPO or another policy-gradient method) is the same. What changes is the failure mode: a verifier cannot be flattered, so the policy can only raise its reward by being right more often or by finding a hole in the verifier.
4. The accuracy plus format recipe
DeepSeek-R1-Zero was trained with RL from a base model using only rule-based rewards. Its authors chose not to use a neural reward model for this stage, citing the risk of reward hacking during long RL runs. The reward has two parts:
- Accuracy. For math, the final answer must appear in a required form (for example a box) and match the key. For coding problems, a compiler runs predefined tests.
- Format. The reasoning must be placed between <think> and </think> tags.
The two parts are coupled. The accuracy rule can only read an answer it can find, so the format rule is partly a precondition for the accuracy rule. A model that solves the problem but forgets the box gets nothing for its correct answer.
For DeepSeek-R1 the authors also observed that the chain of thought mixed languages. They added a language-consistency reward, the proportion of words in the reasoning that are in the target language, and summed it with the accuracy reward:
In the final RL stage of DeepSeek-R1, reasoning prompts kept their rule-based rewards while general prompts were scored by learned reward models for helpfulness and harmlessness. That is a hybrid reward of the routing kind (Section 6). The optimiser behind these runs is the GRPO method from the RL notes.
5. When rules are enough, and when they are not
Rules are enough
The task has a checkable target: a numeric answer, a test suite, a schema, a word count.
Is 391 the answer? Do 12 of 12 tests pass?
Rules fall short
Quality is a judgement: clarity, tone, helpfulness, depth, a sensible refusal.
Is this email polite and clear?
Rules run out in four recognisable ways.
- Open-ended quality. "Explain recursion to a beginner" has no answer key. A rule can count words but cannot tell a good explanation from a bad one.
- Partial credit. A proof with one gap, or code that is right but slow, is neither fully right nor fully wrong. Exact match gives 0 to both.
- Style. Two correct answers can differ greatly in readability. A correctness rule scores them the same.
- Safety nuance. A keyword filter can block a word, but it cannot tell a dangerous request from a historian's question that uses the same word.
In each case a learned model, trained on judgements, supplies the missing signal. The rule still has a job: it anchors the parts that can be checked.
6. Ways to combine rules and a learned RM
A hybrid reward is a fixed combination \(R=\Phi\big(r_{\text{RM}},r_1,\ldots,r_K\big)\) of a learned reward \(r_{\text{RM}}\) and rule-based rewards \(r_1,\ldots,r_K\). The combination \(\Phi\) is chosen by the designer and is not learned with the policy.
Four choices of \(\Phi\) cover most systems:
- Routing. Use the rule when the prompt is verifiable, the learned RM otherwise.
- Additive shaping. Add weighted rule rewards to the RM score (Section 7).
- Gating. If a hard rule fails, the response gets a floor reward whatever the RM says (Section 8).
- Penalties. Subtract costs for length, language mixing or other unwanted traits (Section 8).
Routing needs a set \(\mathcal V\) of prompts that come with a verifier:
In a training loop the patterns are usually stacked:
7. Additive shaping and the scale problem
The additive form keeps every signal and weights it:
The weights only mean something if the terms share a scale. A Bradley-Terry RM outputs unbounded logits, while a rule outputs 0 or 1. Suppose a confident wrong answer gets an RM logit of 4.0 and a plain correct answer gets 2.5. With \(w_{\text{RM}}=w_{\text{acc}}=1\), the totals are \(4.0+0=4.0\) and \(2.5+1=3.5\): the wrong answer wins. Squash the RM score first,
and the totals become \(0.982\) and \(1.924\). The correct answer now wins. Other choices, such as standardising RM scores within a batch, serve the same purpose. Once scales are fixed, the weights can be chosen so that correctness cannot be outvoted.
Let \(r_{\text{acc}}\in\{0,1\}\), let \(\tilde r_{\text{RM}}\in[0,1]\), and let all remaining weighted terms together lie in an interval of width \(D\). If \(w_{\text{acc}}>w_{\text{RM}}+D\), every correct response receives a higher total than every incorrect one. The gap between any correct and any incorrect total is at least \(w_{\text{acc}}-w_{\text{RM}}-D>0\).
Within each group, correct or incorrect, the RM and the other terms still decide the order. This is a lexicographic preference written as a sum: be right first, then be good.
8. Gates and penalties
A gate turns a rule into a hard requirement. Let \(g(x,y)\in\{0,1\}\) be 1 when all hard rules pass (the output parses, the answer tag is present, no banned content). The gated reward is
The multiplicative form \(R=g\cdot r_{\text{RM}}\) sets failing responses to 0. That works only if RM scores are never negative. If a passing response scores \(r_{\text{RM}}=-0.8\), a failing response with \(R=0\) now ranks above it. Use a floor below the RM's range, or squash the RM score to \([0,1]\) first.
Penalties are softer. They subtract a cost that grows with the unwanted trait. A length penalty with budget \(L_{\max}\) and strength \(\lambda\) is
With \(L_{\max}=1000\) tokens and \(\lambda=0.5\), a 1400-token response pays \(0.5\times 400/1000=0.2\). A language-mixing penalty can be written as \(-(1-r_{\text{lang}})\) using Equation 5. Penalties target known biases of learned RMs: most preference-trained RMs favour longer answers, and an additive length penalty is a direct counterweight.
9. Written rules for safety
Safety behaviour is too nuanced for a regular expression, yet designers often know exactly what they want: a refusal should be brief, should not lecture the user, and should not contain the requested harmful content. Two lines of work turn such written rules into rewards by asking a language model to apply them.
Rule Based Rewards
Desired behaviour is broken into explicit propositions, such as "contains a short apology" or "is judgemental toward the user". An LLM grader estimates the probability that each proposition holds. The probabilities are combined with weights fitted on a small labelled set, and the result is added to the learned RM's reward.
grader checks each rule, weights combine them
Constitutional AI
A short written constitution of principles guides the model. In a supervised stage the model critiques and revises its own answers against a principle. In an RL stage an AI judge compares two answers under a principle, and its choices train a preference model (RL from AI feedback).
principles produce AI preference labels
In the additive form, a proposition-based safety reward looks like
These are not rule-based in the program sense, because the grader is itself a model. They sit between the two families: the criteria are fixed and written down like rules, while the checking is done by a model. This makes the policy auditable (each rule can be read and changed) without requiring a regex for every nuance. The generative judges of Chapter 09 are the natural graders.
10. Reward hacking on both sides
A policy optimises whatever the reward measures, including its blind spots. Rules and learned RMs have different blind spots, which is the main argument for using both.
| Hack | Reward fooled | What catches it |
|---|---|---|
| Correct tags around an empty or guessed answer | Format rule | Correctness rule; small format weight |
| Special-casing the visible tests (hard-coded outputs) | Unit-test rule | Hidden held-out tests; code review by a model |
| Guessing on multiple choice | Exact match | Negative reward for wrong answers; open-ended versions |
| Writing several answers so the extractor finds one | Answer extractor | Strict extraction: exactly one final answer |
| Long, confident, flattering text | Learned RM | Length penalty; correctness rule |
| Wrong answer in polished style | Learned RM | Correctness rule |
| Correct answer delivered rudely or unsafely | Correctness rule | Learned RM; safety propositions |
Multiple choice shows how a small change to a rule removes an incentive. With four options and reward 1 for right, 0 for wrong, a random guess earns \(0.25\) in expectation, more than saying "I don't know". Give \(-\tfrac13\) for a wrong answer instead:
Rules are exact but narrow: they fail when the policy finds an input the rule was not written for. Learned RMs are broad but soft: they fail when the policy finds text that looks good without being good. Correctness from the rule blocks the RM's style hacks; judgement from the RM blocks the rule's form-only hacks.
11. Weaknesses
- Scale and weight tuning. The weights in Equation 7 interact with RM calibration and must be retuned when the RM changes.
- False negatives from verifiers. Correct answers in unexpected forms (\(0.5\) vs \(\tfrac12\), a reordered list) are marked wrong and the policy is pushed away from them.
- Narrow coverage. Verifiable prompts are mostly math, code and constrained instructions. A model trained mostly on them can drift on everything else.
- Routing errors. A prompt sent to the wrong branch gets a meaningless reward, for instance an open question checked against a single answer key.
- Incomplete written rules. Safety propositions cover the cases their authors thought of; new failure types need new propositions.
- Sparse signal. A 0/1 verifier gives no gradient on prompts the policy never solves, or always solves. Group-relative methods see zero advantage on such prompts.
12. Laboratory: building a hybrid reward
Three responses to the same math prompt have fixed attributes. Switch reward components on and off, set their weights, and watch the totals and the ranking change. The RM score is already squashed to \([0,1]\). The length penalty uses \(L_{\max}=1000\) tokens (Equation 10). The gate sets the total to 0 when the format rule fails.
| Response | Correct? | Well formatted? | RM score | Length |
|---|---|---|---|---|
| A · plain and right | yes | yes | 0.55 | 600 |
| B · polished and wrong | no | yes | 0.85 | 1400 |
| C · right, tags missing | yes | no | 0.70 | 350 |
Hybrid reward mixer
\(R=w_{\text{acc}}r_{\text{acc}}+w_{\text{fmt}}r_{\text{fmt}}+w_{\text{RM}}\tilde r_{\text{RM}}+r_{\text{len}}\)Breakdown
Try "RM only": the polished wrong answer B wins. "Format only" ties A with B and puts the correct C last. At the default settings the correct responses already beat B, but only because of these particular numbers. Raise \(w_{\text{acc}}\) above \(1.7\) and Proposition 14.1 guarantees it (\(w_{\text{RM}}=1\), and format plus length span \(D=0.5+0.2=0.7\) for these responses). Then turn on the gate and see C fall below B: a gate overrides the sum.
13. Worked example, step by step
A GRPO group samples four responses to one math prompt. The reward is accuracy plus format, \(r=w_{\text{acc}}r_{\text{acc}}+w_{\text{fmt}}r_{\text{fmt}}\). Response 1 is right and formatted, 2 is right without tags, 3 is wrong with tags, 4 is wrong without tags. Compute the group-normalised advantages \(\hat A_i=(r_i-\bar r)/\operatorname{std}(r)\) for two weightings.
- Equal weights \(w_{\text{acc}}=w_{\text{fmt}}=1\): rewards \(r=[2,\,1,\,1,\,0]\).
- Mean \(\bar r=1\). Deviations \([1,0,0,-1]\), variance \(\tfrac{1+0+0+1}{4}=0.5\), std \(\approx 0.707\).
- Advantages \(\hat A=[+1.41,\;0,\;0,\;-1.41]\). Right-but-untagged (2) and wrong-but-tagged (3) are treated the same.
- Lower the format weight to \(w_{\text{fmt}}=0.2\): rewards \(r=[1.2,\,1.0,\,0.2,\,0]\), mean \(\bar r=0.6\).
- Deviations \([0.6,\,0.4,\,-0.4,\,-0.6]\), variance \(\tfrac{0.36+0.16+0.16+0.36}{4}=0.26\), std \(\approx 0.510\).
- Advantages \(\hat A\approx[+1.18,\;+0.78,\;-0.78,\;-1.18]\). The correct answer without tags is now pushed up and the formatted wrong answer pushed down.
- Lesson: with \(w_{\text{acc}}>w_{\text{fmt}}\), format can break ties but cannot outvote correctness, which is Proposition 14.1 with \(D=w_{\text{fmt}}\).
14. What comes next
Rules give a clean outcome signal on verifiable tasks, but they only judge the end of a solution. The last chapter returns to rewards inside the reasoning: the many kinds of process reward model, what each one's step score actually means, and how those scores are used in search.
Check with a rule whatever can be checked, judge with a learned model whatever cannot, and combine them so that hard requirements cannot be bought with style.
See also
- Lambert et al., 2024, Tülu 3: open post-training recipes, including RL with verifiable rewards (RLVR).
- DeepSeek-AI, 2025, DeepSeek-R1: incentivising reasoning through RL with rule-based accuracy and format rewards.
- Shao et al., 2024, DeepSeekMath: introduces GRPO, the group-relative optimiser used with these rewards.
- Mu et al., 2024, Rule Based Rewards for language model safety.
- Bai et al., 2022, Constitutional AI: harmlessness from AI feedback.
- Gao et al., 2023, scaling laws for reward model overoptimization.
- The RL notes on GRPO.
Previous
← Uncertainty-aware and ensemble RMs
Next chapter
PRM variants in depth
Five kinds of process reward and what each step score means.