Note
Go to the end to download the full example code or to run this example in your browser via Binder.
May the AI replace the annotators? The alt-test and prediction-powered inference#
Two statistical tools answer the questions a reviewer asks about an AI judge. The alternative annotator test of Calderon et al. (2025) asks whether the AI aligns with a group of people at least as well as a member of the group does (with a cost–benefit margin ε): for each annotator, leave them out, and test whether the AI agrees with the others more often than the left-out person, with a Benjamini–Yekutieli correction over annotators. Prediction-powered inference (Angelopoulos et al., 2023) uses many cheap AI labels and a few human labels to estimate a population quantity — here the share of candidates people prefer to a reference design — with a valid confidence interval.
Five annotators, three AI judges#
Annotators are simulated users with related tastes; each labels 60 duels.
import matplotlib.pyplot as plt
import numpy as np
import easyiec as ei
from easyiec.evaluators import LLMJudge, MockJudgeClient, make_crowd
from easyiec.problems import ChernoffFace
from easyiec.validation import alt_test, make_individuals, ppi_mean
problem = ChernoffFace()
rng = np.random.default_rng(0)
crowd = make_crowd(problem, n=5, spread=0.1, seed=3, noise=0.05)
group = lambda g: float(np.mean([u.true_utility(g) for u in crowd])) # noqa: E731
duels = [make_individuals(problem.random(rng, 2)) for _ in range(60)]
def labels(ev):
return {k: int(ev.evaluate(ei.Query("pairs", [a, b])).pair_results[0][2] > 0.5) for k, (a, b) in enumerate(duels)}
humans = {u.name: labels(u) for u in crowd}
rows = []
for noise in [0.02, 0.05, 0.1, 0.3]:
ai = LLMJudge(MockJudgeClient(group, score_on="genome", noise=noise, seed=1), problem, image_size=48)
res = alt_test(humans, labels(ai), epsilon=0.15)
rows.append((noise, res.omega, res.rho, res.passed))
print(f"AI noise {noise}: winning rate ω = {res.omega:.2f}, advantage ρ = {res.rho:.2f}, passed = {res.passed}")
fig, ax = plt.subplots(figsize=(6, 3))
ax.bar([f"AI noise {r[0]}" for r in rows], [r[1] for r in rows],
color=["#009E73" if r[3] else "#D55E00" for r in rows])
ax.axhline(0.5, color="0.5", ls="--", lw=0.8)
ax.set_ylabel("winning rate ω", fontsize=8)
ax.set_title("alternative annotator test (ε = 0.15); green = passed", fontsize=9)

AI noise 0.02: winning rate ω = 1.00, advantage ρ = 1.00, passed = True
AI noise 0.05: winning rate ω = 1.00, advantage ρ = 0.94, passed = True
AI noise 0.1: winning rate ω = 0.00, advantage ρ = 0.86, passed = False
AI noise 0.3: winning rate ω = 0.00, advantage ρ = 0.75, passed = False
Text(0.5, 1.0, 'alternative annotator test (ε = 0.15); green = passed')
