AI Wiki中文/EN

AI feedback: changing the judge changes the learning signal

AI 反馈学习

Measure order and style bias, then distinguish reward distillation from direct scoring.

On this pageIntuitionMathematics & methodImplementationLimitationsExercisesResearch connections

Swapping the answers can fix one bias while leaving another

Imagine a judge that likes whichever answer appears first. Evaluating both orders seems an obvious repair. Now suppose it also likes ornate wording, even when the wording accompanies a wrong answer. Swapping positions addresses the first preference, not the second.

Reinforcement learning from AI feedback, or RLAIF, uses AI-generated judgments in the learning signal. The judge, reward model and policy can be different models. Lee and colleagues, section 2, distinguish a distilled route, which fits a reward model to AI comparisons, from a direct route, which uses AI scores as rewards during reinforcement learning. Bai and colleagues, section 4, demonstrate principle-conditioned AI comparisons within Constitutional AI. Not every RLAIF procedure has to use that two-stage constitutional revision recipe.

Our program uses a declared numerical judge, not an AI service. It separates position bias, content-related preference and the numerical route from feedback to policy. Its “intended utility” is authored for the example, not a measurement of real human preferences.

Averaging aligned candidate orders repairs an order effect while a style bonus remains.
Averaging aligned candidate orders repairs an order effect while a style bonus remains.

Align candidate identity before averaging

Let a candidate have intended utility uiu_i, but let the judge add a style bonus bib_i. Its effective score is:

vi=ui+bi.v_i=u_i+b_i.

A positional advantage aa for the first option produces the following probability when ii is shown first:

Pfirst(i,j)=σ(vi−vj+a).P_{\mathrm{first}}(i,j)=\sigma(v_i-v_j+a).

If the answers are swapped, the first-option probability now concerns jj. Convert it back to the probability of candidate ii before averaging:

t‾ij=12[Pfirst(i,j)+1−Pfirst(j,i)]=12[σ(vi−vj+a)+σ(vi−vj−a)].\overline t_{ij}=\frac12\left[P_{\mathrm{first}}(i,j)+1-P_{\mathrm{first}}(j,i)\right]=\frac12[\sigma(v_i-v_j+a)+\sigma(v_i-v_j-a)].

This models the order-balancing idea in Lee, section 2.1.1. For equal scores it yields 0.5 and satisfies t‾ij+t‾ji=1\overline t_{ij}+\overline t_{ji}=1. In this synthetic additive-bias model, it preserves the ranking of vv, not necessarily the ranking of uu. It also generally changes confidence relative to σ(vi−vj)\sigma(v_i-v_j); “balanced” is not the same as perfectly calibrated. Real judges need not have a constant additive order effect.

For the distilled route, a scalar reward model fits the balanced soft labels. With sij=σ(ri−rj)s_{ij}=\sigma(r_i-r_j):

LR=−1N∑(i,j)[t‾ijlog⁡sij+(1−t‾ij)log⁡(1−sij)].\mathcal L_R=-\frac1N\sum_{(i,j)}[\overline t_{ij}\log s_{ij}+(1-\overline t_{ij})\log(1-s_{ij})].

Then a policy optimizes those fitted scores with a specified reference and regularization. Reward fitting introduces another approximation between the judge and the policy; removing it does not remove judge error.

In Lee’s direct variant, the judge supplies a distribution over rating categories 1 through 10. After normalizing their probabilities, the expected rating is mapped to [−1,1][-1,1]:

ρi=∑k=110kP(k∣x,yi),ridirect=2ρi−19−1.\rho_i=\sum_{k=1}^{10}kP(k\mid x,y_i),\qquad r_i^{\mathrm{direct}}=2\frac{\rho_i-1}{9}-1.

The toy supplies the ten logits with a smooth handcrafted curve. There is no language-model tokenization or rating prompt. In an actual implementation, specify how multi-token rating strings are scored and which probability mass is normalized.

For either reward route, our finite policy is computed with the exact KL-regularized solution:

pi=qieri/β∑jqjerj/β,qi>0, β>0.p_i=\frac{q_i e^{r_i/\beta}}{\sum_jq_j e^{r_j/\beta}},\qquad q_i>0,\ \beta>0.

It is an optimization oracle for three responses, not an on-policy RL training loop. Direct and distilled rewards can have different scales. Using the same β\beta does not make their regularization strengths comparable.

Judge agreement and policy quality are distinct evaluations. A simple strict agreement statistic against a declared ordering is:

A=1N∑(i,j)1{(t‾ij−1/2)(ui−uj)>0}.A=\frac1N\sum_{(i,j)}\mathbf1\{(\overline t_{ij}-1/2)(u_i-u_j)>0\}.

This toy counts a judge tie as no strict agreement. Lee, section 2.3, instead defines AI labeler agreement with a binary argmax convention and separately evaluates policy win rate and harmlessness using human judgments. Our tie convention is explicit, and our statistic must not be labeled their benchmark score.

An order-balanced judge still prefers the wrong feature

Use Python and NumPy to run the complete program. Utilities are (1,0.4,-0.5) and style bonuses (0,0,1.5), making effective scores (1,0.4,1). The third answer’s style hides its poor utility. The positional advantage is 1.2.

