Recall, precision, and baselines: how to read a model's score

In the previous post, a model with 99.90% accuracy caught no defects at all. This post picks up the next question: what should you measure instead, and when can you trust the number? At first the terms were unfamiliar enough that I could barely solve the practice questions, so I went through them one at a time and tried again. I also wrote down what I missed along the way. It covers classification metrics, regression error, baselines, benchmarks, and LLM grading. It does not cover the math behind the metrics or library code.

Before we start: terms

TermOne-line meaning
FN, False Negative (a miss)A defective unit passed as good
FP, False Positive (a false alarm)A good unit flagged as defective
Recall (also Sensitivity)Of the real defects, the share that was caught
PrecisionOf the alarms, the share that were real defects
AccuracyOf everything, the share that was right
ThresholdThe score above which the model raises an alarm
BaselineThe score you get by always giving the same answer, with nothing learned
F1 scoreRecall and precision combined into one number, pulled toward the lower of the two
MAE, Mean Absolute ErrorHow far off a numeric prediction is, on average
RMSE, Root Mean Squared ErrorLike MAE, but large misses are penalized more heavily
FPR, False Positive RateOf the good units, the share that got an alarm
ROC curve, AUCThe curve of FPR against recall as the threshold moves, and the area under it
PR curveThe curve of recall against precision as the threshold moves
Benchmark contaminationTest questions that were already in the model's training data
LLM-as-a-judgeUsing an LLM to grade another LLM's answers

1. Misses and false alarms

A defect-inspection model has four possible outcomes.

Actually defectiveActually good
Flagged as defectiveTP: caught correctlyFP: false alarm
Passed as goodFN: missedTN: passed correctly

There are only two ways to be wrong: a miss (FN), where a defect gets through, and a false alarm (FP), where a good unit gets flagged.

Reading the abbreviations as two letters keeps them straight.

  • The second letter, P or N, is what the model said. P (Positive) means "defective," N (Negative) means "good."
  • The first letter, T or F, is whether it was right.
  • So FN means "said good, and was wrong," which is a miss.

Which mistake costs more depends on the situation. If defective chips ship to a customer, a miss costs more. If every alarm stops the line, a false alarm costs more.

2. Recall and precision

The two metrics differ in what goes in the denominator.

MetricDenominatorFormulaQuestion it answers
RecallAll real defectsTP ÷ (TP + FN)How many of the real defects were caught?
PrecisionAll alarmsTP ÷ (TP + FP)How many of the alarms were real?

Say 15 of 20 defective chips were caught, and the alarm went off 30 times in total.

  • Recall = 15 ÷ 20 = 75%
  • Precision = 15 ÷ 30 = 50%

They are easiest to remember as pairs: recall goes with misses, precision goes with false alarms. Fewer misses raise recall, and fewer false alarms raise precision. So when misses are expensive, look at recall first; when false alarms are expensive, look at precision first. Cancer screening, where missing a patient is not acceptable, is a recall case.

In medicine, recall is often called sensitivity. It is the same metric.

3. Threshold

On the question of what to do when no threshold can meet two conditions at once (recall of at least 95%, and no more than 50 false alarms a day), I answered "maybe just hit the recall target?" It is one option, but it was not enough of an answer.

A model usually outputs a score, such as "defect score 0.73," and raises an alarm when the score passes a threshold that a person sets.

ThresholdAlarmsRecallPrecision
LowerMoreGoes upGoes down
HigherFewerGoes downGoes up

So raising one of recall and precision lowers the other. If people complain about too many false alarms, you raise the threshold and accept lower recall in return.

If no threshold meets both conditions, the threshold cannot solve the problem. In an example model that inspects 100,000 chips a day (100 of them defective), setting recall to 95% produces 2,273 false alarms a day. Hitting the recall target alone still breaks the false-alarm condition, and on the floor people end up ignoring the alarms. There are two things you can do.

  • Improve the model. Add data or features so the scores of good and defective chips overlap less.
  • Renegotiate the conditions. Bring the numbers to the people on the floor: "At 95% recall we get about 2,300 false alarms a day. If we cut false alarms to 50, recall drops. Which matters more?"

Which side to give up is a decision with costs attached, so it is better not to make it alone.

4. Baseline

On the question of whether a model with 97% accuracy is good, when 30 out of 1,000 customers cancel, I said "no" and gave the reason as "because the baseline is unclear." As the metric to use instead of accuracy, I picked precision. Both answers were a little off.

A baseline is the score of a model that learns nothing and always gives the same answer. Picture a model that looks at no customer data and tells every customer "you won't cancel."

ActualCountModel's answerResult
Doesn't cancel970Won't cancelRight
Cancels30Won't cancelWrong

