Skip to main content
QUICK REVIEW

[Paper Review] Calibrated Language Model Fine-Tuning for In- and Out-of-Distribution Data

Lingkai Kong, Haoming Jiang|arXiv (Cornell University)|Oct 22, 2020
Topic ModelingComputer Science37 references7 citations
TL;DR

This paper proposes a regularized fine-tuning method for pre-trained language models that improves calibration for both in-distribution and out-of-distribution (OOD) data using two novel regularizers: on-manifold regularization via feature-space interpolation to enhance in-distribution smoothness, and off-manifold regularization via large-perturbation samples to reduce OOD overconfidence. The method significantly reduces expected calibration error and improves OOD detection across six datasets.

ABSTRACT

Fine-tuned pre-trained language models can suffer from severe miscalibration for both in-distribution and out-of-distribution (OOD) data due to over-parameterization. To mitigate this issue, we propose a regularized fine-tuning method. Our method introduces two types of regularization for better calibration: (1) On-manifold regularization, which generates pseudo on-manifold samples through interpolation within the data manifold. Augmented training with these pseudo samples imposes a smoothness regularization to improve in-distribution calibration. (2) Off-manifold regularization, which encourages the model to output uniform distributions for pseudo off-manifold samples to address the over-confidence issue for OOD data. Our experiments demonstrate that the proposed method outperforms existing calibration methods for text classification in terms of expectation calibration error, misclassification detection, and OOD detection on six datasets. Our code can be found at https://github.com/Lingkai-Kong/Calibrated-BERT-Fine-Tuning.

Motivation & Objective

  • To address the severe miscalibration of fine-tuned pre-trained language models on both in-distribution and out-of-distribution data.
  • To improve model reliability by ensuring predictive probabilities reflect true likelihoods for in-distribution inputs.
  • To reduce overconfidence in predictions for OOD inputs by encouraging uniform output distributions.
  • To mitigate overfitting and improve generalization through data augmentation-based regularization.
  • To provide a scalable, training-time solution that outperforms post-hoc calibration and Bayesian methods.

Proposed method

  • Introduces on-manifold regularization by generating pseudo-samples through linear interpolation in the hidden feature space of training data.
  • Uses these interpolated samples to impose a smoothness constraint on the model’s decision boundary within the data manifold.
  • Applies off-manifold regularization by generating adversarial-like perturbations far from the data manifold to encourage uniform output probabilities for OOD inputs.
  • Optimizes the model using a joint objective that combines cross-entropy loss with both regularizers to balance in-distribution and OOD calibration.
  • Employs a two-stage optimization process: inner minimax problems to generate robust pseudo-samples, followed by standard fine-tuning with regularized loss.
  • Tunes hyperparameters for both regularizers jointly to ensure complementary effects on calibration performance.

Experimental results

Research questions

  • RQ1Can data augmentation via on-manifold interpolation improve in-distribution calibration of fine-tuned language models?
  • RQ2Can off-manifold regularization effectively reduce overconfidence in predictions for out-of-distribution inputs?
  • RQ3Does combining both regularizers lead to better overall calibration than individual components or baseline methods?
  • RQ4How do the hyperparameters of on- and off-manifold regularizers interact, and is joint tuning necessary?
  • RQ5Can this method achieve state-of-the-art performance in both in-distribution calibration and OOD detection without increasing inference cost?

Key findings

  • The proposed method reduces expected calibration error (ECE) by up to 60% compared to BERT baseline on 20NG 15, from 9.24% to 3.69%.
  • On the 20NG dataset, OOD detection AUC improves from 21.65% (BERT) to 63.92% with both regularizers, demonstrating strong OOD generalization.
  • Removing off-manifold regularization causes a 20.05% drop in OOD AUC (from 63.92% to 43.87%), proving its critical role in OOD calibration.
  • On-manifold regularization alone reduces ECE to 5.00% on 20NG, showing its effectiveness in improving in-distribution calibration.
  • Joint tuning of both regularizers is essential, as ablation shows suboptimal performance when components are removed or tuned independently.
  • The method outperforms existing calibration baselines in both ECE and OOD detection across six diverse text classification datasets.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.