PE: A Poincare Explanation Method for Fast Text Hierarchy Generation
Abstract
The black-box nature of deep learning models in NLP hinders their widespread application. The research focus has shifted to Hierarchical Attribution (HA) for its ability to model feature interactions. Recent works model non-contiguous combinations with a time-costly greedy search in Eculidean spaces, neglecting underlying linguistic information in feature representations. In this work, we introduce a novel method, namely Poincare Explanation (PE), for modeling feature interactions with hyperbolic spaces in a time efficient manner. Specifically, we take building text hierarchies as finding spanning trees in hyperbolic spaces. First we project the embeddings into hyperbolic spaces to elicit inherit semantic and syntax hierarchical structures. Then we propose a simple yet effective strategy to calculate Shapley score. Finally we build the the hierarchy with proving the constructing process in the projected space could be viewed as building a minimum spanning tree and introduce a time efficient building algorithm. Experimental results demonstrate the effectiveness of our approach.
1 Introduction
Deep learning models have been ubiquitous in Natural Language Processing (NLP) areas accompanied by the explosion of the parameters, leading to increased opaqueness. Consequently, a series of interpretability studies have emerged Abnar and Zuidema (2020); Geva et al. (2021); He et al. (2022), among them feature attribution methods stand out owing to fidelity and loyalty axioms and straightforward applicability Guidotti et al. (2018).
Previous feature-based works are limited to single words or phrases Miglani et al. (2020). However, Mardaoui and Garreau (2021) point out that LIME’s Ribeiro et al. (2016) performance on simple models is not plausible 111A figure illustration is provided in Appendix E. To model feature interactions, Hierarchical Attribution (HA) Chen et al. (2020); Ju et al. (2023) has been introduced, with a attribution-then-cluster stage in which constructs feature interaction process by distributing text group scores at different levels222A vivid HA example is provided in Appendix D.. From bottom to the up, HA categorizes all words into different clusters, ending with a tree structure.
However, building feature hierarchies is not a trivial thing. Existing methods have three following problems. P-1: Detecting contiguous text spans to replace all possible interactions Singh et al. (2019); Chen et al. (2020). Only using spans might lose long-range dependencies in text Vaswani et al. (2017). For example, in the positive example “Even in moments of sorrow, certain memories can evoke happiness”, (“Even”, “sorrow”) is vital and non-adjacent. P-2: Current algorithms estimating the importance of feature combinations are accompanied by lengthy optimization processes Ju et al. (2023); Chen et al. (2020). For example, HE Ju et al. (2023) estimates the importance of words using LIME algorithm and then enumerates word combinations to construct the hierarchy, with a cubic time complexity333For convenience of comparison, we ignore the time taken by linear regression in LIME algorithm and detailed discussion is in Section 6.. ASIV Lu et al. (2023) uses directional Shapley value to model the direction of feature interactions, while estimating Shapley value requires exponential time. P-3: Previous methods cannot model the linguistic information including syntax and semantic information. Syntax and semantics can help to construct a hierarchical tree. For syntax, ** et al. (2020) build hierarchies directly on Dependency Parsing Trees (DPT) and compute Pearson Correlation (i.e.). The results in Figure 1 demonstrate syntax could contribute to building explainable hierarchies by reaching a higher correlation. For semantic, we take Figure 2 as an example, the hierarchy in hyperbolic space has already achieved preliminary interpretability with the proximity corresponding the polarity.
As the input text length continues to increase, efficiently modeling the interaction of non-contiguous features has become a key challenge in promoting HA. Building a hierarchical attribution tree based on the input text is essentially a hierarchical clustering problem. The definition is as follows: given words and their pairwise similarities, the goal is to construct a hierarchy over clusters (word groups). PE approaches this problem by following three steps. First, to model linguistic hierarchical information, we project word embeddings into hyperbolic spaces to uncover hidden semantics and syntax structures. Next, inspired by cooperative game theory Owen (2013), we regard words as players and clusters as coalitions and introduce a simple yet effective strategy to estimate the Shapley score contribution. Finally we calculate pairwise similarities and propose an algorithm that conceptualizes the bottom-up clustering process as generating a minimum spanning tree.
Our contributions are summarized as follows:
-
•
We propose a method, PE, using hyperbolic geometry for generating hierarchical explanations, revealing the feature interaction process.
-
•
PE introduces a fast algorithm for generating hierarchical attribution trees that model non-contiguous feature interactions.
-
•
We evaluate the proposed method on three datasets with BERT Devlin et al. (2019), and the results demonstrate the effectiveness.
2 Related Work
Feature importance explanation methods mainly assign attribution scores to features Qiang et al. (2022); Ferrando et al. (2022); Modarressi et al. (2023). Methods can be classified into two categories: single-feature explanation type and multi-feature explanation type.
2.1 Single-Feature Explanation
Earlier researches focus on single feature attribution Ribeiro et al. (2016); Sundararajan et al. (2017); Kokalj et al. (2021). For example, LIME Ribeiro et al. (2016) aims to fit the local area of the model by linear regression with sampled data points ending with linear weights as attribution scores. Gradient&Input (GradInp) Shrikumar et al. (2017b) combines the gradient norm with Shapley value Shapley et al. (1953). Deeplift Shrikumar et al. (2017a) depends on activation difference to calculate attribution scores. IG Sundararajan et al. (2017); Sanyal and Ren (2021); Enguehard (2023) uses path integral to compute the contribution of the single feature to the output. It is noticeable that IG is the unique path method to satisfy the completeness and symmetry-preserving axioms. There exist several variants of IG. DIG Sanyal and Ren (2021) regards similar words as interpolation points to estimate the integrated gradients value. SIG Enguehard (2023) computes the importance of each word in a sentence while kee** all other words fixed. However, scoring individual features is incompatible with interactions between features.
2.2 Multi-Feature Explanation
Multi-feature explanation methods aim to model feature interactions in deep learning architectures. For example, Dhamdhere et al. (2020) proposes a variant of Shapley value to measure the interactions. Zhang et al. (2021a) defines the multivariant Shapley value to analyze interactions between two sets of players. Enouen and Liu (2022) proposes a sparse interaction additive network to select feature groups. Tsang et al. (2020) proposes an Archipelago framework to measure feature attribution and interaction through ArchAttribute and ArchDetect. Lu et al. (2023) proposes ASIV to model asymmetric higher-order feature interactions. To illustrate the feature interplay process completely, the explanation of feature interaction could be articulated within a hierarchical framework. HEDEG Chen et al. (2020) designs a top-down model-agnostic hierarchical explanation method, with neglecting non-contiguous interactions. Ju et al. (2023) addresses the connecting rule limitation in HEDGE, and proposes a greedy algorithm , HE, for generating hierarchical explanations, which is time-costly. And they all neglect lingustice information including syntax and semantics.
3 Background
We first give a review of hyperbolic geometry.
Poincare ball A common representation model in hyperbolic space is the Poincare ball, denoted as , where is a constant greater than . is a Riemannian manifold, and is its metric tensor, is the conformal factor and is the negative curvature of the hyperbolic space. PE uses the standard Poincare ball with . The distance for is:
(1) |
where denotes the Möbius addition. We use to denote the Möbius matrix multiplication. The Möbius addition for , is defined as Demirel (2013):
(2) |
Given a linear projection and , then the Möbius matrix multiplicationis defined as Demirel (2013):
(3) |
Cooperative Game Theory We use to denote a set of players (i.e. token set). A game is a pair and is the characteristic function. A coalition is any subset of . In a cooperative game, players can form coalitions, and each coalition has a value .
4 Methodology
This section provides a detailed introduction to the three parts of PE. First, we need to score each feature; then, based on these scores, we construct a hierarchy. In Section 4.1, we consider semantic and syntax factors. Besides we facilitate feature Shapley contribution calculation in Section 4.2. In Section 4.3, we combine these factors to score each feature and propose a fast algorithm for constructing the hierarchy.
4.1 Poincare Projection
In this paper, we choose Probing Hewitt and Manning (2019) to recover information from embeddings. Namely, we train two matrices to project the Eculidean embeddings to hyperbolic spaces. For a classification task, given a sequence and a trained model , is the sequence length. represents the predicted label, and represents the model’s output probability for the predicted label.
4.1.1 Label Aware Semantic Probing
In this subsection, we extract the semantics from the embeddings through probing. We project the embeddings into a hyperbolic space using a transformation matrix. In this space, the distribution of examples with different semantics will change according to their semantic variations. First, we feed the sequence into a pre-trained language model to obtain the contextualized representations , with denotes the output dim. Next, the sentence embedding is obtained by the hidden representations of the special tag (e.g.[CLS]), which is the first token of the sequence and used for classification tasks. Our probing matrix consists of two types: ( denotes the projection dim) for probing label-aware semantic information and syntax information. For semantics, we can obtain the projected representation:
(4) |
Also we can obtain the token presentation:
(5) |
To train the probing matrices, we draw inspiration from prototype networks Snell et al. (2017), assuming that there exist centroids representing labels in the hyperbolic space. The closer a point is to a centroid, the higher the probability that it belongs to that category. Specifically, instead of using mean pooling to calculate the prototypes, we directly initialize the prototype embeddings in hyperbolic space, denoted as ( is the -th label centroid). Given a distance , the prototypes produce a distribution over classes for a point based on a softmax over distances to prototypes in the embedding space:
(6) |
We minimize the negative log-probability of the true class via RiemannianAdam Kochurov et al. (2017).
4.1.2 Syntax Probing
Similarly, in this subsection, we obtain syntax through probing. The difference is that for syntax, we focus on tokens. In the projected hyperbolic space, the distance of the token embeddings from the origin and the distance between tokens correspond to the depth of the tokens and their distance in the DPT respectively. We project word embeddings first:
(7) |
where . How to parameterize a dependency tree from dense embeddings is non-trivial. Following Hewitt and Manning (2019), we define two metrics to measure the deviation from the standard: using the distance between two words in embedding space to represent the distance of word nodes in the dependency tree, and using the distance of a word from the origin to represent the depth of the word node. We use the following two loss functions:
(8) |
(9) |
where and represent the distance of words and the depth of words respectively. And denotes the distance between and the origin in the projected hyperbolic space.
4.2 Shapley Contribution Estimation
According to cooperative game theory, we regard the input as a set of players , where each element of the set corresponds to a word, and the process of hierarchical clustering is viewed as a game, with clusters containing more than two words considered a coalition. Following Zhang et al. (2021b), we define the characteristic function as . Given a game , a fair payment scheme rewards each player according to its contribution. The Shapley value removes the dependence on ordering by taking the average over all possible orderings for fairness. The Shapley value of player in a game is as follows:
(10) |
where is the set of all permutations of the players, is the set of players preceding player (i.e. token ) in permutation . is the value that the coalition of players can achieve together. In practical, Monte Carlo sampling is used:
(11) |
where denotes the -th permutation in . Unfortunately, Monte Carlo sampling methods can exhibit slow convergence Mitchell et al. (2022).
It is noticeable that attention mechanism of Transformer is permutation invariant Vaswani et al. (2017); Xilong et al. (2023), and the sinusoidal position embedding is only related to the specific position, not to the word. Moreover, after being trained with a Language Modeling task, the model has the ability to fill in the blanks based on context. Therefore, we assume that it is unnecessary to enumerate exponential combinations of words and the contribution of preceding permutation set (e.g.) is included in larger subsequent permutation sets (e.g.). Therefore, we directly calculate contribution as follows:
(12) |
where denotes the player set excluding player and denotes the input excluding token .
4.3 Minimum Spanning Tree
Our goal is to identify a hierarchy tree that aligns with semantic similarities, syntax similarities, and the contributions of individual elements. Building upon Dasgupta (2016), we use the following cost:
(13) |
where denotes the pairwise similarities, is leaves of , which is the subtree rooted at , is the parent node of and as shown in Figure 3. Due to the unfolding dilemma of process, we adopt following expansion by Wang and Wang (2018):
(14) |
where
(15) |
where means the is the descendant of , illustrated in Figure 3. The same for and .
We aim to find the binary tree :
(16) |
Directly optimizing this cost presents a combinatorial optimization problem. We introduce the following decomposition:
(17) |
where .
5 Experiments
5.1 Experimental Setups
Datasets To evaluate the effectiveness of PE, we perform comprehensive experiments on three representative text classification datasets: “Rotten Tomatoes” Pang and Lee (2005), “TREC” Li and Roth (2002), “Yelp” Zhang et al. (2015). Detailed statistics are in Table 1.
Datasets | Train/Dev/Test | C | L |
Rotten Tomatoes | 10K/2K/2K | 2 | 64 |
TREC | 5000/452/500 | 6 | 64 |
Yelp | 10K/2K/1K | 2 | 256 |
Metrics Following prior literature DeYoung et al. (2020), we use AOPC metric, which is the average difference of the change in predicted class probability before and after removing top words.
(18) |
Higher is better. And we evaluate two different strategies: and . Concretely, We assign values to words through the following formula:
(19) |
where is the prototype of predicted label in the semantic hyperbolic space, is the origin in the syntatic hyperbolic space, .
Infrastructures All experiments are processed on one 15 core 2.6GHz CPU (Intel(R) Xeon(R) Platinum 8358P) and one RTX3090 GPU.
Baselines We compare PE with three hierarchical attribution methods: HEDGE Chen et al. (2020), , Ju et al. (2023) and three feature interaction methods: SOC ** et al. (2020), Bivariate Shapley (BS)Masoomi et al. (2022) and ASIV Lu et al. (2023).
Datasets Methods | Rotten Tomatoes | TREC | ||||||||||
Avg | Avg | Avg | Avg | |||||||||
SOC | 0.102 | 0.117 | 0.149 | 0.153 | 0.074 | 0.087 | 0.097 | 0.099 | ||||
HEDGE | 0.087 | 0.134 | 0.084 | 0.194 | 0.068 | 0.079 | 0.095 | 0.101 | ||||
0.075 | 0.195 | 0.076 | 0.193 | 0.063 | 0.072 | 0.059 | 0.066 | |||||
0.062 | 0.117 | 0.061 | 0.119 | 0.081 | 0.092 | 0.075 | 0.086 | |||||
BS | 0.109 | 0.121 | 0.103 | 0.185 | 0.099 | 0.104 | 0.097 | 0.105 | ||||
ASIV | 0.101 | 0.113 | 0.098 | 0.181 | 0.093 | 0.106 | 0.092 | 0.113 | ||||
PE | 0.304 | 0.352 | 0.364 | 0.313 | 0.214 | 0.220 | 0.183 | 0.174 |
Datasets | Yelp | ||||
Methods | |||||
HEDGE | 0.077 | 0.084 | 0.074 | 0.089 | |
0.056 | 0.075 | 0.065 | 0.076 | ||
0.040 | 0.071 | 0.059 | 0.064 | ||
PE | 0.110 | 0.138 | 0.112 | 0.143 |
5.2 General Experimental Results
We first evaluate our method using the AOPC metric across three datasets, as shown in Tables 2 and 3. Firstly, our method, PE, consistently surpasses the baseline in binary and multiclass tasks for both short and long texts. For instance, PE outperforms by 0.235 in Table 2 and by 0.067 in Table 3 of ,, Rotten Tomatoes / Yelp setting. Second, in comparison to recent works such as SOC and , our method’s primary advantage lies in its computation efficiency. We conduct an analysis comparing the average time of various approaches to construct HA trees. The results in Table 3 indicate that PE substantially outperforms its counterparts in terms of speed, being twice as fast as SOC and six times faster than .
5.3 Ablation Study
We conduct ablation experiments with three modified baselines from PE: PE w/o prob corresponding , PE w/o semantic corresponding and PE w/o syntax corresponding .
As shown in Figure 4, both PE and variants outperform w/o prob baselines, demonstrating our approach’s effectiveness in directly calculating contributions in Equation 12. Moreover, we observe that both in and settings, the utility of estimating contribution is more striking than the other two components in Equation 19. The reason may be that context has a greater impact on output than single semantics and syntax. It is noticeable that syntax slightly outperforms semantics, we hypothesis that the reason might be related to the nature of the tasks in the TREC dataset, as the labels tend to associate with syntactic structures Li and Roth (2002).
5.4 Case Study
For qualitative analysis, we present two typical examples from the Rotten Tomatoes dataset to illustrate the role of PE in modeling the interaction of discontinuous features and we show more examples in Appendix B. In the first example, we compare the results of PE and in interpreting BERT model. Figure 5 provides two hierarchical explanation examples for a positive and negative review, each generated by PE and respectively. In Figure 5(a), it can be seen that PE accurately captures the combination of words with positive sentiment polarity: delightful, out, and humor, and captures the key combination of out and humor at step 1. Additionally, this example includes a word with negative polarity: stereotypes, where it can be observed that captures its combination with in and delightful, missing the combination with out and humor. In Figure 5(b), PE captures the combination of slightest and wit in the first phase and complements it with the combination of lacking at step 2. HE captures the combination of combination and animation at step 1, and it adds lacking at step 2. We can infer that PE is able to capture the feature combination more related to the label at a shallow level, which demonstrates the effectiveness of our method.
Additionally, to more vividly demonstrate the role of semantics and syntax in building hierarchical explanations, we illustrate with two examples from the TREC dataset. As shown in Figure 6(a), when , at the level , PE combines center, temperature, the, earth together. However, when , PE combines the, temperature, the, earth together. In the dependency parse tree of the sentence what is the temperature of the center of the earth, the distance to root is greater than center. This indicates that incorporating syntactic information is meaningful for constructing convincing hierarchical explanations.
6 Analysis of Time Complexity
In this section, we delve into the time complexity associated with HA methods, which can be divided into two parts: the complexity of generating attribution scores, denoted as , and the complexity of generating the hierarchy from the scores, denoted as . As shown in Table 4, we elaborate on the time complexity of various methods. For score computation, HEDGE utilizes the Monte Carlo sampling algorithm, with the number of samples denoted by , leading to a time complexity of . uses the LOO algorithm Lipton (2018), with a time complexity of , where is the maximum number of iterations of the LOO algorithm. method employs the LIME algorithm, with ridge regression solving complexity of , and is the number of sampled instances. The time complexity of PE for solving scores is .
7 Conclusion
In this paper, we introduce PE, a computationally efficient method employing hyperbolic geometry for modeling feature interactions. More concretely, we use two hyperbolic projection matrices to embed the semantic and syntax information and devise a simple strategy to estimate the contributions of feature groups. Finally we design an algorithm to decode the hierarchical tree in an time complexity. Based on the experimental results of three typical text classification datasets, we demonstrate the effectiveness of our method.
8 Limitations
The limitations of our work include: 1) Although our method boasts low time complexity, the use of the probing method to train additional model parameters, including two Poincare projection matrices, somewhat limits the generalizability of our approach. 2) In our experiments, we decompose the weights of the edges of the HA tree according to Equation 17. Whether there exists a optimal decomposition formula remains for future investigation.
References
- Abnar and Zuidema (2020) Samira Abnar and Willem Zuidema. 2020. Quantifying attention flow in transformers. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics.
- Chen et al. (2020) Hanjie Chen, Guangtao Zheng, and Yangfeng Ji. 2020. Generating hierarchical explanations on text classification via feature interaction detection. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics.
- Dasgupta (2016) Sanjoy Dasgupta. 2016. A cost function for similarity-based hierarchical clustering. In Proceedings of the Forty-Eighth Annual ACM Symposium on Theory of Computing.
- Demirel (2013) Oğuzhan Demirel. 2013. A characterization of möbius transformations by use of hyperbolic triangles. Journal of Mathematical Analysis and Applications.
- Devlin et al. (2019) Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In NAACL2018.
- DeYoung et al. (2020) Jay DeYoung, Sarthak Jain, Nazneen Fatema Rajani, Eric Lehman, Caiming Xiong, Richard Socher, and Byron C. Wallace. 2020. ERASER: A benchmark to evaluate rationalized NLP models. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics.
- Dhamdhere et al. (2020) Kedar Dhamdhere, Ashish Agarwal, and Mukund Sundararajan. 2020. The shapley taylor interaction index. In Proceedings of the 37th International Conference on Machine Learning.
- Enguehard (2023) Joseph Enguehard. 2023. Sequential integrated gradients: a simple but effective method for explaining language models. In Findings of the Association for Computational Linguistics: ACL 2023.
- Enouen and Liu (2022) James Enouen and Yan Liu. 2022. Sparse interaction additive networks via feature interaction detection and sparse selection. In Advances in Neural Information Processing Systems.
- Ferrando et al. (2022) Javier Ferrando, Gerard I. Gállego, and Marta R. Costa-jussà. 2022. Measuring the mixing of contextual information in the transformer. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing.
- Geva et al. (2021) Mor Geva, Roei Schuster, Jonathan Berant, and Omer Levy. 2021. Transformer feed-forward layers are key-value memories. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing.
- Graham and Hell (1985) Ronald L Graham and Pavol Hell. 1985. On the history of the minimum spanning tree problem. Annals of the History of Computing.
- Guidotti et al. (2018) Riccardo Guidotti, Anna Monreale, Salvatore Ruggieri, Franco Turini, Fosca Giannotti, and Dino Pedreschi. 2018. A survey of methods for explaining black box models.
- He et al. (2022) Junxian He, Chunting Zhou, Xuezhe Ma, Taylor Berg-Kirkpatrick, and Graham Neubig. 2022. Towards a unified view of parameter-efficient transfer learning. In International Conference on Learning Representations.
- Hewitt and Manning (2019) John Hewitt and Christopher D. Manning. 2019. A structural probe for finding syntax in word representations. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers).
- Honnibal and Montani (2017) Matthew Honnibal and Ines Montani. 2017. spaCy 2: Natural language understanding with Bloom embeddings, convolutional neural networks and incremental parsing. To appear.
- ** et al. (2020) Xisen **, Zhongyu Wei, Junyi Du, Xiangyang Xue, and Xiang Ren. 2020. Towards hierarchical importance attribution: Explaining compositional semantics for neural sequence models. In International Conference on Learning Representations.
- Ju et al. (2023) Yiming Ju, Yuanzhe Zhang, Kang Liu, and Jun Zhao. 2023. A hierarchical explanation generation method based on feature interaction detection. In Findings of the Association for Computational Linguistics: ACL 2023.
- Kochurov et al. (2017) Max Kochurov, Rasul Karimov, and Serge Kozlukov. 2017. Geoopt: Riemannian optimization in pytorch. In International Conference on Machine Learning, GRLB Workshop.
- Kokalj et al. (2021) Enja Kokalj, Blaž Škrlj, Nada Lavrač, Senja Pollak, and Marko Robnik-Šikonja. 2021. BERT meets shapley: Extending SHAP explanations to transformer-based classifiers. In Proceedings of the EACL Hackashop on News Media Content Analysis and Automated Report Generation.
- Li and Roth (2002) Xin Li and Dan Roth. 2002. Learning question classifiers. In COLING 2002: The 19th International Conference on Computational Linguistics.
- Lipton (2018) Zachary C. Lipton. 2018. The mythos of model interpretability: In machine learning, the concept of interpretability is both important and slippery. Queue.
- Lu et al. (2023) Xiaolei Lu, Jianghong Ma, and Haode Zhang. 2023. Asymmetric feature interaction for interpreting model predictions. In Findings of the Association for Computational Linguistics: ACL 2023.
- Mardaoui and Garreau (2021) Dina Mardaoui and Damien Garreau. 2021. An analysis of lime for text data. In Proceedings of The 24th International Conference on Artificial Intelligence and Statistics.
- Masoomi et al. (2022) Aria Masoomi, Davin Hill, Zhonghui Xu, Craig P Hersh, Edwin K. Silverman, Peter J. Castaldi, Stratis Ioannidis, and Jennifer Dy. 2022. Explanations of black-box models based on directional feature interactions. In International Conference on Learning Representations.
- Miglani et al. (2020) Vivek Miglani, Narine Kokhlikyan, Bilal Alsallakh, Miguel Martin, and Orion Reblitz-Richardson. 2020. Investigating saturation effects in integrated gradients. Human Interpretability Workshop at ICML.
- Mitchell et al. (2022) Rory Mitchell, Joshua Cooper, Eibe Frank, and Geoffrey Holmes. 2022. Sampling permutations for shapley value estimation. J. Mach. Learn. Res.
- Modarressi et al. (2023) Ali Modarressi, Mohsen Fayyaz, Ehsan Aghazadeh, Yadollah Yaghoobzadeh, and Mohammad Taher Pilehvar. 2023. DecompX: Explaining transformers decisions by propagating token decomposition. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).
- Owen (2013) Guillermo Owen. 2013. Game theory. Emerald Group Publishing.
- Pang and Lee (2005) Bo Pang and Lillian Lee. 2005. Seeing stars: Exploiting class relationships for sentiment categorization with respect to rating scales. In Proceedings of the 43rd Annual Meeting of the Association for Computational Linguistics (ACL’05).
- Qiang et al. (2022) Yao Qiang, Deng Pan, Chengyin Li, Xin Li, Rhongho Jang, and Dongxiao Zhu. 2022. Attcat: Explaining transformers via attentive class activation tokens. In Advances in Neural Information Processing Systems.
- Ribeiro et al. (2016) Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. 2016. "why should i trust you?": Explaining the predictions of any classifier. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining.
- Sanyal and Ren (2021) Soumya Sanyal and Xiang Ren. 2021. Discretized integrated gradients for explaining language models. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing.
- Shapley et al. (1953) Lloyd S Shapley et al. 1953. A value for n-person games.
- Shrikumar et al. (2017a) Avanti Shrikumar, Peyton Greenside, and Anshul Kundaje. 2017a. Learning important features through propagating activation differences. In Proceedings of the 34th International Conference on Machine Learning - Volume 70.
- Shrikumar et al. (2017b) Avanti Shrikumar, Peyton Greenside, Anna Shcherbina, and Anshul Kundaje. 2017b. Not just a black box: Learning important features through propagating activation differences.
- Singh et al. (2019) Chandan Singh, W. James Murdoch, and Bin Yu. 2019. Hierarchical interpretations for neural network predictions. In International Conference on Learning Representations.
- Snell et al. (2017) Jake Snell, Kevin Swersky, and RichardS. Zemel. 2017. Prototypical networks for few-shot learning. In Neural Information Processing Systems,Neural Information Processing Systems.
- Sundararajan et al. (2017) Mukund Sundararajan, Ankur Taly, and Qiqi Yan. 2017. Axiomatic attribution for deep networks. In International conference on machine learning.
- Tsang et al. (2020) Michael Tsang, Sirisha Rambhatla, and Yan Liu. 2020. How does this interaction affect me? interpretable attribution for feature interactions. In Advances in Neural Information Processing Systems.
- Vaswani et al. (2017) Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Łukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In NIPS2017.
- Wang and Wang (2018) Dingkang Wang and Yusu Wang. 2018. An improved cost function for hierarchical cluster trees.
- Xilong et al. (2023) Zhang Xilong, Liu Ruochen, Liu **, and Liang Xuefeng. 2023. Interpreting positional information in perspective of word order. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).
- Zhang et al. (2021a) Die Zhang, Hao Zhang, Huilin Zhou, Xiaoyi Bao, Da Huo, Ruizhao Chen, Xu Cheng, Mengyue Wu, and Quanshi Zhang. 2021a. Building interpretable interaction trees for deep nlp models.
- Zhang et al. (2021b) Die Zhang, Hao Zhang, Huilin Zhou, Xiaoyi Bao, Da Huo, Ruizhao Chen, Xu Cheng, Mengyue Wu, and Quanshi Zhang. 2021b. Building interpretable interaction trees for deep nlp models. Proceedings of the AAAI Conference on Artificial Intelligence.
- Zhang et al. (2015) Xiang Zhang, Junbo Zhao, and Yann LeCun. 2015. Character-level convolutional networks for text classification. In Advances in Neural Information Processing Systems.
Appendix A Proof
First, we prove that the conclusion holds for , and we generalize to the case of using induction.
Notation Due to the specificity of the binary tree we are solving for, a unique candidate tree can correspond to a node permutation . For a tree with leaves, we define as the corresponding permutation.
We denote the constructed permutation and prefix permutation in Algorithm 1.
Base Case We here start the discussion from the left case in Figure 10. The cost can be expanded into:
(20) |
Notice that is smallest among , , and among , , , only one will hold true. We can conclude that is the solution that minimizes the cost.
Induction Step We assume that the tree corresponding to the permutation has the smallest cost. To prove that is also the smallest. We use a proof by contradiction to demonstrate that corresponds to the tree with the smallest cost. We define the tree’s level as in Figure 10. Firstly, we introduce the following lemma:
Lemma We denote the -th step permutation produced in Algorithm 1 as , and its corresponding tree cost as . Now, if we swap the nodes at level and , , and the resulting sequence , then .
Proof.
We consider the cost after the swap as three parts: the triples that do not include and , the part of the triples that include and the part that include , denoted as , and . For ease of proof, we denote the sequence to the left of as , and the sequence between and as . Obviously remains unchanged, as for , before and after the swap:
(21) |
(22) |
By subtracting, we obtain:
(23) |
Similarly we obtain:
(24) |
Now we prove that is smallest. If is not the smallest, then the node at the last level can be the smallest by swap** with a previous node. There are two cases: when the swapped node is from the first level (e.g. ), in this case, the difference in cost before and after the swap becomes:
(25) |
where , . Similarly, when the swapped node is located in other levels, the cost after the swap will not decrease. This means that in cannot be smaller through swap** other leaves from different levels, thus is smallest.
The primary difference is that the edge weights in our graph Graham and Hell (1985) are not all known in advance but are dynamically generated.
Appendix B Visualization
Appendix C Implementation Details
In this work, all language models are implemented by Transformers. All our experiments are performed on one A800. The results are reported with 5 random seeds.
For fine tuning the projection matrix , we iterate 5 epochs using RiemanianAdam optimizer and learning rate is initialized as 1e-3, the batch size is 32. For fine tuning the projection matrix , we use the Penn Treebank dataset we iterate 40 epochs using Adam optimizer and learning rate is initialized as 1e-3. We set as 64. We use grid search to search .