Bag of Tricks for In-Distribution Calibration of Pretrained Transformers

Jaeyoung Kim, Dongbin Na, Sungchul Choi, Sungbin Lim · DOI

TL;DR

Pretrained language models (PLMs) often exhibit overconfidence in their predictions, hindering their reliable deployment. This paper proposes "CALL," a novel combination of calibration techniques (confidence penalty losses, data augmentation, and ensemble methods) that significantly improves both the calibration and accuracy of PLMs, especially in low-resource settings.

What Problem Does This Paper Address?

Modern deep neural networks, including powerful pretrained language models (PLMs) like BERT and RoBERTa, have revolutionized NLP tasks. However, a persistent issue is their tendency to be "overconfident" – they assign high probabilities to their predictions even when those predictions are incorrect. This mismatch between confidence and correctness, known as miscalibration, is a significant barrier to trusting these models in real-world applications. While various calibration techniques exist, most have been evaluated primarily in computer vision. This paper investigates the effectiveness of these techniques specifically for PLMs in text classification, particularly in data-scarce scenarios where miscalibration is amplified.

Methods

The authors explore three main categories of calibration techniques:

  • Confidence Penalty Losses: These are alternative loss functions that penalize overly confident predictions. The paper examines Brier Loss (BL) and Entropy Regularized Loss (ERL), and also considers Label Smoothing (LS) as a regularization technique.
  • Data Augmentations: Techniques that generate synthetic training data to expose models to more diverse patterns. They evaluate methods like Synonym Replacement (SR), Easy Data Augmentation (EDA), and a variant of MixUp (MixUp-CLS).
  • Ensemble Methods: Combining multiple models to improve robustness and calibration. They investigate Deep Ensemble (DE), Monte Carlo Dropout (MCDrop), and Multi-Input Multi-Output (MIMO).

The core contribution is the proposed Calibrated PLM (CALL), a hybrid approach that combines the most effective techniques from these categories. CALL aims to leverage the strengths of each method while mitigating their individual weaknesses.

Datasets

The paper uses three standard text classification datasets:

  • TREC: A dataset for question classification.
  • Stanford Sentiment Treebank (SST2): A sentiment analysis dataset for movie reviews.
  • 20 Newsgroups (20NG): A topic categorization dataset with 20 categories.

Experiments are conducted in both full-data and low-resource (10% of training data) settings.

Key Insights and Ideas

  • Trade-offs Exist: Confidence penalty losses, while improving calibration, can sometimes lead to a slight decrease in classification accuracy.
  • Ensemble Diversity is Key (and Fragile): Ensemble methods generally improve calibration, but their effectiveness can degrade if ensemble members overfit to the training data, leading to reduced predictive diversity.
  • Data Augmentation's Role: Text-specific data augmentations like EDA and MixUp are more effective for calibrating PLMs than simpler methods like SR. These augmentations help models learn more robust representations and better match the distribution of unseen data.
  • Synergy is Powerful: The proposed CALL framework, by combining confidence penalty losses (BL+ERL), data augmentation (MixUp), and ensemble methods (DE or MIMO), effectively complements the weaknesses of individual techniques. For instance, data augmentation and ensembles help offset accuracy drops from penalty losses, while penalty losses and augmentation counteract ensemble overfitting.

Key Results

  • In the low-resource regime (10% data), ensemble methods like DE and MIMO showed significant improvements in calibration (lower ECE and NLL) compared to the baseline.
  • For the full-data setting, BL+ERL demonstrated the best calibration performance, particularly in terms of NLL.
  • The proposed CALL framework (specifically CALLDE and CALLMIMO) consistently achieved strong results, outperforming individual methods and baselines across various metrics and datasets. For example, CALLDE achieved the best NLL on SST2 and 20NG in the full-data setting.
  • The paper provides detailed tables showing accuracy, ECE, and NLL for numerous combinations of techniques, highlighting the best performers for each metric and dataset.

Limitations and Future Work

  • ID Calibration Focus: The current work focuses on in-distribution (ID) calibration. The authors acknowledge that whether CALL performs well for out-of-distribution (OOD) detection and generalization tasks remains an open question.
  • Room for Improvement: While CALL shows significant improvements, the authors suggest that more diverse approaches might further enhance performance, pointing to existing literature on advanced calibration techniques.
  • Future Research: The paper leaves the exploration of CALL's effectiveness in OOD settings and the investigation of more advanced calibration methods for future work.

Summary updated

BibTeX
@inproceedings{kim2023bag,
  author = {Jaeyoung Kim and Dongbin Na and Sungchul Choi and Sungbin Lim},
  title = {{Bag of Tricks for In-Distribution Calibration of Pretrained Transformers}},
  booktitle = {EACL (Findings)},
  year = {2023},
  doi = {10.18653/v1/2023.findings-eacl.40},
}
Figure