Inferensys

Glossary

FullGrad

An attribution method that satisfies completeness by aggregating the gradient of the output with respect to both the input features and the biases at every layer of the network.
Data engineer managing feature store on laptop, feature definitions visible, casual data engineering session.
COMPLETENESS-DRIVEN ATTRIBUTION

What is FullGrad?

FullGrad is a feature attribution method that satisfies the completeness axiom by aggregating the gradient of the model's output with respect to both the input features and the biases at every layer of the network.

FullGrad is an axiomatic attribution method that decomposes a neural network's prediction into a sum of feature-wise importance scores by aggregating two distinct gradient signals: the gradient of the output with respect to the input pixels and the gradient with respect to the bias parameters at every layer. This dual-pathway approach ensures that the sum of all attributed scores exactly equals the model's output difference from a zero baseline, strictly satisfying the completeness axiom.

By incorporating bias gradients, FullGrad captures the importance of features that influence the network through additive, non-multiplicative pathways—information that standard input-gradient methods like Saliency Maps or Integrated Gradients inherently miss. The final attribution map is constructed by element-wise multiplying the input with its gradient and summing this with the spatially upsampled bias contributions from all intermediate layers, producing a dense, full-resolution explanation that accounts for the entire signal flow through the network.

COMPLETENESS THROUGH BIAS GRADIENTS

Key Features of FullGrad

FullGrad is an attribution method that satisfies the completeness axiom by aggregating gradients with respect to both input features and the bias parameters at every layer of a neural network, providing a mathematically complete decomposition of the output.

01

Completeness via Bias Aggregation

FullGrad satisfies the completeness axiom by decomposing the model output into a sum of contributions from the input and all intermediate bias terms. Unlike input-gradient-only methods, FullGrad captures the additive bias contributions at each neuron, ensuring that the sum of all attributions exactly equals the model's prediction difference from a zero baseline. This eliminates the missing attribution problem found in methods like vanilla saliency maps.

02

FullGrad Decomposition Formula

The FullGrad attribution for an input x is computed as:

  • Input contribution: (x ⊙ ∇ₓf(x)) — element-wise product of input and input gradient
  • Bias contributions: ∇_b f(x) · b for every bias parameter b across all layers
  • Total attribution: Sum of input contribution and all bias contributions

This formulation ensures that every parameter with a gradient contributes to the explanation, not just the input layer.

03

Bias as a Structural Prior

FullGrad leverages the bias parameters inherent in most neural network architectures as a structural prior for attribution. Since biases represent learned offsets that shift neuron activations independently of inputs, their gradients capture the model's input-independent reasoning. This is particularly important for networks with batch normalization, where the beta parameter serves an analogous role to bias and must be included in the FullGrad decomposition.

04

Comparison with Integrated Gradients

While both FullGrad and Integrated Gradients satisfy completeness, they differ fundamentally:

  • Integrated Gradients: Requires a baseline input and interpolates along a path, accumulating input gradients
  • FullGrad: Requires no baseline; instead aggregates bias gradients across all layers
  • Computational cost: FullGrad requires a single backward pass, while Integrated Gradients typically needs 20–300 forward/backward passes
  • Axiom satisfaction: FullGrad satisfies completeness, sensitivity, and linearity without needing a baseline choice
05

Implementation in PyTorch

A FullGrad implementation requires capturing gradients with respect to both inputs and all bias parameters:

  • Use torch.autograd.grad with retain_graph=True to compute gradients for each parameter group
  • Register hooks on bias parameters and batch normalization layers to extract ∇_b f(x)
  • For Conv2D layers, the bias gradient is spatially broadcast to match the feature map dimensions
  • The final saliency map is the sum of the input-gradient product and all spatially resized bias-gradient products
06

Sanity Check Evaluations

FullGrad passes critical sanity checks that many attribution methods fail:

  • Model parameter randomization test: FullGrad attributions change significantly when model weights are randomized, confirming sensitivity to learned parameters
  • Data randomization test: Attributions differ when trained on shuffled labels, proving dependence on true data-label relationships
  • Cascading randomization: FullGrad remains sensitive even when layers are randomized sequentially from top to bottom, unlike Guided Backpropagation which fails this test
COMPLETENESS AND BIAS SENSITIVITY COMPARISON

FullGrad vs. Other Attribution Methods

A feature-level comparison of FullGrad against other gradient-based and perturbation-based attribution methods, evaluating their adherence to the completeness axiom, bias sensitivity, and computational requirements.

FeatureFullGradIntegrated GradientsGrad-CAM

Satisfies Completeness Axiom

Captures Bias Contributions

Requires Baseline Input

Gradient-Dependent

Layer-Specific Attribution

Computational Cost

1 backward pass

20-300 forward passes

1 backward pass

Applicable to Non-CNN Architectures

Output Resolution

Input pixel-level

Input pixel-level

Coarse heatmap

FULLGRAD EXPLAINED

Frequently Asked Questions

Concise answers to the most common technical questions about the FullGrad attribution method, its completeness property, and how it differs from other gradient-based explanation techniques.

FullGrad is a feature attribution method that satisfies the completeness axiom by aggregating the gradient of the model's output with respect to both the input features and the biases at every layer of a neural network. Unlike standard input-gradient methods that only compute the partial derivative with respect to the raw input pixels, FullGrad captures the contribution of every network parameter. It works by performing a forward pass to cache the bias terms and intermediate feature maps, then a backward pass to compute the gradient of the output with respect to the input and each bias. The final attribution map is the sum of the input-gradient multiplied element-wise by the input, plus the bias-gradients broadcast and summed across their corresponding spatial locations. This ensures that the sum of all attribution scores exactly equals the model's output difference from a zero baseline, providing a theoretically complete decomposition of the prediction.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.