Writing · AI evaluation

How Many Test Cases Do You Need to Evaluate an LLM Feature?

Robert Morong · 2026-10-23 · Drafted with AI assistance (Claude)

The honest answer is "enough that the confidence interval on your accuracy is narrower than the decision you are trying to make." That sounds abstract, so here are the actual numbers. Everything below is a 95% Wilson interval, computed with the short function in the Wilson interval post.

What a test set of a given size can tell you

Suppose your feature gets 80% of the test cases right. How uncertain is that number?

The interval shrinks with the square root of the sample size, so each extra bit of precision costs more than the last. Going from 100 to 200 cases helps a lot. Going from 500 to 1,000 helps much less.

How many cases for a target precision

If you decide in advance how wide an interval you can live with, you can work out the test set size. These are the case counts needed for the 95% Wilson interval to have a half-width at or under the target, at different true accuracy levels:

Two things stand out. Features that are already very accurate need far fewer cases to pin down, and being precise to within two points is expensive at any accuracy level.

Comparing two prompts or models needs more than you think

Everything above is about measuring one system. Comparing two is harder, because you are trying to detect a difference, and differences are small. If a new prompt moves accuracy from 80% to 84%, a 100-case test set cannot reliably confirm that, because each of the two intervals is about ±8 points wide.

Two things help. First, run both systems on the same cases and use a paired test, which looks only at the cases where the two systems disagree. That removes the noise from cases both get right or both get wrong, and is covered in the prompt regression testing post. Second, decide the smallest difference you would act on before you look at results, and size the test set for that.

Practical rules

The intervals assume cases are independent and that they were not used to tune the prompt. Cases drawn from the same source with near-duplicates will make the true uncertainty larger than the interval suggests.

Run these checks without hand-rolling them

The AI Reliability Test Kit is a Python harness that measures accuracy with Wilson and bootstrap confidence intervals, robustness to rewording and option reordering, run-to-run consistency and calibration, then writes a shareable HTML scorecard with a Ship / Caution / Not-ready verdict. It runs offline with a built-in mock model, or against OpenAI, Anthropic and any OpenAI-compatible or local endpoint.

See what is in the Test Kit Try the free option-order check first

Keep reading