Interactive Evolutionary Computation in PythonHuman, simulated and AI evaluators. The easyiec toolbox

Chapter 6
Validating evaluators

An evaluator is a measuring instrument, and an instrument is calibrated before it is trusted. This chapter collects the measurements that decide whether an evaluator — above all an AI judge — can stand in for people: agreement statistics, diagnostics of position bias, consistency and transitivity, psychometric audits of discrimination, calibration of stated confidence, the alternative annotator test, prediction-powered inference and the judge-substitution study that combines them. It ends with a protocol for introducing an AI judge into an IEC application.

6.1 Agreement

The simplest question is how often two evaluators answer alike. For rankings the package offers Kendall’s τ, Spearman’s ρ, rank-biased overlap, which weights the top of two rankings more than the bottom [57], and the overlap of the top-k sets. For categorical labels — chosen or not, A or B — it offers Cohen’s κ for two raters [58], Fleiss’ κ for several [59] and Krippendorff’s α, which tolerates missing labels and any level of measurement [60]; for ratings the intraclass correlation [61]; and for a panel Kendall’s coefficient of concordance W [52]. feedback_agreement compares two answers to the same query in a protocol-aware way, and pairwise_agreement_matrix tabulates all pairs of evaluators of a study.

Agreement is necessary but not sufficient. Two evaluators can agree because both follow a superficial cue, and an evaluator can disagree with a person who is himself inconsistent. The following diagnostics look at an evaluator in isolation.

6.2 Diagnostics of a judge

The swap test. Each of n random pairs is asked twice, as (A, B) and as (B, A), of a judge without debiasing. A consistent judge names the same winner in both orders; position_consistency reports the share of consistent pairs and the share of decided duels won by the first-shown candidate, which should be one half [5].

Position bias in a log. position_bias needs no extra queries: it counts, over a logged session, how often each display position was chosen and tests the counts against uniformity with a χ2 test. The galleries must not be ordered by the strategy — most strategies show the survivors first — so the diagnostic is applied to random galleries or to sessions with shuffled display order (fig. 6.2).

Self-consistency and transitivity. self_consistency repeats the same queries and measures the agreement of the repetitions; transitivity asks a full round robin of m candidates and counts the cyclic triads a≻b≻c≻a. Kendall and Babington Smith’s coefficient of consistency [51],

