The Role of n-gram Smoothing in the Age of Neural Networks

Luca Malagutti, Andrius Buinovskij, Anej Svete, Clara Meister, Afra Amini, Ryan Cotterell

Abstract

Classical n-gram smoothing techniques, once foundational to Natural Language Processing, were largely sidelined by the advent of neural language models. This paper re-evaluates their utility, proving that modern label smoothing is a special case of classical add-$\lambda$ smoothing. We introduce a generalized framework that converts any n-gram smoothing method into a neural regularizer. Our experiments on WikiText-2 and IWSLT-14 demonstrate that sophisticated smoothers like Jelinek-Mercer significantly outperform standard label smoothing, reducing perplexity from 142.10 to 137.41 and improving BLEU scores.

Introduction

Before the dominance of deep learning, n-gram models faced the "curse of dimensionality," where unseen word sequences resulted in zero-probability estimates. To mitigate this, researchers developed smoothing techniques to redistribute probability mass from seen to unseen events. While modern neural networks handle context more effectively, they still rely on heuristics like label smoothing to prevent overconfidence. This work bridges the gap by asking if the statistically grounded logic of classical smoothing can enhance modern neural architectures.

Methods

The authors establish a formal link between the two eras by proving that label smoothing is mathematically equivalent to add-$\lambda$ smoothing. Building on this, they propose a generalized framework to transform any n-gram smoothing technique into an additive regularizer.

The generalized framework treats smoothing as a map from a noisy empirical distribution to a cleaner one, used to guide neural training.

The framework decomposes the difference between a raw empirical distribution ($p_D$) and a smoothed distribution ($\tilde{p}_D$) into two components: $p_+$, where probability is added, and $p_-$, where it is removed. By incorporating these as KL-divergence terms into the maximum-likelihood objective, the neural network is trained to mimic sophisticated smoothers like Jelinek-Mercer (JM), Katz, or Kneser-Ney (KEN).

Results

The proposed n-gram regularizers were evaluated on WikiText-2 for language modeling and IWSLT-14 for machine translation.

Language modeling results on WikiText-2 showing perplexity (ppl) across different smoothing methods.

As shown in the table above, the Jelinek-Mercer (JM) regularizer achieved a perplexity of 137.41, a substantial improvement over the unregularized baseline (147.12) and standard label smoothing (142.10). Similar gains were observed in machine translation, where JM reached 33.67 BLEU compared to the 33.23 achieved by label smoothing. Across tasks, more complex smoothers consistently provided statistically significant improvements over simpler approaches.

Discussion and Future Work

While these results are compelling, challenges remain regarding scale and computational overhead. Pre-computing n-gram counts adds a processing step, and the current study primarily utilized bigrams to manage space complexity. Future research could explore more efficient data structures for higher-order n-grams and evaluate performance on massive datasets and morphologically diverse languages.

Conclusion

This research demonstrates that "old school" statistical methods still hold valuable insights for modern deep learning. By reframing n-gram smoothing as a form of neural regularization, we can move beyond blunt heuristics like label smoothing toward more nuanced, data-driven regularization strategies.

Summary updated

BibTeX
@inproceedings{malagutti2024role,
  author = {Luca Malagutti and Andrius Buinovskij and Anej Svete and Clara Meister and Afra Amini and Ryan Cotterell},
  title = {{The Role of n-gram Smoothing in the Age of Neural Networks}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2024},
  url = {https://openreview.net/forum?id=YDwLL4rE8W},
}
Figure