You have a labeled dataset and a nagging question: how many of these labels are wrong? You do not need to re-label everything to find out. A small, well-designed audit gives a reliable estimate of the error rate, with an honest confidence interval, in an afternoon of expert time. This post shows how to size the audit, how to compute the interval correctly, and how to break the result down by class.

Step 1: Draw a random sample

The audit only works if the sample is random. Do not audit the items you already suspect, and do not audit only the most recent batch. Draw uniformly from the whole dataset, or stratify by class if some classes are rare (more on that below).

import random def draw_audit_sample(item_ids, n, seed=7): rng = random.Random(seed) return rng.sample(list(item_ids), n) 

Fix the seed and save the list. If someone later asks how the audit was done, you can reproduce it exactly.

Step 2: Have an expert re-label blind

The auditor should label each sampled item without seeing the original label. If they see it, they will agree with it more often than they should, and your error estimate will be too low. After blind labeling, compare and send disagreements to a second expert for adjudication. Only adjudicated disagreements count as errors.

Step 3: Compute the error rate with a proper interval

With 400 audited items and 18 confirmed errors, the point estimate is 4.5%. The question is how sure you are. The simple normal approximation behaves badly when error rates are small, so use the Wilson score interval instead.

import math def wilson_interval(errors, n, z=1.96): if n == 0: return (0.0, 1.0) p = errors / n denom = 1 + z**2 / n centre = (p + z**2 / (2 * n)) / denom half = z * math.sqrt(p * (1 - p) / n + z**2 / (4 * n**2)) / denom return (max(0.0, centre - half), min(1.0, centre + half)) low, high = wilson_interval(18, 400) print(f"error rate 4.5%, 95% CI {low:.1%} to {high:.1%}") # error rate 4.5%, 95% CI 2.9% to 7.0% 

That interval, roughly 3% to 7%, is what you report. It is much more useful than a single number, because it tells stakeholders how precise the audit is.

Step 4: Size the audit before you start

If you want the interval to be no wider than plus or minus 2 percentage points, you can work out the sample size in advance from a rough guess of the error rate.

def audit_size(expected_error=0.05, margin=0.02, z=1.96): return math.ceil(z**2 * expected_error * (1 - expected_error) / margin**2) print(audit_size()) # 457 print(audit_size(0.10)) # 865 print(audit_size(0.05, 0.03)) # 203 

A tighter margin costs a lot more. Going from plus or minus 3 points to plus or minus 2 points more than doubles the audit.

Step 5: Break it down by class

Overall error rate hides the classes that matter. Report errors per class, each with its own interval.

from collections import Counter def per_class_errors(original, audited): totals, errors = Counter(), Counter() for orig, truth in zip(original, audited): totals[truth] += 1 if orig != truth: errors[truth] += 1 return {c: (errors[c], totals[c], wilson_interval(errors[c], totals[c])) for c in totals} 

You will often find that a few classes carry most of the errors, usually lookalike pairs or classes with vague guideline definitions. Small classes will have wide intervals because few of them land in a random sample. If they matter, run a stratified audit that samples more from those classes, and weight the results back to the true class proportions when reporting the overall rate.

What to do with the result

  • Under about 2%: usually fine for training. Focus on the test set, where errors distort your metrics directly.
  • Between 2% and 10%: look at the per-class breakdown. Fix the guideline for the worst classes and re-label those classes only.
  • Above 10%: the labeling process needs work, not just the data. Check guideline clarity, annotator training and review coverage.

Running this audit at a regular cadence, for example every major batch, turns label quality from a guess into a tracked number. Annotation platforms such as Taskmonk can route a percentage of work to review as part of the workflow setup, which makes ongoing audits easier to run without building the plumbing yourself.