Flow-based Attribution in Graphical Models: A Recursive Shapley Approach

Raghav Singal, George Michailidis, Hoiyi Ng

Introduction: The Need for Flow-Based Attribution

In Explainable AI (XAI) and causal inference, understanding how changes in input variables (source nodes) affect the final output (sink node) is crucial. Standard approaches, such as the classic Shapley Value, are primarily "node-based." They might reveal that a specific feature is responsible for 40% of an output change, but they treat the underlying model as a black box, completely ignoring the internal pathways that route this influence.

To truly understand complex systems like neural networks or causal graphs, we need "flow-based" or edge-based attribution to see how effects propagate through intermediate variables. While existing flow-based methods (like Layer-wise Relevance Propagation or DeepSHAP) exist, they are often model-specific or violate critical axioms like implementation invariance—meaning two models computing the exact same mathematical function might yield different attributions simply because their internal wiring differs.

This paper introduces the Recursive Shapley Value (RSV), a mathematically rigorous, model-agnostic, and axiomatically sound method for tracing effect propagation through any Directed Acyclic Graph (DAG).

The Recursive Shapley Value (RSV) Method

RSV operates on a "top-down" principle to track how influence flows through complex network structures. It breaks the attribution process down into three core steps:

  1. Source Attribution: It first attributes the total change in the output to the exogenous source nodes (the initial inputs).
  2. Recursive Games: It then flows this attribution down the DAG. At every single node, RSV sets up a local cooperative game to decide how to split the attribution the node just received among its outgoing edges.
  3. Counterfactual Characteristic Functions: The "players" in these local games are the outgoing edges. To determine an edge's contribution, RSV asks a counterfactual question: "How much attribution would this node have received if this specific outgoing edge were inactive (i.e., blocked from transmitting updated values)?"
Illustration of recursive games and counterfactual edge blocking in RSV.

By computing the Shapley value for these local games at every node, RSV recursively distributes the exact total effect from the inputs down to the final output. Unlike backpropagation-based methods that rely on ad-hoc chain rules, RSV's sequence of games naturally conserves flow.

Key Insights and Axiomatic Foundations

RSV is not just a heuristic; it is mathematically proven to be the unique solution that satisfies four core flow-based axioms:

  • Flow Conservation: The flow into a node equals the flow out.
  • Flow Symmetry: Equivalent edges receive equal flow.
  • Flow Nullity: Redundant edges get zero flow.
  • Flow Linearity: Attributions scale linearly with combinations of games.

Crucially, RSV is implementation invariant. If you refactor a model's internal equations but keep the overall input-output mapping identical, RSV will still assign the exact same attribution to the source nodes. Furthermore, because it tracks edge flows, RSV unlocks robust non-linear mediation analysis, allowing researchers to easily separate direct effects from indirect effects.

Simulating Causal Unfairness

To demonstrate RSV's utility, the authors evaluate the method using synthetic graphical models, specifically focusing on a "causal unfairness" simulation. This scenario models college admissions involving sensitive attributes, test scores, and department choices.

Complex Directed Acyclic Graph (DAG) used for the causal unfairness simulation.

In this simulation, RSV successfully quantified "unresolved discrimination." It accurately split the influence of a sensitive attribute into a "fair channel" (e.g., applying to a less competitive department) and an "unfair channel" (e.g., unreported insider referrals).

As the mathematical weight of the unfair influence parameter was increased from 0 to 6, RSV correctly showed the attribution flowing through the unfair channel increasing proportionally. When the unfair channel was neutralized entirely, RSV correctly assigned it exactly 0 attribution, perfectly demonstrating the flow nullity axiom in practice.

Limitations and Future Work

While theoretically robust, the current RSV framework assumes the relationships between nodes are deterministic. Extending this to handle stochasticity (e.g., via structural equations with errors) is a key next step. Additionally, computing Shapley values recursively across a large graph is notoriously computationally expensive. The runtime and scalability of RSV in massive networks, such as deep Large Language Models (LLMs), remain an open question for future research.

Summary updated

BibTeX
@inproceedings{singal2021flow,
  author = {Raghav Singal and George Michailidis and Hoiyi Ng},
  title = {{Flow-based Attribution in Graphical Models: A Recursive Shapley Approach}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
}
Figure