Introduction
Deep Neural Networks (DNNs) have revolutionized Natural Language Processing (NLP), yet they remain largely "black boxes." While standard attribution methods can identify which words contribute most to a prediction, they often fail to capture the complex interplay between words—how they cooperate or conflict to form a final sentiment or grammatical judgment. This research introduces a post-hoc method to visualize these relationships through Interaction Trees, providing a window into the internal logic of diverse models like BERT, LSTMs, and CNNs.
Quantifying Interactions via Shapley Values
The foundation of this approach is the concept of Interaction Benefit ($B$), derived from game-theoretic Shapley values. In this framework, words in a sentence are treated as players in a cooperative game. The interaction benefit between two constituents is defined as the difference between their joint contribution to the model's output and the sum of their individual contributions.
A positive $B$ indicates a cooperative relationship (e.g., "not" and "bad" combining to create a positive sentiment), while a negative $B$ suggests an adversarial or conflicting relationship. This metric allows for a rigorous quantification of how multi-word structures influence model decisions without requiring changes to the model's architecture.
Constructing the Interaction Tree
Using the Interaction Benefit, the researchers build a binary tree from the bottom up. Starting with individual words as leaves, the algorithm greedily merges adjacent words or constituents that exhibit the highest "interaction density." This process continues until the entire sentence is represented by a single root node.
Unlike traditional syntactic parsers, this method is entirely model-driven. It does not assume human linguistic rules but instead uncovers the specific hierarchical logic the model has learned during training. This allows researchers to diagnose the "density of modeled interactions" (what the tree captures) versus "unmodeled interactions" (what the structure misses).
Empirical Analysis and Key Insights
The authors evaluated their method on standard benchmarks, including the Stanford Sentiment Treebank (SST-2) and the Corpus of Linguistic Acceptability (CoLA). Several key insights emerged:
- Divergence from Human Syntax: A striking discovery was that the interaction trees generated for models like BERT often differ significantly from human-defined syntactic trees (such as those from the Berkeley Neural Parser). This suggests that DNNs develop their own internal "logic" for processing language that is effective but non-intuitive to humans.
- Task-Specific Logic: The structure of the tree is highly dependent on the task. For sentiment analysis (SST-2), models tend to merge emotional word clusters early. For linguistic acceptability (CoLA), they prioritize noun phrase structures.
- Synthetic Validation: On a custom AND-OR dataset with ground-truth hierarchical interactions, the method achieved a recall of 97.77%, proving it can accurately extract known structures.
Reliability and Model Complexity
Because calculating exact Shapley values is computationally expensive (NP-hard), the authors employ a sampling-based approximation. They demonstrate that the resulting trees become stable and accurate with approximately 1,000 samples.
As shown in the stability analysis, BERT exhibits significantly higher instability and error in Shapley value estimation compared to simpler models like LSTMs or CNNs. This indicates that BERT encodes much more complex, high-order interactions, requiring greater computational effort to explain its decision-making process reliably.
Conclusion
Interaction Trees provide a powerful, post-hoc tool for interpreting any trained NLP model without sacrificing performance. By revealing that deep models often bypass traditional linguistic syntax in favor of their own internal hierarchies, this work highlights the need for model-specific explanation tools. Future research will focus on reducing the computational cost of Shapley sampling and extending the method to sub-word or character-level interactions for even more granular analysis.
Summary updated