RLVR vs RLHF: reinforcement learning with verifiable rewards explained

For agent builders4 min read

In RLVR vs RLHF, the difference is where the reward comes from. RLVR stands for reinforcement learning with verifiable rewards: a program checks whether the answer is correct. RLHF uses a model trained on human preferences. This post explains the difference, shows a small verifiable reward function in Python, and lists what makes a problem suitable.

Where the term comes from

The Tulu 3 paper introduced RLVR as a post-training method alongside supervised fine-tuning and direct preference optimization. In the paper's description it is the final training stage. It still uses reinforcement learning, but the reward comes from checking whether a completion is correct, rather than from a learned reward model.

Source: Tulu 3 paper abstract(opens in a new tab)

Source: Tulu 3 paper (HTML version)(opens in a new tab)

The authors apply it only where outcomes can be verified. As the paper describes them, the targets were math problem-solving and precise instruction following. The released training sets are built on GSM8K, MATH and IFEval style constraints. A completion earns a fixed reward when it passes the check, and nothing otherwise.

A prompt with a known answer goes to the model, a checker program scores the solution, and a pass gives a reward.
The RLVR loop.

RLVR vs RLHF in one table

RLHFRLVR
SignalHuman comparisons of answers, often through a learned reward modelA program that checks correctness
Good forQuality that is a matter of judgment, such as tone and helpfulnessAnswers with a checkable result, such as math or code
Main riskThe reward model can be fooled by styleThe checker can be fooled by a shortcut
CostPeople label comparisonsPeople write problems and checkers once

The two are not rivals. A model can go through preference tuning for style and then RLVR for tasks where correctness is exact. Which one fits depends on whether a right answer exists that a program can recognize.

A verifiable reward in Python

Here is a minimal reward function for arithmetic word problems. The model is told to end its answer with a line that begins with Answer, and the checker compares only that number.

Python
import re def reward(completion: str, expected: float) -> float:    match = re.findall(r"^Answer:\s*(-?[\d.,]+)\s*$", completion, re.M)    if not match:        return 0.0                      # no final answer line    try:        got = float(match[-1].replace(",", ""))    except ValueError:        return 0.0    return 1.0 if abs(got - expected) < 1e-6 else 0.0 good = "12 boxes of 7 is 84, minus 4 gives 80.\nAnswer: 80"wrong = "I think it is about 80.\nAnswer: 81"unformatted = "The answer is 80"print(reward(good, 80), reward(wrong, 80), reward(unformatted, 80))

Even this tiny function makes choices. It uses only the last answer line, so a model cannot hedge with two answers. It scores unparseable output as zero. And it ignores the working, so a lucky guess passes. Those are the places to look when a reward function goes wrong.

What makes a good RLVR problem

  • There is one correct final answer, or a set of tests that define correct.
  • The check runs fast and gives the same result every time.
  • The problem is hard enough that the model fails some of the time. If it always passes, there is nothing to learn, and if it never passes, there is no signal.
  • The answer cannot be reached by a trick, like guessing from a small set of options.
  • The problem statement is unambiguous, so two experts agree on the answer.

Unit tests are the natural verifiers for code. Exact answers or numeric tolerances work for math. Structured constraints, like produce exactly three bullet points under 20 words, are what IFEval style checks cover.

It also helps to know the base pass rate before training. Sample the model several times on each problem and record how often it passes. Problems it always solves add little, and problems it never solves give no signal. Keep the middle band, where the model sometimes succeeds, and add new problems as it improves.

Where it breaks

A verifiable reward is only as good as the verifier. A weak check invites shortcuts, and the model will find them. Test the checker with deliberately wrong answers as well as right ones, and read samples of passing outputs. The reward hacking post in this series shows the pattern.

Before any training, write ten problems by hand and run the checker on a correct answer, a wrong answer and a badly formatted answer for each. That is thirty tests of the verifier with no model involved, and it finds a parser bug faster than a training run will.

Curatrain's experts write problems a program can check, for RLVR, with the checkers and reference answers that go with them.