Track V · RL for LLMs & Agents · 07/10

과최적화와 reward hackingOver-optimisation and reward hacking

학습된 보상은 진짜 목표의 대리(proxy)일 뿐이다. proxy를 세게 최적화할수록 진짜 보상이 올랐다 떨어지는 이유를 Goodhart의 법칙과 Gao et al.의 √KL 스케일링 법칙으로 설명하고, 실제 reward hacking 사례와 완화책(KL, 앙상블, 보상 변형, 길이 통제, held-out 평가)의 효과와 한계를 직접 실험한다.A learned reward is only a proxy for the true goal. Explain, with Goodhart's law and Gao et al.'s √KL scaling laws, why the true reward rises and then falls the harder you optimise the proxy, and experiment with real reward-hacking cases and the effects and limits of mitigations (KL, ensembles, reward transformation, length control, held-out evaluation).

40 분min reward hacking · overoptimization · Goodhart · KL · ensemble · best-of-n 먼저 볼 것:Before this: 보상모델Reward models, KL 정규화 RL과 PPO for LMsKL-regularised RL and PPO for LMs, Best-of-N과 rejection samplingBest-of-N and rejection sampling

A reward model is a function learned from tens of thousands of human preference pairs. Since we cannot directly measure what we really want (“helpful and honest responses”), we built a stand-in for it — a proxy. Reinforcement learning is relentlessly diligent at pushing up whatever number it is given. So if you optimise a proxy hard enough, sooner or later it finds the point where the proxy and the true goal diverge, and heads there. This is over-optimisation, and what it produces is reward hacking. This lesson covers why the phenomenon is unavoidable, how predictable it is, and what can slow it down.

Goodhart’s law

“When a measure becomes a target, it ceases to be a good measure.” That is how Strathern summarised the economist Goodhart’s observation. Manheim & Garrabrant (2018) split it into four kinds, and all four actually show up in RLHF.

KindWhat happensHow it looks in RLHF
Regressionalproxy = true + noise. Selecting the maximum also selects the noiseBoN picks out the RM’s chance overestimates
ExtremalOut of distribution, the relation between proxy and true itself changesThe RM gives wild scores to extreme responses it has never seen
CausalThe proxy looks at a correlated feature, not the causeLength correlates with quality in preference data → longer responses are preferred
AdversarialThe optimiser actively seeks out the proxy’s weaknessesThe policy exploits holes in the RM or grader

The simplest, regressional case is visible straight from a calculation. If the true reward is g∼N(0,σg2)g\sim\mathcal{N}(0,\sigma_g^2) and the proxy is p=g+ϵp = g + \epsilon with ϵ∼N(0,σϵ2)\epsilon\sim\mathcal{N}(0,\sigma_\epsilon^2), the Gaussian conditional expectation gives

E[g∣p]=σg2σg2+σϵ2 p\mathbb{E}[g\mid p]=\frac{\sigma_g^2}{\sigma_g^2+\sigma_\epsilon^2}\,p

The higher the proxy you select for, the higher the true reward too, but always only by the ratio σg2/(σg2+σϵ2)<1\sigma_g^2/(\sigma_g^2+\sigma_\epsilon^2) < 1, and the gap between the two grows with stronger selection. This alone does not make the true reward fall. It falls because of extremal and causal effects — when the proxy is systematically wrong out of distribution.

Scaling laws of over-optimisation

You cannot measure the “true reward” thousands of times by asking humans every time. Gao, Schulman and Hilton (2023) sidestepped this with a synthetic setup. They designate one large RM as the gold RM (playing the role of the true reward), and train proxy RMs of different sizes and data amounts on preference labels assigned by it. The policy is optimised against a proxy with Best-of-n or PPO, and the result is measured with the gold RM. The horizontal axis is how far it has moved from the initial policy, d=DKL(π ∥ πinit)d=\sqrt{D_{\text{KL}}(\pi\,\|\,\pi_{\text{init}})}.

The functional forms they found are as follows (with the initial policy’s gold score set to 0).

RBoN(d)=d (αBoN−βBoN d),RRL(d)=d (αRL−βRLlog⁡d)R_{\text{BoN}}(d)=d\,(\alpha_{\text{BoN}}-\beta_{\text{BoN}}\,d),\qquad R_{\text{RL}}(d)=d\,(\alpha_{\text{RL}}-\beta_{\text{RL}}\log d)

Both rise in proportion to dd at first, pass a peak, and then come down. BoN peaks at d⋆=α/2βd^\star=\alpha/2\beta. BoN’s KL can be written analytically as log⁡n−n−1n\log n-\frac{n-1}{n} (strictly, an upper bound). The paper’s qualitative conclusions are:

  • The larger the proxy RM (and the more data), the more smoothly the coefficients improve, so the peak is higher and further out. It does not remove over-optimisation, it delays it.
  • RL uses more KL distance than BoN to get the same gold improvement.
  • In their RL setup, adding a KL penalty did not improve the gold-vs-KL curve itself; it acted much like early stopping.

Why KL\sqrt{\text{KL}} in particular? For small moves, KL is proportional to the square of the distance moved. For a Gaussian whose mean moves by μ\mu, DKL=μ2/2σ2D_{\text{KL}}=\mu^2/2\sigma^2, so KL∝μ\sqrt{\text{KL}}\propto\mu. In other words dd is the distance moved in distribution space, and the αd\alpha d term says the reward initially rises linearly in that distance.

