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.
| Cell | Meaning | Used in precision |
|---|---|---|
| True positive (TP) | Predicted positive, actually positive | Numerator and denominator |
| False positive (FP) | Predicted positive, actually negative | Denominator only |
| False negative (FN) | Predicted negative, actually positive | Not used |
| True negative (TN) | Predicted negative, actually negative | Not used |
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, recall and related metrics
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.
| Metric | Formula | Question answered | Main blind spot |
|---|---|---|---|
| Precision | TP / (TP + FP) | How reliable are positive predictions | Ignores missed positives |
| Recall | TP / (TP + FN) | How many positives were found | Ignores false alarms |
| F1 score | 2PR / (P + R) | Balance of both | Hides which side is weak |
| Accuracy | (TP + TN) / all | Share of all correct predictions | Misleading on imbalanced data |
| Specificity | TN / (TN + FP) | How well negatives are rejected | Ignores positive class quality |
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 setting | Effect on precision | Effect on recall | Typical use |
|---|---|---|---|
| High, such as 0.9 | Usually higher | Lower | Automated actions with costly errors |
| Medium, such as 0.5 | Moderate | Moderate | Default balanced operation |
| Low, such as 0.2 | Usually lower | Higher | Screening followed by human review |
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.
| Variant | How it is computed | When to use |
|---|---|---|
| Macro precision | Mean of per-class precision | Every class matters equally |
| Micro precision | Pooled TP and FP across classes | Frequent classes dominate by design |
| Weighted precision | Per-class mean weighted by support | Reflect class frequencies |
| Precision at k | Relevant items among top k results | Search, retrieval and recommendation |
| Average precision | Area under precision-recall curve | Ranking quality across thresholds |
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.