Learning label smoothing for text classification

Han Ren, Yajie Zhao, Yong Zhang, Wei SunPeerJ Comput. Sci 2024 · DOI

TL;DR

This paper introduces Discrimination-Aware Label Smoothing (DALS), a novel approach to improve text classification by adaptively learning soft labels during training. DALS leverages both correctly and incorrectly classified samples to create more informative soft labels, leading to better model generalization and robustness compared to traditional label smoothing.

What Problem Does This Paper Address?

Deep learning models, especially in natural language processing, are prone to overfitting due to their complexity and the often limited size and noisy nature of training data. Label smoothing (LS) is a regularization technique that helps mitigate overfitting by softening the one-hot encoded target labels. However, standard LS applies a uniform distribution to all non-target classes, ignoring potential semantic relationships between them. This can lead to suboptimal regularization, especially when some classes are semantically closer to others. The paper aims to address this by developing a more nuanced label smoothing method that considers inter-class relationships.

Methods

The core contribution is Discrimination-Aware Label Smoothing (DALS). Unlike traditional LS, which uses a fixed uniform distribution for non-target labels, DALS dynamically learns these distributions. The process involves:

  • Iterative Soft Label Generation: DALS generates soft labels for the current training epoch based on the model's predictions from the previous epoch.
  • Leveraging True and False Positives: The method distinguishes between true positive samples (correctly predicted) and false positive samples (incorrectly predicted but with high confidence for a wrong class). It uses these to inform the soft label distribution.
  • Adaptive Smoothing: The soft label distribution for a given sample is influenced by the model's predictions on both true positive and false positive samples, aiming to create a more discriminative and semantically aware target.
  • Balancing Hard and Soft Labels: A hyperparameter alpha controls the trade-off between the original hard labels and the newly generated soft labels, allowing for fine-tuning the regularization strength.
  • Plug-and-Play: DALS can be integrated into existing models without requiring architectural changes, making it broadly applicable.

Datasets

The paper evaluates DALS on five benchmark text classification datasets:

  • 20-Newsgroups (20NG): A collection of approximately 20,000 newsgroup documents.
  • R8 and R52: Subsets of the Reuters 21,578 dataset, containing 8 and 52 categories, respectively.
  • Ohsumed: A corpus of medical literature abstracts, with 23 classes.
  • MR (Movie Review): A sentiment analysis dataset consisting of short movie reviews, with binary classification (positive/negative).

Key Insights and Ideas

  • Beyond Uniform Smoothing: The key insight is that not all "wrong" labels are equally wrong. DALS recognizes that classes semantically similar to the true class should receive higher probabilities in the soft label distribution than distant classes.
  • Learning from Mistakes: By incorporating information from false positive predictions, DALS learns from the model's errors in a structured way, guiding it towards better decision boundaries.
  • Robustness to Corrupted Labels: The experiments demonstrate that DALS not only improves performance on clean data but also makes models more robust to noisy or mislabeled training data.
  • Improved Calibration: DALS contributes to better model calibration, meaning the predicted probabilities more accurately reflect the true likelihood of correctness.

Key Results

  • Accuracy Improvements: DALS, when used with the BertGCN backbone, achieved higher classification accuracy than several baseline models on the tested datasets. Specifically, it showed average accuracy increases of 5% on Ohsumed and 2% on 20NG and R52 compared to models without DALS.
  • Competitive Performance: Even on the MR dataset, which has only two opposing labels and limited label correlation, DALS maintained competitive results.
  • Reduced Impact of Corrupted Labels: Figures 2 and 3 show that as the proportion of corrupted labels increases, DALS-enhanced models generally experience a smaller drop in accuracy compared to their non-DALS counterparts.
  • Lower Expected Calibration Error (ECE): Table 5 indicates that DALS achieved lower ECE values than standard Cross-Entropy (CE) and other label smoothing methods, signifying better-calibrated predictions.

Limitations and Future Work

  • Sparse Data: The authors acknowledge that DALS might not yield significant improvements on classification tasks with very sparse data, where data fitting might be more critical than generalization.
  • Dataset-Dependent Hyperparameters: The optimal settings for hyperparameters like alpha and lambda can vary across datasets, requiring careful tuning for each specific application.
  • Future Work: The authors plan to integrate DALS into machine learning pipelines for various downstream tasks to explore its effectiveness in measuring decision thresholds and improving performance in more complex scenarios.

Summary updated

BibTeX
@article{ren2024learning,
  author = {Han Ren and Yajie Zhao and Yong Zhang and Wei Sun},
  title = {{Learning label smoothing for text classification}},
  journal = {PeerJ Comput. Sci.},
  year = {2024},
  doi = {10.7717/peerj-cs.2005},
}
Figure