Judge Calibration and Meta-Evaluation › Computing Agreement Between the Panel and Each Judge
Language AI HandbookAll chapters Each simulator draws one noisy margin in canonical answer order, then applies the first-position bonus in both presentations. A positive margin selects A and a negative one selects B, subject to the tie zone.
PythonIn [6]Expand
def make_judge(
name,
position_bias,
length_bias,
self_bias,
own_source=None,
tie_threshold=0.0,
noise=0.15,
):
def judge(rng, i):
pref = latent_pref[i]
score_a = 0.5 * (pref == 0)
score_b = 0.5 * (pref == 1)
relative_length = fixture["len_diff"].iloc[i] / 200.0
score_a += length_bias * relative_length
score_b -= length_bias * relative_length
if own_source is not None:
score_a += self_bias * (fixture["src_1"].iloc[i] == own_source)
score_b += self_bias * (fixture["src_2"].iloc[i] == own_source)
delta = float(
score_a - score_b + rng.normal(0, noise) - rng.normal(0, noise)
)
def canonical_choice(margin):
if abs(margin) <= tie_threshold:
return np.nan
return 0 if margin > 0 else 1
first_position_bonus = position_bias * 0.5
return (
canonical_choice(delta + first_position_bonus),
canonical_choice(delta - first_position_bonus),
)
judge.__name__ = name
return judge
judge_A = make_judge(
"judge_A_neutral",
position_bias=0.0,
length_bias=0.0,
self_bias=0.0,
tie_threshold=0.05,
noise=0.20,
)
judge_B = make_judge(
"judge_B_position",
position_bias=0.5,
length_bias=0.0,
self_bias=0.0,
tie_threshold=0.05,
noise=0.20,
)
judge_C = make_judge(
"judge_C_verbose_selfpref",
position_bias=0.0,
length_bias=0.4,
self_bias=0.4,
own_source="model_b",
tie_threshold=0.05,
noise=0.20,
)A has no assigned position, length, or source offset. B adds a first-position bonus. C adds length and Model B offsets. The observed diagnostics describe sample outcomes and need not match those coefficients.
PythonIn [7]Expand
for name, simulate in [("A", judge_A), ("B", judge_B), ("C", judge_C)]:
paired = np.array([simulate(rng, i) for i in range(N)])
fixture[f"judge_{name}"] = paired[:, 0]
fixture[f"judge_{name}_swapped"] = paired[:, 1]
print(
f"Nondecisions in first presentation: A={fixture['judge_A'].isna().sum()}, "
f"B={fixture['judge_B'].isna().sum()}, C={fixture['judge_C'].isna().sum()}"
)Each simulated call returns two canonical candidate identities, zero for A and one for B, plus possible nondecisions. The original order presents A first. The second order presents B first. The paired position function therefore counts first-position wins as original=0 plus swapped=1.
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!