Skip to content
AI.info

Natural language processing

Error Analysis, Calibration, and Abstention

Turn NLP failures into an improvement plan through error taxonomies, confidence analysis, selective prediction, coverage trade-offs, and human review.

By the end you can

Example

Two identical metric drops can require opposite fixes

Suppose an entity extractor loses five F1 points after it is deployed. The number is one number. The six candidates below are six different repairs, and the metric cannot say which one it is describing.

The annotation mechanism alone can produce a drop of exactly this size. That has been measured. In 2019 Geva and colleagues held the amount of training data fixed and changed one thing: whether the test examples came from annotators the model had already seen during training. On OpenBookQA, across all five annotator sets, “performance drops by up to 23 accuracy points”. The same experiment cost “up to 10 accuracy points in COMMONSENSEQA and 5 in MNLI”. No model weight changed. No preprocessing changed. No vocabulary changed. Only who had written the sentences. Their conclusion is plain: “This shows that the model does not generalize to examples generated by unseen annotators.”

Five points on MNLI is the drop this section opens with, and its cause was a property of the labour pool. A team that read that number as a modelling failure would have retrained a model that was never broken.

  • New vocabulary: product names introduced after training are missed.
  • Annotation drift: reviewers changed whether version numbers belong inside spans — the mechanism Geva and colleagues priced at up to 23 accuracy points on OpenBookQA and about 5 on MNLI, with the model held constant.
  • Preprocessing defect: a normalization update shifted character offsets.
  • Domain shift: traffic moved from formal reports to short mobile messages.
  • Workflow change: documents are now truncated before the entity-rich appendix.
  • Threshold change: a new confidence rule suppresses borderline but correct predictions.

Visual

A layered error taxonomy

Classifying failures by mechanism prevents indiscriminate retraining. The layers below are not a filing cabinet for blame; they are the list of things that can be true at the moment the score falls.

The hardest pair to separate is data and annotation from representation and model. A shortcut sitting in the data looks, from the outside, exactly like competence in the model. Gururangan and colleagues measured that gap in 2018. Natural language inference asks whether a premise entails a hypothesis, so a system shown only the hypothesis should be guessing. Theirs was not: “Specifically, we show that a simple text categorization model can correctly classify the hypothesis alone in about 67% of SNLI (Bowman et. al, 2015) and 53% of MultiNLI (Williams et. al, 2017).”

Two thirds of one benchmark is reachable without the input the task is defined around. The reported score was partly a record of how the data was collected, not of inference ability. Every aggregate metric reports that as model performance. A bigger model, retrained, preserves it faithfully.

FigureLayers · 5 layers
  1. 01

    Input and preprocessing

    Encoding, normalization, tokenization, truncation, metadata, or parsing failures.

  2. 02

    Data and annotation

    Coverage gaps, inconsistent guidelines, missing labels, contamination, or outdated examples.

  3. 03

    Representation and model

    Vocabulary, capacity, objective, shortcut, or generalization failures.

  4. 04

    Decision policy

    Threshold, calibration, hierarchy, abstention, or conflict-resolution failures.

  5. 05

    Workflow and user interaction

    Bad routing, unsupported automation, unclear interface, or failed recovery.

Confidence is a property of a system under conditions

A classifier is calibrated when predictions assigned a confidence near 0.8 are correct about 80 percent of the time for comparable cases; calibration can differ by class, domain, language, document length, and time.

A ranking score, cosine similarity, or generative token probability is not automatically a calibrated probability of task correctness. Calibration requires an explicit target and held-out evidence.

This property is not inherited from accuracy. Guo and colleagues showed that in 2017: “Modern neural networks, unlike those from a decade ago, are poorly calibrated”. They trace the drift to “depth, width, weight decay, and Batch Normalization”. The repair turned out to be unexpectedly cheap. On most datasets temperature scaling, “a single-parameter variant of Platt Scaling”, is “surprisingly effective at calibrating predictions”. A model can become more accurate and less honest about its own confidence in the same training run.

The phrase “under conditions” is the load-bearing one, and Desai and Durrett put a measurement on it in 2020. They evaluated BERT and RoBERTa on natural language inference, paraphrase detection and commonsense reasoning, in-domain and out-of-domain. The same weights were well behaved in one setting and not the other: “when used out-of-the-box, pre-trained models are calibrated in-domain, and compared to baselines, their calibration error out-of-domain can be as much as 3.5x lower”. The repair is condition-specific too. Temperature scaling is what works in-domain; label smoothing is what works out-of-domain. So a calibration report describes a model and a condition jointly. Carried across the boundary it was measured on, it is a claim about a setting the team never tested.

A numeric score becomes confidence only after empirical validation for a defined event.

Comparison

Signals that look similar but mean different things

Combining them requires care and validation — and all of them move in the same direction when conditions do.

Under dataset shift, no method keeps its uncertainty honest. That was the finding of the first large-scale comparison of predictive uncertainty under shift, run in 2019 by Ovadia and colleagues across image, text-adjacent and tabular tasks. Their Section 5, “Takeaways and Recommendations”, states it without qualification: “Along with accuracy, the quality of uncertainty consistently degrades with increasing dataset shift regardless of method.”

Post-hoc calibration is the clearest casualty, and the paper says exactly how it fails: “while temperature scaling achieves low ECE for low values of shift, the ECE increases significantly as the shift increases, which indicates that calibration on the i.i.d. validation dataset does not guarantee calibration under distributional shift”. A temperature fitted on a held-out split from the same distribution is a repair for the condition it was fitted in. It is not a durable property.