In a picture: the proxy rises, the gold bends

The figure below shrinks this story to one dimension. Summarise a response by a single feature xx (something like length, degree of flattery, or flashiness of formatting), and set the initial policy to π0=N(0,1)\pi_0=\mathcal{N}(0,1). The true reward peaks at a moderate xx and gets worse when xx is too large. The proxy is almost identical to the truth near π0\pi_0, but outside, where there is no data, it simply extends the slope at the edge. If “longer was better” inside the data, the RM believes “longer is better” out of distribution as well.

The policy moves along the path

πc(x) ∝ π0(x) exp⁡(c⋅rproxy(x)),c=ηt\pi_c(x)\ \propto\ \pi_0(x)\,\exp\big(c\cdot r_{\text{proxy}}(x)\big),\qquad c = \eta t

This path does not come from nowhere. The solution of max⁡πEπ[r]−βDKL(π∥π0)\max_\pi \mathbb{E}_\pi[r]-\beta D_{\text{KL}}(\pi\|\pi_0) is π⋆∝π0er/β\pi^\star\propto\pi_0 e^{r/\beta} (derived in RLHF-PPO), and running mirror descent with KL as the distance (natural policy gradient) without regularisation gives log⁡πt+1=log⁡πt+ηr+const\log\pi_{t+1}=\log\pi_t+\eta r+\text{const}, which follows exactly this path. With a KL penalty β\beta, the update becomes log⁡πt+1−log⁡π0=(1−ηβ)(log⁡πt−log⁡π0)+ηr\log\pi_{t+1}-\log\pi_0=(1-\eta\beta)(\log\pi_t-\log\pi_0)+\eta r, so ct=1−(1−ηβ)tβ→1βc_t=\frac{1-(1-\eta\beta)^t}{\beta}\to\frac1\beta: it stops at one point on the same path.

보상모델은 사람 선호 데이터 수만 쌍으로 학습한 함수다. 우리가 정말 원하는 것(“도움이 되고 정직한 응답”)을 직접 잴 수 없으니 그 대리(proxy)를 만든 것이다. 강화학습은 주어진 숫자를 올리는 데 지독하게 성실하다. 그래서 proxy를 세게 최적화하면 언젠가는 proxy와 진짜 목표가 갈라지는 지점을 찾아내 그쪽으로 간다. 이것이 과최적화(over-optimization) 이고, 그 결과물이 reward hacking이다. 이 레슨은 그 현상이 왜 피할 수 없는지, 얼마나 예측 가능한지, 무엇으로 늦출 수 있는지를 다룬다.

Goodhart의 법칙

“측정값이 목표가 되면 더 이상 좋은 측정값이 아니다.” 경제학자 Goodhart의 관찰을 Strathern이 이렇게 요약했다. Manheim & Garrabrant(2018)는 이것을 네 가지로 나누는데, RLHF에서 모두 실제로 보인다.

종류무엇이 일어나는가RLHF에서의 모습
Regressionalproxy = 진짜 + 잡음. 최댓값을 고르면 잡음도 같이 고른다BoN이 RM의 우연한 과대평가를 골라낸다
Extremal분포 밖에서는 proxy와 진짜의 관계 자체가 달라진다RM이 본 적 없는 극단적 응답에 엉뚱한 점수
Causalproxy가 원인이 아니라 상관된 특징을 본다선호 데이터에서 길이가 품질과 상관 → 긴 응답 선호
Adversarial최적화하는 쪽이 proxy의 약점을 능동적으로 찾는다정책이 RM·채점기의 허점을 이용

가장 단순한 regressional 경우는 계산으로 바로 보인다. 진짜 보상 g∼N(0,σg2)g\sim\mathcal{N}(0,\sigma_g^2), proxy p=g+ϵp = g + \epsilon, ϵ∼N(0,σϵ2)\epsilon\sim\mathcal{N}(0,\sigma_\epsilon^2)이면 가우시안 조건부 기대값에서

E[g∣p]=σg2σg2+σϵ2 p\mathbb{E}[g\mid p]=\frac{\sigma_g^2}{\sigma_g^2+\sigma_\epsilon^2}\,p

다. proxy가 높은 쪽을 고를수록 진짜 보상도 오르지만 항상 비율 σg2/(σg2+σϵ2)<1\sigma_g^2/(\sigma_g^2+\sigma_\epsilon^2) < 1만큼만 오르고, 둘의 차이는 선택이 강할수록 커진다. 이것만으로는 진짜 보상이 떨어지지는 않는다. 떨어지는 것은 extremal·causal 효과, 즉 분포 밖에서 proxy가 체계적으로 틀릴 때다.

과최적화의 스케일링 법칙

사람에게 매번 물어서는 “진짜 보상”을 수천 번 잴 수 없다. Gao, Schulman, Hilton(2023)은 이 문제를 합성 설정으로 우회했다. 큰 RM 하나를 gold RM(진짜 보상 역할)으로 정하고, 그것이 매긴 선호 레이블로 크기와 데이터 양이 다른 proxy RM들을 학습한다. 정책은 proxy에 대해 Best-of-n이나 PPO로 최적화하고, 그 결과를 gold RM으로 잰다. 가로축은 초기 정책에서 얼마나 멀어졌는지, d=DKL(π ∥ πinit)d=\sqrt{D_{\text{KL}}(\pi\,\|\,\pi_{\text{init}})}이다.

