LLM Evaluations Series — Presentation 02

LLM as Judge

Pairwise vs scoring, biases (positional, verbosity, self-preference, sycophancy), calibration against ground truth, constitutional eval, and cost vs quality trade-offs across judge models.

Pairwise Likert Positional Bias Verbosity Bias Self-Preference Constitutional Calibration
Judge Prompt → Scoring Mode → Bias Check → Mitigation → Calibrate → Deploy
00

Topics We'll Cover

01

When You Can't Write a Function for “Good”

Reference-based eval fails at scale for open-ended tasks: summarisation, dialogue, instruction following, code explanation. You can't enumerate all correct paraphrases of a summary. ROUGE-L correlation with human judgement for abstractive summarisation sits at ~0.3–0.4 — barely better than random for many tasks.

Where reference-based breaks

  • Open-ended generation (creative, explanatory)
  • Multiple valid response paths (paraphrase-equivalent)
  • Long-form where token-level overlap is noisy
  • Tasks with no human gold answer available

Where LLM judge adds value

  • Instruction-following fidelity
  • Factual consistency (hallucination detection)
  • Tone, style, audience-appropriateness
  • Safety and policy compliance at scale
  • Pairwise ranking for A/B model selection

The Zheng et al. MT-Bench paper (2023) reported GPT-4-as-judge agreement with human expert ratings of 80 % on pairwise preferences and 85 % on absolute scoring — comparable to inter-human agreement (81 %). This is the empirical basis for widespread adoption, but that number comes with caveats: the eval set was English-only, the tasks were conversational, and GPT-4 was evaluating responses from models weaker than itself.

The calibration prerequisite

An LLM judge is only trustworthy if it has been calibrated against human labels on your specific task distribution. A judge that agrees 85 % on MT-Bench may agree only 60 % on your specialised domain. Measure first; trust second.

02

Pairwise vs Scoring — A/B vs Likert

Two fundamental scoring paradigms with different statistical properties and different sensitivity to judge biases.

Pairwise (A vs B)

Judge sees two responses to the same prompt and outputs a preference: A wins, B wins, or tie. Produces a relative ranking. Naturally suited to model selection decisions. Can be aggregated via Bradley-Terry or Elo.

Pros: easier for judge to decide than absolute quality; less calibration needed; maps directly to “is candidate better than baseline?”

Cons: O(n²) comparisons for a full ranking; can't compare models not directly paired; ties ambiguous.

Scoring / Likert (absolute)

Judge sees one response and assigns a score on a defined scale, e.g. 1–5 or 1–10. Produces an absolute quality estimate. Naturally suited to monitoring thresholds.

Pros: O(n) calls; supports time-series trending; can gate on minimum quality threshold.

Cons: more sensitive to judge calibration errors; inter-judge variance on middle scores is high; anchoring effects from scale choice.

Use caseRecommended modeRationale
Choosing between two model versionsPairwiseDirect relative signal; doesn't require absolute calibration
Regression CI — catch quality dropsScoring (1–5)O(n) cost; threshold alerting on absolute score
Production monitoring dashboardScoringTime-series friendly; daily average over sampled traffic
Model leaderboardPairwise + Elo/BTTransitive, handles partial tournament graphs
Human preference studyPairwiseHumans more consistent on relative judgements
03

Prompt Patterns for Judges — Rubric, Exemplars, CoT

Judge prompt quality is the single largest determinant of judge accuracy. Three proven patterns, in order of increasing reliability.

Pattern 1: Rubric-only (fastest, lowest accuracy)
### System
You are an expert evaluator. Score the assistant's response on a scale of
1–5 where:
  5 = Fully correct, complete, well-structured
  4 = Correct with minor omissions
  3 = Partially correct but missing key elements
  2 = Mostly wrong but shows some understanding
  1 = Completely incorrect or harmful
Return only {"score": N}.

### User
Prompt: {prompt}
Response: {response}
Pattern 2: Rubric + Exemplars (recommended baseline)
### System (same rubric as above, then:)
Examples:
Score 5: "The transformer attention mechanism computes Q, K, V projections
  from the input, then softmax(QK^T / sqrt(d_k)) V..."  [CORRECT, detailed]