What held up best was disagreement between independently trained models — “Deep ensembles seem to perform the best across most metrics and be more robust to dataset shift” — with roughly five members capturing most of the gain. The signal in the comparison below that costs the most compute is the one that survives the move.

FigureComparison · 4 columns

Predictive probability

A model output intended to estimate a label probability.

  • May need post-hoc calibration
  • Sensitive to prevalence
  • Class-specific behavior
  • Defined for a target event

Margin or entropy

Measures separation or dispersion among model scores.

  • Useful ranking signal
  • Not inherently calibrated
  • Can flag ambiguity
  • Affected by output space

Ensemble disagreement

Compares several models or stochastic passes.

  • Can expose model uncertainty
  • Costs more compute
  • Members may share blind spots
  • Needs task validation

Out-of-distribution score

Estimates atypicality relative to training evidence.

  • May detect novel inputs
  • Novel does not mean wrong
  • Thresholds drift
  • Representation-dependent

Analogy

A weather forecast with a cancellation policy

A forecast reports rain probability, and an event organizer cancels only when expected loss exceeds a threshold. The probability and decision rule are related but distinct.

Rain is observed as it falls, while the NLP event behind a label is observed less clearly. Labels can be ambiguous, delayed, or selectively recorded.

Calibration estimates reliability; abstention policy converts reliability into action.

Key idea

Abstention improves accepted quality by reducing coverage

A system can defer low-confidence cases to a person or safer fallback; raising the threshold often improves precision among accepted cases while leaving more work unresolved.

Evaluate the entire risk–coverage curve rather than one convenient threshold; manual-review capacity, queue delay, and reviewer accuracy determine whether abstention helps the product.

That trade can carry a guarantee. Geifman and El-Yaniv attached one in 2017. They build a selective classifier on top of an already-trained network. It “allows a user to set a desired risk level”, and at test time it “rejects instances as needed, to grant the desired risk (with high probability)”. Their headline case reports the shape of the curve rather than a point on it: “an unprecedented 2% error in top-5 ImageNet classification can be guaranteed with probability 99.9%, and almost 60% test coverage”. Two percent error was bought by handing roughly two fifths of the work back.

Which score you abstain on is itself worth coverage. Kamath and colleagues measured how much in 2020. They trained a question-answering model on SQuAD, tested it on mixtures of SQuAD and five other QA datasets, and compared two abstention rules against one fixed quality bar: “Our method answers 56% of questions while maintaining 80% accuracy; in contrast, directly using the model's probabilities only answers 48% at 80% accuracy.” Same model, same 80% accuracy target, eight points more of the traffic answered. The entire difference is a trained calibrator that predicts whether the model errs, in place of the raw softmax number the model already emits. The threshold is only half the policy. The quantity you threshold on is the other half.

Selective prediction trades automated coverage for lower risk on accepted cases.

Steps

Conduct an error-analysis sprint

The output should be a prioritized set of hypotheses and experiments.

FigureProcess · 5 steps
  1. 1. Sample by consequence and uncertainty

    Include frequent, severe, confident-wrong, abstained, and novel cases.

  2. 2. Label the failure mechanism

    Use a shared taxonomy and allow multiple contributing causes.

  3. 3. Quantify each cluster

    Estimate frequency, severity, affected slices, and review effort.

  4. 4. Propose the smallest discriminating fix

    Choose data, policy, preprocessing, model, threshold, or interface changes.

  5. 5. Create regression evidence

    Add fixed tests and a refreshed representative evaluation slice.

The largest error cluster is not always the first priority

A rare unsupported medical instruction may deserve more attention than a common punctuation error; conversely, a severe-looking one-off example may not justify a broad model change.

Prioritize expected harm, frequency, confidence, detectability, fix cost, and possible regression; product owners and domain experts should participate in the decision.

Error analysis is resource allocation under uncertainty, not a contest for the most interesting mistake.

Plot a risk–coverage curve for a classifier

Sort validation predictions by confidence. Then compute error rate as lower-confidence cases are deferred. Repeat by class and one important user slice.

Estimate human-review workload and correction accuracy at several thresholds. The best operating point may differ across labels.

What it costs to skip that estimate is on the record. Wong and colleagues published an external validation of the proprietary Epic Sepsis Model in JAMA Internal Medicine in 2021. They ran it over 38,455 hospitalizations at Michigan Medicine, of which 2,552 (7%) involved sepsis. Hospitalization-level AUC was 0.63 (95% CI, 0.62–0.64). At the alert threshold of 6, the operating point reads: “The ESM also did not identify 1709 patients with sepsis (67%) despite generating alerts for an ESM score of 6 or higher for 6971 of all 38 455 hospitalized patients (18%), thus creating a large burden of alert fatigue.”

Read that as a point on a risk–coverage curve nobody plotted. Nearly one admission in five generated review work. Two thirds of the patients the tool existed to find were missed anyway. That is the workload of a low threshold with the misses of a high one. The authors' conclusion is one sentence: “This external validation cohort study suggests that the ESM has poor discrimination and calibration in predicting the onset of sepsis.”

An independent team reached the same place three years later. Writing in JAMIA Open in 2024, they ran the model over 145,885 emergency-department encounters at two county hospitals and reported, in a 6-hour window, “a sensitivity of 14.7%, specificity of 95.3%, positive predictive value of 7.6%, and negative predictive value of 97.7%”. Their verdict: “The ESPMv1 provides suboptimal diagnostic characteristics for undifferentiated patients in a county ED.” Every one of these numbers was available before deployment, from a validation set and a curve.

Abstention becomes a product decision only after coverage and review capacity are measured together.

Key takeaways