"""Authored synthetic judge: order bias, style bias and two reward routes; no AI calls."""
import json
import numpy as np


def sigmoid(x):
    x = np.asarray(x, dtype=float)
    return np.exp(-np.logaddexp(0, -x))


def softmax(x):
    x = np.asarray(x, dtype=float)
    if x.ndim != 1 or not len(x) or not np.isfinite(x).all():
        raise ValueError("Expected a nonempty finite vector")
    e = np.exp(x - x.max())
    return e / e.sum()


def preferences(scores, pairs):
    return sigmoid(scores[pairs[:, 0]] - scores[pairs[:, 1]])


def pair_loss_grad(scores, pairs, targets):
    scores = np.asarray(scores, dtype=float)
    pairs = np.asarray(pairs, dtype=int)
    targets = np.asarray(targets, dtype=float)
    if (scores.ndim != 1 or pairs.ndim != 2 or pairs.shape[1] != 2
        or len(pairs) == 0 or targets.shape != (len(pairs),)
        or not np.isfinite(scores).all() or not np.isfinite(targets).all()
        or np.any((targets < 0) | (targets > 1))
        or pairs.min() < 0 or pairs.max() >= len(scores)):
        raise ValueError("Invalid scores, pairs or soft labels")
    delta = scores[pairs[:, 0]] - scores[pairs[:, 1]]
    loss = np.mean(np.logaddexp(0, delta) - targets * delta)
    residual = (sigmoid(delta) - targets) / len(pairs)
    gradient = np.zeros_like(scores)
    np.add.at(gradient, pairs[:, 0], residual)
    np.add.at(gradient, pairs[:, 1], -residual)
    return float(loss), gradient


def fit_scores(pairs, targets, size=3, steps=2000):
    scores = np.zeros(size)
    for _ in range(steps):
        _, gradient = pair_loss_grad(scores, pairs, targets)
        scores -= 0.5 * gradient
    return scores


def policy_for_reward(reference, reward, beta):
    reference = np.asarray(reference, dtype=float)
    reward = np.asarray(reward, dtype=float)
    if (reference.ndim != 1 or reference.shape != reward.shape
        or not np.isfinite(reference).all() or not np.isfinite(reward).all()
        or np.any(reference <= 0) or not np.isclose(reference.sum(), 1)
        or not np.isfinite(beta) or beta <= 0):
        raise ValueError("Positive normalized reference and beta are required")
    return softmax(np.log(reference) + reward / beta)


PAIRS = np.array([[0, 1], [1, 2], [0, 2]])


def ordered_preference(left_score, right_score, position_bias=1.2):
    return float(sigmoid(left_score-right_score+position_bias))


def symmetrized(left_score,right_score,position_bias=1.2):
    ab=ordered_preference(left_score,right_score,position_bias)
    ba=ordered_preference(right_score,left_score,position_bias)
    return (ab+1-ba)/2


def direct_reward(score_logits):
    # Teaching analogue of normalized probabilities of rating categories 1..10.
    probabilities=softmax(score_logits)
    if len(probabilities)!=10:raise ValueError("Ten rating logits are required")
    mean=float(probabilities@np.arange(1,11))
    return 2*(mean-1)/9-1


def demo():
    utility=np.array([1.,.4,-.5])
    style_bonus=np.array([0.,0.,1.5])
    judged=utility+style_bonus
    original=np.array([ordered_preference(judged[i],judged[j]) for i,j in PAIRS])
    balanced=np.array([symmetrized(judged[i],judged[j]) for i,j in PAIRS])
    reward=fit_scores(PAIRS,balanced)
    reference=np.array([.4,.4,.2])
    distilled=policy_for_reward(reference,reward,.7)
    centers=np.array([8.,6.,8.])
    direct=np.array([direct_reward(-.5*(np.arange(1,11)-c)**2) for c in centers])
    online=policy_for_reward(reference,direct,.7)
    return dict(utility=utility.tolist(), style_bonus=style_bonus.tolist(),
        unbalanced=original.tolist(), balanced=balanced.tolist(),
        # A tie is not an agreement with a strict underlying utility order.
        strict_agreements=int(np.sum(balanced>.5)), comparisons=len(PAIRS),
        learned_reward=reward.tolist(), distilled_policy=distilled.tolist(),
        direct_scores=direct.tolist(), direct_policy=online.tolist(),
        reference_utility=float(reference@utility),
        distilled_utility=float(distilled@utility), direct_utility=float(online@utility),
        note="Rewards have different scales; equal beta is not a controlled method comparison.")


if __name__ == "__main__":
    print(json.dumps(demo(), indent=2))

For pairs (A,B),(B,C),(A,C), unbalanced first-option probabilities are approximately (0.858149,0.645656,0.768525). After swapping and aligning identities they become (0.606246,0.393754,0.5). Only one of three comparisons strictly agrees with the intended utility ordering. The tie on A versus C is especially revealing: the judge treats a good answer and a bad but stylish answer as equal.

