Towards Understanding Large-Scale Discourse Structures in Pre-Trained and Fine-Tuned Language Models
Abstract
With a growing number of BERTology works analyzing different components of pre-trained language models, we extend this line of research through an in-depth analysis of discourse information in pre-trained and finetuned language models.
We move beyond prior work along three dimensions:
First, we describe a novel approach to infer discourse structures from arbitrarily long documents.
Second, we propose a new type of analysis to explore where and how accurately intrinsic discourse is captured in the BERT and BART models.
Finally, we assess how similar the generated structures are to a variety of baselines as well as their distributions within and between models.
Introduction
Transformer-based machine learning models are an integral part of many recent improvements in
Natural Language Processing (NLP).
With their rise spearheaded by Vaswani et al.
(2017), the pre-training/fine-tuning paradigm has gradually replaced previous approaches based on architecture engineering, with transformer models such as
BERT (Devlin et al., 2019), BART (Lewis et al., 2020), RoBERTa (Liu et al., 2019) and others delivering state-of-the-art performance on a wide variety of tasks.
Besides their strong empirical results on most real-world problems, such as summarization (Zhang et al., 2020; Xiao et al., 2021a), questionanswering (Joshi et al., 2020; O˘guz et al., 2021) and sentiment analysis (Adhikari et al., 2019; Yang et al., 2019), uncovering what kind of linguistic knowledge is captured by this new type of pretrained language models (PLMs) has become a prominent question by itself.
As part of this line of research, called BERTology (Rogers et al., 2020), researchers explore the amount of linguistic understanding encapsulated in PLMs, exposed through either external probing tasks (Raganato and Tiedemann, 2018; Zhu et al., 2020;
Koto et al., 2021a) or unsupervised methods (Wu et al., 2020; Pandia et al., 2021). Previous work thereby either focuses on analyzing the syntactic structures (e.g., Hewitt and Manning (2019);
Wu et al. , relations (Papanikolaou et al., 2019), ontologies (Michael et al., 2020) or, to a more limited extend, discourse related behaviour (Zhu et al., 2020;
Koto et al., 2021a; Pandia et al., 2021).
Generally speaking, while most previous
BERTology works has focused on either sentence level phenomena or connections between adjacent sentences, large-scale semantic and pragmatic structures (oftentimes represented as discourse trees or graphs) have been less explored.
These structures (e.g., discourse trees) play a fundamental role in expressing the intent of multi-sentential documents and, not surprisingly, have been shown to benefit many NLP tasks such as summarization (Gerani et al., 2019), sentiment analysis (Bhatia et al., 2015; Nejat et al., 2017; Hogenboom et al., 2015) and text classification (Ji and Smith, 2017).
With multiple different theories for discourse proposed in the past, the RST discourse theory (Mann and Thompson, 1988) and the lexicalized discourse grammar (Webber et al., 2003) (underlying PDTB (Prasad et al., 2008)) have received most attention.
While both theories propose tree-like structures, the PDTB framework postulates partial trees up to the between-sentence level, while RST-style discourse structures consist of a single rooted tree covering whole documents, comprising of: (1) The tree structure, combining clause-like sentence fragments (Elementary Discourse Units, short: EDUs) into a discourse constituency tree, (2) Nuclearity, assigning every tree-branch primary ( Nucleus ) or peripheral ( Satellite ) importance in a local context and (3) Relations, defining the type of connection holding between siblings in the tree.
Given the importance of large-scale discourse structures, we extend the area of BERTology research with novel insights regarding the amount of intrinsic discourse information captured in established PLMs.
More specifically, we aim to better understand to what extend RST-style discourse information is stored as latent trees in encoder selfattention matrices 1 .
While we focus on the RST formalism in this work, our presented methods are theory-agnostic and, hence, applicable to discourse structures in a broader sense, including other treebased theories, such as the lexicalized discourse grammar.
Our contributions in this paper are:
(1) A novel approach to extract discourse information from arbitrarily long documents with standard transformer models, inherently limited by their input size.
This is a non-trivial issue, which has been mostly by-passed in previous work through the use of proxy tasks like connective prediction, relation classification, sentence ordering, EDU segmentation, cloze story tests and others.
An exploration of discourse information locality across pre-trained and fine-tuned language models, finding that discourse structures are consistently captured in a fixed subset of self-attention heads.
(3) An in-depth analysis of the discourse quality in pre-trained language models and their fine-tuned extensions.
We compare constituency and dependency structures of 2 PLMs fine-tuned on 4 tasks and 7 fine-tuning datasets to gold-standard discourse trees, finding that the captured discourse structures outperform simple baselines by a large margin, even showing superior performance compared to distantly supervised models.
(4) A similarity analysis between PLM inferred discourse trees and supervised, distantly supervised and simple baselines.
We reveal that PLM constituency discourse trees do align relatively well with previously proposed supervised models, but also capture complementary information.
(5) A detailed look at information redundancy in self-attention heads to better understand the structural overlap between self-attention matrices and models.
Our results indicate that similar discourse information is consistently captured in the same heads, even across fine-tuning tasks.
Related Work
At the base of our work are two of the most popular and frequently used PLMs: BERT (Devlin et al., 2019) and BART (Lewis et al., 2020).
We choose these two popular approaches in our study due to their complementary nature (encoder-only vs. encoder-decoder) and based on previous work by Zhu et al.
(2020) and Koto et al.
(2021a), showing the effectiveness of BERT and BART models for discourse related tasks.
Our work is further related to the field of discourse parsing.
With a rich history of traditional machine learning models (e.g., Hernault et al.
; Ji and Eisenstein (2014)
; Joty et al. (2015);
Wang et al.
(2017) , inter alia ), recent approaches slowly shifted to successfully incorporate a variety of PLMs into the process of discourse prediction, such as ELMo embeddings (Kobayashi et al., 2019),
XLNet (Nguyen et al., 2021), BERT (Koto et al., 2021b), RoBERTa (Guz et al., 2020) and SpanBERT (Guz and Carenini, 2020).
Despite these works showing the usefulness of PLMs for discourse parsing, all of them cast the task into a “local" problem, using only partial information through the shift-reduce framework (Guz et al., 2020; Guz and Carenini, 2020), natural document breaks (e.g. paragraphs Kobayashi et al. (2020)) or by framing the task as an inter-EDU sequence labelling problem on partial documents (Koto et al., 2021b).
However, we believe that the true benefit of discourse information emerges when complete documents are considered, leading us to propose a new approach to connect PLMs and discourse structures in a “global” manner, superseding the local proxy-tasks with a new methodology to explore arbitrarily long documents.
Aiming to better understand what information is captured in PLMs, the line of BERTology research has recently emerged (Rogers et al., 2020), with early work mostly focusing on the syntactic capacity of PLMs (Hewitt and Manning, 2019;
Jawahar et al., 2019; Kim et al., 2020), in parts also exploring the internal workings of transformerbased models (e.g., self-attention matrices (Raganato and Tiedemann, 2018; Mareˇcek and Rosa, 2019)).
More recent work started to explore the alignment of PLMs with discourse information, encoding semantic and pragmatic knowledge.
Along those lines, Wu et al.
(2020) present a parameterfree probing task for both, syntax and discourse.
With their tree inference approach being computationally expensive and limited to the exploration of the outputs of the BERT model, we significantly extend this line of research by exploring the internal self-attention matrices of PLMs with a more computationally feasible approach.
More tradi- tionally, Zhu et al.
(2020) use 24 hand-crafted rhetorical features to execute three different supervised probing tasks, showing promising performance of the BERT model.
Similarly, Pandia et al.
(2021) aim to infer pragmatics through the prediction of discourse connectives by analyzing the model inputs and outputs and Koto et al.
(2021a) analyze discourse in seven PLMs through seven supervised probing tasks, finding that BART and BERT contain most information related to discourse.
In contrast to the approach taken by both Zhu et al.
(2020) and Koto et al.
(2021a), we use an unsupervised methodology to test the amount of discourse information stored in PLMs (which can also conveniently be used to infer discourse structures for new and unseen documents) and extend the work by Pandia et al.
(2021) by taking a closer look at the internal workings of the selfattention component.
Looking at prior work analyzing the amount of discourse information in PLMs, structures are solely explored through the use of proxy tasks, such as connective prediction (Pandia et al., 2021), relation classification (Kurfalı and Östling, 2021), and others (Koto et al., 2021a).
However, despite the difficulties of encoding arbitrarily long documents, we believe that to systematically explore the relationship between PLMs and discourse, considering complete documents is imperative.
Along these lines, recent work started to tackle the inherent input-length limitation of general transformer models through additional recurrence in the Transformer-XL model (Dai et al., 2019), compression modules (Rae et al., 2020) or sparse patterns (e.g., as in the Reformer (Kitaev et al., 2020), BigBird (Zaheer et al., 2020), and
Longformer (Beltagy et al., 2020) models).
While all these approaches to extend the maximum document length of transformer-based models are important to create more globally inspired models, the document-length limitation is still practically and theoretically in place, with models being limited to a fixed number of pre-defined tokens the model can process.
Furthermore, with many proposed systems still based on more established PLMs (e.g., BERT) and with no single dominant solution for the general problem of the input length-limitation yet, we believe that even with the restriction being actively tackled, an in-depth analysis of traditional PLMs with discourse is highly valuable to establish a solid understanding of the amount of semantic and pragmatic information captured.
Besides the described BERTology work, we got encouraged to explore fine-tuned extensions of standard PLMs through previous work showing the benefit of discourse parsing for many downstream tasks, such as summarization (Gerani et al., 2019), sentiment analysis (Bhatia et al., 2015; Nejat et al., 2017; Hogenboom et al., 2015) and text classification (Ji and Smith, 2017).
Conversely, we recently showed promising results when inferring discourse structures from related downstream tasks, such as sentiment analysis (Huber and Carenini, 2020) and summarization (Xiao et al., 2021b).
Given this bidirectional synergy between discourse and the mentioned downstream tasks, we move beyond traditional experiments focusing on standard PLMs and additionally explore discourse structures of PLMs fine-tuned on a variety of auxiliary tasks.
Discourse Extraction Method
With PLMs rather well analyzed according to their syntactic capabilities, large-scale discourse structures have been less explored.
One reason for this is the input length constraint of transformer models.
While this is generally not prohibitive for intra- sentence syntactic structures (e.g., presented in Wu et al.
, it does heavily influence large-scale discourse structures, operating on complete (potentially long) documents.
Overcoming this limitation is non-trivial, since traditional transformer-based models only allow for fixed, short inputs.
Aiming to systematically explore the ability of PLMs to capture discourse, we investigate a novel way to effectively extract discourse structures from the self-attention component of the BERT and
BART models.
We thereby extend our previously proposed tree-generation methodology (Xiao et al., 2021b) to support the input length constraints of standard PLMs using a sliding-window approach in combination with matrix frequency normalization and an EDU aggregation method. Figure 1 visualizes the complete process on a small scale example with 3 EDUs and 7 sub-word embeddings.
we previously proposed in Xiao et al.
(2021b) explores a twostage approach to obtain discourse structures from a transformer model, by-passing the input-length constraint.
Using the intuition that the selfattention score between any two EDUs is an indicator of their semantic/pragmatic relatedness, influencing their distance in a projective discourse tree, they use the CKY dynamic programming approach (Jurafsky and Martin, 2014) to generate constituency trees based on the internal selfattention of the transformer model.
To generate dependency trees, we apply the same intuition used to infer discourse trees with the Eisner algorithm (Eisner, 1996).
Since we explore the discourse information captured in standard PLMs, we can’t directly transfer our two-stage approach in Xiao et al.
(2021b)
, first encoding individual EDUs using BERT and subsequently feeding the dense representations into a fixed-size transformer model.
Instead, we propose a new method to overcome the length-limitation of the transformer model 2 .
The Sliding-Window Approach is at the core of our new methodology to overcome the inputlength constraint.
We first tokenize arbitrarily long documents with n EDUs E = { e 1 , ..., e n } into the respective sequence of m sub-word tokens T
= { t 1 , ...t m } with n ≪ m , according to the PLM tokenization method (WordPiece for BERT, BytePair-Encoding for BART), as show at the top of
Figure 1.
Using the sliding window approach, we subdivide the m sub-word tokens into sequences of maximum input length t max , defined by the PLM ( t max = 512 for BERT, t max = 1024 for BART).
Using a stride of 1 , we generate ( m − t max ) +sliding windows W , feed them into the PLM, and extract the resulting t max × t max partial square selfattention matrices ( M P in Figure 1) for a specific self-attention head 3 .
The Frequency Normalization Method allows us to combine the partially overlapping selfattention matrices M P into a single document-level matrix M D of size m × m .
To this end, we combine multiple overlapping windows, generated due to the stride size of 1 , by adding up the self-attention cells, while keeping track of the number of overlaps in a separate m × m frequency matrix M F .
We then divide M D by the frequency matrix M F , to generate a frequency normalized self-attention matrix M A (see bottom of Figure 1).
The EDU Aggregation is the final processing step to obtain the document-level self-attention matrix.
In this step, the m sub-word tokens
T = { t 1 , ...t m } are aggregated back into n EDUs
E = { e 1 , ..., e n } by computing the average bidirectional self-attention score between any two EDUs in M A .
For example, in Figure 1, we aggregate the scores in cells M A [0:1 , 5:6] to compute the final output of cell [0 , 2] (purple matrix in Figure 1) and M A [5:6 , 0:1] to generate the value of cell [0 , 2] .
This way, we obtain the average bidirectional selfattention scores between EDU 1 and EDU 3 .
We use the resulting n × n matrix as the input to the
CKY/Eisner discourse tree generation methods.
Experimental Setup 4. Pre-Trained Models
We select the BERT-base ( 110 million parameters) and BART-large ( 406 million parameters) models for our experiments.
We choose these models for their diverse objectives (encoder-only vs. encoderdecoder), popularity for diverse fine-tuning tasks, and their prior successful exploration in regards to discourse information (Zhu et al., 2020;
Koto et al., 2021a).
For the BART-large model, we limit our analysis to the encoder, as motivated in Koto et al.
(2021a), leaving experiments with the decoder and cross-attention for future work.
[Table]
along with the underlying tasks and domains.
4. Fine-Tuning Tasks and Datasets
We explore the BERT model fine-tuned on two classification tasks, namely sentiment analysis and natural language inference (NLI).
For our analysis on BART, we select the abstractive summarization and question answering tasks.
Table 1 summarizes the 7 datasets used to fine-tune PLMs in this work, along with their underlying tasks and domains 4 .
4. Evaluation Treebanks
RST-DT (Carlson et al., 2002) is the largest English RST-style discourse treebank, containing
Wall-Street-Journal articles, annotated with full constituency discourse trees.
To generate additional dependency trees, we apply the conversion algorithm proposed in Li et al.
GUM (Zeldes, 2017) is a steadily growing treebank of richly annotated texts.
In the current version 7 . 3 , the dataset contains 168 documents from 12 genres, annotated with full RST-style constituency and dependency discourse trees.
All evaluations shown in this paper are executed on the 38 and 20 documents in the RST-DT and
GUM test-sets, to be comparable with previous baselines and supervised models.
A similarly-sized validation-set is used where mentioned to determine the best performing self-attention head.
4. Baselines and Evaluation Metrics
Simple Baselines: We compare the inferred constituency trees against right- and left-branching structures.
For dependency trees, we evaluate against simple chain and inverse chain structures.
Distantly Supervised Baselines: We compare our results obtained in this paper against our previous approach presented in Xiao et al.
(2021b), using similar CKY and Eisner tree-generation methods to infer constituency and dependency tree structures [Figure] from a summarization model trained on the CNNDM and New York Times (NYT) corpora (referred to as Sum CNN-DM and Sum NYT ) 5 .
Supervised Baseline: We select the popular TwoStage discourse parser (Wang et al., 2017) as our supervised baseline, due to its strong performance, available model checkpoints and code 6 , as well as the traditional architecture.
We use the published
Two-Stage parser checkpoint on RST-DT (from here on called Two-Stage RST-DT ) and re-train the discourse parser on GUM ( Two-Stage GUM ).
We convert the generated constituency structures into dependency trees following Li et al.
Evaluation Metrics: We apply the original parseval score to compare discourse constituency structures with gold-standard treebanks, as argued in
Morey et al.
To evaluate the generated dependency structures, we use the Unlabeled Attachment Score (UAS).
Experimental Results 5. Discourse Locality
Our discourse tree generation approach described in section 3 directly uses self-attention matrices to generate discourse trees.
The standard BERT model contains 144 of those self-attention matrices ( 12 layers, 12 self-attention heads each), all of which potentially encode discourse structures.
For the BART model, this number is even higher, consisting of 12 layers with 16 self-attention heads each.
With prior work suggesting the locality of discourse information in PLMs (e.g., Raganato and
Tiedemann (2018); Mareˇcek and Rosa (2019); Xiao et al.
(2021b))
, we analyze every self-attention matrix individually to gain a better understanding of their alignment with discourse information.
Besides investigating standard PLMs, we also explore the robustness of discourse information across fine-tuning tasks.
We believe that this is an important step to better understand if the captured discourse information is general and robust, or if it is “re-learned” from scratch for downstream tasks.
To the best of our knowledge, no previous analysis of this kind has been performed in the literature.
To this end, Figure 2 shows the constituency and dependency structure overlap of the generated discourse trees from individual self-attention heads with the gold-standard tree structures of the GUM dataset 7 .
The heatmaps clearly show that constituency discourse structures are mostly captured in higher layers, while dependency structures are more evenly distributed across layers.
Comparing the patterns between models, we find that, despite being fine-tuned on different downstream tasks, the discourse information is consistently encoded in the same self-attention heads.
Even though the best performing self-attention matrix is not consistent, discourse information is clearly captured in a “local" subset of self-attention heads across all presented fine-tuning tasks.
This plausibly suggests that the discourse information in pre-trained BERT and BART models is robust and general, requiring only minor adjustments depending on the fine-tuning task.
5. Discourse Quality
We now focus on assessing the discourse information captured in the single best-performing selfattention head.
In Table 2, we compare the discourse structure quality of pre-trained and finetuned PLMs in the context of supervised models, distantly supervised approaches and simple baselines. We show the oracle-picked best head on the test-set, analyzing the upper-bound for the poten-
[Table]
tial performance of PLMs on RST-style discourse structures. This is not a realistic scenario, as the best performing head is generally not known apriori. Hence, we also explore the performance using a small-scale validation set to pick the bestperforming self-attention matrix. In this more realistic scenario for discourse parsing, we find that scores on average drop by 1 . 55 points for BERT and 1 .
33% for BART compared to the oraclepicked performance of a single self-attention matrix.
We show detailed results of this degradation in
Appendix C 8 .
Our results in Table 2 are separated into three sub-tables, showing the results for BERT,
BART and baseline models on the RST-DT and
GUM treebanks, respectively.
In the BERT and BART sub-table, we further annotate each performance with ↑ , • , ↓ , indicating the relative performance to the standard pre-trained model as supe- rior, equal, or inferior.
Taking a look at the top sub-table (BERT) we find that, as expected, the randomly initialized transformer model achieves the worst performance.
Fine-tuned models perform equal or worse than the standard PLM.
Despite the inferior results of the fine-tuned models, the drop is rather small, with the sentiment analysis models consistently outperforming NLI.
This seems reasonable, given that the sentiment analysis objective is intuitively more aligned with discourse structures (e.g., long-form reviews with potentially complex rhetorical structures) than the between-sentence NLI task, not involving multi-sentential text.
In the center sub-table (BART), a different trend emerges.
While the worst performing model is still (as expected) the randomly initialized system, finetuned models mostly outperform the standard PLM.
Interestingly, the model fine-tuned on the CNNDM corpus consistently outperforms the BART baseline, while the XSUM model performs better on all but the GUM dependency structure evaluation.
On one hand, the superior performance of both summarization models on the RST-DT dataset seems reasonable, given that the fine-tuning datasets and the evaluation treebank are both in the news domain.
The strong results of the CNN-DM model on the GUM treebank, yet inferior performance of XSUM, potentially hints towards dependency discourse structures being less prominent when fine-tuning on the extreme summarization task, compared to the longer summaries in the
CNN-DM corpus.
The question-answering task evaluated through the SQuAD fine-tuned model underperforms the standard PLM on GUM, however reaches superior performance on RST-DT.
Since the SQuAD corpus is a subset of Wikipedia articles, more aligned with news articles than the 12 genres in GUM, we believe the stronger performance on
RST-DT (i.e., news articles) is again reasonable, yet shows weaker generalization capabilities across domains (i.e., on the GUM corpus).
Interestingly, the question-answering task seems more aligned with dependency than constituency trees, in line with what would be expected from a factoid-style question-answering model, focusing on important entities, rather than global constituency structures.
Directly comparing the BERT and BART models, the former performs better on three out of four metrics.
At the same time, fine-tuning hurts the performance for BERT, however, improves BART models.
Plausibly, these seemingly unintuitive results may be caused by the following co-occurring circumstances: (1) The inferior performance of
BART can potentially be attributed to the decoder component capturing parts of the discourse structures, as well as the larger number of self-attention heads “diluting” the discourse information.
The different trends regarding fine-tuned models might be directly influenced by the input-length limitation to 512 (BERT) and 1024 (BART) subword tokens during the fine-tuning stage, hampering the ability to capture long-distance semantic and pragmatic relationships.
This, in turn, limits the amount of discourse information captured, even for document-level datasets (e.g., Yelp, CNN-DM,
SQuAD).
With this restriction being more prominent in BERT, it potentially explains the comparably low performance of the fine-tuned models.
Finally, the bottom sub-table puts our results in the context of previously proposed supervised and distantly-supervised models, as well as simple baselines.
Compared to simple right- and leftbranching trees (Span), the PLM-based models reach clearly superior performance.
Looking at the chain/inverse chain structures (UAS), the improvements are generally lower, however, the vast majority still outperforms the baseline.
Comparing the first two sub-tables against completely supervised methods (Two-Stage RST-DT , Two-Stage GUM ), the BERT- and BART-based models are, unsurprisingly, inferior.
Lastly, compared to the distantly supervised Sum CNN-DM and Sum NYT models, the
PLM-based discourse performance shows clear improvements over the 6-layer, 8-head standard transformer. [Figure]
5. Discourse Similarity
Further exploring what kind of discourse information is captured in the PLM self-attention matrices, we directly compare the emergent discourse structures with trees inferred from existing discourse parsers and simple baselines.
This way, we aim to better understand if the information encapsulated in PLMs is complementary to existing methods, or if the PLMs solely capture trivial discourse phenomena and simple biases (e.g., resemble rightbranching constituency trees).
Since the GUM dataset contains a more diverse set of test documents (12 genres) than the RST-DT corpus (exclusively news articles), we perform our experiments from here on only on the GUM treebank.
Figure 3 shows the micro-average structural overlap of discourse constituency (left) and dependency (right) trees between the PLM-generated discourse structures and existing methods, baselines, as well as gold-standard trees.
Noticeably, the generated constituency trees (on the left) are most aligned with the structures predicted by supervised discourse parsers, showing only minimal overlap to simple structures (i.e., right- and left-branching trees).
Taking a closer look at the generated dependency structures presented on the right side in Figure 3, the alignment between PLM inferred discourse trees and the simple chain structure is predominant, suggesting a potential weakness in regards to the discourse exposed by the Eisner algorithm in the BERT and BART model.
Not surprisingly, the highest overlap between PLM-generated trees and the chain structure occurs when finetuning on the CNN-DM dataset, well-known to contain a strong lead-bias (Xing et al., 2021).
To better understand if the PLM-based constituency structures are complementary to existing, [Figure] supervised discourse parsers, we further analyze the correctly predicted overlap.
More specifically, we compute the intersection between PLM generated structures and gold-standard trees as well as previously proposed models and the gold-standard.
Subsequently, we intersect the two resulting sets (e.g., BERT ∩ Gold Trees ↔ Two-Stage (RST-DT) ∩ Gold Trees).
This way, we explore if the correctly predicted PLM discourse structures are a subset of the correctly predicted trees by supervised approaches, or if complementary discourse information is captured.
We find that > 20% and > 16% of the correctly predicted constituency and dependency structures of our PLM discourse inference approach are not captured by supervised models, making the exploration of ensemble methods a promising future avenue.
A detailed version of Fig.
3 as well as more specific results regarding the correctly predicted overlap of discourse structures are shown in Appendix E.
5. Discourse Redundancy
Up to this point, our quantitative analysis of the ability of PLMs to capture discourse information has been limited to the single best-performing head. However, looking at individual models, the discourse performance distribution in Figure 2 suggests that a larger subset of self-attention heads performs similarly well (i.e., there are several dark purple cells in each heatmap).
This leads to the interesting questions if the information captured in different, top-performing self-attention heads is redundant or complementary. Similarly, Figureindicates that the same heads perform well across different fine-tuning tasks, leading to the question if the discourse structures captured in a single selfattention matrix of different fine-tuned models is consistent, or varies depending on the underlying task.
Hence, we take a detailed look at the similarity of model self-attention heads in regards to their alignment with discourse information and explore if (1) the top performing heads
h i , ..., h k of a specific model m m capture redundant discourse structures, and if (2) the discourse information captured by a specific head h i across different models m m , ..., m o contain similar discourse information.
Specifically, we pick the top 10 best performing self-attention matrices of each model, remove selfattention heads that don’t appear in at least two models (since no comparisons can be made), and compare the generated discourse structures in a nested aggregation approach.
Figure 4 shows a small-scale example of our nested visualization methodology.
For the selfattention head-aligned approach (Figure 4 (a)), high similarity values (calculated as the microaverage structural overlap) along the diagonal (grey cells) would be expected if the same head h i encodes consistent discourse information across different fine-tuning tasks and datasets.
Inversely, the model-aligned matrix (Figure 4 (b)) should show high values along the diagonal if different heads h i , ..., h k in the same model m k capture redundant discourse information.
Besides the visual inspection methodology presented in Figure 4, we also compare aggregated similarities between the same head (=Head) against different heads ( ̸ = Head) and between the same model (=Model) against different models ( ̸ = Model) (i.e., grey cells (=) and white cells ( ̸ = ) in Figure 4 (a) and (b)).
In order to assess the statistical significance of the resulting differences in the underlying distributions, we compute a two-sided, independent t-test between same/different models and same/different heads 9 .
The resulting redundancy evaluations for BERT are presented in Figure 5 10 .
It appears that the same self-attention heads
h
i consistently encode similar discourse information across models indicated by: (1) High similarities (yellow) along the diagonal in heatmaps I & III and (2) through the statistically significant difference in distributions at the bottom of Figure 5 (a) and (b).
However, different self-attention heads
h i , ..., h k of the same model m m encode different discourse information (heatmaps II & IV ).
While the trend is stronger for constituency tree structures, there is a single dependency self-attention head which does generally not align well between models and heads (purple line in heatmap III ).
Plausibly, this specific self-attention head encodes fine-tuning task specific discourse information, making it a prime candidate for further investigations in future work.
Furthermore, the similarity patterns observed in Figure 5 (a) and (b) point towards an opportunity to combine model self-attention heads to improve the discourse inference performance compared to the scores shown in Table 2, where each self-attention head was assessed individually, in future work.
Conclusions
In this paper, we extend the line of BERTology work by focusing on the important, yet less explored, alignment of pre-trained and fine-tuned PLMs with large-scale discourse structures.
We propose a novel approach to infer discourse information for arbitrarily long documents.
In our experiments, we find that the captured discourse information is consitently local and general, even across a collection of fine-tuning tasks.
We compare the inferred discourse trees with supervised, distantly supervised and simple baselines to explore the structural overlap, finding that constituency discourse trees align well with supervised models, however, contain complementary discourse information.
Lastly, we individually explore self-attention matrices to analyze the information redundancy.
We find that similar discourse information is consistently captured in the same heads.
In the future, we intend to explore additional discourse inference strategies based on the insights we gained in this analysis. Specifically, we want to explore more sophisticated methods to extract a single discourse tree from multiple self-attention matrices, rather than only the single best-performing head. Further, we want to investigate the relationship between supervised discourse parsers and PLM generated discourse trees and more long term, we plan to analyze PLMs with enhanced input-length limitations. Acknowledgements
We thank the anonymous reviewers and the UBC
NLP group for their insightful comments and suggestions.
This research was supported by the Language & Speech Innovation Lab of Cloud BU, Huawei Technologies Co., Ltd and the Natural Sciences and Engineering Research Council of Canada (NSERC).
Nous remercions le Conseil de recherches en sciences naturelles et en génie du
Canada (CRSNG) de son soutien.
We investigate 7 fine-tuned BERT and BART models from the huggingface model library, as well as the two pre-trained models.
The model names and links are provided in Table Pre [Figure] Trained
Fine
[Table]
Tuned Link
BERT-base – https://huggingface.co/bert-base-uncased BERT-base IMDB https://huggingface.co/textattack/bert-base-uncased-imdb BERT-base
Yelp https://huggingface.co/fabriceyhc/bert-base-uncased-yelp_polarity
BERT-base
SSThttps://huggingface.co/textattack/bert-base-uncased-SSTBERT-base
MNLI https://huggingface.co/textattack/bert-base-uncased-MNLI
BART
[Figure]
large – https://huggingface.co/facebook/bart-large
BART-large CNN-DM https://huggingface.co/facebook/bart-large-cnn
BART-large
[Table]
https://huggingface.co/facebook/bart-large-
[Table]
BART-large SQuAD https://huggingface.co/valhalla/bart-large-finetuned-squadv B Test-Set Results on RST-DT and GUM [Figure]
[Figure]
C Oracle-picked self-attention head compared to validation-picked matrix
[Table]
D Detailed Self-Attention Statistics
[Table] [Table]
F
[Figure]
[Figure] [Figure]
[Figure] [Figure]
[Figure] [Figure]
[Figure]
=Head* ̸ = Head =Model* ̸ = Model
[Figure] [Figure]
[Figure] [Figure]
[Figure] [Figure] [Figure]