Feature Clipping for Uncertainty Calibration

Linwei Tao, Minjing Dong, Chang Xu

Abstract

Modern deep neural networks (DNNs) are frequently overconfident, assigning high-probability scores to incorrect predictions. This paper introduces Feature Clipping (FC), a simple yet effective post-hoc calibration method. FC caps feature values at a specific threshold to intentionally increase entropy in high-error samples while preserving information in accurate ones. Our evaluation across standard benchmarks demonstrates that FC consistently improves calibration and is orthogonal to existing output-based methods, achieving state-of-the-art results when combined with other techniques.

Introduction

In safety-critical domains such as autonomous driving and medical diagnosis, a model's confidence must accurately reflect its likelihood of being correct—a property known as calibration. However, modern DNNs are notoriously poorly calibrated, tending toward extreme overconfidence. While existing solutions like Temperature Scaling (TS) adjust final output probabilities, they often treat all samples uniformly. This research identifies a structural cause for miscalibration: samples with High Calibration Error (HCE)—those the model is certain about but gets wrong—tend to exhibit abnormally large feature values and higher variance compared to Low Calibration Error (LCE) samples.

Methodology: Feature Clipping

Feature Clipping (FC) is the first calibration technique to operate on internal features rather than final outputs. The method applies a clipping function to the feature vector $x$ (typically from the penultimate layer):

$$\tilde{x} = \max(\min(x, c), -c)$$

where $c$ is a learnable hyperparameter. The threshold $c$ is optimized by minimizing the Negative Log Likelihood (NLL) on a validation set, similar to the tuning of the temperature parameter in TS.

The underlying logic is that HCE samples, which possess larger feature values, suffer a greater loss of information when clipped. This targeted information loss increases entropy in the final Softmax layer, effectively reducing overconfidence in potentially erroneous predictions.

Analysis of Feature Distributions

The motivation for FC stems from the discovery of the "Thick Tail" in feature distributions. By analyzing histograms of feature values, the authors observed that HCE samples have significantly higher variance and larger magnitudes than LCE samples.

Distribution of feature values for samples with High Calibration Error (HCE) vs Low Calibration Error (LCE).

This observation suggests that overconfidence is physically encoded in feature magnitudes. By strategically "damaging" these features through clipping, the model is forced to produce more humble probability estimates for high-variance samples. Theoretical analysis using truncated normal distributions confirms that clipping increases entropy more significantly for HCE samples than for LCE ones.

Experimental Results

The researchers evaluated FC across CIFAR-10, CIFAR-100, and ImageNet-1K using various architectures, including ResNets, DenseNets, and MobileNet-V2.

Comparison of Expected Calibration Error (ECE) across various datasets and models, showing the benefit of adding Feature Clipping (+ours) to existing methods.

Key findings include:

  • Superior Calibration: FC consistently outperforms standard Temperature Scaling. For instance, on CIFAR-100 with ResNet-50, the Expected Calibration Error (ECE) dropped from 17.52% to 3.98% with FC, compared to 5.72% with TS.
  • Orthogonality: Since FC modifies features, it can be combined with output-based methods like Group Calibration (GC) or Ensemble Temperature Scaling (ETS) to achieve state-of-the-art results.
  • Accuracy Preservation: As a post-hoc method, FC maintains or slightly improves top-1 accuracy, avoiding the performance degradation sometimes seen with training-time regularization.
  • Architectural Nuances: The impact is more pronounced in CNNs (which use ReLU and have more "runaway" features) than in Vision Transformers, though both benefit from the approach.

Conclusion

Feature Clipping offers a computationally efficient and effective way to calibrate DNNs by addressing the root cause of overconfidence in the feature space. While currently using a global threshold, future work could explore adaptive, per-sample thresholds based on feature statistics. Its simplicity and compatibility with existing methods make it a robust choice for improving model reliability in production environments.

Summary updated

BibTeX
@inproceedings{tao2025feature,
  author = {Linwei Tao and Minjing Dong and Chang Xu},
  title = {{Feature Clipping for Uncertainty Calibration}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i19.34297},
}
Figure