cswork / libraryOpen practice workspace

Articles

SHAP Interview Questions: Correlated Features, Baselines, and Interpretation Limits

Practice SHAP interview questions covering correlated features, background baselines, local and global importance, and causal limits.

SHAP can produce an attractive waterfall plot for almost any prediction. The interview challenge is explaining what the bars mean. A feature's attribution depends on the model output being explained, the background population, and the rule used when features are “missing.” Correlated features make those choices visible.

This guide develops a defensible answer with a duplicate-income example. It shows why attributions move when the baseline changes, how dependence changes credit allocation, and why predictive attribution does not establish a causal intervention.

For a related diagnostic exercise, open Detect leakage and evaluate a prediction model and ask whether an explanation can reveal a suspicious feature without proving how it entered the data.

Evidence boundary: The SHAP definitions and current explainer behavior come from the original NeurIPS paper and SHAP documentation. Interpretation cautions come from primary research critiques. The scorecards, audit workflow, and interview language below are original preparation guidance.

What an interviewer is testing

A strong response answers six urgent questions:

  1. Is the task to explain one prediction, global model behavior, an error, or a causal decision?
  2. What model output and link scale are being explained?
  3. Which background population defines the expected prediction?
  4. How does the explainer handle dependent or correlated features?
  5. Are attributions stable across reasonable background and feature-group choices?
  6. What evidence beyond SHAP would support the requested decision?

The article-specific thesis is: a SHAP value is an allocation relative to a defined game, not a feature's universal effect. State the baseline, missing-feature semantics, and output scale before interpreting magnitude or direction.

Start with the local additivity statement

For one input x, a SHAP explanation commonly takes the additive form

model_output(x) = expected_output + sum(feature_attribution_j).

The expected output is defined over a background distribution or another explainer-specific reference. Each attribution allocates the difference between that baseline and this prediction among features.

The original 2017 SHAP paper unifies a class of additive feature-attribution methods using Shapley-value ideas and assigns an importance value to each feature for a particular prediction. That mathematical foundation does not make the attribution causal or invariant to the game definition.

SHAP's waterfall documentation describes the plot in the same accounting order: start from the expected model output over the background, then add positive and negative feature contributions until reaching the selected prediction. When presenting a plot, label all three:

  • the baseline value;
  • the output scale, such as raw margin, log-odds, or probability;
  • the final model prediction.

If the bars add on a raw margin but the stakeholder reads them as probability-point changes, the explanation is incorrect even when the software ran correctly.

Worked example: one prediction, two baselines

Consider a synthetic approval model with two redundant inputs:

  • annual_income;
  • monthly_income, which is approximately annual income divided by twelve.

Assume the model outputs a raw score of 4.4 for an applicant with annual income of $80,000 and monthly income of about $6,667. This is a deliberately simplified fixture, not a real lending model.

With a broad applicant background, suppose the expected raw score is 2.0. The attributions must sum to 2.4. A possible interventional explanation for the two income fields is +1.2 and +1.2, with other contributions summing to zero.

With a more affluent qualified-applicant background, suppose the expected score is 3.6. The same final prediction remains 4.4, but the bars now need to sum to only 0.8; the duplicate income contributions might be +0.4 each.

Explanation elementBroad applicant backgroundQualified-applicant background
Expected raw score2.03.6
Annual-income attribution+1.2+0.4
Monthly-income attribution+1.2+0.4
Final raw score4.44.4

The prediction did not change. The reference question changed from “why above a broad applicant?” to “why above a qualified applicant?” Neither baseline is automatically correct. Choose the population that matches the explanation's audience and decision, document it, and test sensitivity.

Correlated features force a missingness choice

Shapley-style calculations evaluate coalitions of present and absent features. A tabular model cannot literally run with a field conceptually absent unless the explainer defines how to integrate or condition over missing values.

An interventional or marginal approach can replace a feature using background rows without preserving all observed dependencies. With annual and monthly income, it may create combinations such as high annual income and low monthly income that are implausible. This approach stays closer to which inputs the fitted model explicitly uses, but it can evaluate off-manifold combinations.

A conditional approach respects correlations by drawing missing values conditional on present ones. Because monthly income predicts annual income, the method can share credit across both fields—even if the fitted formula directly uses only one. SHAP's current LinearExplainer documentation describes this as the distinction between being “true to the model” under an interventional option and “true to the data” under a correlation-dependent option.

For tree models, current TreeExplainer exposes interventional, tree_path_dependent, and auto feature-perturbation choices. Interventional mode requires a background dataset; tree-path-dependent mode can use training-path counts recorded in the model. These modes answer related but nonidentical games. Do not compare their bar charts as though only computation changed.

