Sub topic 12
Practical Mitigations and When Each Helps
This chapter assumes you can read Python, have prompted an LLM, and know the earlier chapters' vocabulary: pointwise and pairwise judging, rubrics, and position, verbosity and self-preference bias. Here you will pair each bias with a fix, see what each fix costs, and learn when a fix does nothing.
Mitigations reduce a bias, and you still have to measure it
No mitigation removes a bias completely. Each one lowers a specific error, costs extra calls or effort, and can fail in a specific way. Treat every mitigation as a hypothesis, and check it against human labels (see the previous chapter on human agreement).
The table maps each failure mode to its usual fix.
| Failure mode | Main mitigation | Extra cost | Limit |
|---|---|---|---|
| Position bias | Run both answer orders, call disagreement a tie | 2x calls | Does not fix a judge that is simply weak |
| Verbosity bias | Rubric says to ignore length, compare length-matched answers, audit win rate by length | Little | Length and quality are often truly correlated |
| Self-preference | Use a judge from a different model family, or several judges | 1x to 3x calls | Families can share training data and blind spots |
| Run-to-run variance | Low temperature, repeat and take the median | n times calls | Repeating does not fix a consistent bias |
| Rubric ambiguity | Narrow single-criterion rubric, scored examples | Authoring time | Examples can anchor scores too strongly |
| Unknown accuracy | Human-labeled calibration set | Labeling time | Labels can be noisy or go stale |
Position bias: swap and require agreement
In pairwise judging, many judges lean toward the first or the second answer. The fix is to run each comparison twice with the order swapped. Only count a winner if both runs pick the same answer. The function below does this.
def judge_pair(call_judge, question, a, b):
"""call_judge(question, first, second) returns "first" or "second"."""
r1 = call_judge(question, a, b)
r2 = call_judge(question, b, a)
win1 = "A" if r1 == "first" else "B"
win2 = "B" if r2 == "first" else "A"
return win1 if win1 == win2 else "tie"Treating disagreement as a tie is deliberate. The judge's preference followed the slot and not the content, so it carries no information about quality. Report the tie rate next to the win rate. A tie rate of 40% or more usually means one of three things: the answers really are close, the rubric is vague, or the judge is weak. Compare the tie rate on pairs where humans clearly prefer one answer to separate these cases.
Do not mitigate by always putting your new system in slot B. That bakes the bias into every result.
Verbosity and style bias: constrain, then audit
Judges often prefer longer, more polished, more confident text. Three steps help.
- Write "Ignore length and writing style" into the rubric, and judge one criterion at a time.
- Where you can, compare answers of similar length, or ask the generator for a fixed length.
- Audit the results. Measure how often the longer answer wins.
The audit is cheap and needs no extra judge calls.
def longer_win_rate(results):
"""results: list of (len_a, len_b, winner), winner is "A", "B" or "tie"."""
decided = [(la, lb, w) for la, lb, w in results if w != "tie"]
if not decided:
return None
longer = sum(
(w == "A" and la > lb) or (w == "B" and lb > la)
for la, lb, w in decided
)
return longer / len(decided)
results = [(120, 80, "A"), (60, 200, "B"), (90, 100, "A"), (150, 70, "A"), (50, 55, "tie")]
print(longer_win_rate(results))This prints 0.75. A rate near 0.5 suggests length is not driving verdicts. A rate far above 0.5 is a warning, not proof. If humans also prefer the longer answers, the correlation may be legitimate. Check by comparing the judge with human labels on pairs where the shorter answer is better.
Self-preference: separate the judge from the generator
A judge can favor text that resembles its own output. If the model under test and the judge are the same model, the scores may be inflated.
- Use a judge from a different model family than the system being graded.
- When you compare systems from several vendors, use more than one judge and check whether the rankings agree.
- If only one model is available as judge, say so in your report and weight human spot checks more heavily.
Switching families is not a guarantee. Models trained on similar web data can share preferences. Validate the choice with human labels like any other.
Variance: lower the temperature, then repeat
Setting temperature to 0 makes verdicts more repeatable, but many hosted models are still not fully deterministic. Do not assume identical inputs give identical scores. For pointwise scores on a 1 to 5 scale, sample several times and take the median. Record the spread as well.
import random
import statistics
def repeated_score(call_judge, prompt, n=5):
scores = [call_judge(prompt) for _ in range(n)]
return statistics.median(scores), max(scores) - min(scores)
def fake_judge(prompt, _rng=random.Random(1)):
return _rng.choice([3, 4, 4, 4, 5])
median, spread = repeated_score(fake_judge, "demo prompt")
print(median, spread)Items with a large spread are the ones the judge is unsure about. Route them to human review instead of averaging the uncertainty away. Repetition fixes noise only. If the judge is consistently wrong about an item, five runs give the same wrong answer five times.
Rubric and prompt fixes
Many "biases" are really vague rubrics. These changes cost little.
- Judge one criterion per call. A single prompt that asks for correctness, tone and completeness at once produces blurry scores.
- Define every score level in words, as in "1 = contradicts the context; 3 = partly supported; 5 = fully supported".
- Ask for a short reasoning field before the score, and parse the output as structured JSON. Reject out-of-range or malformed verdicts instead of repairing them silently.
- If you add scored examples to the prompt, vary them and keep them balanced across levels. A single example at score 4 pulls many verdicts toward 4.
The calibration set ties everything together
Every mitigation above is checked against a calibration set. This is a modest collection, often 50 to 200 items, labeled by humans with the same rubric. After each change to the judge, rerun it on this set and compute raw agreement and Cohen's kappa. A fix helps only if agreement improves, or stays the same while cost drops.
Keep the calibration set separate from any examples you put in the judge prompt. If the same items appear in both, the agreement number is inflated.
Choosing mitigations
Do not stack everything by default. Each layer multiplies cost: swapping doubles calls, three repeats triple them, and two judges double them again. A pairwise comparison with swapping, three repeats and two judges makes 12 calls per item. Start from the failure you actually observed.
Common mistakes
- Swapping order but breaking the label mapping. In
judge_pair, the second run's "first" refers to answer B, which is whywin2is "B" whenr2 == "first". - Reporting a median of repeated runs without the spread, which hides unstable items.
- Using a different family as judge and assuming the self-preference problem is solved, without checking agreement.
- Adding mitigations after seeing a disappointing score and keeping only those that raise it. Decide the procedure before you look at the system under test.
What to remember
Match the fix to the symptom: order swaps for position bias, rubric limits and length audits for verbosity, a different judge family for self-preference, and repetition for variance. Confirm each fix on human-labeled data. Spend extra calls only where they reduce an error you have seen.
Exercise
A pairwise judge run in both orders gives these results over 10 pairs: it picks the same answer in both orders for 6 pairs, and it picks whichever answer is shown first for the other 4. What is the tie rate, and what does a result like this suggest you should do next?
Show answer
The tie rate is 4/10 = 40%, because the 4 order-dependent pairs count as ties. This points to strong position bias or answers that are hard to tell apart. Next, check the judge on pairs where humans clearly prefer one answer. If it still flips there, make the rubric more specific or use a stronger judge. If it flips only on close pairs, the ties are probably legitimate.
Exercise
You run longer_win_rate and get 0.82 on 100 decided pairs. A colleague says the judge has verbosity bias. What additional check would tell you whether they are right?
Show answer
Compare the judge with human labels on the pairs where the shorter answer is the better one, or on length-matched pairs. If humans also prefer the longer answer on most pairs, the 0.82 may reflect real quality differences. If the judge picks the longer answer much more often than humans do, verbosity bias is likely, and you should tighten the rubric or control for length.