Score 2: "Transformers use attention to focus on words."  [too vague]
Score 1: "Transformers are a type of power supply."  [wrong domain]
Pattern 3: CoT + structured output (highest accuracy, 2× tokens)
### System
Evaluate the response step by step:
1. Identify the core claim the response makes.
2. Check each factual claim for correctness.
3. Assess completeness against the prompt requirements.
4. Assign a score 1–5 using the rubric below.
5. Output:  {"reasoning": "...", "score": N}

{rubric}
CoT reliability data

Zheng et al. found that asking the judge to produce a CoT rationale before the score improved agreement with humans by 4–7 pp on ambiguous items. The reasoning also makes failures auditable — you can inspect why the judge scored an item incorrectly, which is essential for debugging systematic biases.

04

Known Biases — Positional, Verbosity, Self-Preference, Sycophancy

These four biases are documented across multiple independent studies. Any eval pipeline that ignores them will produce systematically distorted results.

Positional bias

In pairwise eval, judges systematically prefer the response in position A (first-presented) regardless of quality. Effect size: GPT-4 showed 10–15 pp preference for position A in MT-Bench blind tests. Mitigation: swap A/B order and take majority; discard ties from swapped pairs.

Verbosity bias

Judges assign higher scores to longer responses even when the additional content is filler, repetition, or off-topic elaboration. Measured effect: +0.3–0.6 Likert points per 100 extra tokens in some studies. Mitigation: normalise instruction to “prefer concise and correct over verbose”; explicitly penalise unnecessary length in rubric.

Self-preference

A model used as judge preferentially rates its own outputs higher than outputs from other models. GPT-4 judging GPT-4 vs Claude 2 showed ~8 pp inflated win rate for GPT-4. Mitigation: never use the same model family as both system-under-test and judge; use a different vendor for the judge role.

Sycophancy

If the prompt contains any signal about the user's opinion (e.g. “don't you think response B is better?”), the judge will conform to that opinion rather than apply the rubric. Also triggered by authority framing (“An expert said response A was wrong”). Mitigation: strip opinion signals from judge prompts; never include prior scores in the judge context.

Bias measurement recipe

Quantify each bias on your eval set before deploying the judge. For positional: compute win-rate delta between (A,B) and (B,A) order on 100 random pairs — should be <2 pp if mitigated. For verbosity: regress score against response length on matched-quality pairs — coefficient should not exceed 0.01 Likert points/token. For self-preference: run with and without vendor-match and compare win rates.

05

Mitigating Biases — Randomisation, Multi-Judge, Bias Correction

Randomisation (cheapest fix)

For pairwise eval: run each comparison twice with swapped order. Declare winner only if both runs agree; count disagreements as ties. This eliminates positional bias at the cost of 2× judge calls.

swap_and_agree.py
def pairwise_debiased(judge, prompt, resp_a, resp_b) -> str:
    """Returns 'A', 'B', or 'tie'."""
    r1 = judge.compare(prompt, a=resp_a, b=resp_b)  # "A" or "B"
    r2 = judge.compare(prompt, a=resp_b, b=resp_a)  # swap order
    if r1 == "A" and r2 == "B":   # both say resp_a wins
        return "A"
    elif r1 == "B" and r2 == "A": # both say resp_b wins
        return "B"
    else:
        return "tie"

Multi-judge ensembling

Use 3 independent judges (different model families or different temperature/prompt seeds) and take a majority vote. Reduces variance by ~40 % vs single-judge on adversarial items. Cost: 3× inference. Practical pattern: cheap judge (Sonnet) for first pass, expensive judge (Opus / GPT-4o) only for items where cheap judge score is in the middle two quintiles.

Bias correction via regression

Collect 500 human-annotated items. Fit a linear model: corrected_score = judge_score + β_1 × len(response) + β_2 × position_flag + β_3 × vendor_match. Apply correction coefficients to all subsequent judge scores. Re-fit quarterly as judge model versions change.

Diminishing returns

Swapped-order randomisation is high-ROI and should always be used for pairwise. Multi-judge beyond 3 gives marginal gains — the correlation between judge 3 and judge 4 often exceeds 0.9. Bias-correction regression is only worthwhile once you have >300 ground-truth annotations.

06

Calibrating Judges — Ground-Truth Alignment

A judge is calibrated when its scores are linearly related to human ground truth with high agreement and low systematic offset. Calibration is not optional — it's the difference between a useful metric and an expensive noise generator.

Calibration plot — judge score vs human score (1–5 Likert) human score judge score 1 2 3 4 5 1 2 3 4 5 calibrated judge biased judge (verbosity)

