Logit-based ensemble distribution distillation for robust autoregressive sequence uncertainties

Yassir Fathullah, Guoxuan Xia, Mark J. F. Gales

Abstract

Efficiently and reliably estimating uncertainty is an important objective in deep learning. It is especially pertinent to autoregressive sequence tasks, where training and inference costs are typically very high. However, existing research has predominantly focused on tasks with static data such as image classification. In this work, we investigate Ensemble Distribution Distillation (EDD) applied to large-scale natural language sequence-to-sequence data. EDD aims to compress the superior uncertainty performance of an expensive (teacher) ensemble into a cheaper (student) single model. Importantly, the ability to separate knowledge (epistemic) and data (aleatoric) uncertainty is retained. Existing probability-space approaches to EDD, however, are difficult to scale to large vocabularies. We show, for modern transformer architectures on large-scale translation tasks, that modelling the ensemble logits, instead of softmax probabilities, leads to significantly better students. Moreover, the students surprisingly even outperform Deep Ensembles by up to $\sim$10% AUROC on out-of-distribution detection, whilst matching them at in-distribution translation.

Introduction

Deep learning models are often "overconfident" even when they are wrong. In high-stakes tasks like machine translation, we want models to signal when they are unsure so a human can step in. Deep Ensembles (running multiple models and averaging them) are the gold standard for this, as they can distinguish between "data uncertainty" (noise in the input) and "knowledge uncertainty" (the model hasn't seen this type of data before).

However, ensembles are computationally expensive—running five "Big Transformers" takes five times the memory and time. Ensemble Distribution Distillation (EDD) tries to "distill" that ensemble wisdom into one model. The problem? Existing EDD methods operate in "probability space" (using Dirichlet distributions), which breaks down when you have large vocabularies (30k+ words). They suffer from optimization issues where the model ignores important high-probability words and obsesses over rare ones, making them nearly impossible to train for modern NLP.

The Failure of Probability-Space Distillation

Existing probability-space approaches, such as those using Dirichlet distributions, struggle with the high-dimensional output spaces of modern transformers. On toy 2D tasks, these methods can produce confidence surfaces with significant artifacts in out-of-distribution regions, leading to unreliable uncertainty estimates.

Confidence surface of the Dirichlet-based EDD, showing artifacts in out-of-distribution regions.

Logit-based Ensemble Distribution Distillation (L-EDD)

The authors propose moving the distillation process from probability space to logit space. Instead of the student model trying to match the final softmax probabilities of the ensemble, it is trained to predict the parameters of a diagonal Laplace distribution that describes the ensemble's logits.

  • The "What": The student outputs a mean ($\mu$) and a scale ($\sigma$) for every word in the vocabulary.
  • The "Why Laplace?": Unlike a standard Gaussian (Normal) distribution, the Laplace distribution has "heavier tails." This makes it more robust to outliers—useful during the early stages of training when the student’s predictions are wild.
  • Efficiency: Because they use a diagonal distribution, the model remains fast and parallelizable, requiring significantly fewer parameters than a full covariance matrix.
Confidence surface of the proposed Laplace-based L-EDD, demonstrating smoother and more robust uncertainty estimation.

To ensure stability, the authors combine this new loss with standard Knowledge Distillation (KD), effectively teaching the model to be accurate and to understand its own variance.

Key Results and Insights

The researchers evaluated their approach on large-scale Machine Translation (MT) tasks using WMT’16 English-German (En-De) and WMT’20 English-Russian (En-Ru).

  • Superior Detection: On the En-De task, L-EDD (Laplace) achieved a ~10% improvement in AUROC for OOD tasks compared to the original Deep Ensembles.
  • No Accuracy Trade-off: The L-EDD student matched the translation quality (measured by BLEU scores) of the teacher ensemble, meaning you get the efficiency of one model with the accuracy of five.
  • Curing "Length Bias": One of the most fascinating findings is that standard ensembles actually get more confident as a sentence gets longer, even if they are translating gibberish. L-EDD shows almost no correlation between sequence length and uncertainty, making it much more robust.

Conclusion

L-EDD represents a major step forward in making uncertainty estimation practical for large-scale sequence models. By modeling logits instead of probabilities, it bypasses the "vanishing gradient" issues found in probability-space distillation and captures the diversity of the ensemble much more effectively. Future work will explore extending this approach to structured covariance matrices and broader tasks like image captioning.

Summary updated

BibTeX
@inproceedings{fathullah2023logit,
  author = {Yassir Fathullah and Guoxuan Xia and Mark J. F. Gales},
  title = {{Logit-based ensemble distribution distillation for robust autoregressive sequence uncertainties}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2023},
  url = {https://openreview.net/forum?id=tAYLlwAMVT},
}
Figure