It gets 970 out of 1,000 right, so its accuracy is 97%, without looking at anything. So if a carefully built model also has 97% accuracy, accuracy alone cannot tell you whether it learned anything. The right reason is not "the baseline is unclear" but "the baseline is already 97%."

The metric to check first is recall, because the point of the model is to find customers who will cancel. The model above finds none of the 30, so its recall is 0%, and that shows immediately. Its precision cannot even be computed, because it never flags anyone. So check recall first, then precision to see how many wrong customers get flagged.

When the task is finding the rare case, such as defects, cancellations, disease, or fraud, do not trust accuracy; start with recall. For numeric prediction, a baseline can be "tomorrow's value equals today's," and rules already used on the floor, such as SPC control limits, also serve as baselines.

5. F1

F1 combines recall and precision into one number. It uses the harmonic mean rather than the plain average, so it is pulled toward the lower of the two.

ModelRecallPrecisionPlain averageF1
A. Flags almost every chip100%1%50.5%about 2%
B. Flags a reasonable number80%70%75%about 75%

Model A is unusable because nearly every alarm is false, yet its plain average is over 50. Its F1 of 2% makes that obvious. A high F1 requires both recall and precision to be high.

6. MAE and RMSE

I wondered why anyone uses MAE if it is less sensitive to large errors than RMSE. On the practice questions, I also picked MAE as the metric for a situation where false alarms had to come down, and got it wrong.

First, the two kinds of metrics belong to different kinds of problems.

Problem typeExampleMetrics
Choosing one of two (classification)Defective or notRecall, precision, accuracy, F1
Predicting a number (regression)Film thickness, tomorrow's temperatureMAE, RMSE

Whether to raise an alarm is a classification problem, so MAE does not apply.

A model that predicts numbers is measured by how far off it is. Suppose the errors over five days were 1, 1, 1, 1, 10.

  • MAE is the average error: (1 + 1 + 1 + 1 + 10) ÷ 5 = 2.8
  • RMSE squares the errors, averages them, and takes the square root. Squaring leaves 1 as 1 but turns 10 into 100, so large errors weigh much more. The result is about 4.56.

When a single large miss is a serious problem, for example when a large thickness error means scrapping the wafer, look at RMSE. There are three reasons to use MAE.

  • It is easy to explain. "Off by 2.8 nm on average" is understood right away.
  • One odd value moves it less. If a sensor fault slips in one garbage value, RMSE gets pulled hard by it.
  • It matches costs that grow in proportion to the error. If every unit of inventory you miss costs the same, a plain average like MAE matches the real cost.

In practice you look at both, and a big gap between them signals that the model occasionally misses by a lot.

7. ROC and PR curves

To read an ROC curve you first need the false positive rate. It is easy to confuse with precision, so here they are side by side.

MetricDenominatorQuestion it answers
PrecisionAll alarmsWhen the alarm went off, was it a real defect?
False positive rateAll good unitsWas a good unit flagged for no reason?

An ROC curve plots the false positive rate on the horizontal axis and recall on the vertical axis as the threshold changes. The closer it hugs the top-left corner (every defect caught, no false alarms), the better the model; the diagonal is the level of raising alarms at random. AUC is the area under the curve: 1 is perfect and 0.5 is random.

TEXT
recall
100% |  *-------------    <- good model: hugs the top left
     | /            .
     |/          .
     |        .           <- random: the diagonal
     |     .
  0% |.______________
     0%            100%  false positive rate

The trouble comes when the thing you are looking for is rare. Take an example model looking at 100,000 chips, 100 of them defective, with the threshold at 0.50. It catches 89 of the 100 defects (89% recall) and raises an alarm on 620 of the 99,900 good chips.

MetricCalculationValue
False positive rate620 ÷ 99,900 good chips0.62%
Precision89 ÷ 709 alarms12.6%

The same 620 false alarms come out under 1% as a false positive rate, because the denominator is 99,900 good chips. So the ROC curve hugs the top left, and this model's AUC comes out at 0.995, close to perfect. By precision, though, nine out of ten alarms are false.

That is why, when finding the rare case, you also look at the PR curve (recall horizontal, precision vertical). Precision shows the number of false alarms directly. If an ROC-AUC of 0.98 comes out on data where fraud is 0.01% of transactions, the right call is not to declare the model bad, but to hold judgment until you have checked precision and the PR curve.

The example model's score distributions were made up for explanation: good-chip scores are normally distributed around 0.25 and defective-chip scores around 0.65.

8. Small evaluation sets

With few test cases, chance has a big effect on the score. If model A gets 41 of 50 cases right and model B gets 43, the difference is two cases. A slightly different set of cases could reverse it, so it is hard to say B is better. With 1,000 cases, 820 against 900 is a different story.

When the difference is small, add more cases, or evaluate several times on different cases and see whether the same model wins each time. LLMs give different answers to the same input, so run each case several times and look at the pass rate. If a prompt change moved the pass count from 15 to 16 out of 20, the right report is "it is too early to say it is better," followed by a larger evaluation.

