TL;DR
Researchers have introduced Feature Clipping (FC), a simple yet remarkably effective post-hoc method to fix overconfident neural networks. By capping abnormally high feature values at a specific threshold, the method selectively increases uncertainty for samples likely to have high calibration errors while preserving the accuracy of well-behaved predictions.
What Problem Does This Paper Address?
Modern deep neural networks (DNNs) are notoriously overconfident. While they might achieve 95% accuracy, their internal "confidence" scores often hover near 100%, even when they are wrong. This lack of model calibration—where predicted probabilities don't reflect actual likelihoods—is a major hurdle for safety-critical applications like autonomous driving or medical diagnosis.
Existing solutions usually fall into two camps:
- Train-time methods: Modifying loss functions (like Label Smoothing or Focal Loss) during initial training.
- Post-hoc methods: Adjusting the output probabilities of a pre-trained model (like Temperature Scaling).
The authors identified a gap: almost all calibration techniques focus on the outputs (logits or probabilities). This paper explores whether we can improve calibration by looking at the internal features the network extracts before the final classification layer.
Methods
The core proposal is Feature Clipping (FC). The authors observed that samples with high calibration errors (HCE)—meaning the model is very confident but wrong—tend to have significantly higher feature values in certain units compared to low calibration error (LCE) samples.
To counter this, FC applies a simple transformation to the features ($x$) of the penultimate layer: $$\tilde{x} = \min(\max(x, c), -c)$$ In practice, since most modern networks use ReLU activations (which are non-negative), this simplifies to $\tilde{x} = \min(x, c)$. The clipping threshold $c$ is a hyperparameter optimized on a small validation set to minimize Negative Log Likelihood (NLL), much like how Temperature Scaling optimizes its temperature parameter.
Datasets
The authors validated FC across a diverse range of standard benchmarks:
- CIFAR-10 & CIFAR-100: Small-scale image classification.
- ImageNet-1K: Large-scale real-world image classification.
They tested these datasets across various architectures, including ResNet, DenseNet, Wide-ResNet, MobileNet-V2, and Vision Transformers (ViT).
Key Insights and Ideas
- The Feature Disparity: The "aha moment" came from visualizing feature distributions. HCE samples exhibit a "thicker tail" in their feature distribution, meaning they have more abnormally large values than LCE samples.
- Selective Information Loss: Clipping acts as a form of information loss. Because HCE samples have higher values and higher variance, clipping them removes more information than it does for LCE samples.
- Entropy as a Penalty: Theoretically, the authors prove that clipping increases the entropy of the resulting probability distribution. Crucially, it increases entropy more for HCE samples, effectively "taming" the model's overconfidence where it is most likely to be wrong.
- Orthogonality: Because FC modifies features rather than just scaling outputs, it is orthogonal to existing methods. It can be combined with Temperature Scaling or specialized training losses for even better results.
Key Results
Feature Clipping consistently improved calibration across nearly all tested scenarios.
- Superior to Temperature Scaling (TS): In many cases, FC alone outperformed the industry-standard TS. For example, on CIFAR-100 with ResNet-50, the Expected Calibration Error (ECE) dropped from 17.52% (uncalibrated) to 3.98% with FC, compared to 5.72% with TS.
- Synergy with other methods: When combined with other post-hoc methods like ETS or PTS, FC reached state-of-the-art performance.
- Accuracy Preservation: Unlike some calibration methods that trade off accuracy for better uncertainty estimates, FC generally maintains or even slightly improves top-1 accuracy.
As shown in the figure above, there is a "sweet spot" for the clipping threshold $c$ (around 0.23 in this ResNet-50/CIFAR-10 example) that drastically reduces ECE while keeping accuracy high.
Limitations and Future Work
- Vision Transformers: While FC still helps, the improvement is less pronounced in Transformers compared to CNNs. The authors count fewer "extremely overconfident" samples in ViTs, suggesting these models might require more nuanced feature-based approaches.
- Fixed Thresholds: Currently, $c$ is a fixed value for all features. Future work could explore adaptive thresholds that vary per feature unit or per sample.
- Layer Sensitivity: The authors found that clipping earlier layers in the network significantly harms accuracy. FC is currently most effective when applied to the penultimate layer or the final logits.
- Search for $c$: The method relies on hyperparameter tuning for $c$. Developing ways to calculate an optimal $c$ directly from feature statistics could make the method even more efficient.
Summary updated