Improving Uncertainty Quantification of Deep Classifiers via Neighborhood Conformal Prediction: Novel Algorithm and Theoretical Analysis

Subhankar Ghosh, Taha Belkhouja, Yan Yan, Janardhan Rao Doppa

Introduction

Deep neural networks (DNNs) have achieved remarkable success in classification and regression tasks, yet they are notoriously prone to overconfidence. In high-stakes environments such as medical diagnosis or autonomous navigation, a point prediction is often insufficient; practitioners require a measure of uncertainty. Conformal Prediction (CP) has emerged as a rigorous mathematical framework to address this, providing prediction sets that are guaranteed to contain the ground truth with a user-specified probability (e.g., 90%).

However, traditional CP methods typically employ a "one-size-fits-all" global threshold calculated across an entire calibration dataset. This approach is often inefficient, resulting in prediction sets that are unnecessarily large for "easy" inputs and potentially less informative for "hard" ones. This paper introduces Neighborhood Conformal Prediction (NCP), a novel algorithm designed to shrink these prediction sets by localizing the uncertainty quantification process within the model's feature space.

The Neighborhood Conformal Prediction (NCP) Framework

The core innovation of NCP lies in its transition from global to local thresholds. Instead of treating every calibration example as equally relevant to a new test point, NCP identifies the $k$-nearest neighbors of the test input within the model's internal representation space—specifically the feature layer immediately preceding the final classification head.

NCP functions as a versatile "wrapper" that can be applied to existing CP scoring functions (such as APS or RAPS). The algorithm follows a four-step pipeline:

  1. Feature Extraction: The method utilizes the learned representations ($\Phi(x)$) of a pre-trained deep model, leveraging the work the model has already done to cluster similar data points.
  2. Local Weighting: For any new test input, the system identifies the $k$ most similar examples from the calibration set.
  3. Importance Assignment: Higher weights are assigned to neighbors that are closer to the test input in the feature space, creating a localized context for uncertainty.
  4. Localized Quantile Calculation: Rather than a global quantile, NCP calculates a threshold specific to that local neighborhood to determine the prediction set boundaries.

Theoretical Foundations

The researchers provide a theoretical basis for why localizing thresholds improves efficiency. They demonstrate that if a model's feature space satisfies two key properties—separation (different classes are distinct) and concentration (similar instances are tightly clustered)—NCP is mathematically guaranteed to produce smaller, more precise prediction sets than standard CP while maintaining the required coverage guarantees. This suggests that the better a model learns to represent data, the more NCP can optimize its uncertainty estimates.

Experimental Evaluation and Results

The efficacy of NCP was tested across a wide range of benchmarks, including CIFAR-10, CIFAR-100, and ImageNet for classification, as well as eleven UCI datasets for regression. The study utilized diverse architectures, including ResNet, DenseNet, and Inception.

Key Findings in Classification

On the ImageNet dataset using a ResNet152 architecture, the impact of NCP was significant:

  • Standard CP: Produced an average prediction set size of 10.55.
  • RAPS (State-of-the-art): Reduced the size to 2.53.
  • NCP + RAPS: Further compressed the set size to 2.12.

This reduction represents a meaningful gain in precision without any loss in the 90% coverage guarantee, demonstrating that NCP effectively "squeezes" more information out of the pre-trained model.

Key Findings in Regression

In regression tasks, the benefits were even more pronounced. For the BlogFeedback dataset, the interval length (the range of predicted values) was reduced from 44.79 using standard CP to 18.97 using the NCP wrapper. This indicates that localizing the threshold allows the model to be much more specific about its predictions in regions of the input space where it is more certain.

Limitations and Future Directions

While NCP offers a powerful upgrade to uncertainty quantification, its performance is intrinsically linked to the quality of the model's learned representations. If a model has not learned to cluster data effectively, the $k$-nearest neighbor approach may yield diminishing returns. Additionally, the method introduces hyperparameters such as the number of neighbors ($k$) and the localization parameter ($\lambda_L$), which currently require a validation set for optimal tuning.

Future research may focus on automating the selection of these parameters or integrating the localization objective directly into the model's training phase to further refine the efficiency of the resulting prediction sets.

Conclusion

Neighborhood Conformal Prediction represents a significant step forward in making deep learning models safer and more practical for real-world deployment. By recognizing that uncertainty is not uniform across the input space, NCP provides a scalable, model-agnostic way to generate tighter, more reliable prediction sets, effectively turning a model's internal features into a high-resolution map of its own confidence.

Summary updated

BibTeX
@inproceedings{ghosh2023improving,
  author = {Subhankar Ghosh and Taha Belkhouja and Yan Yan and Janardhan Rao Doppa},
  title = {{Improving Uncertainty Quantification of Deep Classifiers via Neighborhood Conformal Prediction: Novel Algorithm and Theoretical Analysis}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.1609/aaai.v37i6.25936},
}
Figure