9. Benchmark contamination

A benchmark is a public test set built so that AI models can be compared on the same questions. Contamination is when those questions were already in a model's training data. Public questions spread across the internet, and LLMs are pretrained on internet text, so a model may have seen both the questions and the answers. It is the leakage from the previous post, at benchmark scale.

If the score drops sharply on new questions of the same type, or on the same questions with the numbers changed, suspect contamination. A model that scores 95 on a public benchmark and 50 on the same problems with different numbers is the typical case.

There is one more reason not to take benchmark scores at face value: the test is not about your work. If you are choosing a model to analyze your own equipment logs, first build an evaluation set from those logs, pairing inputs with expected answers, then have every candidate model take the same set and compare. Because the set is not public, it also avoids contamination.

10. LLM-as-a-judge

On the question where showing A then B made A win, and showing B then A made B win, I got the name right: position bias. But I missed how to read that result. On the practice questions, I also picked "switch to a bigger judge model" as the fix for position bias, and got it wrong.

For outputs without a single right answer, such as summaries or reports, an LLM is sometimes given a rubric and asked to grade. It is fast and cheap, but it has known biases, catalogued in the MT-Bench paper (Zheng et al., 2023).

BiasWhat happensResponse
Position biasWhen comparing two answers, it favors the one in a particular position regardless of contentGrade twice with the order swapped
Verbosity biasIt favors longer, more detailed answersState in the rubric that length does not count
Self-enhancement biasIt favors answers written by the same model as itselfUse a different model as the judge, or compare against human grading

If swapping the order flips the result, the judge picked by position, not by content. So the result tells you nothing about which answer is better. Treat it as a tie or withhold judgment, and trust a result only when the same answer wins in both orders.

Switching to a bigger judge model does not fix this. The same paper reports position bias even in the strongest models it tested. Bias is handled by changing how the grading is done.

Before relying on LLM grading, have people grade a sample and check how closely the LLM's scores agree. If people were going to re-grade everything, there would be no point in using an LLM, so a sample is enough. If agreement is low, do not use that judge.

Choosing a metric: practice

1. If a defective chip ships to a customer, the cost of a product recall is very high. Which metric should you protect first?

Answer

Recall. Misses (FN) are the most expensive mistake here, so protect the share of real defects that get caught.

2. Every alarm stops the line and an engineer has to inspect the wafer. When cutting false alarms is urgent, which metric do you watch?

Answer

Precision. False alarms (FP) are expensive, so watch the share of alarms that are real defects. This is a classification problem, so MAE does not apply.

3. On data with a 0.05% defect rate, ROC-AUC comes out at 0.99. What is the right conclusion?

Answer

You cannot judge yet without checking precision and the PR curve. The false positive rate's denominator is all good units, so ROC tends to look good when the target is rare.

4. In film-thickness prediction, a large miss means scrapping the wafer. Which metric weighs large errors more?

Answer

RMSE. It squares errors before averaging, so one large error moves it a lot.

5. A new defect classifier has 95% accuracy. What do you check first?

Answer

The accuracy of the baseline that calls everything good. With a 5% defect rate, that baseline is also 95%.

6. On 50 test cases, prompt v1 passes 41 and v2 passes 43. What is the right conclusion?

Answer

The difference is small, so add more cases or run several times and see whether the result holds in the same direction.

7. A model that scored 90 on a public benchmark scores 60 on newly written questions of the same type. What do you suspect first?

Answer

Benchmark contamination. A sharp drop on unseen questions is its signal.

8. Comparing two answers with an LLM judge, the answer shown first keeps winning regardless of content. What is the right response?

Answer

Grade twice with the order swapped, and trust the result only when the same answer wins both times. Also check a sample against human grading.

To sum up

  • Classification metrics are computed from four cells: misses (FN), false alarms (FP), TP, and TN.
  • Recall divides by the real defects, precision divides by the alarms. Recall goes with misses, precision with false alarms.
  • Moving the threshold trades recall against precision. If you cannot meet both targets, improve the model or bring the numbers to the people on the floor and renegotiate.
  • When the target is rare, the baseline is already high, so accuracy cannot tell you much. Start with recall.
  • F1 is pulled toward the lower of recall and precision.
  • Numeric predictions are measured with MAE and RMSE. RMSE is sensitive to large errors; MAE is easier to explain and less moved by odd values.
  • When the target is rare, ROC-AUC can look better than the model really is, so look at precision and the PR curve too.
  • With a small evaluation set, a small difference may be chance.
  • Public benchmarks can be contaminated and are not about your work, so you need an evaluation set built from your own data.
  • LLM judges have position, verbosity, and self-enhancement biases, so grade twice with the order swapped and compare a sample against human grading.