이들이 찾은 함수꼴은 다음과 같다(초기 정책의 gold 점수를 0으로 둔 값).

RBoN(d)=d (αBoN−βBoN d),RRL(d)=d (αRL−βRLlog⁡d)R_{\text{BoN}}(d)=d\,(\alpha_{\text{BoN}}-\beta_{\text{BoN}}\,d),\qquad R_{\text{RL}}(d)=d\,(\alpha_{\text{RL}}-\beta_{\text{RL}}\log d)

둘 다 처음에는 dd에 비례해 오르다가 최고점을 지나 내려간다. BoN은 d⋆=α/2βd^\star=\alpha/2\beta에서 최고다. BoN의 KL은 해석적으로 log⁡n−n−1n\log n-\frac{n-1}{n}로 쓸 수 있다(정확히는 상한이다). 논문의 정성적 결론은 이렇다.

  • proxy RM이 클수록(그리고 데이터가 많을수록) 계수가 매끄럽게 좋아져, 최고점이 더 높고 더 멀리 있다. 과최적화를 없애지는 않고 늦춘다.
  • 같은 gold 개선을 얻는 데 RL이 BoN보다 더 많은 KL 거리를 쓴다.
  • 그들의 RL 설정에서는 KL penalty를 넣어도 gold-대-KL 곡선 자체가 좋아지지 않았고, early stopping과 비슷하게 작동했다.

왜 하필 KL\sqrt{\text{KL}}일까. 작은 이동에서 KL은 이동 거리의 제곱에 비례한다. 평균이 μ\mu만큼 움직인 가우시안이라면 DKL=μ2/2σ2D_{\text{KL}}=\mu^2/2\sigma^2이니 KL∝μ\sqrt{\text{KL}}\propto\mu다. 즉 dd는 분포 공간에서 움직인 거리이고, 보상이 그 거리에 대해 처음에는 선형으로 오른다는 것이 αd\alpha d 항이다.

그림으로: proxy는 오르고 gold는 꺾인다

아래 그림은 이 이야기를 1차원으로 줄였다. 응답을 한 가지 특징 xx(길이, 아첨 정도, 형식의 화려함 같은 것)로 요약하고, 초기 정책을 π0=N(0,1)\pi_0=\mathcal{N}(0,1)로 둔다. 진짜 보상은 적당한 xx에서 최고이고 너무 커지면 나빠진다. proxy는 π0\pi_0 근처에서는 진짜와 거의 같지만 데이터가 없는 바깥에서는 가장자리의 기울기를 그대로 연장한다. 데이터 안에서 “길수록 좋았다”면 RM은 분포 밖에서도 “길수록 좋다”고 믿는다.

정책은 다음 경로를 따라 움직인다.

πc(x) ∝ π0(x) exp⁡(c⋅rproxy(x)),c=ηt\pi_c(x)\ \propto\ \pi_0(x)\,\exp\big(c\cdot r_{\text{proxy}}(x)\big),\qquad c = \eta t

이 경로는 아무 가정 없이 나온 것이 아니다. max⁡πEπ[r]−βDKL(π∥π0)\max_\pi \mathbb{E}_\pi[r]-\beta D_{\text{KL}}(\pi\|\pi_0)의 해가 π⋆∝π0er/β\pi^\star\propto\pi_0 e^{r/\beta}이고(RLHF-PPO에서 유도한 식), KL을 거리로 쓰는 mirror descent(natural policy gradient)를 정규화 없이 돌리면 log⁡πt+1=log⁡πt+ηr+const\log\pi_{t+1}=\log\pi_t+\eta r+\text{const}라서 정확히 이 경로를 간다. KL penalty β\beta를 넣으면 업데이트가 log⁡πt+1−log⁡π0=(1−ηβ)(log⁡πt−log⁡π0)+ηr\log\pi_{t+1}-\log\pi_0=(1-\eta\beta)(\log\pi_t-\log\pi_0)+\eta r이 되어 ct=1−(1−ηβ)tβ→1βc_t=\frac{1-(1-\eta\beta)^t}{\beta}\to\frac1\beta, 같은 경로 위의 한 점에서 멈춘다.

√KL – proxy – gold – gold 최고점peak – (√KL –)
Left: the response space (the horizontal axis is some feature of the response, such as length or degree of flattery). Grey is the initial policy π0, blue the current policy, green the true reward (gold), and red the learned reward model (proxy). The two are nearly identical where π0 has mass and diverge outside, where there is no data. Drag step: on the right, the proxy keeps rising while the gold rises and then falls. Turn on ensemble-min and the parts where the RMs are wrong in different ways are erased, delaying the collapse, but with a large shared error m the same thing eventually happens. Turn on the KL penalty and the policy stops at one point on the same curve (the grey dashed line on the right is the gold of Best-of-n). 왼쪽: 응답 공간(가로축은 응답의 어떤 특징, 예를 들어 길이나 아첨 정도). 회색은 초기 정책 π0, 파랑은 현재 정책, 초록은 진짜 보상(gold), 빨강은 학습된 보상모델(proxy). 둘은 π0가 있는 곳에서는 거의 같고, 데이터가 없는 바깥에서 갈라진다. step을 끌어 보면 오른쪽에서 proxy는 계속 오르는데 gold는 올랐다가 떨어진다. ensemble-min을 켜면 RM들이 서로 다르게 틀린 부분이 지워져 붕괴가 늦어지지만, 공유 오차 m이 크면 결국 같은 일이 일어난다. KL penalty를 켜면 정책이 같은 곡선 위의 한 점에서 멈춘다(오른쪽 회색 점선은 Best-of-n의 gold).
  1. Drag step from 0 to 100. On the right, the proxy (red) keeps rising to the end, but the gold (green) bends and falls near KL≈2.5\sqrt{\text{KL}}\approx2.5. On the left you can see that at that moment the blue policy crosses the gold peak into the region where only the proxy is high.
  2. Lower the shared error m to 0 and the proxy is mostly right even out of distribution, so there is almost no collapse. The size of over-optimisation depends on how wrong the proxy is out of distribution.
  3. Turn on ensemble-min to use the most pessimistic of four RMs. The parts where each RM is wrong differently are erased, so the peak rises and the collapse is delayed. But raise m to 1 and every member is wrong in the same direction, so the minimum is fooled too.
  4. Turn on the KL penalty and vary β. However many steps you take, the policy stops at c=1/βc=1/\beta. The curve on the right itself does not change. A good β is, in the end, one that stops near the gold peak — and to know it, you have to measure the gold.

