Reinforcement Learning from Verifiable Rewards › The RLVR Objective
Language AI HandbookAll chapters The verifier score enters the objective as a proxy for the desired behavior. The objective below adds regularization to the reward, so both terms affect the policy update.
A bandit over sequences
Consider a single-turn setup with one terminal reward. The prompt is the context and the complete sampled token sequence is the action, so the objective can be framed as a contextual bandit. Write for that sequence and for the text decoded from it. The policy samples the tokens one at a time, and the verifier scores the decoded response.
A common objective combines the terminal reward with a forward KL penalty to a fixed reference policy . Use the same stopping rule for both policies, and assume both policies terminate with probability one for the prompts under consideration. If a response ends by sampling an end-of-sequence token, include that token in the sum. Under this convention the token log-ratios add up to the sequence log-ratio.
where:
- : the policy parameters
- : the task distribution over prompts
- is the policy's probability of sampling the complete token sequence given .
- is the reward for the sequence. With the bare verifier reward, .
- : the reference policy
- : the nonnegative KL penalty coefficient
- : the token at position and the tokens before it
- counts the sampled tokens in , including the end token when it was sampled.
The reward is one scalar for the response. The regularizer is a sum of realized token log-ratios. At a fixed prompt, averaging that sum under the current policy gives the forward KL divergence between the current and reference distributions over sampled token sequences. When , a finite penalty requires reference support for every sequence the current policy can sample for almost every prompt under . It also requires the prompt-averaged forward KL to be finite. A realized log-ratio may be negative.
The policy gradient
Set here and write the resulting reward-only objective as . Assume a fixed reward and, for each prompt, a set of positive-probability sequences that stays fixed in a neighborhood of the current parameters. A finite softmax over a fixed set of actions satisfies that support condition. If differentiation can pass through the expectation, the gradient uses the reward minus an action-independent baseline as the coefficient of the sequence score function.
where:
- : the gradient with respect to the policy parameters
- : the sequence-level reward for the response
- : a baseline that can depend on the prompt but not on the sampled response
Expanding the log-probability of the sequence into its tokens:
Substituting the token sum shows that this reward-only estimator multiplies every token’s score function by the same advantage .
A positive advantage gives the sampled sequence a positive coefficient. That coefficient does not identify which tokens caused the outcome. A correct response can receive negative advantage if the verifier score is below its baseline. Even a 900-token response receives just one binary reward in this setup.
Outcome supervision scores the completed answer. Process supervision can score or label individual reasoning steps, as in Lightman et al.. A checker can also verify intermediate results if those results have a specification. This chapter uses a terminal check and leaves intermediate-step supervision to the later reward-model chapter.
Where the variance comes from
Under the assumptions above, the gradient estimator is unbiased. The expected reward conditional on the prompt is a useful value baseline. Subtracting it gives the return relative to the policy's expected reward for that prompt. A baseline that minimizes gradient variance can also depend on how much the score-function norm varies across sampled outputs.
Summing over responses to compute the exact expectation is impractical for a language model. These three baselines can be estimated from sampled responses or learned from data.
- A learned value function estimates expected reward at the prompt in this bandit framing. In a token-level actor–critic method the value can instead depend on the generated prefix.
- A group mean uses the average reward of responses to the same prompt. Each response contributes its own reward to the mean, so this baseline depends on the response whose gradient it weights. The arithmetic example below derives the resulting bias for independent draws.
- A leave-one-out mean averages the other sampled responses to the same prompt. With independent draws and at least two samples, the baseline for a response does not depend on that response.
With the within-group sample mean, equal rewards produce zero centered advantages for that prompt. Its reward-gradient contribution is zero in that batch, while a separate KL term can still contribute. Filtering zero-variance batches or resampling their prompts changes which data receive training updates.
The plot shows the variance of the binary reward alone. For a pass probability , that variance is , which reaches at and approaches zero at the extremes. The parameter-gradient variance also depends on the response score functions.
VisualizationOut [5]Expand

Adding a constant to every reward leaves the expected reward-only gradient unchanged. Multiplying rewards by a positive scalar rescales that gradient. When the objective also includes KL or another fixed-scale term, rescaling the reward changes its weight relative to that term. Keep the scales explicit when comparing experiments.
KL regularization
The KL penalty changes the objective by charging for probability shifts away from a reference distribution. Practical uses include the following.
- Reference proximity. Increasing the penalty increases the cost of moving away from under this objective. A soft penalty does not impose a hard divergence bound.
- Proxy optimization. The penalty can oppose a shift toward a verifier shortcut when that shift incurs divergence. A shortcut close to the reference can still be attractive.
- Capability retention. Reference proximity can discourage some behavior changes. A held-out capability measurement is still needed to establish retention.
One option is the sampled estimator described in the DeepSeekMath report. It avoids summing over the full vocabulary for each sampled prefix. The following argument concerns the expected KL value. It does not imply that differentiating the sample gives the same estimator under any sampling scheme.
where:
- : the reference policy's probability of token given the prompt and prior tokens
- : the current policy's probability of the same token
- : the per-token estimate of the KL divergence
For a token sampled from the current policy, with the same positive support for both distributions, this estimator is non-negative and its expectation is the forward KL from the current policy to the reference. At a fixed prefix, the expected ratio is one, so the expected two linear terms cancel. Confirm the support assumptions when comparing this expression with probabilities after token masking. Track verifier reward and held-out correctness separately when tuning the regularization weight.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!