Calibrating Structured Output Predictors for Natural Language Processing

Abhyuday Jagannatha, Hong YuACL 2020

Introduction

Modern deep learning models for Natural Language Processing (NLP), such as BERT, are frequently "overconfident" in their predictions. While a model might assign a 99% probability to a specific output, that output is not necessarily correct 99% of the time. In high-stakes domains like healthcare or finance, this misalignment between confidence and accuracy is a significant barrier to deployment.

This paper addresses the challenge of structured prediction calibration. In tasks like Named Entity Recognition (NER) or Part-of-Speech (POS) tagging, the number of possible output sequences grows exponentially with length, making standard calibration techniques computationally infeasible. Furthermore, users often prioritize the accuracy of specific extracted entities rather than the entire sequence.

Methodology

The researchers introduce a general framework for calibrating confidence scores by shifting focus from full sequences to specific "entities of interest." The approach consists of three primary stages:

  1. Defining Entities of Interest: The system targets specific spans or labels (e.g., a medication name in a clinical note) rather than the whole sentence.
  2. The Forecaster Model: A secondary Gradient Boosted Decision Tree is trained to act as a "forecaster," refining uncalibrated model outputs into reliable confidence scores.
  3. Feature Engineering: The forecaster utilizes high-signal features including model uncertainty (via MC-Dropout), the rank of the prediction among the top-$k$ candidates, and task-specific metrics like entity length or language model perplexity.
  4. Uncertainty-Aware Decoding: These calibrated scores are used to re-rank the top-$k$ predictions. If a lower-ranked guess has a significantly higher calibrated confidence, the system can switch its final answer to improve accuracy.

Key Insights

Entity-Level Calibration

By narrowing the scope to specific entities, the researchers bypass the "output space explosion" of structured prediction. This makes calibration both mathematically tractable and more aligned with human utility.

Reliability diagrams illustrating the alignment of accuracy and model confidence for calibrated vs. uncalibrated models on EMRQA and MADE datasets.

The Power of Rank

The discrete rank of a prediction (e.g., being the 1st vs. 2nd best guess) serves as a powerful signal for the calibrator. Even when raw probability differences are negligible, the rank helps the model distinguish between likely and unlikely outcomes.

Key Results

The proposed method was evaluated across diverse benchmarks, including POS tagging (Penn Treebank), NER (CoNLL 2003, MADE 1.0), and QA (SQuAD 1.1, EMRQA).

  • Massive Calibration Gains: Across all tasks, the Expected Calibration Error (ECE) saw dramatic reductions. For instance, in POS tagging with BERT, ECE dropped from an uncalibrated 35.11% to just 1.81%.
  • Performance Gains via Re-ranking: Calibration isn't just a post-processing step; it improves model performance. In the MADE 1.0 NER task, F1-scores increased from 84.01 to 84.34 simply by using better-calibrated scores for re-ranking.
  • Robustness to Domain Shift: When tested on out-of-domain (OOD) data, the calibrated models remained significantly more reliable than uncalibrated baselines, which tended to become wildly overconfident on unfamiliar text.
Expected Calibration Error (ECE) results for POS tagging, comparing various calibration methods across BERT, BERT+CRF, and DistilBERT architectures.

Conclusion and Future Work

While the framework significantly improves calibration and accuracy, it does face a "sharpness loss" in OOD scenarios, where the model becomes more cautious. Future research may explore integrating aleatoric uncertainty (data noise) alongside epistemic uncertainty to further refine these predictive scores. Overall, this work provides a scalable path toward building more trustworthy and self-aware NLP systems.

Summary updated

BibTeX
@inproceedings{jagannatha2020calibrating,
  author = {Abhyuday Jagannatha and Hong Yu},
  title = {{Calibrating Structured Output Predictors for Natural Language Processing}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2020},
  doi = {10.18653/v1/2020.acl-main.188},
}
Figure