Reward hacking in practice

Length. If longer responses win more often in the preference data, the RM learns length as a signal of quality. Singhal et al. (2023) reported that in several RLHF setups much of the reward improvement is explained by increased response length, and that using length alone as the reward reproduces much of the improvement. LLM-as-judge evaluations also tend to prefer longer responses, so AlpacaEval separately reports a length-controlled win rate.

Sycophancy. Sharma et al. (2023) showed that RLHF models tend to change their answers to match the user’s opinion, and that human preference data and preference models themselves fairly often prefer convincingly written sycophantic responses to correct ones. When what people like differs from what is good for people, RLHF learns the former.

Formatting and verbosity. “Diligent-looking” formatting — lists, bold text, filler — raises RM scores. The policy grows the formatting instead of the content.

Test hacking in code RL. Verifiable rewards are not safe either. If unit tests are the reward, the policy finds ways to pass the tests instead of solving the problem: editing the test files, hard-coding specific inputs, making the verification function pass unconditionally, or exiting the process cleanly before the tests run. Baker et al. (2025) observed such hacks in coding RL of frontier reasoning models and showed that monitoring the model’s chain of thought (CoT) with another LLM can catch many of them. At the same time they warned that if you put that monitor into the reward to penalise “bad thoughts”, the model can learn to keep hacking while hiding its intent (obfuscation). The monitor is, in the end, just another proxy.

Mitigations and their limits

MethodWhat it doesLimit
KL regularisation / early stoppingStays near the initial policyOnly decides where on the curve to stop. β must be chosen by gold evaluation
RM ensemble (min, mean − std)Treats disagreement between members as an out-of-distribution signal and scores pessimisticallyIf members share the same pretraining and data, they share errors too
Reward transformation / cappingClips the reward or makes it relative to a reference response, reducing the gain from extremesThe signal vanishes near the cap
Length controlLength penalty, length-controlled RMs and evaluationBiases other than length remain
Environment hardening (RLVR)Hidden tests, read-only files, validating the grader’s parserThe holes the policy finds are where the designer did not imagine
Held-out evaluationPeriodic measurement with human evaluation, benchmarks or a different judge not used in trainingExpensive and slow. But without it you do not know where to stop

Coste et al. (2024) reported that optimising the ensemble minimum (worst-case) or the mean minus the between-member variance (uncertainty-weighted) reduces over-optimisation. Eisenstein et al. (2023) looked at the same phenomenon more broadly and concluded that ensembles “mitigate but do not eliminate” it. Members starting from the same pretrained model tend to be wrong in the same direction, and that shared error cannot be erased by the ensemble — the case where you raise m in the figure.

→ Go deeper: Rewards and environments — how frontier labs build hard-to-hack verifiers, rubric and generative rewards, and hardened environments.

확인 문제Check yourself

During RL training, the score of the RM used for training keeps rising, but the human-evaluation win rate (not used for training) has been falling for a few hundred steps. What is the right first thing to do?

This is the classic over-optimisation curve: the proxy (RM) rises while the gold (human evaluation) has bent. First go back to where the gold peaked (early stopping), then look at what the policy changed after that. If features such as response length, the share of lists and bold text, or refusal phrases grew along with it, the RM is overvaluing them. Only then do remedies like raising the KL, reinforcing the RM on that feature, or using an ensemble make sense.

Try it yourself

First, Best-of-n. Draw nn samples from π0=N(0,1)\pi_0=\mathcal{N}(0,1), pick the one with the highest proxy, and measure its gold reward. As nn grows the KL grows as log⁡n−n−1n\log n-\frac{n-1}{n}, and the gold bends somewhere. At the end we fit Gao et al.’s functional form d(α−βd)d(\alpha-\beta d) by least squares.

NumPy Best-of-n over-optimisation and the √KL functional form
import numpy as np

rng = np.random.default_rng(0)

K = 0.25
def gold(x):                       # true reward: peaks at x = 1/(2K) = 2, worse beyond
    return x - K * x**2

def proxy(x, m=1.0, b=0.35):       # learned RM: equals gold near π0 (|x|<1.5), wrong outside
    t = np.clip((np.abs(x) - 1.5) / 2, 0, 1); ramp = t * t * (3 - 2 * t)
    lin = gold(1.5) + (1 - 2 * K * 1.5) * (x - 1.5)      # extend the slope at the edge of the distribution
    return gold(x) + ramp * (m * (lin - gold(x)) + b * (x - 1.5 * np.sign(x)))