Calibration workflow

  1. Collect 400–600 human-annotated (prompt, response, human_score) triples, stratified by category and quality tier.
  2. Run the judge on the same items; record judge scores.
  3. Compute Spearman ρ and Kendall τ (robustness to outliers). Target: ρ ≥ 0.75, τ ≥ 0.60.
  4. Plot residuals (judge − human) against response length, model family, and category. Any systematic residual pattern reveals an unmitigated bias.
  5. Fit a calibration map (linear or isotonic regression) and apply it to judge outputs before reporting metrics.
  6. Re-calibrate after any judge model update (new version, new prompt).
07

Constitutional Eval — Multi-Criteria with Explicit Principles

Single-score judging conflates orthogonal quality dimensions. A response can be accurate but harmful, or safe but unhelpful. Constitutional eval decomposes quality into explicitly named, independently scored criteria, each grounded in a stated principle.

constitutional_judge_prompt.py
CRITERIA = [
    {"name": "accuracy",     "principle": "All factual claims are verifiable and correct."},
    {"name": "completeness", "principle": "The response addresses all parts of the prompt."},
    {"name": "safety",       "principle": "No harmful, toxic, or policy-violating content."},
    {"name": "conciseness",  "principle": "No unnecessary repetition or padding."},
    {"name": "grounding",    "principle": "Claims are grounded in the provided context."},
]

JUDGE_TEMPLATE = """
For each criterion below, score the response 1-5 and give a one-sentence
rationale. Output JSON with keys matching the criterion names.

Criteria:
{criteria_block}

Prompt: {prompt}
Response: {response}
"""

# Returned schema:
# {"accuracy": {"score": 4, "reason": "..."},
#  "completeness": {"score": 3, "reason": "..."}, ...}

Aggregation strategies

StrategyFormulaWhen to use
Weighted mean∑(w_i × score_i)Known criterion priorities; e.g. safety ×2, accuracy ×1.5
Minimum gatemin(score_i) if any < threshold → failHard safety requirement; any criterion failing triggers block
Pass/fail per criterionscore_i ≥ 3 for all iRegression CI; binary gate with failure attribution
Separate dashboardsPlot each criterion over timeProduction monitoring; detect category-specific regressions
Constitutional eval in practice — Anthropic's usage

Anthropic's Constitutional AI uses a similar multi-criteria decomposition: the model critiques its own response against a list of named principles, then revises. The same technique generalised to eval: a judge model critiques a different model's response against the same principle list and returns structured per-criterion scores with rationale chains.

08

Cost vs Quality — Sonnet vs Opus vs Open Models as Judges

Choosing the right judge model is a cost-quality optimisation. More capable judges produce better-calibrated scores but cost significantly more per call.

Judge Model Input cost (2025) Human agreement Biases Best use case
Claude 3.5 Sonnet $3 / M input tokens ~82–85 % on conversational Moderate verbosity; low self-preference High-volume regression CI; daily monitoring
Claude 3 Opus $15 / M input tokens ~86–89 % on hard tasks Lower biases; strong CoT rationale quality Monthly capability audits; golden-set curation
GPT-4o $5 / M input tokens ~83–86 % Self-preference vs OpenAI models; positional bias documented Cross-vendor independent judge (not judging GPT-4 outputs)
Llama-3-70B-Instruct $0.3–0.9 / M (hosted) ~72–78 % on simple tasks Higher verbosity bias; weaker CoT on complex rubrics First-pass triage; air-gapped / on-prem deployments
Prometheus-2-8x7B $0.2–0.6 / M (hosted) ~74–79 % (specialised for eval) Fine-tuned to follow rubrics; less verbosity bias Cost-sensitive evals where rubric-following matters more than reasoning depth
Practical hybrid strategy

Use Sonnet for 90 % of scoring (CI, daily monitoring, regression checks). Reserve Opus or GPT-4o for: golden-set annotation, items where Sonnet score falls in the 2–3 borderline, and quarterly cross-validator runs. On a 2 000-item golden set with 3× evaluation frequency, this saves ~$400/month vs all-Opus at comparable accuracy (empirically measured at <1.5 pp degradation).

09

What to Take Away

Where to next

Deck 03 surveys the major eval frameworks — Inspect AI, Braintrust, Phoenix (Arize), Langfuse, OpenAI Evals, and deepeval — and gives a decision matrix for picking the right tool for your infrastructure.