ζ=1−c cmax,cmax= { (m3−m)∕24m odd, (m3−4m)∕24m even, (6.1)

equals 1 for a transitive judge and 0 for the most intransitive one. audit_judge runs the three diagnostics in one call and plot_judge_audit draws them side by side (fig. 6.1).

audits = [audit_judge(j, problem, goal="Choose the image you find more beautiful.", n_pairs=20, n_items=7) 
          for j in judges.values()] 
for a in audits: 
    print({k: (round(v, 2) if isinstance(v, float) else v) for k, v in a.summary().items()})
   

Figure 6.1

Figure 6.1. Diagnostics of a careful, a position-biased and a noisy mock AI judge and of a simulated person: position consistency in the swap test, share of duels won by the first-shown candidate (ideal 0.5), coefficient of consistency ζ of a seven-candidate round robin, and self-consistency of repeated answers.

Open in ColabExample plot_01_judge_audit.py in the gallery

Figure 6.2

Figure 6.2. Choice rate by display position in 20 random galleries for a careful and a position-biased judge, with the p-value of the χ2 test of uniformity.

6.3 Psychometric audits

Psychophysics characterizes a sensory system by its psychometric function, the probability of a correct answer in a two-alternative forced choice as a function of the stimulus difference [22]. The idea transfers to evaluators. psychometric_audit draws pairs of candidates so that a controlled attribute — the brightness of an image, the smile of a face, the Dice coefficient of a segmentation — differs by graded amounts, with most levels at small differences, asks the evaluator which candidate has more of the attribute, and fits a Weibull function with a lapse rate by maximum likelihood,

P(Δ)=12+(12−λ)(1−exp⁡(−(Δ∕α)β)),(6.2)

where Δ≥0 is the attribute difference, α a scale, β the steepness and λ∈[0,0.1] the lapse rate: guessing gives P(0)=12, and even a large difference is missed with probability λ. Two numbers summarize the evaluator. The threshold Δ75 at which the evaluator is right 75 % of the time is its just-noticeable difference: an AI judge with a threshold larger than the differences between the candidates of a late gallery cannot steer the search there. The lapse rate measures careless errors that no difference cures. When the 75 % level is not reached within the tested range, the threshold is reported as infinite.

The audit separates two questions that a single accuracy figure mixes: can the judge see the attribute, and does it use it when asked about something more vague. Asking “choose the brighter image” measures the first; comparing the judge’s answers to “choose the more beautiful image” with the attribute measures the second.

for noise in [0.01, 0.03, 0.08]: 
    judge = LLMJudge(MockJudgeClient(brightness, score_on="image", noise=noise, seed=1), problem, image_size=96, 
                     debias="none") 
    res = psychometric_audit(judge, problem, "brightness", goal="Choose the brighter image.", n_levels=6, 
                             per_level=12, name=f"judge noise {noise}") 
    results.append(res) 
    print(f"{res.attribute}: threshold {res.threshold75:.3f}, lapse {res.lapse:.2f}, accuracy {res.accuracy:.2f}")
   

Figure 6.3

Figure 6.3. Psychometric functions of three mock judges that score the brightness of Julia-set images with noise 0.01, 0.03 and 0.08: proportion correct (dots, 95 % intervals) against the brightness difference, fitted Weibull functions and 75 % thresholds (dotted).

Open in ColabExample plot_02_psychometric.py in the gallery

6.4 Calibration and scale use

AI judges can be asked for a confidence. calibration bins the stated confidences and compares them with the observed accuracy; the expected calibration error is the weighted mean absolute gap. A well-calibrated confidence is valuable for escalation, but the uncertainty that the judge derives from the disagreement of its own views (section 5.3) is usually the more reliable signal; the judge-substitution study below measures how well each predicts errors. scale_usage examines ratings: the share of each level, the entropy of the distribution and the compression towards the middle, a common rating bias of people and models alike.

6.5 May the AI replace the annotators?

Calderon, Reichart and Dror [6] turned the question into a test. With m≥3 human annotators who labelled the same items, each annotator j is left out in turn. For every item, the AI’s label and annotator j’s label are both scored by their alignment with the remaining annotators (for categorical labels the share of matching labels); Wijf=⊮[sif≥sij] records whether the AI did at least as well, Wijh=⊮[sij≥sif] whether the annotator did. The null hypothesis that the AI’s advantage ρjf−ρjh falls short of a cost–benefit margin −𝜀 is tested with a paired t-test or Wilcoxon test for each j, and the Benjamini–Yekutieli procedure [62] controls the false discovery rate across annotators. The winning rate ω is the share of annotators the AI beats; the AI passes if ω≥12. The margin expresses how much worse than a person the AI may be given its lower cost; the authors suggest 0.2 for experts, 0.15 for skilled annotators and 0.1 for crowd workers. alt_test implements the procedure (fig. 6.3a).

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}")
   

6.6 Prediction-powered inference

Sometimes the goal is not to replace people but to estimate a population quantity — the share of generated designs people prefer to a reference, the mean rating of a batch — from many cheap AI labels and a few human ones. Using the AI labels alone is biased by the AI’s errors; using the human labels alone is unbiased but imprecise. Prediction-powered inference [7] combines them: with N unlabelled items scored by the AI (ŷ) and n items scored by both,

𝜃^PP=1 N∑i=1Nŷi−1 n∑j=1n(ŷj−yj),se^2=σ^ŷ2 N+σ^ŷ−y2 n,(6.3)

the AI’s mean corrected by its average error on the labelled items, with a valid confidence interval that is narrower than the classical one whenever the AI’s errors vary less than the labels themselves. ppi_mean returns both intervals and the naive AI-only estimate (fig. 6.3b).

(a)

(a) Alternative annotator test

(a)

