TL;DR
Perturbation-based explainability methods (like SHAP and LIME) often produce unstable or misleading feature importances because machine learning models become highly miscalibrated when evaluated on perturbed, out-of-distribution inputs. This paper introduces ReCalX, a post-hoc recalibration method that dynamically adjusts model confidence based on the level of input perturbation. ReCalX significantly improves explanation robustness and fidelity without altering the model's original predictions.
What Problem Does This Paper Address?
Popular explainability methods like SHAP and LIME work by systematically modifying (perturbing) input features—such as masking pixels in an image or replacing tabular values with dataset means—and observing how the model's output probabilities change.
However, these perturbed inputs are inherently out-of-distribution (OOD). Machine learning models are notoriously bad at estimating uncertainty on OOD data, leading to severe miscalibration (where a model's stated confidence doesn't match its actual accuracy). If the underlying probabilities used to calculate feature importance are distorted by OOD artifacts, the resulting explanations become noisy, unstable, and unfaithful to the model's true behavior.
Methods
The authors first provide a rigorous mathematical proof showing that miscalibration under perturbations directly degrades both global and local explanation quality. To fix this, they propose ReCalX (Recalibration for Explanations).
ReCalX builds on classical temperature scaling but adapts it dynamically to the explainability context:
- Measure Perturbation Level: For any given feature subset $S$, it computes the perturbation level $\lambda(S)$, defined as the fraction of features that have been modified.
- Binned Temperature Scaling: It partitions the perturbation range $[0, 1]$ into $B$ equal-width bins and learns a specific temperature parameter $T_b$ for each bin using a held-out validation set.
- Information-Preserving Adjustments: Because temperature scaling is strictly monotonic, it is information-preserving and accuracy-preserving. It corrects the probability calibration under specific perturbation intensities without changing the model's original discrete predictions or rankings.
Datasets
The method was evaluated across both tabular and image domains using standard architectures (MLPs, Tabular ResNets, ResNet50, DenseNet121, ViT, and SigLIP):
- Tabular Datasets: Electricity, Covertype, Credit, and Pol (plus 6 additional datasets detailed in the appendix).
- Image Datasets: ImageNet (ILSVRC2012).
Key Insights and Ideas
- Miscalibration isn't uniform: As perturbation strength increases, miscalibration often gets worse, but its behavior varies wildly by architecture. For instance, while tabular models show a uniform increase in calibration error with higher perturbation, a ResNet50 on ImageNet actually exhibits worse miscalibration at lower perturbation levels. This highlights why static calibration fails and adaptive calibration is necessary.
- Standard calibration fails under perturbation: Standard temperature scaling only calibrates on unperturbed data ($\lambda = 0$). The authors show this can actually worsen calibration error when features are heavily masked.
- Theoretical bound on explanation error: The paper provides a tight theoretical bound showing that the mean squared difference between an actual explanation and an ideally calibrated explanation is directly constrained by the maximum calibration error across all perturbation subsets.
Key Results
- Massive Reductions in Calibration Error: ReCalX achieved relative reductions in maximum calibration error ($CE_{KL}^{MAXS}$) of over 80% across almost all image models and up to 92.3% on tabular models compared to uncalibrated baselines.
- Higher Explanation Fidelity: In "remove-and-retrain" experiments (where top features are sequentially removed and the model is retrained), features identified by ReCalX-calibrated explanations caused a significantly steeper drop in performance, proving that ReCalX uncovers truly important features.
- Improved Robustness: ReCalX substantially reduced both average and maximum sensitivity metrics across LIME, Kernel SHAP, and Feature Ablation, making explanations much less vulnerable to random noise or minor input variations.
- Visually Cleaner Attributions: Qualitatively, image explanations calibrated with ReCalX were noticeably less noisy and more tightly focused on the actual objects of interest.
Limitations and Future Work
- Setup Overhead: ReCalX requires access to a validation dataset to pre-compute the bin temperatures under various perturbation levels.
- Inference Overhead: While minimal (on the order of milliseconds), it does add a small step during explanation generation to select the appropriate temperature based on the feature mask.
- Scope: The current implementation focuses primarily on classification tasks using temperature scaling. While the authors demonstrate extensions to regression in the appendix, future work could explore applying these principles to gradient-based or counterfactual explanation methods.
Summary updated