RL wants a scalar reward, and people give comparisons. Turning hundreds of thousands of labels of the form “A is better than B” into a function that outputs one number per response is the job of the reward model (RM). In this lesson we derive the probability model behind that conversion (Bradley–Terry) and see what that model can and cannot learn from data. Then we tell apart the various kinds of “reward function” used in RLHF: preference RMs, ORMs, PRMs, value functions and LLM judges.
From comparisons to scores: Bradley–Terry
Suppose each response has a hidden utility , and the labeller picks the one with the larger utility. The labeller’s judgement, however, is noisy.
We pick the Gumbel distribution because the algebra comes out cleanly. The difference of two independent Gumbel(0,1) variables follows the standard logistic distribution, whose CDF is exactly the sigmoid. Therefore
This is the Bradley–Terry (BT) model. Writing gives the original form . Making the noise Gaussian instead yields the Thurstone model, with the normal CDF in place of the sigmoid; in practice the two differ little and BT is the standard.
Maximising the log-likelihood of the data gives the reward model’s loss.
The gradient shows at once what this loss does. With ,
It raises the chosen score and lowers the rejected score, with strength — the probability that the model currently gets that pair wrong. Pairs it already gets right by a wide margin contribute almost nothing. This structure reappears unchanged in the DPO lesson.
RL은 스칼라 보상을 원하고, 사람은 비교를 준다. “A가 B보다 낫다”는 라벨 수십만 개를 응답마다 숫자 하나를 내는 함수 로 바꾸는 것이 보상모델(reward model, RM) 의 일이다. 이 레슨에서는 그 변환의 확률 모델(Bradley–Terry)을 유도하고, 그 모델이 데이터로부터 무엇을 알 수 있고 무엇을 알 수 없는지 본다. 그다음 RLHF에서 쓰이는 여러 종류의 “보상 함수”, 즉 선호 RM, ORM, PRM, 가치함수, LLM judge를 구분한다.
비교에서 점수로: Bradley–Terry
응답 마다 숨은 효용 가 있고, 라벨러는 효용이 큰 쪽을 고른다고 하자. 다만 라벨러의 판단에는 잡음이 섞인다.
Gumbel 분포를 고르는 이유는 계산이 깔끔해서다. 독립인 두 Gumbel(0,1) 변수의 차이는 표준 로지스틱 분포를 따르고, 그 CDF가 바로 시그모이드다. 그러므로
이것이 Bradley–Terry(BT) 모델이다. 로 쓰면 라는 원래 형태가 된다. 잡음을 가우시안으로 두면 시그모이드 대신 정규 CDF가 나오는 Thurstone 모델이 되는데, 실제로는 둘의 차이가 작고 BT가 표준이다.
데이터 의 로그우도를 최대화하면 보상모델의 손실이 된다.
gradient를 보면 이 손실이 무엇을 하는지 바로 보인다. 라 하면
chosen의 점수는 올리고 rejected의 점수는 내리는데, 그 세기가 , 즉 모델이 현재 그 쌍을 틀릴 확률이다. 이미 큰 차이로 맞히는 쌍은 거의 기여하지 않는다. 이 구조는 DPO 레슨에서 그대로 다시 나온다.
What part of the reward does the data determine?
Only the difference enters the loss. Two things follow.
The shift is not determined. Adding the same constant to every reward — more generally, a different constant per prompt — leaves the loss unchanged. The absolute value of a reward model’s output means nothing; only differences within the same prompt mean something. This is why it is fine to normalise rewards (subtract the mean, whiten) or subtract a baseline in the RL stage.
The scale is tied to the noise level. In the derivation above we fixed the noise scale at 1. If real labellers are times noisier, then , and the scores fitted by BT estimate . In other words, BT scores are “rewards measured in units of label noise”. In the extreme where labels never waver (the better one is always chosen), the loss keeps decreasing as the scale grows, so the MLE does not exist. In RL this scale only enters together with as anyway (next lesson), so changing the reward scale is the same as changing the KL coefficient.
Check it yourself in the figure below. We generate noisy comparisons from the hidden scores of ten items and fit BT by gradient ascent.
보상의 무엇이 데이터로 정해지나
손실에는 차이 만 들어간다. 그래서 두 가지가 생긴다.
이동(shift)은 정해지지 않는다. 모든 보상에 같은 상수, 더 일반적으로 prompt마다 다른 상수 를 더해도 손실은 똑같다. 보상모델 출력의 절대값은 의미가 없고, 같은 prompt 안에서의 차이만 의미가 있다. RL 단계에서 보상을 정규화(평균 빼기, whitening)하거나 baseline을 빼도 괜찮은 이유가 이것이다.
스케일은 잡음 크기와 묶여 있다. 위 유도에서 잡음의 스케일을 1로 고정했다. 실제 라벨러의 잡음이 배 크다면 이고, BT로 맞춘 점수는 를 추정한다. 즉 BT 점수는 “라벨 잡음 단위로 잰 보상” 이다. 라벨이 전혀 흔들리지 않는 극단(항상 더 나은 쪽을 고름)에서는 손실이 스케일을 키울수록 계속 줄어들어 MLE가 존재하지 않는다. RL에서는 이 스케일이 어차피 와 함께 로만 들어가므로(다음 레슨), 보상 스케일을 바꾸는 것은 KL 계수를 바꾸는 것과 같다.
아래 그림에서 직접 확인해 보자. 항목 10개의 숨은 점수에서 잡음 섞인 비교를 만들고, BT를 경사상승으로 맞춘다.
- Reduce the number of comparisons to around 10 and some pairs are never compared at all; the ranking accuracy swings wildly. This is why RMs need a lot of data.
- With the number of comparisons at its maximum, change T: the order stays almost the same, but the slope of the fitted scores follows .
- With large T (labellers disagree a lot), the ranking is less accurate for the same number of comparisons, because each label carries less information.
Implementation: a linear reward model
A real RM is an LLM, but the loss and gradient are the same for a linear model. Each response has a feature vector (only here, is a feature, not the RM parameters) and . We generate BT labels from a hidden and then recover .
import numpy as np
rng = np.random.default_rng(0)
d, n_items = 8, 400
w_true = rng.normal(size=d) # hidden "true" reward: r*(y) = w_true · φ(y)
Phi = rng.normal(size=(n_items, d)) # a feature vector φ(y) per response
r_true = Phi @ w_true
def sigmoid(z): return 1 / (1 + np.exp(-z))
def make_pairs(n_pairs, rng):
i = rng.integers(0, n_items, n_pairs)
j = rng.integers(0, n_items, n_pairs)
i, j = i[i != j], j[i != j]
i_wins = rng.random(len(i)) < sigmoid(r_true[i] - r_true[j]) # Bradley–Terry labeller
return np.where(i_wins, i, j), np.where(i_wins, j, i) # (y_w, y_l)
yw, yl = make_pairs(3000, rng)
yw_te, yl_te = make_pairs(2000, rng)
def loss_and_grad(w, D):
"""D[k] = φ(y_w) - φ(y_l), so D @ w = r(y_w) - r(y_l)."""
delta = D @ w
loss = -np.mean(np.log(sigmoid(delta) + 1e-12))
# d/dw [-log σ(Δ)] = -(1 - σ(Δ)) (φ_w - φ_l)
grad = -((1 - sigmoid(delta))[:, None] * D).mean(0)
return loss, grad
def train(yw, yl, steps, lr=0.5, log_every=None, on_step=None):
D = Phi[yw] - Phi[yl]
w = np.zeros(d)
for step in range(steps + 1):
loss, g = loss_and_grad(w, D)
if on_step: on_step(step, w, loss)
if log_every and step % log_every == 0:
sw, sl = Phi[yw_te] @ w, Phi[yl_te] @ w
acc = np.mean(sw > sl) + 0.5 * np.mean(sw == sl) # ties count as half
print(f"step {step:3d} loss {loss:.4f} test pair accuracy {acc:.3f}")
w -= lr * g
return w, loss
w, _ = train(yw, yl, 300, log_every=100)
ceiling = np.mean(r_true[yw_te] > r_true[yl_te])
print(f"even ranking by the true reward r* gives accuracy {ceiling:.3f} (a ceiling set by the labels being random)")
cos = w @ w_true / np.linalg.norm(w) / np.linalg.norm(w_true)
print(f"cos(w, w_true) = {cos:.3f}, |w| / |w_true| = {np.linalg.norm(w)/np.linalg.norm(w_true):.2f}")
# 1) shift invariance: adding the same constant to every reward leaves the loss unchanged
delta = (Phi[yw] @ w + 3.7) - (Phi[yl] @ w + 3.7)
print(f"loss after shifting rewards by +3.7: {-np.mean(np.log(sigmoid(delta))):.4f} (unchanged)")
# 2) scale: with deterministic labels (the better one always wins) |w| grows without bound
better = r_true[yw] > r_true[yl]
yw_d, yl_d = np.where(better, yw, yl), np.where(better, yl, yw)
def report(step, w, loss):
if step in (100, 1000, 3000):
print(f"deterministic labels, step {step:4d}: loss {loss:.4f} |w|/|w_true| = {np.linalg.norm(w)/np.linalg.norm(w_true):.2f}")
_ = train(yw_d, yl_d, 3000, on_step=report)There are three things to see in the output. The test pair accuracy is almost the same as the accuracy obtained by ranking with the true reward; that is, the ceiling on RM accuracy is set by how consistent the labels are. With BT labels, is recovered almost equal to (because the noise scale matches 1), but with deterministic labels keeps growing. This overconfidence is one of the reasons real RMs are trained for only about 1 epoch.
In PyTorch it looks like this. The backbone can be any decoder LM.
import torch
import torch.nn as nn
import torch.nn.functional as F
from transformers import AutoModel
class RewardModel(nn.Module):
def __init__(self, name: str):
super().__init__()
self.backbone = AutoModel.from_pretrained(name) # transformer without an LM head
self.head = nn.Linear(self.backbone.config.hidden_size, 1)
def forward(self, input_ids, attention_mask):
h = self.backbone(input_ids=input_ids, attention_mask=attention_mask).last_hidden_state # (B, T, H)
last = attention_mask.sum(dim=1) - 1 # assumes right padding: position of the last real token
h_last = h[torch.arange(h.size(0), device=h.device), last] # (B, H)
return self.head(h_last).squeeze(-1) # (B,) scalar reward
def preference_loss(model, chosen, rejected, margin=None):
"""chosen / rejected: batches of (input_ids, attention_mask) for the same prompts."""
r_w = model(**chosen)
r_l = model(**rejected)
delta = r_w - r_l
if margin is not None: # Llama 2: margin m(y_w, y_l) by preference strength
delta = delta - margin
loss = -F.logsigmoid(delta).mean() # using log σ directly is numerically stable
acc = (r_w > r_l).float().mean()
return loss, accVariants: margins and K-wise
Margin. Llama 2 put the preference strength chosen by the labeller (“significantly better”, “slightly better”, etc.) into the loss.
The stronger the preference, the larger the , demanding a wider score gap for that pair. According to Lambert’s book, Llama 3 dropped this term because the gain shrank as they scaled up.
K-wise (Plackett–Luce). Given a full ranking of K responses, use a probability model that repeats “pick the best of the remaining ones by softmax”.
With K = 2 this is BT. It also meshes with the Gumbel derivation: add Gumbel noise to the utilities and take the argmax, and the result follows exactly a softmax distribution (the Gumbel-max trick); repeating that gives Plackett–Luce.
Reward model A outputs r(x,y); reward model B outputs r(x,y) + 5·len(x) (a term that depends only on the prompt length is added). How do the two RMs compare in BT loss and in use for RL?
Only the within-prompt difference enters the BT loss, so a term that depends only on the prompt vanishes. In the policy gradient, too, contributes nothing to the expected gradient because , and with a baseline that subtracts the per-prompt mean or GRPO-style group normalisation it vanishes exactly even in the sample. The relative size against the KL term, however, depends on the scale, so multiplication — unlike a constant shift — does change the result.
Kinds of reward function
In the RLHF literature, quite different things are mixed under the name “reward model”. Sorting them by what they predict makes it clear.
| Kind | Input | What it predicts | Training signal |
|---|---|---|---|
| Preference RM (BT) | the whole | a preference logit; only differences are meaningful | pairwise comparisons, |
| ORM (outcome) | , at every token | the probability that this response is ultimately correct | correctness (0/1), BCE at every token |
| PRM (process) | the probability that each reasoning step is correct | step-level labels, BCE at step boundaries | |
| Value function | partial response | the expected return from following the current policy | returns of on-policy rollouts (TD/GAE) |
| LLM judge / generative RM | prompt + response(s) + criteria | a verdict in text (score, winner) | prompting, or fine-tuning on verdict data |
ORM. The GSM8K verifier of Cobbe et al. (2021) is the prototype. Collect solutions that got the right answer and ones that did not, and train a binary classifier at every token of the response on “is this solution ultimately correct?”.
PRM. Lightman et al. (2023) built PRM800K, in which people labelled each step of MATH solutions as positive / neutral / negative, and trained a PRM with the loss applied only at step boundaries. In best-of-N, choosing one of the same generator’s candidates, the PRM was clearly better than the ORM, because it is a denser signal that points at the wrong step. The price is the labelling cost, and later work moved toward generating step labels automatically with Monte Carlo rollouts.
How it differs from a value function. ORMs and value functions both have the shape “predict the outcome from a partial response”, so they are easy to confuse. The difference is under which policy the expectation is taken. An ORM is a correctness probability learned offline from fixed data; a value function is an expected return refitted continually on rollouts of the policy currently being trained, and its purpose is computing advantages (variance reduction) (actor-critic lesson). A reward model says “what is good”; a value function says “how much the current policy will get from here”.
LLM-as-judge and generative reward models
Giving a strong LLM criteria and asking it to pick the better of two responses, or to score one from 1 to 10, is cheap and fast, and agrees with human judgement fairly well (Zheng et al. 2023). The AI feedback of Constitutional AI, the preference-data labelling of Tülu 3, and most open evaluations (MT-Bench, AlpacaEval, Arena-Hard) work this way. Generative RMs, which generate a rationale before the verdict, are in the same family.
The known biases are these.
- Position bias: prefers the response presented first (or last). Ask twice with the order swapped, and treat a flipped verdict as a tie.
- Verbosity / length bias: prefers longer responses. This is why length-controlled evaluations, which correct for length by regression, appeared. If RL optimises this bias as is, responses keep getting longer.
- Self-enhancement: prefers the style written by itself (or by models of the same family).
Lambert’s book summarises that, on RM benchmarks, generative judging generally lags behind dedicated classifier RMs, and notes that it is common to sample verdicts at temperature 0 to reduce variance.
In best-of-64, where you pick one of 64 MATH solutions to submit, which verifier is likely to do better for the same data budget?
This is the key result of Lightman et al. (2023). An ORM learns only from outcomes, so its signal for telling a solution that went wrong midway but got the right answer from a clean one is weak. A PRM gets labels at every step and learns where the first error is. A value function is the expected return of a particular policy, not a correctness judge, and it is not trained to pick among the candidates of a different generator.
→ Go deeper: Rewards and environments — reward design in frontier RL: verifiers, rubric and generative rewards, multi-environment RLVR.
Summary
- Bradley–Terry comes from a choice model that adds Gumbel noise to utilities: . The RM loss is its negative log-likelihood.
- The strength of the gradient is , the probability of currently getting it wrong. Pairs that are already right contribute almost nothing to learning.
- The shift of the reward (a per-prompt constant) is not determined by the data, and its scale is tied to label noise. In RL only matters.
- Margins (Llama 2) and Plackett–Luce (K-wise) are variants that use richer labels.
- An ORM predicts the probability of a correct final answer, a PRM the probability that each step is correct, a value function the current policy’s expected return, and an LLM judge a verdict in text. LLM judges have position, length and self-preference biases.
- 비교 수를 10개 근처로 줄이면 한 번도 비교되지 않은 쌍이 생기고, 순위 정확도가 크게 흔들린다. RM 데이터가 많이 필요한 이유다.
- 비교 수를 최대로 두고 T를 바꾸면, 순서는 거의 그대로인데 맞춘 점수의 기울기가 를 따라간다.
- T가 크면(라벨러끼리 의견이 많이 갈리면) 같은 비교 수로도 순위가 덜 정확하다. 정보가 적은 라벨이기 때문이다.
구현: 선형 보상모델
실제 RM은 LLM이지만, 손실과 gradient는 선형 모델에서도 똑같다. 응답마다 특징 벡터 가 있고(여기서만 는 RM 파라미터가 아니라 특징이다) 라고 하자. 숨은 로 BT 라벨을 만든 뒤 를 복원한다.
import numpy as np
rng = np.random.default_rng(0)
d, n_items = 8, 400
w_true = rng.normal(size=d) # 숨은 "진짜" 보상: r*(y) = w_true · φ(y)
Phi = rng.normal(size=(n_items, d)) # 응답마다 특징 벡터 φ(y)
r_true = Phi @ w_true
def sigmoid(z): return 1 / (1 + np.exp(-z))
def make_pairs(n_pairs, rng):
i = rng.integers(0, n_items, n_pairs)
j = rng.integers(0, n_items, n_pairs)
i, j = i[i != j], j[i != j]
i_wins = rng.random(len(i)) < sigmoid(r_true[i] - r_true[j]) # Bradley–Terry 라벨러
return np.where(i_wins, i, j), np.where(i_wins, j, i) # (y_w, y_l)
yw, yl = make_pairs(3000, rng)
yw_te, yl_te = make_pairs(2000, rng)
def loss_and_grad(w, D):
"""D[k] = φ(y_w) - φ(y_l) 이므로 D @ w = r(y_w) - r(y_l)."""
delta = D @ w
loss = -np.mean(np.log(sigmoid(delta) + 1e-12))
# d/dw [-log σ(Δ)] = -(1 - σ(Δ)) (φ_w - φ_l)
grad = -((1 - sigmoid(delta))[:, None] * D).mean(0)
return loss, grad
def train(yw, yl, steps, lr=0.5, log_every=None, on_step=None):
D = Phi[yw] - Phi[yl]
w = np.zeros(d)
for step in range(steps + 1):
loss, g = loss_and_grad(w, D)
if on_step: on_step(step, w, loss)
if log_every and step % log_every == 0:
sw, sl = Phi[yw_te] @ w, Phi[yl_te] @ w
acc = np.mean(sw > sl) + 0.5 * np.mean(sw == sl) # 동점은 반으로
print(f"step {step:3d} loss {loss:.4f} 테스트 쌍 정확도 {acc:.3f}")
w -= lr * g
return w, loss
w, _ = train(yw, yl, 300, log_every=100)
ceiling = np.mean(r_true[yw_te] > r_true[yl_te])
print(f"진짜 보상 r*로 매겨도 정확도는 {ceiling:.3f} (라벨 자체가 확률적이라 생기는 천장)")
cos = w @ w_true / np.linalg.norm(w) / np.linalg.norm(w_true)
print(f"cos(w, w_true) = {cos:.3f}, |w| / |w_true| = {np.linalg.norm(w)/np.linalg.norm(w_true):.2f}")
# 1) 이동 불변성: 모든 보상에 같은 상수를 더해도 손실은 그대로다
delta = (Phi[yw] @ w + 3.7) - (Phi[yl] @ w + 3.7)
print(f"보상 +3.7 이동 후 손실 {-np.mean(np.log(sigmoid(delta))):.4f} (그대로)")
# 2) 스케일: 라벨이 결정적이면(항상 더 좋은 쪽을 고름) |w|가 끝없이 커진다
better = r_true[yw] > r_true[yl]
yw_d, yl_d = np.where(better, yw, yl), np.where(better, yl, yw)
def report(step, w, loss):
if step in (100, 1000, 3000):
print(f"결정적 라벨, {step:4d} step: loss {loss:.4f} |w|/|w_true| = {np.linalg.norm(w)/np.linalg.norm(w_true):.2f}")
_ = train(yw_d, yl_d, 3000, on_step=report)결과에서 볼 것은 세 가지다. 테스트 쌍 정확도가 진짜 보상으로 매긴 정확도와 거의 같다. 즉 RM 정확도의 천장은 라벨의 일관성이 정한다. BT 라벨에서는 가 와 거의 같게 복원되지만(잡음 스케일이 1로 맞기 때문), 결정적 라벨에서는 가 계속 커진다. 실제 RM이 1 epoch 정도만 학습되는 이유 중 하나가 이 과신(overconfidence)이다.
PyTorch로 쓰면 다음과 같다. backbone은 어떤 decoder LM이든 된다.
import torch
import torch.nn as nn
import torch.nn.functional as F
from transformers import AutoModel
class RewardModel(nn.Module):
def __init__(self, name: str):
super().__init__()
self.backbone = AutoModel.from_pretrained(name) # LM head 없는 transformer
self.head = nn.Linear(self.backbone.config.hidden_size, 1)
def forward(self, input_ids, attention_mask):
h = self.backbone(input_ids=input_ids, attention_mask=attention_mask).last_hidden_state # (B, T, H)
last = attention_mask.sum(dim=1) - 1 # 오른쪽 padding 가정: 마지막 실제 토큰 위치
h_last = h[torch.arange(h.size(0), device=h.device), last] # (B, H)
return self.head(h_last).squeeze(-1) # (B,) 스칼라 보상
def preference_loss(model, chosen, rejected, margin=None):
"""chosen / rejected: 같은 prompt에 대한 (input_ids, attention_mask) 배치."""
r_w = model(**chosen)
r_l = model(**rejected)
delta = r_w - r_l
if margin is not None: # Llama 2: 선호 강도에 따른 margin m(y_w, y_l)
delta = delta - margin
loss = -F.logsigmoid(delta).mean() # log σ 를 직접 쓰면 수치적으로 안정하다
acc = (r_w > r_l).float().mean()
return loss, acc변형: margin과 K-wise
Margin. Llama 2는 라벨러가 고른 선호 강도(“훨씬 낫다”, “약간 낫다” 등)를 손실에 반영했다.
강한 선호일수록 큰 을 써서 그 쌍의 점수 차가 더 벌어지도록 요구한다. Lambert의 책에 따르면 Llama 3에서는 규모를 키우자 이득이 줄어 이 항을 뺐다.
K-wise (Plackett–Luce). K개 응답의 전체 순위 를 받았다면, “남은 것 중 1등을 softmax로 고르는 일”을 반복하는 확률 모델을 쓴다.
K = 2이면 BT와 같다. Gumbel 유도와도 맞물린다. 효용에 Gumbel 잡음을 더하고 argmax를 고르면 그 결과는 정확히 softmax 분포를 따르고(Gumbel-max trick), 그것을 반복한 것이 Plackett–Luce다.
보상모델 A의 출력은 r(x,y), 보상모델 B의 출력은 r(x,y) + 5·len(x) (prompt 길이에만 의존하는 항을 더함)이다. 두 RM의 BT 손실과 RL에서의 쓰임은?
BT 손실에는 같은 prompt 안의 차이 만 들어가므로 prompt에만 의존하는 항 는 사라진다. policy gradient에서도 는 이라 기대 gradient에 기여하지 않고, prompt별 평균을 빼는 baseline이나 GRPO식 그룹 정규화를 쓰면 표본에서도 정확히 사라진다. 다만 KL 항과의 상대적 크기는 스케일에 좌우되므로, 상수 이동이 아니라 곱셈은 결과를 바꾼다.
보상 함수의 종류
RLHF 문헌에서 “보상모델”이라는 이름 아래 꽤 다른 것들이 섞여 있다. 무엇을 예측하는지로 구분하면 명확하다.
| 종류 | 입력 | 예측하는 것 | 학습 신호 |
|---|---|---|---|
| 선호 RM (BT) | 전체 | 선호 로짓. 차이만 의미 있음 | 쌍 비교, |
| ORM (outcome) | , 토큰마다 | 이 응답이 최종적으로 맞을 확률 | 정답 여부(0/1), 토큰마다 BCE |
| PRM (process) | 각 추론 단계가 옳을 확률 | 단계별 라벨, 단계 경계에서 BCE | |
| 가치함수 | 부분 응답 | 현재 정책을 따랐을 때의 기대 return | on-policy rollout의 return (TD/GAE) |
| LLM judge / 생성형 RM | prompt + 응답(들) + 기준 | 텍스트로 된 판정(점수, 승자) | 프롬프팅, 또는 판정 데이터로 미세조정 |
ORM. Cobbe et al.(2021)의 GSM8K 검증기가 원형이다. 정답을 맞힌 풀이와 틀린 풀이를 모아, 응답의 모든 토큰에서 “이 풀이는 결국 맞는가”를 이진 분류로 학습한다.
PRM. Lightman et al.(2023)은 MATH 풀이의 각 단계에 사람이 긍정/중립/부정 라벨을 단 PRM800K를 만들고, 단계 경계에서만 손실을 거는 PRM을 학습했다. 같은 생성기의 후보 중 하나를 고르는 best-of-N에서 PRM이 ORM보다 뚜렷이 좋았다. 틀린 단계를 짚어 주는 더 촘촘한 신호이기 때문이다. 대가는 라벨 비용이고, 이후 연구들은 Monte Carlo rollout으로 단계 라벨을 자동으로 만드는 방향으로 갔다.
가치함수와의 차이. ORM과 가치함수는 둘 다 “부분 응답에서 결과를 예측”하는 모양이라 헷갈리기 쉽다. 차이는 어떤 정책 아래의 기대값인가다. ORM은 고정된 데이터에서 오프라인으로 학습한 정답 확률이고, 가치함수는 지금 학습 중인 정책의 rollout으로 계속 다시 맞추는 기대 return이며, 그 용도는 advantage 계산(분산 감소)이다(actor-critic 레슨). 보상모델은 “무엇이 좋은가”를, 가치함수는 “지금 정책이 여기서 얼마나 받을 것인가”를 말한다.
LLM-as-judge와 생성형 보상모델
강한 LLM에게 기준을 주고 두 응답 중 나은 쪽을 고르게 하거나 1–10점을 매기게 하는 방법은 싸고 빠르며, 사람 판단과의 일치도도 꽤 높다(Zheng et al. 2023). Constitutional AI의 AI 피드백, Tülu 3의 선호 데이터 라벨링, 대부분의 오픈 평가(MT-Bench, AlpacaEval, Arena-Hard)가 이 방식이다. 판정 전에 근거를 생성하게 하는 생성형 RM도 같은 계열이다.
알려진 편향은 다음과 같다.
- 위치 편향(position bias): 먼저(또는 나중에) 제시된 응답을 더 고른다. 순서를 바꿔 두 번 묻고, 판정이 뒤집히면 무승부로 처리한다.
- 장황함 편향(verbosity / length bias): 더 긴 응답을 선호한다. 길이를 회귀로 보정하는 length-controlled 평가가 나온 이유다. RL이 이 편향을 그대로 최적화하면 응답이 계속 길어진다.
- 자기 선호(self-enhancement): 자기 자신(또는 같은 계열 모델)이 쓴 스타일을 선호한다.
Lambert의 책은 RM 벤치마크 기준으로 생성형 판정이 전용 분류기 RM보다 대체로 뒤처져 있다고 정리하고, 분산을 줄이려 판정은 temperature 0으로 샘플링하는 것이 흔하다고 적는다.
MATH 풀이 64개 중 하나를 골라 제출하는 best-of-64에서, 같은 데이터 예산이라면 어떤 검증기가 더 유리할 가능성이 큰가?
Lightman et al.(2023)의 핵심 결과다. ORM은 결과만 보고 학습하므로 중간에 틀렸지만 답이 맞은 풀이와 깔끔한 풀이를 구분하는 신호가 약하다. PRM은 단계마다 라벨을 받아 첫 오류 지점을 학습한다. 가치함수는 특정 정책의 기대 return이지 정답 판정기가 아니며, 다른 생성기의 후보를 고르는 용도로 학습된 것이 아니다.
→ 더 깊이: 보상과 환경 — 검증기, rubric·생성형 보상, 다중 환경 RLVR까지 프론티어 RL의 보상 설계.
정리
- Bradley–Terry는 효용에 Gumbel 잡음을 더한 선택 모델에서 나온다: . RM 손실은 그 음의 로그우도다.
- gradient의 세기는 , 즉 현재 틀릴 확률이다. 잘 맞힌 쌍은 학습에 거의 기여하지 않는다.
- 보상의 이동(prompt별 상수)은 데이터로 정해지지 않고, 스케일은 라벨 잡음과 묶여 있다. RL에서는 만 의미가 있다.
- Margin(Llama 2)과 Plackett–Luce(K-wise)는 더 풍부한 라벨을 쓰는 변형이다.
- ORM은 최종 정답 확률, PRM은 단계별 정답 확률, 가치함수는 현재 정책의 기대 return, LLM judge는 텍스트 판정이다. LLM judge에는 위치·길이·자기 선호 편향이 있다.
더 읽을거리Further reading
- Lambert, RLHF Book, Ch. 5 Reward Modeling (rlhfbook.com) — BT 손실, margin, K-wise, ORM·PRM·가치함수 비교를 한 장에 정리했다. 이 레슨의 표기를 따른다.Covers the BT loss, margins, K-wise losses and a comparison of ORM, PRM and value functions in one chapter. This lesson follows its notation.
- Bradley & Terry, Rank Analysis of Incomplete Block Designs: I. The Method of Paired Comparisons (Biometrika, 1952) — 쌍 비교 확률 모델의 원전.The original source of the paired-comparison probability model.
- Ouyang et al., Training Language Models to Follow Instructions with Human Feedback (NeurIPS 2022) — K개 응답 순위 → 모든 쌍을 한 배치로, RM 1 epoch 학습 등 실전 세부.Practical details: a ranking of K responses → all pairs in one batch, training the RM for 1 epoch, etc.
- Touvron et al., Llama 2: Open Foundation and Fine-Tuned Chat Models (2023) — 선호 강도에 따른 margin 항, 도움·안전 RM 분리.A margin term based on preference strength; separate helpfulness and safety RMs.
- Lightman et al., Let's Verify Step by Step (2023) — PRM800K. 단계별 라벨로 학습한 PRM이 ORM보다 best-of-N 선택에서 낫다.PRM800K. A PRM trained on step-level labels beats an ORM at best-of-N selection.
- Cobbe et al., Training Verifiers to Solve Math Word Problems (2021) — GSM8K와 결과 검증기(ORM)의 원형.GSM8K and the prototype of the outcome verifier (ORM).
- Zheng et al., Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena (NeurIPS 2023) — LLM judge의 위치·장황함·자기선호 편향을 체계적으로 보고.Systematically reports LLM judges' position, verbosity and self-preference biases.
- Lambert et al., RewardBench: Evaluating Reward Models for Language Modeling (2024) — 첫 공개 RM 벤치마크. chosen/rejected 쌍 정확도로 RM을 비교.The first public RM benchmark. Compares RMs by accuracy on chosen/rejected pairs.