Axiomatic Attribution for Deep Networks
TL;DR. Integrated Gradients (IG) explains a prediction by comparing it with a baseline input. It averages the gradient along the straight line from the baseline to the input and multiplies by the input difference. The attributions then add up exactly to the change in output. The paper derives IG from axioms instead of proposing yet another heuristic.
Why it matters now. IG is still a standard first answer to “which tokens drove this score?”. It applies to rerankers, dense retrievers, reward models and LLM judges, as long as you can take gradients. Its axioms also give you a checklist for judging any newer attribution method. Its weak point, the baseline, is the question to ask of every attribution claim in an IR or RAG paper.
Key idea
Section titled “Key idea”Let be the model output (for example one logit), the input and a baseline. For feature :
Because this is a path integral of a gradient, the fundamental theorem of calculus gives completeness:
In practice the integral is a Riemann sum over points on the path. That costs gradient evaluations.
Key results
Section titled “Key results”The paper is axiomatic. Its evidence is a set of qualitative case studies (§6), not a benchmark table.
- Object recognition (GoogleNet). IG maps on ImageNet images highlight the distinctive features of the predicted object (§6.1).
- Diabetic retinopathy. Attributions localise to lesions in the retina. The interior of a lesion gets negative credit and its boundary positive credit, so the network attends to lesion edges (§6.2).
- Question classification. On WikiTableQuestions-style questions, IG showed that “total number” pushes towards a numeric answer type. It also exposed a spurious trigger: the word “charles” pushed towards a yes/no answer (§6.3).
- Neural machine translation. IG between output and input tokens recovers alignments. These models needed 100–1000 steps (§6.4).
- Chemistry models. For a molecular graph convolution model, atom pairs with a bond carry 46% of one prediction. Identical attributions for differently bonded atoms exposed an architecture bug: features were not fully convolved (§6.5).
Limitations & open questions
Section titled “Limitations & open questions”- Baseline dependence. Different baselines give different attributions, and there is no principled choice for discrete text. The “absence of signal” ideal is easy to state and hard to realise.
- Path dependence. The straight line is one choice among infinitely many paths. Its points can lie far from the data manifold, especially between a zero embedding and real token embeddings.
- Faithfulness is not proven. The axioms constrain how credit is shared, not whether the explanation matches the model’s mechanism. Interactions between features are folded into first-order credit.
- Cost. m gradient passes per explanation is costly for long inputs and large models.
Connections
Section titled “Connections”- A Unified Approach to Interpreting Model Predictions (SHAP): Shapley values with a different “path” structure. Kernel SHAP and IG agree on completeness and disagree on interactions.
- “Why Should I Trust You?” (LIME): a local surrogate model instead of gradients.
- TCAV: directional derivatives along concept directions instead of input features.
- Attention is not Explanation: the debate on whether attention weights can replace gradient-based attribution.
- Probing classifiers and control tasks: asks what a representation encodes, not which input features drove an output.
- Job talk: Sarah Wiegreffe, on faithfulness of explanations.
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
Take f(x) = 1 − ReLU(1 − x), baseline x′ = 0 and input x = 2. (a) Compute the plain gradient attribution x · f′(x). (b) Compute Integrated Gradients exactly. (c) Approximate IG with a right-endpoint Riemann sum using m = 4 steps, and explain why the answer depends on how you define the derivative of ReLU at 0.
What a strong answer covers
- (a) For x > 1 the function is flat at 1, so f′(2) = 0 and the gradient attribution is 0, even though f moved from f(0) = 0 to f(2) = 1. This is the paper's Sensitivity(a) counterexample.
- (b) On the path z = 2α, f′(z) = 1 for z < 1 and 0 for z > 1. IG = (2 − 0) · ∫₀¹ f′(2α) dα = 2 · 0.5 = 1, which equals f(2) − f(0). Completeness holds.
- (c) Points α = 0.25, 0.5, 0.75, 1 give z = 0.5, 1, 1.5, 2 with gradients 1, g(1), 0, 0, where g(1) is the derivative at the kink. The sum is (2/4)·(1 + g(1)), so 0.5 if g(1) = 0 and 1 if g(1) = 1.
- Lesson: the Riemann sum only approximates completeness. The paper's recipe is to check that the attributions sum to F(x) − F(x′) and raise m if they do not (§5).
- Mechanism
Explain why completeness, Σᵢ IGᵢ(x) = F(x) − F(x′), holds for Integrated Gradients, and why the same argument fails for DeepLIFT or LRP when two networks compute the same function with different internals.
What a strong answer covers
- IG is a path integral of the gradient along γ(α) = x′ + α(x − x′). By the fundamental theorem of calculus for path integrals, Σᵢ ∫ ∂F/∂xᵢ dγᵢ = F(γ(1)) − F(γ(0)). This needs F differentiable almost everywhere, which holds for ReLU networks.
- Completeness implies Sensitivity(a): if the input and baseline differ only in one feature and the outputs differ, that feature gets non-zero attribution.
- IG uses only true gradients of F, so it depends only on the function. Two functionally equivalent networks get identical attributions (implementation invariance).
- DeepLIFT and LRP replace gradients with discrete ratios of differences. These do not obey the chain rule, so the attribution depends on how the computation is split into layers.
- Connect
For F(x₁, x₂) = min(x₁, x₂) with baseline (0, 0) and input (1, 3), compute the Integrated Gradients attributions and the Shapley values (missing feature set to its baseline value). Explain where the difference comes from in terms of paths.
What a strong answer covers
- IG path: (α, 3α). Along it min = α, so ∂F/∂x₁ = 1 and ∂F/∂x₂ = 0. IG₁ = 1 · 1 = 1 and IG₂ = 0.
- Shapley: v(∅) = 0, v({1}) = min(1, 0) = 0, v({2}) = min(0, 3) = 0, v({1,2}) = 1. Each feature gets ½ · (0 − 0) + ½ · (1 − 0) = ½.
- Both satisfy completeness (sum = 1). Shapley–Shubik corresponds to averaging over the n! extremal paths that switch features on one at a time; IG uses the single diagonal path (Aumann–Shapley), as in Remark 5 of the paper.
- On the diagonal, x₁ is always the binding minimum, so IG gives it all the credit. Neither answer is "wrong"; the choice of path is a modelling decision.
- Critique
For text models the paper recommends the all-zero embedding as the baseline, noting it is not a valid input. What is the weakest assumption here, and what experiment would show whether IG token attributions for a BERT-style classifier are driven by the baseline rather than the input?
What a strong answer covers
- IG explains F(x) − F(x′), so every attribution is relative to the baseline. If F(x′) is far from a "no information" output, the attributions explain the wrong contrast. The paper asks for a near-zero score at the baseline.
- The straight path from the zero vector to real embeddings passes through points the model never saw. Gradients there may reflect off-manifold behaviour, not the model's reasoning on real text.
- Experiment: compute IG with several baselines (zero vector, [MASK] or [PAD] embeddings, average embedding, a random neutral sentence). Measure rank correlation of token attributions across baselines and check F(x′) for each.
- Follow with a deletion or insertion test: remove the top-k attributed tokens and measure the drop in score. Compare which baseline's ranking predicts the drop best.
- Design
You want to explain why a cross-encoder reranker scores a query–passage pair highly, with attributions over both query and passage tokens. Each pair is 512 tokens and you have one GPU. Design the IG setup: baseline, path, number of steps, sanity checks and cost.
What a strong answer covers
- Attribute the relevance logit, not a softmax over a candidate list, so the target is one scalar per pair.
- Baseline options: zero embeddings for passage tokens only (keep the query fixed) to ask "which passage tokens matter given the query"; or a [PAD]/[MASK] baseline. State that results are relative to this choice.
- Cost: m forward and backward passes per pair. With m = 50 and batching steps, this is about 50× a single scoring pass, so explain a sample of pairs, not the whole run.
- Sanity checks: completeness error |Σ IG − (F(x) − F(x′))| should be small (raise m if not); deletion curves comparing IG with attention weights and with plain gradient × input.
- Aggregate per word by summing sub-token attributions, since completeness makes sums meaningful.
- Research idea
Propose a follow-up project on attributing an LLM-as-judge score (a single "relevance 0–3" token logit) to spans of the judged passage using IG. State a hypothesis, the minimal experiment, and the result that would falsify it.
What a strong answer covers
- Hypothesis example: judge scores are driven mostly by lexical overlap with the query, not by the passage's answer content.
- Setup: compute IG over passage tokens for the logit of the chosen grade, with a fixed neutral baseline; mark query-term overlaps and gold answer spans.
- Minimal experiment: compare attribution mass on overlap tokens and on answer spans across many judged pairs; then edit passages (remove the answer but keep overlap) and check whether the grade follows the attribution.
- Falsifier: if attribution mass on answer spans dominates and answer-removal edits lower the grade as predicted, the overlap hypothesis is wrong.
- Caveat to address: long inputs and the softmax over grade tokens make IG expensive and the baseline choice matters; report completeness error.