Abstract
How do we know when the predictions made by a classifier can be trusted? This is a fundamental problem that also has immense practical applicability, especially in safety-critical areas such as medicine and autonomous driving. The de-facto approach of using the classifier's softmax outputs as a proxy for trustworthiness suffers from the over-confidence issue; while the most recent works incur problems such as additional retraining cost and accuracy versus trustworthiness trade-off. In this work, we argue that the trustworthiness of a classifier's prediction for a sample is highly associated with two factors: the sample's neighborhood information and the classifier's output. To combine the best of both worlds, we design a model-agnostic post-hoc approach NeighborAGG to leverage the two essential information via an adaptive neighborhood aggregation. Theoretically, we show that NeighborAGG is a generalized version of a one-hop graph convolutional network, inheriting the powerful modeling ability to capture the varying similarity between samples within each class. We also extend our approach to the closely related task of mislabel detection and provide a theoretical coverage guarantee to bound the false negative. Empirically, extensive experiments on image and tabular benchmarks verify our theory and suggest that NeighborAGG outperforms other methods, achieving state-of-the-art trustworthiness performance.
Introduction
Modern classifiers are notoriously over-confident. Even when a model is wrong, its "softmax" output (the probability it assigns to a class) often remains high, especially near decision boundaries. This is a major hurdle for safety-critical applications like autonomous driving or medical diagnosis, where we need to know exactly when to stop trusting the AI and call in a human expert.
Existing solutions usually fall into two traps: they either require modifying the model architecture and retraining from scratch, which is expensive and can hurt accuracy, or they use rigid, hand-designed rules that fail to capture the complex relationships between different classes.
Methodology: NeighborAgg
The authors introduce NeighborAgg, a model-agnostic framework that treats trustworthiness as a learning problem. It uses two primary sources of information:
- The Classifier’s Output: The raw logits or softmax scores from the pre-trained "base" classifier.
- Neighborhood Information: For a given input, the algorithm finds its $K$-nearest neighbors in the training set for every possible class. It then calculates a similarity score (using a Laplacian kernel) to see how well the input fits into each class's "neighborhood."
Instead of using a fixed formula, NeighborAgg uses a learnable neural network (essentially a generalized one-hop Graph Convolutional Network) to aggregate these features. This allows the system to "learn" when to trust the model's internal logic versus when to trust the surrounding data.
Key Results and Evaluation
The researchers evaluated NeighborAgg across a diverse range of benchmarks, including tabular data (UCI benchmarks like Landsat and Adult) and image data (MNIST, CIFAR-10).
NeighborAgg consistently outperformed state-of-the-art methods like Trust Score and ConfidNet (TCP). On tabular datasets, it achieved an average gain of 7.63% in APM (Average Precision of Misclassification) and a 2% gain in AUC.
Beyond standard classification, the authors extended this to NeighborAgg-CMD, a variant designed to find mislabeled samples in a dataset. In a case study using the QuoraInsincere dataset, the algorithm successfully identified "insincere" questions that were actually sincere, demonstrating its utility for dataset cleaning.
Discussion: The Complementary Effect
The most striking insight is that neighborhood data and model confidence are "complementary." When a sample is near a messy decision boundary, the model's confidence is unreliable, but the neighborhood consensus is often clear. Conversely, if the neighborhood is sparse or noisy, the model's internal logic takes precedence.
Unlike standard graph methods that only look at how similar a point is to its own class, NeighborAgg looks at similarities across all classes. This allows it to capture inter-class relationships (e.g., "this point looks like a '3' but is also dangerously close to the '8' cluster"). Because the aggregation weights are learned, the model is also less sensitive to the choice of $K$ (number of neighbors).
Conclusion
NeighborAgg provides a robust, post-hoc solution for quantifying classifier trustworthiness without the need for retraining. While it requires a clean validation set to train its aggregator, its superior performance in detecting misclassifications and mislabeled data makes it a valuable tool for high-stakes machine learning applications. Future work will look into making these trust scores more explainable and scaling neighbor lookups for massive transformer models.
Summary updated