Do Neural Language Models Show Preferences for Syntactic Formalisms? (2020)

Abstract: Recent work on the interpretability of deep neural language models has concluded that many properties of natural language syntax are encoded in their representational spaces. However, such studies often suffer from limited scope by focusing on a single language and a single linguistic formalism. In this study, we aim to investigate the extent to which the semblance of syntactic structure captured by language models adheres to a surface-syntactic or deep syntactic style of analysis, and whether the patterns are consistent across different languages. We apply a probe for extracting directed dependency trees to BERT and ELMo models trained on 13 different languages, probing for two different syntactic annotation styles: Universal Dependencies (UD), prioritizing deep syntactic relations, and Surface-Syntactic Universal Dependencies (SUD), focusing on surface structure. We find that both models exhibit a preference for UD over SUD — with interesting variations across languages and layers — and that the strength of this preference is correlated with differences in tree shape.

## introduction recent work on interpretability in nlp has led to the consensus that deep neural language models trained on large, unannotated datasets manage to encode various aspects of syntax as a byproduct of the training objective. probing approaches applied to models like elmo @xcite and bert @xcite have demonstrated that one can decode various linguistic properties such as part-of-speech categories, dependency relations, and named-entity types directly from the internal hidden states of a pretrained model @xcite . another line of work has tried to tie cognitive measurements or theories of human linguistic processing to the machinations of language models, often establishing strong parallels between the two @xcite @xcite . as is the case for nlp in general, english has served as the de facto testing ground for much of this work, with other languages often appearing as an afterthought. however, despite its ubiquity in the nlp literature, english is generally considered to be atypical across many typological dimensions. furthermore, the tendency of interpreting nlp models with respect to existing, canonical datasets often comes with the danger of conflating the theory-driven annotation therein with scientific fact. one can observe this to an extent with the universal dependencies (ud) project @xcite , which aims to collect syntactic annotation for a large number of languages. many interpretability studies have taken ud as a basis for training and evaluating probes, but often fail to mention that ud, like all annotation schemes, is built upon specific theoretical assumptions, which may not be universally accepted. our research questions start from these concerns. when probing language models for syntactic dependency structure, is ud -with its emphasis on syntactic relations between content words -really the best fit? or is the representational structure of such models better explained by a scheme that is more oriented towards surface structure, such as the recently proposed surface-syntactic universal dependencies (sud) @xcite ? and are these patterns consistent across typologically different languages? to explore these questions, we fit the structural probe of @xcite on pretrained bert and elmo representations, supervised by ud/sud treebanks for 13 languages, and extract directed dependency trees. we then conduct an extensive error analysis of the resulting probed parses, in an attempt to qualify our findings. our main contributions are the following: ## related work there has been a considerable amount of recent work attempting to understand what aspects of natural language pre-trained encoders learn. the classic formulation of these probing experiments is in the form of diagnostic classification @xcite @xcite , which attempts to unearth underlying linguistic properties by fitting relatively underparameterised linear models over representations generated by an encoder. these methods have also faced recent critique, for example, concerning the lack of transparency in the classifers' ability to extract meaningful information, as opposed to learning it. alternative paradigms for interpretability have therefore been proposed, such as correlation-based methods @xcite @xcite . however, this critique does not invalidate diagnostic classification: indeed, more recent work @xcite describes methods to show the empirical validity of certain probes, via control tasks. among probing studies specifically pertinent to our paper, @xcite demonstrate that deep rnns are capable of encoding syntax given a variety of pre-training tasks, including language modeling. @xcite demonstrate that, regardless of encoder (recurrent, convolutional, or self-attentive), bilm-based pre-training results in similar high-quality representations that implicitly encode a variety of linguistic phenomena, layer by layer. similarly, @xcite employ the 'edge probing' approach of @xcite to demonstrate that bert implicitly learns the 'classical nlp pipeline', with lower-level linguistic tasks encoded in lower layers and more complex phenomena in higher layers, and dependency syntax in layer 5-6. finally, @xcite describe a syntactic probe for extracting aspects of dependency syntax from pre-trained representations, which we describe in section 4. ## aspects of syntax syntax studies how natural language encodes meaning using expressive devices such as word order, case marking and agreement. some approaches emphasize the formal side and primarily try to account for the distribution of linguistic forms. other frameworks focus on the functional side to capture the interface to semantics. and some theories use multiple representations to account for both perspectives, such as c-structure and f-structure in lfg @xcite or surface-syntactic and deep syntactic representations in @xcite . when asking whether neural language models learn syntax, it is therefore relevant to ask which aspects of syntax we are concerned with. this is especially important if we probe the models by trying to extract syntactic representations, since these representations may be based on different theoretical perspectives. as a first step in this direction, we explore two different dependency-based syntactic representations, for which annotations are available in multiple languages. the first is universal dependencies (ud) @xcite , a framework for cross-linguistically consistent morpho-syntactic annotation, which prioritizes direct grammatical relations between content words. these relations tend to be more parallel across languages that use different surface features to encode the relations. the second is surface-syntactic universal dependencies (sud) @xcite , a recently proposed alternative to ud, which gives more prominence to function words in order to capture variations in surface structure across languages. figure 2 contrasts the two frameworks by showing how they annotate an english sentence. while the two annotations agree on most syntactic relations (in black), including the analysis of core grammatical relations like subject (nsubj foot_0 ) and object (obj), they differ in the analysis of auxiliaries and prepositional phrases. the ud annotation (in blue) treats the main verb chased as the root of the clause, while the sud annotation (in red) assigns this role to the auxiliary has. the ud annotation has a direct oblique relation between chased and room, treating the preposition from as a case marker, while the sud annotation has an oblique relation between chased and from, analyzing room as the object of from. the purpose of the ud style of the dog has chased the cat from the room det noun aux verb det noun adp det noun det nsubj aux comp:aux det obj case det obl obl obj figure 1: simplified ud and sud annotation for an english sentence. the dog has chased the cat from the room det noun aux verb det noun adp det noun @xmath0: simplified ud and sud annotation for an english sentence. the different treatment of function words affects not only adpositions (prepositions and postpositions) and auxiliaries (including copulas), but also subordinating conjunctions and infinitive markers. because of these systematic differences, dependency trees in ud tend to have longer average dependency length and smaller height 2 than in sud. ## probing model to conduct our experiments, we make use of the structural probe proposed by @xcite , which is made up of two complementary components -distance and depth. the former is an intuitive proxy for the notion of two words being connected by a dependency: any two words w i , w j in a tree t are neighbors if their respective distance in the tree amounts to d t pw i , w j q " 1. this metric can theoretically be applied to the vector space of any pretrained neural language model sentence encoding, which ouputs a set of vectors s " h 1 , ..., h n for a sentence. in practice, however, the distance between any two vectors th i , h j u p s will not be directly comparable to their distance 2 the height of a tree is the length of the longest path from the root to a leaf (sometimes referred to as depth). in a corresponding syntactic tree t , because the model does not encode syntax in isolation. to resolve this, @xcite propose to learn a linear transformation matrix b, such that d b ph i , h j q extracts the distance between any two words w i , w j in a parse tree. for an annotated corpus of l sentences, the distance probe can be learned via gradient descent as follows: algorithm 1 invoke cle for sentence s " w 1,n given distance matrix e and depth to be able to score probed trees (against ud and sud gold trees) using the standard metric of unlabeled attachment score (uas), we need to derive a rooted directed dependency tree from the information provided by the distance and depth probes. algorithm 1 outlines a simple method to retrieve a well-formed tree with the help of the chu-liu-edmonds maximum spanning tree algorithm @xcite . essentially, in a sentence s " w 1 . . . w n , for every pair of nodes pw i , w j q with an estimated distance of d between them, if w i has smaller depth than w j , we set the weight of the arc pw i , w j q to ´d; otherwise, we set the weight to ´8. this is effectively a mapping from distances to scores, with larger distances resulting in lower arc scores from the parent to the child, and infinitely low scores from the child to the parent. we also add a pseudo-root w 0 (essential for decoding), which has a single arc pointing to the shallowest node (weighted 0). we use the allennlp @xcite implementation of the chu-liu/edmonds' algorithm. ## experimental design in order to evaluate the extent to which a given model's representational space fits either annotation framework, we fit the structural probe on the model, layer by layer, using ud and sud treebanks for supervision, and compute uas over each treebank's test set as a proxy for a given layer's goodness-of-fit. ## results and discussion figure 3 displays the uas after fitting the structural probes on bert and elmo, per language and layer. what is perhaps most noticeable is that, while bert can achieve accuracies upwards of 79 uas on some languages, elmo fares consistently worse, maxing out at 65 for hindi at layer 2. the most likely explanation for this is that the elmo models are smaller than the multilingual bert's 12-layer transformer-based architecture, which was trained on orders of magnitude more data (albeit multilingually). in general, we find that the probing performance is stable across languages, where layers 7-8 fare the best for bert and layer 2 for elmo. foot_5 this contrasts with prior observations @xcite , as the syntactic 'center of gravity' is placed higher in each model's hierarchy. however, computing a weighted average over layers tends to produce the best overall performance for each model, indicating that the probe can benefit from information encoded across various layers. once we compare the averaged results across syntactic representations, a preference for ud emerges, starting in layer 3 in bert and layer 2 in elmo. we observe the max difference in favor of ud in layer 7 for bert, where the probe performs 3 uas points better than sud, and in the weighted average (layer 13), with 4 uas points. the difference for the 13th bert and 3rd elmo layers is statistically significant at p ď 0.05 (wilcoxon signed ranks test). a further look at differences across languages reveals that, while most languages tend to overwhelmingly prefer ud, there are some that do not: basque, turkish, and, to a lesser extent, finnish. furthermore, the preference towards sud in these languages tends to be most pronounced in the first four and last two layers of bert. however, in the layers where we tend to observe the higher uas overall (7-8), this is minimized for basque/turkish and almost eliminated for finnish. indeed, we see the strongest preferences for ud in these layers overall, where italian and japanese are overwhelmingly pro-ud, to the order of 10+ uas points. ## conclusion and future work we have investigated the extent to which the syntactic structure captured by neural language models aligns with different styles of analysis, using ud treebanks and their sud conversions as proxies. we have extended the structural probe of @xcite to extract directed, rooted trees and fit it on pretrained bert and elmo representations for 13 languages. ultimately, we observed a better overall fit for the ud-style formalism across models, layers, and languages, with some notable exceptions. for example, while the chinese, hebrew, hindi, italian, and japanese models proved to be overwhelmingly better-fit for ud, basque aligned more with sud, and finnish, korean and turkish did not exhibit a clear preference. furthermore, an error analysis revealed that, when attaching words of various part-of-speech tags to their heads, ud fared better across the vast majority of categories, most notably adpositions and determiners. related to this, we found a strong correlation between differences in average tree height and the tendency to prefer one framework over the other. this suggested a tradeoff between morphological complexity -where differences in tree height between ud and sud are minimal and probing accuracy similar -and a high proportion of function words -where sud trees are significantly higher and probing accuracy favors ud. for future work, besides seeking a deeper understanding of the interplay of linguistic factors and tree shape, we want to explore probes that combine the distance and depth assumptions into a single transformation, rather than learning separate probes and combining them post-hoc, as well as methods for alleviating treebank supervision altogether. lastly, given recent criticisms of probing approaches in nlp, it will be vital to revisit the insights produced here within a non-probing framework, for example, using representational similarity analysis (rsa) @xcite over symbolic representations from treebanks and their encoded representations.