Skip to content
CodeKruPro

The accuracy trap at a 5% failure rate

49/99

Module · Judges and guardrails as classifiers

intermediate

about 35 min

What this lesson teaches

The idea

When only 5% of replies fail, a judge that passes everything is 95% accurate and completely useless.

Why a tester cares

For rare failures, what matters is how many failures the judge catches and how many of its flags are real.

Words you will meet

Accuracy:
the share of all verdicts that were right.
Recall:
the share of real failures the judge catches.
Precision:
the share of the judge's flags that are real failures.

What you will do

  1. 1Compute the three metrics
  2. 2Compare the judges
  3. 3Choose per situation
  4. 4Submit
Jump to practice

When only 5% of replies fail, a judge that says "pass" to everything is 95% accurate and useless. Accuracy rewards agreeing with the majority, and in a good product the majority is fine. For rare failures, look at:

  • Recall (the TPR from the last lesson): the share of real failures the judge catches.
  • Precision: of the replies the judge flags, the share that really fail. Low precision means reviewers waste time on false alarms.

Two judges graded the same 400 replies. One looks better on accuracy. Find out which one is actually useful, and when.

Your task

  1. Compute accuracy, precision and recall for both judges.
  2. For three situations, choose the judge you would deploy.

Sign in to practise

The lesson is free to read. A free account lets you talk to the practice bots, run your code and save your score. You will come back to this lesson.

1

Your code

on two_judges.csv

How this is checked: When you submit, your script runs and the server compares what it prints with the right values.

2

Label each one

Which judge would you deploy?

0 of 3 labelled

  1. 1Failures are wrong refund promises; every miss reaches a customer.
  2. 2Failures are cosmetic, and every flag costs an hour of a senior reviewer's time.
  3. 3A new product where about 40% of replies fail. You want the most correct verdicts overall.

How this is checked: Each row has a right label. All 3 must match. This is a harder check: it earns the second 50 points once the core checks pass.

Core checks earn 50 points and the harder checks the other 50. You can submit as many times as you like.

About this lesson

Precision and recall for an LLM judge with rare failures: the accuracy trap

AI Testing for QA EngineersIntermediateJudges and guardrails as classifiers

How it works

When only a small share of replies fail, a judge that passes everything has high accuracy and is useless. Accuracy rewards agreeing with the majority, and in a good product the majority is fine.

For rare failures, two other numbers matter. Recall is the share of real failures the judge catches. Precision is the share of the judge's flags that are real failures; low precision wastes reviewers' time on false alarms. Which matters more depends on what happens after a flag.

About the assignment

Compute accuracy, precision and recall for two judges graded on the same 400 replies, and choose a judge for three situations.

What you will do

  1. Build each judge's confusion matrix from the counts.
  2. Compute the three metrics for both.
  3. For each situation, ask what a miss costs and what a false alarm costs.

Common mistakes

  • Choosing by accuracy

    At a low failure rate, accuracy barely moves whether the judge works or not.

  • Ignoring reviewer time

    A judge that flags too much can drown a review team.

In a real test suite

Teams choose the judge threshold by the cost of each mistake. A safety screen favours recall; a queue sent to busy reviewers favours precision.

It also helps to look at the replies each judge gets wrong. A judge that misses one specific kind of failure every time can sometimes be fixed with a single clause in its rubric, which is cheaper than replacing it.