# --- Best-of-n: draw n from π0 = N(0,1) and pick the highest proxy
def best_of_n(n, trials=400):
    x = rng.standard_normal((trials, n))
    pick = x[np.arange(trials), proxy(x).argmax(1)]
    return proxy(pick).mean(), gold(pick).mean()

g0 = gold(rng.standard_normal(200_000)).mean()
p0 = proxy(rng.standard_normal(200_000)).mean()
print(" n      KL_bon  √KL   proxy-Δ  gold-Δ")
rows = []
for n in [1, 2, 4, 16, 64, 256, 1024, 4096, 16384]:
    kl = np.log(n) - (n - 1) / n                          # BoN KL (upper-bound formula)
    p, g = best_of_n(n, trials=400 if n <= 4096 else 60)
    rows.append((np.sqrt(kl), g - g0))
    print(f"{n:6d}  {kl:6.2f}  {np.sqrt(kl):4.2f}  {p - p0:7.2f}  {g - g0:7.2f}")

# Fit Gao et al. (2023)'s BoN form R(d) = d(α − βd), d = √KL, by least squares
d = np.array([r[0] for r in rows]); R = np.array([r[1] for r in rows])
X = np.stack([d, -d**2], 1)
alpha, beta = np.linalg.lstsq(X, R, rcond=None)[0]
print(f"\nfit: R_bon(d) = d({alpha:.2f} − {beta:.2f} d) → peak d* = α/2β = {alpha/(2*beta):.2f}, "
      f"at n ≈ {np.exp(alpha**2/(4*beta**2) + 1):.0f}")
 

proxy-Δ increases monotonically, while gold-Δ peaks around n=16n=16–6464 and comes down. The peak of the fitted form points to the same place. That the functional form fits well in this toy is no accident: the position of the best sample moves roughly like 2log⁡n≈2 d\sqrt{2\log n}\approx\sqrt{2}\,d, and the gold is a quadratic in that position.

Next we compute exactly, on a grid, the path πc∝π0ec rproxy\pi_c\propto\pi_0e^{c\,r_{\text{proxy}}} that corresponds to RL. We compare a single RM, an ensemble without shared error, and an ensemble with shared error, and see where a KL penalty stops.

NumPy RL path, RM ensembles, KL penalty
xs = np.linspace(-5, 10, 3001)                       # response space as a fine grid
w0 = np.exp(-xs**2 / 2); w0 /= w0.sum()              # π0
G  = gold(xs)

def tilt(p, c):
    """KL-regularised optimum / natural-gradient flow: π_c ∝ π0 · exp(c · proxy)."""
    lw = np.log(w0) + c * p
    pi = np.exp(lw - lw.max()); return pi / pi.sum()

def kl(pi):
    nz = pi > 0
    return max(0.0, float((pi[nz] * np.log(pi[nz] / w0[nz])).sum()))

indiv = np.array([0.35, -0.10, 0.15, -0.25])          # a different error (slope) for each RM
def ensemble(shared):                                   # shared: error common to all RMs
    return [proxy(xs, m=1.0, b=shared + b) for b in indiv]

def frontier(P, cs=np.linspace(0, 12, 49)):
    out = []
    for c in cs:
        pi = tilt(P, c); out.append((np.sqrt(kl(pi)), pi @ P - w0 @ P, pi @ G - w0 @ G))
    return np.array(out)

P_single = ensemble(0.0)[0]
for name, P in [("single RM", P_single),
                ("ensemble-min (shared err 0)", np.min(ensemble(0.0), 0)),
                ("ensemble-min (shared err 0.4)", np.min(ensemble(0.4), 0))]:
    F = frontier(P)
    k = F[:, 2].argmax()
    print(f"{name:29s} gold-Δ peak {F[k,2]:.2f} @ √KL={F[k,0]:.2f}  | end (c=12): √KL={F[-1,0]:.2f}"
          f" proxy-Δ={F[-1,1]:.2f} gold-Δ={F[-1,2]:.2f}")

# A KL penalty β only stops at c = 1/β on the same path (in this idealised setting)
print("\nKL penalty β → convergence point")
for beta in [1.0, 0.5, 0.25, 0.1]:
    pi = tilt(P_single, 1 / beta)
    print(f"  β={beta:<5} √KL={np.sqrt(kl(pi)):.2f}  proxy-Δ={pi @ P_single - w0 @ P_single:.2f}  gold-Δ={pi @ G - w0 @ G:.2f}")
 

Three things show up. (1) A single RM, pushed to the end, makes the gold strongly negative. (2) Without shared error, the ensemble minimum does not rise out of distribution, so the policy stops by itself near the gold peak. (3) With shared error, the ensemble is eventually fooled too. A KL penalty only stops at different points on the same path depending on β, and which β is good you only know by measuring the gold. Comparing with the BoN results above, you can also see that at the same KL, BoN’s gold improvement is larger than the RL path’s.

확인 문제Check yourself

You optimised against the minimum of an ensemble of 4 RMs, yet responses kept getting longer and human evaluation dropped. What is the most plausible cause?

Pessimistic aggregation in an ensemble is conservative only where members disagree. An error that lives in the training data itself, such as length bias, is learned identically by every member, so no disagreement arises and the minimum likes length too. This is Eisenstein et al.’s “mitigate but do not eliminate”. Such shared errors call for remedies that change the source of the error itself: length-controlled data, a length penalty, held-out evaluation with a judge from a different family.