(b) Prediction-powered inference
Figure 6.4. (a) Winning rate ω of four mock AI judges against five simulated annotators labelling 60 duels of Chernoff faces (𝜀=0.15; green: passed). (b) Twenty repetitions of estimating the share of 600 generated faces a person prefers to a reference face: 95 % intervals from 40 human labels and from PPI with the AI’s 600 labels; the AI’s labels alone are biased.

Open in ColabExample plot_03_alt_test_ppi.py in the gallery

6.7 The judge-substitution study

compare_evaluators combines the measurements in one experiment: the same random queries are answered by every evaluator of interest — a person or a simulated stand-in, several AI judges, a panel — and, where a ground truth exists, by a noise-free oracle. The study reports the agreement matrix, each evaluator’s accuracy against the oracle, the area under the ROC curve of each evaluator’s uncertainty for predicting its own errors (0.5: uninformative), and the cost of each evaluator in seconds, calls, tokens and dollars. Figure 6.5 shows such a study on segmentation tuning, where the true mask makes the Dice coefficient an objective oracle. The AUROC column is the one a hybrid evaluator depends on: an AI whose uncertainty predicts its errors can be complemented efficiently by a person.

evaluators = { 
    "careful person": ei.SimulatedUser(problem, target="default", noise=0.03, seed=1), 
    "hurried person": ei.SimulatedUser(problem, target="default", noise=0.12, lapse=0.1, seed=2), 
    "good AI": LLMJudge(MockJudgeClient(dice, score_on="genome", noise=0.05, seed=3), problem, image_size=48), 
    "weak AI": LLMJudge(MockJudgeClient(dice, score_on="genome", noise=0.2, seed=4), problem, image_size=48), 
    "AI panel (3)": Panel([LLMJudge(MockJudgeClient(dice, score_on="genome", noise=0.2, seed=10 + k), problem, 
                                    image_size=48) for k in range(3)]), 
} 
study = compare_evaluators(problem, evaluators, n_queries=40, kind="pairs", n_items=4, reference="careful person", 
                           oracle=dice, seed=0) 
print(study.table().round(3).to_string(index=False))
   

Figure 6.5

Figure 6.5. Accuracy against the Dice oracle (left) and AUROC of the reported uncertainty for predicting errors (right) of two simulated people, two mock AI judges and a three-member AI panel, on 40 queries of two duels each.

Open in ColabExample plot_05_compare_evaluators.py in the gallery

6.8 A protocol for introducing an AI judge

The measurements suggest an order of work, summarized in fig. 6.6.

1.
Audit the instrument. Run the swap test, transitivity and self-consistency on random candidates of the problem; reject or debias a judge with strong position bias or many cyclic triads.
2.
Measure what it can see. Run psychometric audits for the attributes that matter (brightness, overshoot, the Dice coefficient); compare the thresholds with the differences between candidates late in a session.
3.
Compare with people. Let a few people and the judge answer the same queries; compute agreement, the alt-test and, if a ground truth exists, accuracy and the AUROC of uncertainty.
4.
Decide the role. If the judge passes, let it evaluate alone and audit it occasionally; if it is informative but not good enough, use it in a hybrid with calibrated risk control, starting from the labels of step 3; if it is uninformative, use it only to pre-select or not at all.
5.
Report. Publish the audits, the alt-test, the escalation share and the cost with the results, and estimate population quantities with prediction-powered inference rather than from AI labels alone.

Figure 6.6

Figure 6.6. Introducing an AI judge into an IEC application: audit, measure, compare, decide, report. The labels of the comparison with people calibrate the risk-controlled hybrid.

In a nutshell: Validating evaluators

  • Agreement statistics compare evaluators; swap tests, χ2 tests on logs, self-consistency and cyclic triads diagnose a judge in isolation.
  • Psychometric audits measure what a judge can see: its just-noticeable difference and its lapse rate.
  • The alt-test decides with a statistical guarantee whether an AI may replace annotators; PPI estimates population quantities from many AI and few human labels.
  • A judge-substitution study reports agreement, accuracy, the AUROC of uncertainty and cost, and its labels calibrate hybrid escalation.