Quant Memo
Core

Choosing the Baseline in Feature Attribution

Feature-attribution methods explain a prediction relative to a reference point representing 'no information' — and that reference point is a choice, not a given, one that can change the attributions substantially.

Prerequisites: TreeSHAP

Every feature-attribution method — SHAP, integrated gradients, LIME — answers a question of the form "how much did each feature contribute to this prediction, compared to some reference?" That reference, the baseline, represents "no information" or "a typical, uninformative input," and every reported attribution number is only meaningful relative to it. Change the baseline, and the attributions change too, sometimes dramatically, even though the model and the prediction being explained haven't moved at all.

This isn't a bug to be fixed; it's structurally unavoidable, because "how much did this feature contribute" only has a well-defined answer once you say "contribute, compared to what." Common choices include the dataset's average feature values (a "typical" input), an all-zeros vector (useful when zero genuinely means absence, less useful when it doesn't — a stock's zero price isn't a meaningful reference point), or a background sample drawn from the actual data distribution, which many implementations of SHAP use by default, effectively averaging attributions over many different plausible baselines at once. None of these is objectively "correct" — they encode different questions. "Average feature values" answers "how does this input differ from a typical one?" A background sample answers something closer to "how does this input differ from other inputs the model has actually seen?"

Worked example

A model predicts default probability from two features: debt-to-income ratio and account age. For one applicant with debt-to-income of 0.6 and account age of 2 years, the model predicts 30% default probability. Using the dataset average as the baseline (debt-to-income 0.35, account age 6 years, baseline prediction 12%), SHAP attributes the 18-point gap mostly to debt-to-income (say, +14 points) with a smaller contribution from account age (+4 points), because this applicant's debt-to-income is unusually far from the population's typical value. Using an all-zeros baseline instead (debt-to-income 0, account age 0, baseline prediction 5%), the 25-point gap now splits differently — account age contributes much more (+11 points), because going from zero years of history to two years is itself a meaningful change relative to a baseline of no account history at all, a comparison the average-based baseline never made since the typical applicant already has an account. Both attributions are internally consistent and mathematically valid; they simply answer different questions about what "no information" means.

baseline: population average DTI: +14 age: +4

baseline: all-zeros DTI: +14 age: +11

Same model, same prediction, same applicant — different baselines produce noticeably different attributions, because each baseline answers a different question about what "no contribution" means.

What this means in practice

Any reported feature attribution should come with a statement of what baseline was used, the same way a treatment-effect estimate should come with a statement of what population it applies to — "debt-to-income contributed +14 points" is incomplete without "...relative to the population average applicant." Comparing attributions produced with different baselines across two studies, two vendors, or two versions of a model can look like a real disagreement about what matters when it's actually just a difference in reference point.

Feature attributions are always relative to a chosen baseline representing "no information," and that baseline is a modeling choice, not a mathematical necessity — different reasonable baselines can produce visibly different attribution numbers for the exact same prediction from the exact same model.

Comparing SHAP or integrated-gradients attributions across two different tools, papers, or model versions without checking whether they used the same baseline is a common way to mistake a baseline artifact for a genuine finding about which features matter.

Related concepts

Practice in interviews

Further reading

  • Sundararajan, Taly, Yan, Axiomatic Attribution for Deep Networks
ShareTwitterLinkedIn