🤖 AI Summary
Deep neural networks frequently suffer from poor prediction calibration in NLP tasks, limiting their deployment in safety-critical applications. To address this, we propose kNN-UE—a novel uncertainty estimation method that jointly models neighbor distance and neighbor label distribution ratio, enabling both efficiency and interpretability. Leveraging approximate nearest neighbor (ANN) indexing, kNN-UE achieves significant computational speedup without compromising calibration accuracy. Extensive experiments across sentiment analysis, natural language inference, and named entity recognition demonstrate that kNN-UE consistently outperforms state-of-the-art baselines—including density-based approaches—with average expected calibration error (ECE) reduced by up to 32%. When integrated with ANN, the method incurs less than 2% performance degradation, confirming its practicality and robustness. To our knowledge, kNN-UE is the first approach to unify distance- and distribution-based cues within a k-nearest neighbors framework for calibrated uncertainty estimation in NLP.
📝 Abstract
Trustworthiness in model predictions is crucial for safety-critical applications in the real world. However, deep neural networks often suffer from the issues of uncertainty estimation, such as miscalibration. In this study, we propose $k$-Nearest Neighbor Uncertainty Estimation ($k$NN-UE), which is a new uncertainty estimation method that uses not only the distances from the neighbors, but also the ratio of labels in the neighbors. Experiments on sentiment analysis, natural language inference, and named entity recognition show that our proposed method outperforms the baselines and recent density-based methods in several calibration and uncertainty metrics. Moreover, our analyses indicate that approximate nearest neighbor search techniques reduce the inference overhead without significantly degrading the uncertainty estimation performance when they are appropriately combined.