Inferensys

Glossary

Integrated Hessians

An extension of Integrated Gradients that uses the second-order Hessian matrix to capture feature interactions and curvature, providing a more complete attribution for non-linear models.
Data engineer managing feature store on laptop, feature definitions visible, casual data engineering session.
Second-Order Attribution

What is Integrated Hessians?

Integrated Hessians extends the axiomatic Integrated Gradients method to the second order, capturing feature interactions and model curvature for a more complete attribution.

Integrated Hessians is an attribution method that explains a neural network's prediction by decomposing it into both first-order feature effects and second-order feature interactions. While Integrated Gradients captures the independent contribution of each feature, Integrated Hessians uses the Hessian matrix—the gradient of the gradient—to quantify how pairs of features jointly influence the output, satisfying a higher-order completeness axiom.

The method integrates the Hessian along a straight-line path from a baseline input to the actual input, ensuring implementation invariance. This reveals non-linear interaction effects that first-order methods miss, such as the synergistic relationship between two pixels in an image or two words in a sentence, providing a more faithful decomposition of a deep model's complex decision surface.

SECOND-ORDER ATTRIBUTION

Key Features of Integrated Hessians

Integrated Hessians extends Integrated Gradients by incorporating the Hessian matrix to capture feature interactions and curvature, providing a more complete attribution for highly non-linear models.

01

Second-Order Interaction Capture

Unlike first-order methods that assume independent features, Integrated Hessians explicitly models feature interactions by integrating the Hessian matrix along the path from baseline to input.

  • Captures pairwise interactions between features that first-order methods miss
  • Essential for models where features combine non-additively (e.g., XOR patterns)
  • Decomposes the model output into main effects and interaction effects
  • Provides a complete functional decomposition satisfying the completeness axiom
02

Mathematical Foundation

The method computes attributions by integrating both the gradient (first derivative) and the Hessian (second derivative) along a straight-line path.

  • Path integral: ∫ (∇f + H·(x - x')) dα from α=0 to α=1
  • The Hessian matrix H captures local curvature and feature coupling
  • Interaction between features i and j is quantified by the off-diagonal Hessian entries ∂²f/∂xᵢ∂xⱼ
  • Satisfies the completeness axiom: sum of all attributions equals f(x) - f(baseline)
03

Interaction Completeness

Integrated Hessians provides a full decomposition of the model output into individual feature contributions and all pairwise interaction terms.

  • Main effects: Attributions for individual features acting alone
  • Interaction effects: Attributions for pairs of features acting jointly
  • The sum of all main and interaction effects exactly reconstructs the output difference
  • Enables auditing of synergistic and antagonistic feature relationships
  • Critical for domains like genomics where gene-gene interactions drive outcomes
04

Comparison to Integrated Gradients

While Integrated Gradients provides only first-order attributions, Integrated Hessians reveals the full interaction structure.

  • Integrated Gradients: Captures main effects only; assumes feature independence
  • Integrated Hessians: Captures main effects + all pairwise interactions
  • Trade-off: Higher computational cost due to Hessian computation (O(n²) vs O(n))
  • Use Integrated Gradients for quick feature ranking; use Integrated Hessians when interactions matter
  • Both methods share the same axiomatic properties (completeness, sensitivity, implementation invariance)
05

Implementation Considerations

Computing the full Hessian for high-dimensional inputs is computationally expensive, requiring optimization strategies.

  • Hessian-vector products avoid materializing the full n×n matrix
  • Use stochastic sampling along the integration path to reduce computation
  • Leverage automatic differentiation frameworks (PyTorch, JAX) for efficient second-order gradients
  • Sparsity assumptions: Often only top-k interactions are practically significant
  • Approximation techniques like Hessian diagonal can trade accuracy for speed
06

Practical Applications

Integrated Hessians is particularly valuable in domains where feature interactions drive predictions.

  • Healthcare: Identifying drug-drug interactions and gene-environment effects
  • Finance: Modeling non-linear interactions between market factors in risk models
  • NLP: Understanding how word pairs jointly influence sentiment or entailment
  • Computer vision: Explaining how image regions interact to form object representations
  • Scientific ML: Validating that models learn known physical interaction laws
INTEGRATED HESSIANS

Frequently Asked Questions

Explore the mechanics and applications of Integrated Hessians, a second-order attribution method that captures feature interactions and curvature in deep neural networks.

Integrated Hessians is a second-order feature attribution method that extends Integrated Gradients to capture feature interactions and the curvature of a model's decision boundary. While first-order methods like Integrated Gradients decompose a prediction into the independent contributions of individual features, Integrated Hessians decomposes the prediction into both main effects and pairwise interaction terms.

It works by computing the Hessian matrix—the matrix of second-order partial derivatives of the model's output with respect to the input—and integrating it along a straight-line path from a baseline input to the actual input. The diagonal elements of this integrated Hessian represent the main effects (analogous to Integrated Gradients), while the off-diagonal elements quantify how pairs of features interact to influence the prediction. This provides a complete decomposition of the model's output, satisfying the completeness axiom by accounting for all first-order and second-order contributions.

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.