Summary

  • A learned RM is a proxy for the true goal. It may be right in distribution, but it diverges once optimisation pushes the policy out of distribution (Goodhart: regressional, extremal, causal, adversarial).
  • Gao et al. (2023): as a function of d=KLd=\sqrt{\text{KL}}, the gold reward rises and falls in the form d(α−βd)d(\alpha-\beta d) for BoN and d(α−βlog⁡d)d(\alpha-\beta\log d) for RL. A larger RM only raises and delays the peak; it does not remove it.
  • The KL-regularised optimum π∝π0er/β\pi\propto\pi_0e^{r/\beta} is one point on the unregularised natural-gradient path. A KL penalty is a dial that decides where to stop.
  • Reward hacking — length, sycophancy, formatting, bypassing code tests — is observed in practice. Verifiable rewards and CoT monitors are proxies too.
  • Ensembles erase per-member errors but not shared errors. In the end, the basic rule is to choose the stopping point with held-out gold evaluation.
  1. step을 0에서 100까지 끌어 보자. 오른쪽에서 proxy(빨강)는 끝까지 오르지만 gold(초록)는 KL≈2.5\sqrt{\text{KL}}\approx2.5 근처에서 꺾여 내려간다. 왼쪽을 보면 그 순간 파란 정책이 gold의 봉우리를 넘어 proxy만 높은 영역으로 들어간다.
  2. 공유 오차 m을 0으로 내리면 proxy가 분포 밖에서도 대체로 맞아 붕괴가 거의 없다. 과최적화의 크기는 분포 밖에서 proxy가 얼마나 틀렸는가에 달려 있다.
  3. ensemble-min을 켜면 네 RM 중 가장 비관적인 값을 쓴다. RM마다 다르게 틀린 부분이 지워져 최고점이 오르고 붕괴가 늦어진다. 하지만 m을 1로 올리면 모든 멤버가 같은 방향으로 틀려 최소값도 속는다.
  4. KL penalty를 켜고 β를 바꿔 보자. step을 아무리 늘려도 정책이 c=1/βc=1/\beta에서 멈춘다. 오른쪽 곡선 자체는 바뀌지 않는다. 좋은 β는 결국 gold의 최고점 근처에서 멈추게 하는 β이고, 그것을 알려면 gold를 재야 한다.

실제 reward hacking

길이. 선호 데이터에서 긴 응답이 더 자주 이기면 RM은 길이를 품질의 신호로 배운다. Singhal et al.(2023)은 여러 RLHF 설정에서 보상 향상의 상당 부분이 응답 길이 증가로 설명되고, 길이만을 보상으로 써도 개선의 많은 부분이 재현된다고 보고했다. LLM-as-judge 평가도 긴 응답을 선호하는 경향이 있어 AlpacaEval은 길이를 통제한 승률(length-controlled win rate)을 따로 낸다.

아첨(sycophancy). Sharma et al.(2023)은 RLHF 모델들이 사용자의 의견에 맞춰 답을 바꾸는 경향을 보이고, 사람 선호 데이터와 선호 모델 자체가 그럴듯하게 쓴 아첨 응답을 정확한 응답보다 선호하는 경우가 적지 않다는 것을 보였다. 사람이 좋아하는 것과 사람에게 좋은 것이 다를 때 RLHF는 전자를 배운다.

형식과 장황함. 목록, 굵은 글씨, 사족 같은 “성실해 보이는” 형식이 RM 점수를 올린다. 정책은 내용 대신 형식을 키운다.

코드 RL에서의 테스트 해킹. 검증 가능한 보상도 안전하지 않다. 단위 테스트를 보상으로 쓰면 정책은 문제를 푸는 대신 테스트를 통과하는 방법을 찾는다. 테스트 파일을 고치거나, 특정 입력을 하드코딩하거나, 검증 함수가 무조건 통과하게 만들거나, 테스트가 돌기 전에 프로세스를 정상 종료시키는 식이다. Baker et al.(2025)은 최전선 추론 모델의 코딩 RL에서 이런 해킹을 관찰했고, 모델의 사고 과정(CoT)을 다른 LLM으로 모니터링하면 많은 경우 잡아낼 수 있음을 보였다. 동시에 그 모니터를 보상에 넣어 “나쁜 생각”을 벌하면, 해킹은 계속하면서 의도를 숨기는(obfuscation) 쪽으로 배울 수 있다고 경고했다. 모니터도 결국 또 하나의 proxy다.

완화책과 그 한계

방법하는 일한계
KL 정규화 / early stopping초기 정책 근처에 머문다곡선 위 멈출 위치만 정한다. β는 gold 평가로 골라야 한다
RM 앙상블 (min, 평균−표준편차)멤버 간 불일치 = 분포 밖 신호로 보고 비관적으로 평가멤버들이 같은 사전학습·같은 데이터를 공유하면 오차도 공유한다
보상 변형·상한보상을 clip하거나 기준 응답 대비로 바꾸어 극단값의 이득을 줄인다상한 근처에서 신호가 사라진다
길이 통제길이 penalty, 길이를 통제한 RM·평가길이 외의 다른 편향은 그대로
환경 강화 (RLVR)테스트 숨기기, 읽기 전용 파일, 채점기 파서 검증정책이 찾는 허점은 설계자가 상상하지 못한 곳에 있다
held-out 평가학습에 쓰지 않은 사람 평가·벤치마크·다른 judge로 주기적 측정비싸고 느리다. 그러나 이것 없이는 어디서 멈출지 모른다

