Text Smoothing: Enhance Various Data Augmentation Methods on Text Classification Tasks

Xing Wu, Chaochen Gao, Meng Lin, Liangjun Zang, Songlin Hu

Abstract

Before entering the neural network, a token needs to be converted to its one-hot representation, which is a discrete distribution of the vocabulary. Smoothed representation is the probability of candidate tokens obtained from the pre-trained masked language model, which can be seen as a more informative augmented substitution to the one-hot representation. We propose an efficient data augmentation method, dub as text smoothing, by converting a sentence from its one-hot representation to controllable smoothed representation. We evaluate text smoothing on different datasets in a low-resource regime. Experimental results show that text smoothing outperforms various mainstream data augmentation methods by a substantial margin. Moreover, text smoothing can be combined with these data augmentation methods to achieve better performance.

Introduction

Deep learning models are notoriously "data-hungry," often overfitting in low-resource scenarios where labeled data is scarce. While data augmentation is a standard solution in computer vision, text presents a unique challenge due to its discrete nature. Traditional methods like Easy Data Augmentation (EDA) or Back-Translation can inadvertently alter meaning or break syntax. Even advanced contextual augmentation methods that use models like BERT typically select a single replacement token, resulting in a "one-hot" representation that discards valuable semantic information about other contextually compatible words.

The authors propose Text Smoothing, a technique that replaces discrete word representations with continuous probability distributions. This approach captures the semantic neighborhood of a word, providing a denser and more informative input for neural networks.

Methodology

Text Smoothing is a two-stage process designed to create a controllable, context-rich representation of text:

  1. Generating Smoothed Representations: Instead of standard masking, the entire sentence is passed through a pre-trained Masked Language Model (MLM) with dropout enabled. The output logits are processed via softmax to produce a probability distribution over the entire vocabulary for each token position. This "smoothed" vector represents a weighted set of candidate words that are contextually appropriate.
  2. The Mixup Strategy: To prevent semantic drift—such as the MLM predicting an antonym—the original one-hot vector ($t_i$) is blended with the MLM's smoothed distribution ($MLM(t_i)$) using an interpolation hyperparameter $\lambda$: $$\tilde{t}_i = \lambda \cdot t_i + (1 - \lambda) \cdot MLM(t_i)$$ This ensures the original token remains dominant while incorporating information from its semantic neighbors.
The Text Smoothing process: from one-hot representation to a mixed representation using an MLM.

After interpolation, the resulting vector is multiplied by the word embedding matrix to create a smoothed embedding for training the downstream task model.

Experimental Setup

The method was evaluated in a low-resource regime, using only 10 examples per class for training and development across three benchmark datasets:

  • SST-2: Binary sentiment classification of movie reviews.
  • SNIPS: Intent classification for voice assistants.
  • TREC: Question-type classification (6 categories).

Results and Discussion

Text Smoothing demonstrates significant improvements over baseline methods. As a standalone augmentation technique, it outperformed various mainstream methods, including CBERT and BARTspan, by an average of 1.17%.

Comparison of Text Smoothing against various data augmentation baselines across three datasets.

Key Insights

  • Information Density: Unlike sparse one-hot vectors, smoothed representations are dense, capturing nuances like the relationship between "average," "good," and "poor."
  • Efficiency: Text Smoothing generates augmented representations for an entire sentence in a single forward pass, avoiding the need for multiple sampling iterations.
  • The "Plug-in" Effect: Text Smoothing is highly complementary. When applied to the outputs of other methods like EDA, it improved average accuracy by 5.98%, suggesting it can enhance a wide variety of existing augmentation pipelines.
  • Controllability: The $\lambda$ parameter allows for precise control over the augmentation strength, mitigating the risk of semantic drift.

Conclusion and Future Work

Text Smoothing offers a robust and efficient way to augment text data by leveraging the rich semantic knowledge within pre-trained MLMs. While it introduces some computational overhead by requiring a Transformer pass during training, its performance gains in low-resource settings are substantial. Future research could explore its application to sequence-to-sequence tasks like summarization or translation, as well as its performance when using domain-specific MLMs.

Summary updated

BibTeX
@inproceedings{wu2022text,
  author = {Xing Wu and Chaochen Gao and Meng Lin and Liangjun Zang and Songlin Hu},
  title = {{Text Smoothing: Enhance Various Data Augmentation Methods on Text Classification Tasks}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2022},
  url = {https://openreview.net/forum?id=oOENcFKw9Q},
}
Figure