Group redundant features before telling a story

If two columns encode nearly the same construct, individual rankings can be unstable. A model retrained with a different seed may route tree splits through one proxy instead of another while preserving predictions. Attributions then appear to move between columns.

Report a grouped sensitivity view:

ViewQuestion answeredMain risk
Individual columnsWhich encoded inputs receive allocation under this explainer?Arbitrary credit splitting among proxies
Construct groupHow much allocation belongs to the income-information group?Group definition can hide problematic proxies
InterventionalWhich model inputs matter under broken dependencies?Unrealistic combinations
ConditionalWhich information matters given observed dependencies?Credit can flow to unused correlated features
Retraining or ablationDoes performance survive removing the feature or group?Distribution shift and retraining effects

Grouping is an analytical choice, not a way to make every result stable. Show both the group and its members when governance requires visibility into sensitive or proxy fields.

Local and global importance answer different questions

A waterfall plot explains one prediction relative to one baseline. Global mean absolute SHAP values summarize attribution magnitudes over a dataset. They discard sign and depend on which rows were included. A feature can have high global importance while contributing little to a particular case, or have opposing effects that cancel in signed averages.

For global review, report:

  • the exact evaluation population and time window;
  • mean absolute attribution plus signed distributions;
  • outcome, error, and protected-group slices where appropriate;
  • feature-value versus attribution plots, with correlation cautions;
  • stability across background samples, seeds, folds, and plausible explainer settings.

Avoid declaring that the top mean absolute feature is “the most important cause.” It is the largest average allocation under the specified model, population, output, and explainer.

SHAP does not turn prediction into causation

Suppose high monthly income receives a positive attribution. The valid local statement is that this encoded value helped move the fitted model output above its selected baseline under the explainer's rules. It does not mean increasing someone's recorded income would produce the same prediction change, improve a real outcome, or be an ethical intervention.

Correlated confounders, mediators, measurement processes, and model extrapolation remain. The official SHAP documentation includes an example warning about using predictive models in search of causal insights. Kumar and coauthors further argue that Shapley feature-importance games can conflict with common explanation goals and that resolving some issues requires causal reasoning.

Use causal diagrams, domain knowledge, randomized interventions, natural experiments, or appropriate causal estimators for intervention claims. SHAP can help inspect what a predictive model relies on; it cannot supply a missing identification strategy.

Audit explanations as model artifacts

Treat the explainer configuration like versioned code. Save the model identifier, feature pipeline, explainer class and version, perturbation mode, background selection query, output setting, link function, random seed, and aggregation population.

Then run four checks:

  1. Additivity: Confirm baseline plus attributions reproduces the explained output within documented tolerance.
  2. Baseline sensitivity: Repeat with plausible reference populations and explain which question each answers.
  3. Dependence sensitivity: Compare interventional, conditional, grouped, or path-dependent views where supported.
  4. Functional validation: Remove, permute, retrain without, or otherwise test important features using a method aligned with the decision.

A sanity feature with no predictive relationship can expose some implementation failures, but passing that check does not validate causality or human usefulness.

Common wrong answers and precise repairs

Wrong answerWhy it failsBetter response
“A SHAP value is the effect of changing the feature.”Attribution is relative to a coalition game, not automatically an intervention.Say “contribution to this model output under this explainer and baseline.”
“The baseline is just the dataset average.”Which dataset and output scale determine the value.Name the background population, period, and scale.
“Correlated features split credit fairly.”Allocation depends on missingness semantics and representation.Compare modes and grouped constructs.
“TreeSHAP gives the one exact explanation.”It can be exact for a specified tree game while games differ.Record feature-perturbation and model-output settings.
“Largest mean absolute SHAP means strongest cause.”Global magnitude is predictive allocation over selected rows.Add sign, slices, stability, and causal evidence if needed.
“A stable plot proves the model is safe.”Stability does not test leakage, fairness, calibration, or utility.Evaluate those properties directly.

A concise interview answer template

Begin: “I will define the explanation target, baseline population, output scale, and dependence rule.” Then:

  1. State local versus global purpose.
  2. Show baseline plus attributions equals the selected model output.
  3. Explain how absent features are represented.
  4. Identify correlated groups and plausible proxies.
  5. Test sensitivity to background, perturbation mode, and retraining.
  6. Phrase findings as model behavior.
  7. Use separate causal or policy evidence for the final intervention.

That sequence makes a SHAP explanation inspectable instead of treating the visualization as self-validating.

Sources and Further Reading

Sources checked September 12, 2026. All applicant values and attributions are synthetic.