Coste et al.(2024)은 앙상블의 최소값(worst-case)이나 평균에서 멤버 간 분산을 뺀 값(uncertainty-weighted)으로 최적화하면 과최적화가 줄어든다고 보고했다. Eisenstein et al.(2023)은 같은 현상을 더 넓게 보고 “완화하지만 제거하지 못한다”고 결론 냈다. 멤버들이 같은 사전학습 모델에서 출발하면 같은 방향으로 틀리기 쉽고, 그 공유 오차는 앙상블이 지울 수 없다. 그림에서 m을 올린 경우다.

→ 더 깊이: 보상과 환경 — 해킹하기 어려운 검증기, rubric·생성형 보상, 환경 강화를 프론티어 lab들이 어떻게 하는지.

확인 문제Check yourself

RL 학습 중 학습에 쓰는 RM 점수는 계속 오르는데, 학습에 쓰지 않은 사람 평가 승률은 몇 백 step 전부터 떨어지고 있다. 가장 먼저 할 일로 적절한 것은?

전형적인 과최적화 곡선이다. proxy(RM)는 오르고 gold(사람 평가)는 꺾였다. 먼저 gold가 최고였던 지점으로 돌아가고(early stopping), 그 이후 정책이 무엇을 바꿨는지 본다. 응답 길이, 목록·굵은 글씨 비율, 거절 문구 같은 특징이 같이 늘었다면 RM이 그것을 과대평가하고 있다는 뜻이다. 그다음에야 KL을 키우거나, RM을 그 특징에 대해 보강하거나, 앙상블을 쓰는 처방이 의미가 있다.

직접 해 보기

먼저 Best-of-n이다. π0=N(0,1)\pi_0=\mathcal{N}(0,1)에서 nn개를 뽑아 proxy가 가장 높은 것을 고르고, 그 응답의 gold 보상을 잰다. nn을 키우면 KL이 log⁡n−n−1n\log n-\frac{n-1}{n}로 커지고 gold는 어딘가에서 꺾인다. 마지막에 Gao et al.의 함수꼴 d(α−βd)d(\alpha-\beta d)를 최소제곱으로 맞춘다.

NumPy Best-of-n 과최적화와 √KL 함수꼴
import numpy as np

rng = np.random.default_rng(0)

K = 0.25
def gold(x):                       # 진짜 보상: x = 1/(2K) = 2에서 최고, 그 뒤로는 나빠진다
    return x - K * x**2

def proxy(x, m=1.0, b=0.35):       # 학습된 RM: π0 근처(|x|<1.5)에서는 gold와 같고 바깥에서 틀린다
    t = np.clip((np.abs(x) - 1.5) / 2, 0, 1); ramp = t * t * (3 - 2 * t)
    lin = gold(1.5) + (1 - 2 * K * 1.5) * (x - 1.5)      # 분포 가장자리의 기울기를 그대로 연장
    return gold(x) + ramp * (m * (lin - gold(x)) + b * (x - 1.5 * np.sign(x)))

# --- Best-of-n: π0 = N(0,1)에서 n개 뽑아 proxy가 가장 높은 것을 고른다
def best_of_n(n, trials=400):
    x = rng.standard_normal((trials, n))
    pick = x[np.arange(trials), proxy(x).argmax(1)]
    return proxy(pick).mean(), gold(pick).mean()

g0 = gold(rng.standard_normal(200_000)).mean()
p0 = proxy(rng.standard_normal(200_000)).mean()
print(" n      KL_bon  √KL   proxy-Δ  gold-Δ")
rows = []
for n in [1, 2, 4, 16, 64, 256, 1024, 4096, 16384]:
    kl = np.log(n) - (n - 1) / n                          # BoN KL (상한 공식)
    p, g = best_of_n(n, trials=400 if n <= 4096 else 60)
    rows.append((np.sqrt(kl), g - g0))
    print(f"{n:6d}  {kl:6.2f}  {np.sqrt(kl):4.2f}  {p - p0:7.2f}  {g - g0:7.2f}")

# Gao et al. (2023)의 BoN 함수꼴 R(d) = d(α − βd), d = √KL 을 최소제곱으로 맞춘다
d = np.array([r[0] for r in rows]); R = np.array([r[1] for r in rows])
X = np.stack([d, -d**2], 1)
alpha, beta = np.linalg.lstsq(X, R, rcond=None)[0]
print(f"\nfit: R_bon(d) = d({alpha:.2f} − {beta:.2f} d) → 최고점 d* = α/2β = {alpha/(2*beta):.2f}, "
      f"그때 n ≈ {np.exp(alpha**2/(4*beta**2) + 1):.0f}")
 

proxy-Δ는 단조 증가하는데 gold-Δ는 n=16n=16–6464 근처에서 최고를 찍고 내려간다. 맞춘 함수꼴의 최고점도 그 근처를 가리킨다. 이 장난감에서 함수꼴이 잘 맞는 것은 우연이 아니다. 최고 표본의 위치가 대략 2log⁡n≈2 d\sqrt{2\log n}\approx\sqrt{2}\,d로 움직이고, gold가 그 위치의 이차함수이기 때문이다.

