SlowGuess/NAACL_2021_OCR huggingface dataset:
Wen Xiao, Patrick Huber, Giuseppe Carenini
{xiaowen3, huberpat, carenini}@cs.ubc.ca
Previous work indicates that discourse information benefits summarization. In this paper, we explore whether this synergy between discourse and summarization is bidirectional, by inferring document-level discourse trees from pre-trained neural summarizers. In particular, we generate unlabeled RST-style discourse trees from the self-attention matrices of the transformer model. Experiments across models and datasets reveal that the summarizer learns both, dependency- and constituency-style discourse information, which is typically encoded in a single head, covering long- and short-distance discourse dependencies. Overall, the experimental results suggest that the learned discourse information is general and transferable inter-domain<sup>1</sup>.
Extractive summarization is a common and important task within the area of Natural Language Processing (NLP), which can be useful in a multitude of diverse real-life scenarios. Current extractive summarizers typically use exclusively neural approaches, in which the importance of extracted units (i.e., sentences or clauses) and relationship between them are learned by the model from a large amount of data (e.g., Liu and Lapata (2019b)).
Inspired by previous work in pre-neural times, indicating that discourse information, especially discourse trees according to the Rhetorical Structure Theory (RST) (Mann and Thompson, 1988), can benefit the summarization task (Marcu, 1999), several very recent neural summarizers have tried to explicitly encode discourse information to support summarization. Overall, it seems that adding these encodings, consistent with pre-neural results, is beneficial. In particular, injecting discourse has been shown to either improve performance
on the extractive summarization task itself (Xu et al., 2020), or allow for a substantial reduction in the number of the summarizer's parameters, while keeping competitive performance (Xiao et al., 2020).
The central hypothesis we are exploring in this paper is whether the synergy between discourse parsing and summarization is bidirectional. In other words, we examine if summarization is a useful auxiliary task to infer discourse structures. Liu et al. (2019b) performed a preliminary investigation of this conjecture, showing that structural information can be inferred from attention mechanisms while training a neural model on auxiliary tasks. However, they did not perform any comparison against ground-truth discourse trees. Further, recent work showed that discourse trees implicitly induced during training are oftentimes trivial and shallow, not representing valid discourse structures (Ferracane et al., 2019).
In this paper, we address these limitations by explicitly exploring the relationship between summarization and discourse parsing through the inference of document-level discourse trees from pretrained summarization models, comparing the results against ground-truth RST discourse trees. Besides Liu et al. (2019b), our idea and approach are inspired by recent works on extracting syntactic trees from pre-trained language models (Wu et al., 2020) or machine translation approaches (Raganato and Tiedemann, 2018), as well as previous work on knowledge graph construction from pre-trained language models (Wang et al., 2020). Specifically, we generate full RST-style discourse trees from self-attention matrices of a pre-trained transformer-based summarization model. We use three different tree-aggregation approaches (CKY (Jurafsky and Martin, 2014), Eisner (Eisner, 1996) and CLE (Chu and Liu, 1965; Edmonds, 1967)), generating a set of constituency and dependency trees representing diverse discourse-related attributes.
The code can be found in https://github.com/Wendy-Xiao/summ-guided_disco_parser
Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 4139-4152, June 6-11, 2021. ©2021 Association for Computational Linguistics
Our proposal is thereby addressing one of the key limitations in discourse parsing, namely the lack of large training corpora. We aim to overcome this limitation by generating a large number of reasonable quality discourse trees from a pre-trained summarization model, similar in spirit to what Huber and Carenini (2020) did with sentiment. Admittedly, the discourse information captured with our approach is summarization task-specific, however, our generated discourse treebank can be combined with further task-dependent treebanks (e.g. from sentiment) to train more powerful discourse parsers in a multitask framework.
Generally speaking, the ability to infer discourse trees as a "by-product" of the summarization task can also be seen as a form of unsupervised discourse parsing, where instead of leveraging pretrained language models like in Kobayashi et al. (2019), we exploit a pre-trained neural summarizer.
We empirically evaluate our method on three datasets with human RST-style annotations, covering different text genres. Multiple experiments show that the summarization model learns discourse information implicitly, and that more dependency information are captured, compared to structural (i.e., constituency) signals. Interestingly, an additional exploration of the attention matrices of individual heads suggests that, for all models, most of the discourse information is concentrated in a single head, and the best performing head is consistent across all datasets. We further find that the dependency information learned in the attention matrix covers long distance discourse dependencies. Overall, the results are consistent across datasets and models, indicating that the discourse information learned by the summarizer is general and transferable inter-domain.
Rhetorical Structure Theory (RST) (Mann and Thompson, 1988) is one of the most popular theories of discourse, postulating that a document can be represented as a constituency tree, where leaves are clause-like Elementary Discourse Units (EDUs), and internal nodes combine their respective children by aggregating them into a single, joint constituent. Each internal node also has a nuclearity attribute $^2$ , representing the local importance of their direct child-nodes in the parent context from the set of {Nucleus-Nucleus,
Nucleus-Satellite, Satellite-Nucleus}. "Nucleus" child-nodes thereby generally play a more important role when compared to a "Satellite" child-node. Although standard RST discourse trees are encoded as constituency trees, they can be converted into dependency trees with near isomorphic transformations. In this work, we infer both, constituency and dependency trees.
Over the past decades, RST discourse parsing has been mainly focusing on supervised models, typically trained and tested within the same domain using human annotated discourse treebanks, such as RST-DT (Carlson et al., 2002), Instruction-DT (Subba and Di Eugenio, 2009) or GUM (Zeldes, 2017). The intra-domain performance of these supervised models has consistently improved, with a mix of traditional models by Joty et al. (2015) and Wang et al. (2017), and neural models (Yu et al., 2018) reaching state-of-the-art (SOTA) results. Yet, these approaches do not generalize well inter-domain (Huber and Carenini, 2020), likely due to the limited amount of available training data.
Huber and Carenini (2019) recently tackled this data-sparsity issue through automatically generated discourse structures from distant supervision, showing that sentiment information can be used to infer discourse trees. Improving on their initial results, Huber and Carenini (2020) published a large-scale, distantly supervised discourse corpus (MEGA-DT), showing that a parser trained on such treebank delivers SOTA performance on the more general inter-domain discourse parsing task. In this paper, we also tackle the data sparsity problem in discourse parsing, however, using a significantly different approach. First, instead of relying on sentiment, we leverage the task of extractive summarization. Second, instead of a method for distant supervision, we propose an unsupervised approach.
The area of unsupervised RST-style discourse parsing has been mostly underlooked in the past, with recent neural approaches either taking advantage of pre-trained language models to predict discourse (Kobayashi et al., 2019) or using pre-trained syntactic parsers and linguistic knowledge (Nishida and Nakayama, 2020) to infer discourse trees in an unsupervised manner. Similarly, our proposal only relies on a pre-trained neural summarization model to generate discourse trees.
Recent neural summarization models are typically based on transformers (Liu and Lapata, 2019a; Zhang et al., 2019). One advantage of these mod
2In this paper we do not consider rhetorical relations.
els is that they learn the relationship between input units explicitly using the dot-product self-attention, which allows for some degree of exploration of the inner working of these complex and distributed models. Here, we investigate if the attention matrices of a transformer-based summarizer effectively capture discourse information (i.e., how strongly EDUs are related) and therefore can be used to derive discourse trees for arbitrary documents.
Marcu (1999) pioneered the idea to directly apply RST-style discourse parsing to extractive summarization, and empirically showed that RST discourse information can benefit the summarization task, by simply extracting EDUs along the nucleus path. This initial success was followed by further work on leveraging discourse parsing in summarization, including McDonald (2007), Hirao et al. (2013), and Kikuchi et al. (2014). More recently, the benefits of discourse for summarization have also been confirmed for neural summarizers, e.g. in Xiao and Carenini (2019) and Cohen et al. (2018), using the structure of scientific papers (i.e. sections), and in Xu et al. (2020), successfully incorporating RST-style discourse and co-reference information in the BERTSUM summarizer (Liu and Lapata, 2019b).
In contrast to previous approaches demonstrating how discourse can enhance summarization performance, we have recently shown that discourse enables the specification of simpler neural summarizers, without affecting their performance (Xiao et al., 2020). In particular, by using a fixed discourse-based attention they achieve competitive results compared to learnable dot-product self-attention mechanisms, as used in the original transformer model. Inspired by these findings, suggesting that transformer-based summarization models learn effective discourse representations, we explore if useful discourse structures can be inferred from learnt transformer self-attention weights.
Admittedly, Liu and Lapata (2018) and Liu et al. (2019b) presented preliminary work on inferring discourse structures from attention mechanisms, while training a neural model on auxiliary tasks, like text classification and summarization. However, they did not perform any comparison against ground-truth discourse trees as we do here. More importantly, we employ a more explicit approach to infer discourse structures, not as part of the learning process, but extracting the structures after the summarization model is completely trained and
applied to new documents.
While our focus is on discourse, extracting syntactic constituency and dependency trees from transformer-based models has been recently attempted in both, machine translation and language modelling. In machine translation, Mareček and Rosa (2019) and Raganato and Tiedemann (2018) show that trained translation models can capture syntactic information within their attention heads, using the CKY and CLE algorithms, respectively. In pre-trained language models, Wu et al. (2020) propose a parameter-free probing method to construct syntactic dependency trees based on a pretrained BERT model, only briefly elaborating on possible applications to discourse. In contrast to our work, they do not directly use attention heads, but instead build an impact matrix based on the distance between token representations. Furthermore, while their BERT-based model cannot deal with long sequences, our two-level encoder can effectively deal with sequences of any length, which is critical in discourse.
Our main goal is to show the ability of a previously trained summarization model to be directly applied to the task of RST-style discourse parsing. Along this line, we explore the relationship between information learned by the transformer-based summarizer and the task of discourse parsing. We leverage the synergies between units learned in the transformer model by following Xiao et al. (2020), previously proposing the use of a transformer document-encoder on top of a pretrained BERT EDU encoder. This standard summarization model is presented in Figure 1 (left). In the transformer-based document encoder, each head internally contains a self-attention matrix, learned during the training of the summarization model, representing the relationship between EDUs (Figure 1 (center)). In this paper, we analyze these learned self-attention matrices, not only to confirm our intuition that they contain relevant discourse information, but also to computationally exploit such information for discourse parsing. We therefore generate a set of different (constituency/dependency) discourse trees from the self-attention matrices, focusing on different attributes of discourse, as shown in Figure 1 (right). Our generated constituency trees only reveal the discourse tree structure without additional nucle
Figure 1: The pipeline of our whole method.
arity and relation attributes. More interestingly, we complement the constituency interpretation of the self-attention by additionally inferring a dependency tree, also partially guided by discourse structures, but mostly driven by the RST nuclearity attribute, which is shown to be more related to the summarization task where the importance of the different text spans is critical (Hirao et al., 2013). We present and discuss the different parsing algorithms to extract discourse information from the self-attention matrix next.
3.2 Parsing Algorithms
Formally, for an input document  $D = \{u_{1},..,u_{n}\}$  with  $n$  EDUs, each attention head returns an attention matrix  $A \in \mathbf{R}^{n \times n}$  where entry  $A_{ij}$  contains a score measuring how much the  $i$ -th EDU relies on the  $j$ -th EDU. Given those bidirectional scores defining the relationship between every two EDUs in a document, we build a tree such that EDU pairs with higher reciprocal attention scores are more closely associated in the resulting tree. In the constituency case, this means that EDUs with higher mutual attention should belong to sub-trees on lower levels of the tree, while in the dependency case this implies that the path between such EDUs should contain less intermediate nodes. In essence, these requirements can be formalized as searching for the tree within the set of possible trees, which maximizes a combined score.
3.2.1 Constituency Tree (C-Tree) Parsing
To generate a constituency tree from the attention matrix, we follow a large body of previous work in discourse parsing (e.g., Joty et al. (2015)), where constituency discourse trees are generated using the CKY algorithm (Jurafsky and Martin, 2014). Specifically, we fill a  $n \times n$  matrix  $P \in \mathbf{R}^{n \times n}$  generating the optimal tree in bottom-up fashion using
the dynamic programming approach according to:
$$
P _ {i j} = \left\{ \begin{array}{l l} 0, & i > j \\ \sum_ {k = 1} ^ {n} (A _ {k i}), & i = j \\ \max _ {k = i} ^ {j - 1} (P _ {i k} + P _ {(k + 1) j} \\ \quad + \mathrm {a v g} (A _ {i: k, (k + 1): j}) \\ \quad + \mathrm {a v g} (A _ {(k + 1): j, i: k})) / 2, & i <   j \end{array} \right.
$$
where  $P_{ij}$  with  $i = j$  contains the overall importance of EDU  $i$ , computed as the attention paid by others to unit  $i$ .  $P_{ij}$  with  $i < j$  represents the score of the optimal sub-tree spanning from EDU  $i$  to EDU  $j$ . We select the best combination of sub-trees  $k$ , such that the sum of the left subtree spanning  $[i : k]$  and the right one spanning  $[(k + 1) : j]$ , along with the average score of connections between the two sub-trees is maximized.
Figure 2: Example of CKY constituency parsing.
A34	A35
A43	A45
A53	A54
For example, to pick the structure of the sub-tree spanning EDUs  $[3:5]$  (see Fig. 2), we need to decide between the potential sub-tree aggregation of  $((34)5)$  and  $(3(45))$ . The respective scores are computed based on the scores in green and blue blocks in both the CKY and the Attention Matrices. Following this algorithm, two sub-trees with a high attention score between them tend to be combined on lower levels of the tree, indicating they are more related in the discourse tree.
Besides the standard CKY algorithm described
Figure 3: Chu-Liu-Edmonds Algorithm with sentence constraints
above, we also explore a hierarchical CKY approach with sentence and paragraph constraints. Specifically, we do not aggregate  $P_{ij}$  if the span  $[i:j]$  crosses a sentences boundary where either sentence is incomplete. In the previous example, if  $EDU_3$  and  $EDU_4$  were in the same sentence, even if the score of the blue aggregation candidate was higher, we would choose the green sub-tree aggregation. Plausibly, this hierarchical approach will perform better, since the ground-truth treebanks mostly contain sentences and paragraphs that are covered by a complete discourse sub-trees.
3.2.2 Dependency Tree (D-Tree) Parsing
For the dependency tree generation, we use the Eisner (Eisner, 1996) and Chu-Liu-Edmonds algorithm (Chu and Liu, 1965; Edmonds, 1967) to generate projective and non-projective dependency trees, respectively<sup>3</sup>. First, we convert the attention matrix  $A$  into a fully connected graph  $G = (N, E)$ , where  $N$  contains all the EDUs, and  $e_{ij}$ , indicating how much the  $i$ -th EDU influences the  $j$ -th EDU, corresponds to  $A_{ji}$ , which is the attention that the  $j$ -th EDU pays to the  $i$ -th EDU. Based on this graph, we apply the following algorithms:
Eisner Algorithm: We apply this dynamic programming algorithm to generate projective dependency trees. Thereby, we build a matrix  $P \in \mathbf{R}^{n \times n \times 2 \times 2}$ , in which the first and second dimen
sions contain the start and end indexes of sub-trees, similar to the CKY algorithm; while the third and fourth dimensions indicate whether the head is the start or the end unit, and whether the sub-tree is completed. As done for constituency parsing, we also use a hierarchical version of Eisner's algorithm, in which we restrict inter-sentence connections for incomplete sentence trees. Since the Eisner algorithm can only generate projective dependency trees, it will be inaccurate for documents with a non-projective discourse structure.
Chu-Liu-Edmonds (CLE) Algorithm: Originally proposed as a recursive approach to find the maximum spanning tree of a graph given its root, CLE can generate non-projective trees. In the unconstrained case, we simply follow the standard CLE algorithm, selecting the EDU with the highest importance score, computed similar to Sec. 3.2.1, i.e.  $root = \operatorname{argmax}_i \sum_{k=1}^n (A_{ki})$ , as the root. From there, the algorithm selects the "optimal edges", i.e. the maximum in-edges for each node except the root, breaking the cycles recursively.
Again, as we did for CKY and Eisner, we also apply the additional sentence constraint. Unlike for the dynamic programming approaches, which build the trees in a bottom-up fashion and can directly be constrained to avoid cross-sentence aggregations of incomplete sentences, we need to substantially modify CLE to allow for sentence constraints.
In particular, we first build a sentence graph  $G^{s} = \{N^{s}, E^{s}\}$  from the EDU graph (Figure 3
3"Mixed" approaches, dealing with mildly non-projective trees (Kuhlmann and Nivre, 2006), are left for future work.
(b)), in which  $e_{SD}^{s} = \mathrm{avg}_{s\in S,d\in D}e_{sd}$ , and record the maximum edge corresponding to the edge between sentences, i.e.  $\operatorname{argmax}_{s\in S,d\in D}e_{sd}$ . After that, we use the CLE algorithm within the sentence containing the root EDU as the root sentence to find the maximum spanning tree in  $G^{s}$  (Figure 3 (c)). We then add the corresponding EDU edges to the final tree (Figure 3 (d)). For example, the edge  $(s_0,s_1)$  in  $G^{s}$  corresponds to the EDU edge  $(e_0,e_2)$  in  $G$ . Next, we treat nodes with incoming edges from other sentences as the root of the sentence itself and run the CLE algorithm within each sentence (Figure 3 (e)). The final tree (Figure 3 (f)) is eventually formed as the combination of inter-sentence edges derived in sentence graph  $G_{s}$  and intra-sentence edges found within each sentence.
4.1 The Summarization Task
In order to show the generality of the discourse structures learned in the summarization model, we train our summarizer across a variety of datasets and hyper-parameter settings. More specifically, we train on two separate, widely-used news corpora - CNN Daily Mail (CNNDM) (Nallapati et al., 2016) and NYT (Sandhaus, 2008) -, as well as under three hyper-parameter settings with different numbers of layers and attention heads: (a) A simple model with 2 layers and a single head. (b) 6 layers with 8 heads each, proposed in the original transformer model(Vaswani et al., 2017). (c) 2 layers with 8 heads each, constituting a middle ground between the previous two settings. By considering two corpora (CNNDM and NYT) and the three settings, we train six models, which we call: CNNDM-2-1, CNNDM-6-8, CNNDM-2-8, NYT-2-1, NYT-6-8, NYT-2-8 $^4$ .
4.2 Discourse Datasets
The quality of the attention-generated trees is assessed on three discourse datasets (see Table 1).
RST-DT is the largest and most frequently used RST-style discourse treebank (Carlson et al., 2002), containing news articles from the Wall Street Journal. Since this is the genre of both our summarization training corpora, the experiments testing on this dataset are intra-domain.
Instruction-DT contains documents in the home-repair instructions domain (Subba and Di Eugenio, 2009). We categorize the experiments on
this dataset as cross-domain.
GUM contains documents from eight domains including news, interviews, academic papers and more (Zeldes, 2017). Since the GUM corpus is multi-domain, the performance on this dataset will reveal the generalizability of generated trees in a broader sense.
Dataset	#Docs	#EDU/doc	#Sent/doc	#words/doc
RST-DT	385	56.6	22.5	549
Instruction	176	32.7	19.5	318
GUM	127	107	45	874
Table 1: Key RST-style discourse dataset dimensions.
All three discourse datasets contain ground-truth RST-style constituency trees. While all corpora contain potential non-binary sub-trees, Instruction-DT also includes multi-root documents. To account for these cases, we apply the right-branching binarization following Huber and Carenini (2019). Furthermore, we convert constituency trees with nuclearity into ground truth dependency trees using the algorithm proposed in Li et al. (2014).
To evaluate how well the generated trees align with ground-truth trees, we use RST Parseval Scores for constituency trees and Unlabeled Attachment Score for dependency trees, measuring the ratio of matched spans and the ratio of matched dependency relations, respectively.
For each model configuration, we run a set of experiments using the average attention matrix across all heads in a layer, i.e.  $A_{avg} = \sum_h A^h / H$ , with  $H$  as the number of heads. This initial setup is intended to provide insights into the discourse information learned in each layer.