The distilled reward fits those three probabilities and gives policy approximately (0.490239,0.264642,0.245119) from reference (0.4,0.4,0.2) at β=0.7\beta=0.7. The direct route uses rating curves centered at (8,6,8) and produces a slightly different policy. Neither the small difference in expected utility nor equal beta establishes that one route is generally better; the reward scales and handcrafted judgments differ.

For NN pairs, order balancing requires two numerical judge evaluations per pair. In a real labeling workflow, that generally means two judge evaluations rather than one. The toy’s reward fitting costs O(N+K)O(N+K) per update, direct scoring over ten categories costs O(10K)O(10K), and the policy oracle costs O(K)O(K). None of these counts is a measured API price, latency or language-model FLOP estimate.

A cheaper label source still needs an evaluation target

AI judges can disagree with the intended rubric through order, style, verbosity, knowledge gaps or shared training biases. The example implements only two declared effects, so it cannot estimate their real prevalence. Evaluate agreement by task and subgroup rather than assuming a single average covers every use case.

Keep judge selection, calibration and final evaluation data separate where the experimental claim requires independence. Using the same judge to create labels and pronounce the policy successful can conceal a shared error. Fresh human evaluation is also a measured procedure with instructions, uncertainty and disagreement, not an infallible oracle.

Gao and colleagues, section 2.1, use a large reward model as a synthetic gold signal to investigate proxy optimization. That setup is useful precisely when its synthetic status is retained. An AI-generated label, a model-based gold score and a human preference are different evidence sources.

Repair the bookkeeping before judging the judge

  1. The judge returns probability 0.8 for the first option in both candidate orders. What is the balanced probability for candidate A?

Answer: (0.8+1−0.8)/2=0.5(0.8+1-0.8)/2=0.5. The second 0.8 belongs to B after swapping. Averaging 0.8 with 0.8 would fail to align candidate identities.

  1. Does order balancing remove the third answer’s style bonus?

Answer: No. The bonus remains part of vCv_C in both orders. In the example A and C still tie despite different intended utilities.

  1. What direct reward corresponds to a uniform distribution over ratings 1 through 10?

Answer: The expected rating is 5.5, which maps to zero. Concentrating all mass on 1 maps to −1-1; concentrating it on 10 maps to 1.

  1. Two pipelines use the same reference and beta, but one multiplies all rewards by ten. Are their regularization strengths equivalent?

Answer: No. Their exponentiated reward-to-beta ratios differ. Multiplying beta by ten as well would preserve this finite optimal policy; holding beta fixed makes reward more influential.

Trace who supplied each judgment

Lee’s sections 2.1–2.3 explain order handling, feedback routes and different evaluation metrics. Bai’s section 4 adds principles and mixed supervision sources. Gao’s synthetic setup illustrates why a gold-model score must keep its provenance. Recording the judge, prompt/rubric, model version, candidate ordering and evaluation source makes an AI-feedback result interpretable.

Make a prediction, then check

Does averaging both candidate orders eliminate every judge bias?

Choose one answer

Learning objectives

  • Distinguish labeling accuracy, policy quality and direct versus distilled feedback.
  • Verify the toy calculation and state what it cannot establish.

Prerequisites & connections

Explore related knowledge →

References

  1. RLAIF: Scaling Reinforcement Learning from Human Feedback with AI Feedback — v2
    Harrison Lee; Samrat Phatale; Hassan Mansoor; Thomas Mesnard; Johan Ferret; Kellie Lu; Colton Bishop; Ethan Hall; Victor Carbune; Abhinav Rastogi; Sushant Prakash · 2023
  2. Constitutional AI: Harmlessness from AI Feedback — v1
    Yuntao Bai and coauthors · 2022
  3. Scaling Laws for Reward Model Overoptimization — v1
    Leo Gao; John Schulman; Jacob Hilton · 2022

Version1 · Editorial status: Recorded technical checks completed

View technical check record (AI)

Codex · 2026-09-20 · Single AI author. Sections2.1.1/2.1.2/2.2,2.3 opening and4.3/4.4 text; PDF3/4 viewed. Order balancing, distilled/direct feedback and separate evaluation metrics; v2 dated2023-12-01. Sections3.1/3.2 and4.1/4.2 opening; PDF7/10/11 viewed. Critique/revision, supervised stage, AI harmlessness plus human helpfulness labels and soft preference targets. Sections2.1/2.2 and preceding best-of-n text; PDF4 viewed. Synthetic gold RM versus proxy, deterministic comparisons and recalibration; no empirical scaling fit reproduced. Seven paired equations and four explained exercises. Order probabilities aligned by candidate identity; style bias survives; direct rating endpoints and distilled likelihood verified. Strict-tie convention and unequal reward scales explicit; no AI calls.

  • Order probabilities aligned by candidate identity; style bias survives; direct rating endpoints and distilled likelihood verified. Strict-tie convention and unequal reward scales explicit; no AI calls.
  • Four computed SVG variants per topic;10 numeric/geometry tests and30 responsive cases passed. Ten selected final captures directly viewed. Full article acceptance recorded separately.

Source locations checked:

Related topics

No matches. Try a synonym or acronym.

0 results shown

Wrap the whole query in double quotes for a phrase match.