15.4 Verifiers & Reward Models
More candidate solutions help only if selection can distinguish useful work from plausible mistakes. A verifier is like a measuring instrument: its errors, calibration and coverage matter as much as the score it prints. Search can exploit a weak verifier, so evaluate the generator–selector system together.
1. Outcome and process supervision
An outcome reward model (ORM) receives supervision about the completed result. Its input may include the entire solution trace, not just the final answer, and its score need not be binary or restricted to . A single final label provides limited information about which earlier step caused failure.
A process reward model (PRM) uses labels attached to intermediate steps. Let’s Verify Step by Step studies this distinction and provides step annotations. [1] A low process score can guide pruning, but it is a fallible prediction; aggressive pruning may discard a correct unconventional solution. Delimiter tokenization and annotation policy determine what counts as a step.
A masked step-scoring example
Educational module, not a complete trainer. The caller supplies a compatible causal backbone, native chat-template tokens, attention masks and response-step boundaries on the same device. Prompt, padding and unlabeled steps must be false in
step_mask; indices refer to the tokenized sequence after BOS/EOS handling and truncation. Packed conversations need isolated attention and valid within-conversation boundaries. This binary loss does not reproduce three-class annotation schemes, distributed global normalization or calibration.
import torch
from torch import nn
class ProcessRewardModel(nn.Module):
def __init__(self, base_llm, hidden_size):
super().__init__()
self.base_llm = base_llm
self.score_head = nn.Linear(hidden_size, 1)
def forward(self, input_ids, attention_mask, step_end_indices, step_mask):
# [B,S], [B,S], [B,K], [B,K]. Invalid step indices may be -1.
B, S = input_ids.shape
if S == 0 or attention_mask.shape != input_ids.shape:
raise ValueError("nonempty sequences and matching attention mask required")
if step_end_indices.shape != step_mask.shape or step_mask.shape[0] != B:
raise ValueError("step boundary/mask shape mismatch")
valid = step_mask.bool()
if ((step_end_indices[valid] < 0) | (step_end_indices[valid] >= S)).any():
raise ValueError("valid step boundary outside sequence")
indices = step_end_indices.clamp(0, S-1)
rows = torch.arange(B, device=input_ids.device)[:, None]
if not attention_mask[rows, indices][valid].bool().all():
raise ValueError("step boundary points to padding")
outputs = self.base_llm(input_ids=input_ids, attention_mask=attention_mask,
output_hidden_states=True, use_cache=False)
hidden = outputs.hidden_states[-1][rows, indices]
# Co-locate the head and base model before use; respect head dtype.
logits = self.score_head(hidden.to(self.score_head.weight.dtype)).squeeze(-1).float()
return logits, valid
def masked_step_loss(logits, labels, valid):
if not valid.any():
raise ValueError("batch has no labeled response steps")
if labels.shape != logits.shape:
raise ValueError("labels/logits shape mismatch")
targets = labels[valid].float()
if not torch.isfinite(targets).all() or ((targets < 0) | (targets > 1)).any():
raise ValueError("this binary example requires targets in [0,1]")
return nn.functional.binary_cross_entropy_with_logits(logits[valid], targets)
The head returns logits. A sigmoid maps them to , but does not make them calibrated correctness probabilities. Use held-out reliability tests and thresholds tied to the cost of false acceptance and false rejection.
2. Generative verification
GenRM formulates verification through token prediction, with variants that generate reasoning before a verdict. [2] A rationale provides additional sequential computation, not a proof that the verdict is correct. A direct classifier also performs hidden-state computation.
Compare discriminative scoring, direct generative verdicts and rationale-based verification under equal token/time budgets. Check answer leakage, position/verbosity bias, correlated judgments and adversarially persuasive incorrect solutions. More sampled rationales may repeat the same mistake. The interaction below is an authored example rather than a trained verifier evaluation.
What is supervised?
Compare outcome, step and generated-critique signals on the same authored solution.
3x + 7 = 223x = 22 + 73x = 29x = 29/3
3. SCoRe: training revisions on the model’s own trajectories
SCoRe uses two training stages. Stage I improves second attempts while a stronger first-attempt KL penalty keeps initial responses near a reference. Stage II optimizes both attempts and adds a correctness-change bonus to the second reward. [3] Writing binary correctness as for attempt , the bonus is , with . This bonus is not the complete objective: base rewards and reference regularization remain.
The paper studies distribution mismatch and collapsed correction behavior; it does not establish that every SFT method fails or that RL is necessary for every repair task. Measure wrong→right and right→wrong transitions separately, alongside first-attempt quality and total cost.
4. Data and training contracts
A deterministic checker can label the outcome of a constrained task without validating every intermediate statement. Teacher critiques are candidate annotations, not ground truth. Preserve task ID, source/license, teacher/judge version, prompts, decoding settings, seeds, rejection reasons and human-audit results. Cluster related problems and synthetic siblings before splitting; quarantine evaluation prompts, rubrics and variants.
For training, pin base model, tokenizer/template, head, labels, reference checkpoint (or explicitly none), maximum response length, step policy, loss reduction, optimizer, learning rate and class weights. Verify train/serve template parity and truncation; report performance by step count, domain and label source. Budget parameters, gradients, optimizer states, activations, temporary buffers, collectives, checkpoints and evaluation at the selected precision/sharding/recomputation settings.
Observe token-normalized auxiliary LM loss if used, labeled-step loss, calibration, false acceptance/rejection, nonfinite counts, gradient/activation norms, throughput, MFU, data wait and stragglers with reconstructable batch IDs. Define numerical/quality abort thresholds before training. Save model/head, optimizer, scheduler/scaler, RNG, sampler/data cursor and dataset/config hashes atomically with checksums and completion markers; rehearse restore and rollback.
Release only after independent domain, retention, safety, format/tool, latency, cost and error-rate gates pass with uncertainty estimates. Keep the last-known-good artifact bundle and a measured rollback threshold. Evaluate the verifier after search starts selecting against it: selection changes the distribution of errors it encounters.
5. Practical takeaway
Choose supervision granularity and scoring style for the failure you need to detect. Keep outcome labels, process judgments and generated explanations distinct. The next chapter adds actions and tool side effects, making reliable evaluation and recovery more consequential.
Quizzes
Quiz 1: Can an outcome reward model read a full reasoning trace?
Yes. Outcome supervision describes the label, not an answer-only input restriction. One final label still gives limited localization of intermediate errors.
Quiz 2: Why is a generated verification rationale not a certificate?
It is another model output and can rationalize a wrong verdict. Validate it against independent evidence or executable checks and compare under matched compute budgets.
Quiz 3: What happens if padded step indices are scored as real steps?
They introduce spurious supervision and distort both loss and calibration. Mask unlabeled/padded steps, validate boundaries against the attention mask, and reject an all-empty labeled batch.
Quiz 4: Why track wrong→right and right→wrong revisions separately?
Net accuracy can hide a system that fixes some mistakes while breaking many initially correct answers. Both transitions matter for deciding whether revision is useful.
Quiz 5: What is the gradient of the pairwise reward loss?
Let and , where wins the preference comparison. Then . This preference-ranking objective is distinct from the step-label BCE above.
References
- Lightman, H., et al. (2023). Let’s Verify Step by Step. arXiv:2305.20050.
- Zhang, L., et al. (2024). Generative Verifiers: Reward Modeling as Next-Token Prediction. arXiv:2408.15240.
- Kumar, A., et al. (2024). Training Language Models to Self-Correct via Reinforcement Learning. arXiv:2409.12917.