Abstract
Reliable uncertainty quantification is a first step towards building explainable, transparent, and accountable artificial intelligent systems. Recent progress in Bayesian deep learning has made such quantification realizable. In this paper, we propose novel methods to study the benefits of characterizing model and data uncertainties for natural language processing (NLP) tasks. With empirical experiments on sentiment analysis, named entity recognition, and language modeling using convolutional and recurrent neural network models, we show that explicitly modeling uncertainties is not only necessary to measure output confidence levels, but also useful at enhancing model performances in various NLP tasks.
Introduction
Deep learning models in NLP are often overconfident "black boxes" that fail to account for their own ignorance. This research demonstrates that by mathematically separating and quantifying model uncertainty (epistemic) and data uncertainty (aleatoric), we can build more transparent systems and significantly boost performance across sentiment analysis, named entity recognition (NER), and language modeling.
Most modern NLP models provide a single "best guess" without indicating confidence. This is problematic for AI safety and reliability. The authors identify two distinct types of uncertainty that these models usually ignore:
- Model (Epistemic) Uncertainty: This arises from our lack of knowledge about which model parameters best describe the data. If we had infinite data, this uncertainty would vanish.
- Data (Aleatoric) Uncertainty: This is the noise inherent in the data itself. In NLP, language is naturally ambiguous (e.g., a Yelp review that just says "good" could correspond to a 3, 4, or 5-star rating). No amount of extra data will "solve" this ambiguity; the model must simply learn to recognize it.
Methodology
The authors leverage the law of total variance to decompose the variance of a prediction into model and data components.
- Quantifying Model Uncertainty: They use Monte Carlo (MC) Dropout. Instead of using dropout only during training, they keep it active during inference. By running the same input through the network multiple times with different dropout masks, they create an "ensemble" effect. The variance across these multiple passes represents the model's uncertainty.
- Quantifying Data Uncertainty: They modify the network to output two values for every input: a predicted mean ($\mu$) and a predicted variance ($\sigma^2$). They use a "learned loss attenuation" function. Essentially, the model is allowed to "excuse" itself from a high error if it also predicts a high variance for that specific input, but it is penalized by a regularization term to prevent it from simply predicting high variance for everything.
- Adapting to Classification: While variance is natural for regression, it's trickier for classification. The authors propose sampling in the logit space (the layer before the softmax) to estimate uncertainty before converting those values into probabilities.
Key Results and Insights
Perhaps the most surprising finding is that explicitly modeling uncertainty isn't just a "safety feature"—it actually makes the models more accurate. By accounting for noise, the model becomes more robust.
- Sentiment Analysis: In the regression setting, the "Baseline + both uncertainties" model reduced Mean Squared Error (MSE) by 13.5% to 26.4% across different datasets compared to a standard CNN.
- Named Entity Recognition: Modeling data uncertainty improved the F1 score on the CoNLL 2003 dataset by 2.7% (as seen in the table above).
- Language Modeling: Quantifying both uncertainties improved Perplexity (PPL) on the Penn Treebank by 4.2%.
- Linguistic Ambiguity: The model successfully identifies "difficult" tokens. In NER, a word like "Hong" has high data uncertainty because it could be part of a location (Hong Kong), an organization, or a person's name. In contrast, a word like "defended" has low uncertainty because it almost always carries the same label.
Conclusion
The authors note that while model uncertainty (via MC Dropout) provided the biggest gains in sentiment analysis, data uncertainty was more impactful for NER. This suggests that the "best" type of uncertainty to model is highly task-dependent.
A primary limitation is the computational overhead: MC Dropout requires multiple forward passes for every single prediction, which might be too slow for real-time applications. Future work could explore more efficient ways to approximate these Bayesian distributions or investigate how to better utilize these uncertainty scores for "active learning."
Summary updated