Work · Interactive explainer · Synthetic

Right prediction. Wrong reason.

A model can be accurate for a fragile reason. Swap a shortcut, explain an unused feature, and test a distribution shift.

Lucian Murgu · Original synthetic teaching experiment · Not an empirical study

Shape defines the answer. Background is a shortcut. An unused badge can still receive attribution. Inspect all three in a synthetic world we can enumerate exactly.

A synthetic experiment · Hand-specified model · No training or external AI service

Start with the experiment ↓

Start by swapping only the background. The true shape stays the same.

ONE RECORD · TWO WORLDS

What changes the prediction?

Both views use the same model. Only the background changes between them.

Selected record

—P(circle)
Calculating…

Background swapped

—P(circle)
Calculating…

The pictures encode three binary features; the model reads those codes, not pixels. Classify as circle when P(circle) ≥ 50%. The actual class is always the shape.

Inside this model

Adjust the weights. The badge coefficient is fixed at zero.

z = 1.0s + 2.4c + 0.8scP(circle) = 1 / (1 + e−z)

s: circle +1 / square −1
c: blue +1 / sand −1
p: badge +1 / −1; absent from the formula

SAME PREDICTION · DIFFERENT QUESTIONS

What deserves the credit?

Identical in both cohorts. Not a model input weight.

Marginal replacementConditional observation
Pushes away from circlePushes toward circle
Exact Shapley contributions in percentage points of P(circle). With the common baseline, both explanations reconstruct the same prediction. Shared scale: −100 to +100 pp, centered on zero. A negative bar is not an error rate.

Two meanings of “missing”

Marginal replacement: hold the revealed features fixed; average the others over the chosen population. This can break their relationship with the revealed features.

Conditional observation: keep only population records that match the revealed features. A badge can convey information about shape even when the model ignores the badge.

Population average —+ feature contributions= prediction —
Inspect all eight coalitions and the exact accounting

The three features have eight possible subsets. Each contribution averages its marginal addition over all six feature orders. The table shows the model's expected P(circle) after revealing each subset.

All coalition values, as percentages
Revealed featuresMarginalConditional

Export results for full floating-point values. Displayed contributions are rounded to two decimals; a displayed sum may differ by 0.01 percentage points.

ONE MODEL · TWO POPULATIONS

Does the explanation survive a shift?

Change which clues travel together. The model stays fixed.

Blue with circles; sand with squares.

Only this association changes across cohorts.

Reference cohort

—

Shifted cohort

—

● Correct prediction · × Wrong prediction. Each symbol is one synthetic record. Outlined symbols match the selected three-feature combination. Each cohort contains exactly 800 records with 400 circles and 400 squares; repeated records are not independent real-world observations.

Inspect the complete population and select a record

All eight distinct combinations are shown. Select a row to update the linked prediction, counterfactual and explanations. Background and badge are independent conditional on shape in this construction.

Synthetic cohort counts and model predictions
RecordRef.ShiftedP(circle)

Selection changes the inspected record, not the population counts.

WHAT THIS ESTABLISHES

An attribution is an answer to a specified question.

In the shortcut scenario, accuracy falls when the background stops tracking shape. A locally accurate explanation does not guarantee a robust model. In the unused-feature scenario, the badge can receive conditional credit because it reveals information about shape. Flipping the badge alone still changes the prediction by exactly zero.

Neither set of bars identifies a real-world causal effect. “Marginal” and “conditional” define two different expectation games. The appropriate question depends on what you want to investigate. The distinction is discussed by Janzing and colleagues and Aas and colleagues; additive feature attribution is developed by Lundberg and Lee.

Mathematical specification and reproducibility

For a selected record x and subset S of revealed features, marginal replacement uses vm(S) = E[f(xS, X−S)]. Conditional observation uses vc(S) = E[f(X) | XS = xS]. The marginal version retains dependencies among the missing features.

φj=∑S⊆N∖{j}w(S)Δj(S) w(S)=|S|!(2−|S|)!3! Δj(S)=v(S∪{j})−v(S)

There are three features. For subset sizes 0, 1 and 2, the weights are 1/3, 1/6 and 1/3. All eight coalition values are enumerated; there is no Monte Carlo sampling or fitted explanation.

Each shape has 400 records. If a background/badge combination agrees with shape with percentages a and b, its integer count is (a/5)(b/5). For a disagreement use 100−a or 100−b. Five-point controls make every count integral, and positive counts ensure every conditional expectation exists.

The model is specified directly, not trained. Its output is a bounded score called P(circle), not evidence of empirical calibration. The population is completely synthetic. The shown background intervention is a feature replacement in this toy system, not a treatment effect in the world.

For a real model review

State the explanation question and reference population. Probe counterfactual changes that preserve the intended label. Evaluate representative shifts. Inspect model outputs and underlying counts alongside the explanation. A plausible chart is a starting point for investigation, not a governance sign-off.

Keep an experiment

Every control is encoded in the URL. The export includes both explanations, all coalitions, population counts and counterfactuals.

Scope & limitations

  • The logistic model is hand-specified, not trained. It consumes three binary feature codes, not the displayed image pixels. The badge is deliberately absent from the score formula.
  • Each 800-record cohort repeats eight possible input combinations with exact integer frequencies; no real datasets, independent trials or generalization estimates are presented.
  • Marginal replacement and conditional observation are different Shapley games. Neither is presented as a measured real-world causal effect; the background reference is explicit.
  • Exact means exhaustive coalition enumeration, not exact real arithmetic. JavaScript results use binary floating point; independent numerical comparisons use tolerance 1e-12. Displayed percentages are rounded.
  • This bounded example does not establish interpretability, robustness, fairness or governance assurance for deployed models.

References

  1. Lundberg & Lee (2017). A Unified Approach to Interpreting Model Predictions.
  2. Janzing, Minorics & Blöbaum (2020). Feature relevance quantification in explainable AI: A causal problem.
  3. Aas, Jullum & Løland (2021). Explaining individual predictions when features are dependent.