SHAP-based Explanations are Sensitive to Feature Representation

Hyunseung Hwang, Andrew Bell, João Fonseca, Venetia Pliatsika, Julia Stoyanovich, Steven Euijong Whang

Abstract

Explainable AI (XAI) tools, particularly SHAP (Shapley Additive Explanations), are increasingly utilized to audit machine learning models for fairness and transparency in high-stakes domains. However, this research demonstrates that SHAP explanations are significantly sensitive to feature representation choices made during data pre-processing. By manipulating how features like age or race are binned or grouped, developers can intentionally obscure a model's reliance on sensitive attributes without altering the model's predictions or retraining the system. This paper identifies a "data engineering attack" vector that poses a substantial risk to regulatory oversight.

Introduction

As artificial intelligence is integrated into critical decision-making processes—such as health insurance eligibility and credit lending—the demand for interpretability has surged. SHAP has emerged as a prominent framework for providing these explanations, often treated as a "gold standard" for identifying which features drive a model's output. The prevailing assumption among auditors is that a low SHAP value for a protected attribute, such as race or gender, indicates a fair model.

This study challenges that assumption by highlighting a critical blind spot: the data engineering pipeline. While most XAI research focuses on the model architecture or the explanation algorithm itself, the authors show that the representation of input data before it reaches the explainer can be leveraged to manipulate the resulting importance rankings.

Methodology

The researchers investigated how specific data engineering choices influence SHAP values while keeping the underlying classifier fixed. They focused on two primary techniques:

1. Feature Bucketization (Binning)

For continuous variables like age, the study compared three representation strategies:

  • Equi-width Binning: Dividing the feature range into intervals of equal size.
  • Equi-depth Binning: Dividing the range such that each interval contains an equal number of samples (percentile-based).
  • Bayesian Optimization (BO) Attack: A novel adversarial approach where Bayesian Optimization is used to find specific bucket boundaries that minimize a feature's SHAP rank. This attack is designed to maintain "fidelity," ensuring the explanation still appears to accurately reflect the model's logic to an unsuspecting auditor.

2. Categorical Encoding and Merging

For categorical features like race, the researchers tested "One-vs-Rest" strategies and combinatorial merging. By grouping specific categories (e.g., merging "White" and "Asian" or "White" and "Black"), they examined how the importance of a sensitive attribute could be diluted across a broader, less "suspicious" category.

Experimental Setup

The study utilized two benchmark datasets from the US Census Bureau via the folktables package, both of which are standard for fairness research:

  • ACS Income (Virginia, 2018): Predicting whether an individual's annual income exceeds $50,000.
  • ACS Public Coverage (Virginia, 2018): Predicting whether an individual is covered by public health insurance.

Key Insights: The Mechanics of Manipulation

The experiments revealed several ways in which feature representation dictates the "story" told by SHAP:

Granularity and Importance

SHAP values are highly sensitive to the granularity of a feature. Generally, as a feature is broken down into more fine-grained buckets, its SHAP importance increases. This is because more granular representations allow the explainer to attribute specific model behaviors to narrower data segments.

The "Hiding in Plain Sight" Effect

Conversely, by coarsening a feature—lumping specific values into broad ranges—its perceived importance can be demoted. For instance, a model might rely heavily on the specific age of 22 to make a prediction. If "Age" is represented as a continuous variable, it may rank as the most important feature. However, if that age is placed into a broad "18–35" bucket, the signal becomes "typical" within the group, causing the SHAP value to plummet.

Adversarial Pre-processing

The Bayesian Optimization attack demonstrated that a malicious actor does not need to rely on trial and error. They can mathematically optimize the pre-processing steps to "hide" sensitive features. In the ACS Income dataset, this approach successfully demoted "Age" from the #1 most important feature to #5, reducing its feature weight from 0.99 to 0.37, all while maintaining over 88% explanation fidelity.

Results and Discussion

The empirical results underscore the fragility of SHAP-based audits:

  • Rank Volatility: Simple changes in bucketization caused the rank of the "Age" feature to shift by as many as 20 positions.
  • Feature Cloaking: On the Public Coverage dataset, merging "White" and "Black" categories into a single group reduced the SHAP importance of race to nearly zero. This effectively "cloaks" the model's reliance on race from any auditor using SHAP.

Conclusion and Future Directions

The core takeaway of this research is a call for "Pipeline-Aware Auditing." It is no longer sufficient to audit a model in isolation; auditors must scrutinize the entire data pipeline, from raw data collection to the final representation used by the explainer.

Future work is needed to address the complexities of feature intersectionality—how multiple represented features interact to hide bias—and to develop automated tools for exploring the vast combinatorial space of categorical groupings. As it stands, the way data is presented to an explainer is just as influential as the model's underlying logic, making current XAI-based auditing vulnerable to strategic manipulation.

Summary updated

BibTeX
@inproceedings{hwang2025shap,
  author = {Hyunseung Hwang and Andrew Bell and João Fonseca and Venetia Pliatsika and Julia Stoyanovich and Steven Euijong Whang},
  title = {{SHAP-based Explanations are Sensitive to Feature Representation}},
  booktitle = {FAccT},
  year = {2025},
  doi = {10.1145/3715275.3732105},
}
Figure