Accurate estimation of feature importance faithfulness for tree models

Mateusz Gajewski, Adam Karczmarz, Mateusz Rapicki, Piotr Sankowski

TL;DR

This paper introduces $PGI^2$, a new perturbation-based metric designed to evaluate the "faithfulness" of feature importance explanations in tree ensemble models. Crucially, the authors provide an exact, polynomial-time algorithm to compute this metric analytically, completely eliminating the need for noisy and slow Monte Carlo approximations while offering a competitive new greedy feature-ranking alternative to SHAP.

What Problem Does This Paper Address?

As machine learning models are increasingly deployed in high-stakes domains like medicine, understanding why a model made a specific prediction is vital. Local feature attribution methods (such as SHAP or LIME) attempt to answer this by assigning importance weights to features for individual predictions. However, we need a way to verify if these explanations are faithful—meaning they truly reflect the model's internal decision-making logic rather than just providing a plausible-looking answer.

A popular way to measure faithfulness is the Prediction Gap on Important feature perturbation (PGI). Intuitively, if you perturb features that an explainer claims are important, the model's prediction should change significantly.

The catch? Standard PGI uses absolute differences, making it mathematically intractable to compute exactly. Instead, practitioners rely on Monte Carlo sampling, which is inherently noisy, slow, and prone to approximation errors. This paper tackles the challenge of computing a reliable, exact faithfulness metric specifically tailored for decision tree ensembles (like XGBoost).

Methods

The authors make two primary contributions:

  1. The $PGI^2$ Metric and Exact Algorithm: They modify the standard prediction gap definition by swapping the absolute value with a squared difference: $$PG^2(x, S) := \mathbb{E}_{x' \sim \text{perturb}(x,S)} [(f(x') - f(x))^2]$$ This mathematical adjustment prevents positive and negative prediction changes from canceling each other out in expectation. More importantly, it allows them to design an exact $O(n^2)$ algorithm (where $n$ is the total number of nodes in the tree ensemble) to compute the metric analytically using nested pre-order traversals over the tree structures.

  2. Greedy Feature Ordering: Leveraging this exact algorithm, they propose a greedy heuristic to rank features. The algorithm iteratively selects the next feature that maximizes the squared prediction gap when combined with the already selected features, creating a direct alternative to traditional explainers.

Datasets

The authors evaluated their approach using XGBoost models (both single trees and ensembles of 40 trees) across three standard regression datasets:

  • Red Wine Quality: 1,599 examples with 11 continuous features, predicting wine scores.
  • California Housing: 20,640 examples with 8 numerical features, predicting median house values.
  • Parkinson Telemonitoring Data: 5,875 voice measurements with 17 numerical features, predicting clinical scores.

Key Insights and Ideas

  • The Power of Squaring: Changing the metric from an absolute difference to a squared difference transforms an intractable integration problem into a combinatorial one. The expectation can be broken down into joint probabilities of leaf activations, which can be tracked exactly via interval intersections.
  • Sampling is Highly Flawed for Small Budgets: When allocated the same time budget as the exact algorithm, standard Monte Carlo methods exhibit substantial approximation errors, particularly on smaller models where the exact algorithm executes almost instantaneously.
  • SHAP and $PGI^2$ Disagree on Importance: The feature rankings produced by the greedy $PGI^2$ approach differ substantially from SHAP. Even for single trees, they pick the exact same top feature less than 76% of the time, demonstrating that optimizing directly for faithfulness yields a fundamentally distinct perspective on feature importance.
Ratio of datapoints sharing the same top-k features between greedy PGI2 and SHAP

Key Results

  • Numerical Stability: As the iteration count for Monte Carlo (MC) and Quasi-Monte Carlo (QMC) sampling approaches infinity, their outputs visibly converge to the exact algorithm's output, confirming the numerical stability of the closed-form solution.
Figure 1: NMAE for σ = 0.3 and for Bigger model for Red Wine Quality dataset.
  • Efficiency Trade-offs: For single trees, the exact algorithm is vastly superior to sampling. However, because the exact algorithm scales quadratically ($O(n^2)$), larger tree ensembles allow sampling methods to run enough iterations within the same time budget to achieve very low errors (Normalized Mean Absolute Error down to 0.001).
Iterations and NMAE to match exact algorithm execution time
  • Faithfulness Performance: The greedy $PGI^2$ ranking consistently outperforms SHAP when evaluated using the $PGI^2$ metric itself. When cross-evaluated using alternative feature-removal benchmarks (like remove-and-retrain), SHAP and $PGI^2$ are highly competitive, proving that the new method is a viable, robust alternative.
Global comparison of average PGI2 scores between SHAP and Greedy PGI2

Limitations and Future Work

  • Scalability to Massive Ensembles: Because the exact algorithm's running time is quadratic with respect to the total number of nodes ($O(n^2)$), it can become computationally expensive for massive random forests or gradient-boosted architectures containing hundreds of thousands of nodes.
  • Feature Independence Assumption: The metric assumes that feature perturbations are independent. In real-world scenarios where features are highly correlated, this assumption may lead to evaluating the model on unrealistic out-of-distribution data points.
  • Future Directions: The authors suggest exploring hybrid approaches that combine exact sub-tree calculations with sampling to handle massive ensembles more efficiently.

Summary updated

BibTeX
@inproceedings{gajewski2025accurate,
  author = {Mateusz Gajewski and Adam Karczmarz and Mateusz Rapicki and Piotr Sankowski},
  title = {{Accurate estimation of feature importance faithfulness for tree models}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  url = {https://openreview.net/forum?id=fz9dt472kz},
}
Figure