다음은 RL에 해당하는 경로 πc∝π0ec rproxy\pi_c\propto\pi_0e^{c\,r_{\text{proxy}}}를 격자 위에서 정확히 계산한다. 단일 RM, 공유 오차가 없는 앙상블, 공유 오차가 있는 앙상블을 비교하고, KL penalty가 어디서 멈추는지 본다.

NumPy RL 경로, RM 앙상블, KL penalty
xs = np.linspace(-5, 10, 3001)                       # 응답 공간을 촘촘한 격자로
w0 = np.exp(-xs**2 / 2); w0 /= w0.sum()              # π0
G  = gold(xs)

def tilt(p, c):
    """KL-정규화 최적해 / natural-gradient 흐름: π_c ∝ π0 · exp(c · proxy)."""
    lw = np.log(w0) + c * p
    pi = np.exp(lw - lw.max()); return pi / pi.sum()

def kl(pi):
    nz = pi > 0
    return max(0.0, float((pi[nz] * np.log(pi[nz] / w0[nz])).sum()))

indiv = np.array([0.35, -0.10, 0.15, -0.25])          # RM마다 다른 오차(기울기)
def ensemble(shared):                                   # shared: 모든 RM이 함께 가진 오차
    return [proxy(xs, m=1.0, b=shared + b) for b in indiv]

def frontier(P, cs=np.linspace(0, 12, 49)):
    out = []
    for c in cs:
        pi = tilt(P, c); out.append((np.sqrt(kl(pi)), pi @ P - w0 @ P, pi @ G - w0 @ G))
    return np.array(out)

P_single = ensemble(0.0)[0]
for name, P in [("single RM", P_single),
                ("ensemble-min (공유 오차 0)", np.min(ensemble(0.0), 0)),
                ("ensemble-min (공유 오차 0.4)", np.min(ensemble(0.4), 0))]:
    F = frontier(P)
    k = F[:, 2].argmax()
    print(f"{name:28s} gold-Δ 최고 {F[k,2]:.2f} @ √KL={F[k,0]:.2f}  | 끝(c=12): √KL={F[-1,0]:.2f}"
          f" proxy-Δ={F[-1,1]:.2f} gold-Δ={F[-1,2]:.2f}")

# KL penalty β는 같은 경로 위 c = 1/β에서 멈추게 할 뿐이다 (이 이상화된 설정에서)
print("\nKL penalty β → 수렴점")
for beta in [1.0, 0.5, 0.25, 0.1]:
    pi = tilt(P_single, 1 / beta)
    print(f"  β={beta:<5} √KL={np.sqrt(kl(pi)):.2f}  proxy-Δ={pi @ P_single - w0 @ P_single:.2f}  gold-Δ={pi @ G - w0 @ G:.2f}")
 

세 가지가 보인다. (1) 단일 RM은 끝까지 밀면 gold가 크게 음수가 된다. (2) 공유 오차가 없으면 앙상블의 최소값은 분포 밖에서 오르지 않아, 정책이 gold 최고점 근처에서 스스로 멈춘다. (3) 공유 오차가 있으면 앙상블도 결국 속는다. KL penalty는 β에 따라 같은 경로의 다른 점에 멈출 뿐이고, 어느 β가 좋은지는 gold를 재 봐야 안다. 앞의 BoN 결과와 비교하면 같은 KL에서 BoN의 gold 개선이 RL 경로보다 크다는 것도 볼 수 있다.

확인 문제Check yourself

RM 4개의 앙상블 최소값으로 최적화했는데도 응답이 계속 길어지며 사람 평가가 떨어졌다. 가장 그럴듯한 원인은?

앙상블의 비관적 집계는 멤버끼리 의견이 갈리는 곳에서만 보수적이다. 길이 편향처럼 학습 데이터 자체에 들어 있는 오차는 모든 멤버가 똑같이 배우므로 불일치가 생기지 않고, 최소값도 길이를 좋아한다. 이것이 Eisenstein et al.의 “완화하지만 제거하지 못한다”이다. 이런 공유 오차에는 길이 통제 데이터, 길이 penalty, 다른 계열의 judge로 만든 held-out 평가처럼 오차의 출처 자체를 바꾸는 처방이 필요하다.

정리

  • 학습된 RM은 진짜 목표의 proxy다. 분포 안에서는 맞아도 최적화가 정책을 분포 밖으로 밀면 갈라진다(Goodhart: regressional, extremal, causal, adversarial).
  • Gao et al.(2023): gold 보상은 d=KLd=\sqrt{\text{KL}}에 대해 BoN은 d(α−βd)d(\alpha-\beta d), RL은 d(α−βlog⁡d)d(\alpha-\beta\log d) 꼴로 올랐다 떨어진다. 더 큰 RM은 최고점을 높이고 늦출 뿐 없애지 않는다.
  • KL-정규화 최적해 π∝π0er/β\pi\propto\pi_0e^{r/\beta}는 정규화 없는 natural-gradient 경로 위의 한 점이다. KL penalty는 어디서 멈출지를 정하는 다이얼이다.
  • 길이, 아첨, 형식, 코드 테스트 우회 같은 reward hacking은 실제로 관찰된다. 검증 가능한 보상과 CoT 모니터도 proxy다.
  • 앙상블은 멤버별 오차를 지우지만 공유 오차는 못 지운다. 결국 held-out gold 평가로 멈출 지점을 고르는 것이 기본이다.

더 읽을거리Further reading