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)
alternative annotator test (ε = 0.15); green = passed
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')

Prediction-powered estimate of a preference share#

Population: 600 generated faces. Question: which share of them would a person prefer to a reference face? The AI labels all 600, the person 40.

reference = make_individuals([problem.random(np.random.default_rng(99))])[0]
pool = make_individuals(problem.random(rng, 600))
truth = np.mean([crowd[0].true_utility(p.genome) > crowd[0].true_utility(reference.genome) for p in pool])
person = crowd[0]
ai = LLMJudge(MockJudgeClient(person.true_utility, score_on="genome", noise=0.06, seed=2), problem, image_size=32)


def prefers(ev, it):
    return float(ev.evaluate(ei.Query("pairs", [it, reference])).pair_results[0][2] > 0.5)


ests = []
for rep in range(20):
    idx = np.random.default_rng(rep).choice(len(pool), 40, replace=False)
    y = [prefers(person, pool[i]) for i in idx]
    f_l = [prefers(ai, pool[i]) for i in idx]
    if rep == 0:
        f_u = np.array([prefers(ai, p) for p in pool])
    ests.append(ppi_mean(y, f_l, f_u))
e = ests[0]
print(f"truth {truth:.3f} | AI only {e['naive_ai']:.3f} | 40 people {e['classical']:.3f} "
      f"[{e['classical_ci'][0]:.3f}, {e['classical_ci'][1]:.3f}] | PPI {e['estimate']:.3f} [{e['ci'][0]:.3f}, {e['ci'][1]:.3f}]")
fig, ax = plt.subplots(figsize=(6.4, 3.6))
for k, e in enumerate(ests):
    ax.plot(e["classical_ci"], [k - 0.15] * 2, color="#D55E00", lw=2, label="40 human labels" if k == 0 else None)
    ax.plot(e["ci"], [k + 0.15] * 2, color="#285780", lw=2, label="PPI: 40 human + 600 AI labels" if k == 0 else None)
ax.axvline(truth, color="black", lw=1, label="true share")
ax.axvline(ests[0]["naive_ai"], color="0.5", ls="--", lw=1, label="AI labels alone (biased)")
ax.set_xlabel("share of faces preferred to the reference", fontsize=8)
ax.set_ylabel("repetition", fontsize=8)
ax.legend(frameon=False, fontsize=7, loc="upper right")
plt.show()
plot 03 alt test ppi
truth 0.300 | AI only 0.247 | 40 people 0.275 [0.135, 0.415] | PPI 0.272 [0.156, 0.388]

Total running time of the script: (0 minutes 20.420 seconds)

Gallery generated by Sphinx-Gallery