Counterfactuals and SHAP: Which Explanation Survives a Review?

Tim Kleinloog 6 min read

A loan applicant is declined and asks for an explanation under GDPR Article 22. The model's SHAP output comes back with income at -0.34, debt-to-income at -0.28, employment tenure at -0.12. A counterfactual says: if reported monthly income were EUR 380 higher and the loan balance EUR 2,000 lower, the application would have been approved. Both describe the same decision accurately. They tell different stories, and supervisors increasingly ask which one an institution can actually deliver.

Choosing between attribution and counterfactuals comes down to the obligation being met and the person the explanation is written for.

What SHAP Attribution Tells You

SHAP, short for SHapley Additive exPlanations, breaks a model output into the sum of its feature contributions using ideas from cooperative game theory. Each feature gets a score for how far it moved the prediction from the average. Positive values push up, negative values pull down.

SHAP has practical strengths for compliance. It is auditable at scale, since values can be stored next to every prediction and analysed in aggregate: which features drive most decisions, how importance shifts over time, whether protected characteristics influence outcomes by indirect routes. It also maps cleanly onto validation frameworks such as SR 11-7, where reviewers need to judge whether a model's mechanics match its stated purpose. A validator can compare SHAP-derived importance against the economic reasoning behind a credit model and spot where the two diverge.

What SHAP does not answer is "what should I do differently?" The output is attribution, not action. Neither a loan officer nor an applicant can read contribution scores and find a concrete route to another outcome.

What Counterfactual Explanations Tell You

A counterfactual identifies the smallest input change that would alter the output. In binary classification it is usually the minimal set of feature changes that flips a denial to an approval. That makes it actionable by construction: it describes an alternative world with a different answer.

Its compliance weight comes from GDPR Recital 71, which gives individuals the right to obtain an explanation of the decision and to challenge it. An actionable counterfactual answers the challenge right more directly than a set of attribution scores. The applicant can judge whether the required change is achievable and dispute whether the criterion is legitimate. For a non-technical reader, that is meaningful in a way the scores are not.

The costs are real. Counterfactuals are heavier to compute and harder to produce consistently at scale. Near a decision boundary they can be unstable: small perturbations in the input produce large swings in the explanation, which is awkward when an auditor needs reproducibility.

The Regulatory Framing

Neither GDPR nor the EU AI Act names SHAP or counterfactuals. What they specify is the result: an explanation sufficient for the individual to understand the decision and contest it where the law allows. Article 13 of the Act requires transparency documentation for high-risk systems, covering the logic involved and the significance and consequences of the processing. Article 86 extends a right to explanation of individual decisions.

EBA guidance on internal governance and model risk does not prescribe a method either. It reinforces the principle that outputs must be explainable to oversight functions in terms they can interpret and act on. A compliance officer reviewing an adverse credit decision needs to judge whether appropriate criteria were applied, not merely confirm that the model's arithmetic was consistent.

That creates a split obligation: attribution that holds up in audit, and individual explanations a person can understand. SHAP covers the first well; counterfactuals usually serve the second better.

When to Use SHAP, When to Use Counterfactuals

Requirement SHAP Counterfactual
Batch audit of feature importance Strong fit Not designed for this
Monitoring feature drift impact Strong fit Weak fit
Individual decision explanation to customer Partial (technical) Strong fit
GDPR Art 22 right to explanation Defensible but contested More directly responsive
EU AI Act Art 13 transparency Strong fit Supplementary
Validator model review Strong fit Useful for boundary cases

The Practical Challenge: Maintaining Both

Running both methods in production is not a matter of importing two libraries. Each needs versioning, logging and a link to a specific model version. Retraining means recalibrating both the SHAP baseline and the counterfactual generation logic against the new version. If the two drift out of step, explanations for a decision made three months earlier stop being reproducible when a regulator or customer asks.

This is where many implementations fail. The model is updated, the explainability pipeline follows, and the old explanations are gone because the reference version was overwritten. For a regulated institution, that is a documentation gap under DORA's ICT risk framework and potentially a breach of the Act's audit trail obligations.

Neither is Complete on Its Own

The choice is often framed as a technical selection problem. The compliance requirements actually pull two ways at once. Attribution satisfies internal audit and model validation. Actionable counterfactuals satisfy the individual explanation rights that come from GDPR and consumer protection.

SHAP is not inadequate for compliance. For the audit trail, batch monitoring and checking that a model's feature weights align with economic reasoning, it does real work. The open question is whether scores alone give a GDPR-meaningful explanation to the person who receives it. For a non-technical credit applicant, often they do not, and institutions with only SHAP pipelines are exposed when individual requests arrive.

The practical answer is to build both, store both next to each prediction, and say plainly in the documentation which type serves which regulatory purpose. That map is itself part of the compliance record.

Back to Blog

Ready to govern your models?

See how Deeploy keeps the file current

Start with one model and watch the evidence build as the work happens.

Request Access See How It Works