Precision

On this page 7

Precision is the evaluation metric that measures what fraction of a model’s positive predictions are actually correct. It is calculated as true positives divided by all predicted positives, TP / (TP + FP), and answers the question: when the model says yes, how often is it right?

In model evaluation within artificial intelligence, precision is the standard measure of how costly false alarms are. It is almost always reported alongside recall, because a model can reach high precision simply by making very few positive predictions. In this context the word does not mean numerical precision such as FP16 or BF16, which describes number formats used in training and inference.

How precision is calculated from the confusion matrix

Precision is derived from the confusion matrix, which counts every prediction of a binary classifier in one of four cells. Only the column of predicted positives enters the formula, which is why precision ignores everything the model labeled negative.

CellMeaningUsed in precision
True positive (TP)Predicted positive, actually positiveNumerator and denominator
False positive (FP)Predicted positive, actually negativeDenominator only
False negative (FN)Predicted negative, actually positiveNot used
True negative (TN)Predicted negative, actually negativeNot used
Confusion matrix cells and their role in precision

For example, a spam filter that flags 200 emails, of which 180 are really spam, has a precision of 180 / 200 = 0.90. Precision ranges from 0 to 1 and is undefined when the model predicts no positives at all; evaluation libraries usually report 0 or raise a warning in that case, and the chosen convention should be stated.

Precision and recall describe two different kinds of error. Precision penalizes false positives, while recall, TP / (TP + FN), penalizes missed positives. The F1 score combines them as their harmonic mean, which stays low unless both are reasonably high.

MetricFormulaQuestion answeredMain blind spot
PrecisionTP / (TP + FP)How reliable are positive predictionsIgnores missed positives
RecallTP / (TP + FN)How many positives were foundIgnores false alarms
F1 score2PR / (P + R)Balance of bothHides which side is weak
Accuracy(TP + TN) / allShare of all correct predictionsMisleading on imbalanced data
SpecificityTN / (TN + FP)How well negatives are rejectedIgnores positive class quality
Precision compared with neighboring evaluation metrics

Precision is closely tied to the positive predictive value used in medicine, and the two terms are mathematically identical. Unlike specificity, precision depends on the base rate: the same classifier shows lower precision when positives become rarer in the evaluated population.

Thresholds and the precision-recall trade-off

Most classifiers output a score, and a decision threshold turns it into a label. Raising the threshold usually increases precision and lowers recall, because the model only commits to cases it is most confident about. The precision-recall curve plots this trade-off across all thresholds, and average precision summarizes the area beneath it.

Threshold settingEffect on precisionEffect on recallTypical use
High, such as 0.9Usually higherLowerAutomated actions with costly errors
Medium, such as 0.5ModerateModerateDefault balanced operation
Low, such as 0.2Usually lowerHigherScreening followed by human review
Effect of the decision threshold on precision

The relationship is not strictly monotonic: precision can dip locally as the threshold rises if a few confident predictions are wrong. Thresholds should therefore be chosen on a validation set, not on the final test set, to avoid optimistic estimates.

Precision for multi-class, ranking and generative tasks

Beyond binary classification, precision requires an averaging or cutoff rule that must always be reported with the number.

VariantHow it is computedWhen to use
Macro precisionMean of per-class precisionEvery class matters equally
Micro precisionPooled TP and FP across classesFrequent classes dominate by design
Weighted precisionPer-class mean weighted by supportReflect class frequencies
Precision at kRelevant items among top k resultsSearch, retrieval and recommendation
Average precisionArea under precision-recall curveRanking quality across thresholds
Variants of precision and when each applies

In retrieval for RAG systems, precision at k measures how much of the context passed to the model is relevant. In generative evaluation, related ideas appear as claim-level precision, the share of generated statements that are supported by evidence.

Common mistakes when reporting precision

Precision is easy to compute and easy to misread. The following errors appear frequently in evaluation reports and benchmark comparisons.

A sound report states the exact definition of a positive, the threshold or cutoff used, the averaging method, the size of the evaluation set and the class distribution. With these details, two teams can reproduce the number and compare models on equal terms instead of comparing values computed under different conditions.

  • Reporting precision without recall: a model that predicts one confident positive can reach a precision of 1.0.
  • Comparing across different base rates: precision measured on a balanced test set overstates precision in production where positives are rare.
  • Omitting the averaging method: macro and micro precision can differ greatly on imbalanced data.
  • Tuning the threshold on the test set: this inflates the reported value.
  • Ignoring confidence intervals: with few predicted positives, precision estimates are statistically unstable.

A non-technical view

Precision tells you how often a model is right when it raises its hand. If a smoke detector goes off ten times and there was real smoke eight times, its precision is eight out of ten.

High precision means few false alarms, so people can trust an alert. It says nothing about fires the detector missed, which is why precision is always read together with recall.

A concrete example

A bank uses a model to flag card transactions for automatic blocking. Each wrongly blocked purchase frustrates a legitimate customer, so the fraud team sets a target of at least 0.95 precision for automatic blocks.

On a validation month of transactions, the team finds that a score threshold of 0.92 achieves precision of 0.96 but recall of only 0.40. They therefore add a second review tier: scores between 0.60 and 0.92 trigger a text message asking the customer to confirm the purchase, where lower precision is acceptable.

The two-tier design keeps customer complaints about false blocks low while still catching most fraud. The team recalculates precision every month because the share of fraudulent transactions changes with the season.