LSTM s Compose—and L earn— B ottom-Up (2020)

Abstract: Recent work in NLP shows that LSTM language models capture compositional structure in language data. In contrast to existing work, we consider the learning process that leads to compositional behavior. For a closer look at how an LSTM’s sequential representations are composed hierarchically, we present a related measure of Decompositional Interdependence (DI) between word meanings in an LSTM, based on their gate interactions. We support this measure with experiments on English language data, where DI is higher on pairs of words with lower syntactic distance. To explore the inductive biases that cause these compositional representations to arise during training, we conduct simple experiments on synthetic data. These synthetic experiments support a specific hypothesis about how hierarchical structures are discovered over the course of training: that LSTM constituent representations are learned bottom-up, relying on effective representations of their shorter children, rather than on learning the longer-range relations independently.

## introduction for years the lstm dominated language architectures. it remains a popular architecture in nlp, and unlike transformer-based models, it can be trained on small corpora @xcite . 1 @xcite even found that the recurrent inductive biases behind the lstm's success are so essential that distilling from them can improve the performance of fully attentional models. however, the reasons behind the lstm's effectiveness in language domains remain poorly understood. a transformer can encode syntax using attention @xcite , and some lstm variants explicitly encode syntax @xcite . so, the success of these models is partly explained by their ability to model syntactic relationships when predicting a word. by contrast, an lstm simply scans a sentence from left to right, accumulating meaning into a hidden representation one word at a time, and using that representation to summarize the entire preceding sequence when predicting the next word. yet we have extensive evidence that trained lstms are also sensitive to syntax. for example, they can recall more history in natural language data than in similarly zipfian-distributed n-gram data, implying that they exploit linguistic structure in long-distance dependencies @xcite . their internal representations appear to encode constituency @xcite and syntactic agreement @xcite . in this paper, we consider how such representations are learned, and what kind of inductive bias supports them. to understand how lstms exploit syntax, we use contextual decomposition (cd; section 2.1), a method that computes how much the hidden representation of an lstm depends on particular past span of words. we then extend cd to decompositional interdependence (di; section 2.2), a measure of interaction between spans of words to produce the representation at a particular timestep. for example, in the sentence "socrates asked the student trick questions", we might expect the hidden representation of the lstm at the word "questions" to interact primarily with its syntactic head "asked", and less with the direct object "the student". if so, then an lstm could be seen as implementing compositional localism @xcite : if a hidden representation encodes meaning, then this meaning is composed from local syntactic relationships. our experiments on syntactically-parsed corpora (section 3) illustrate this property -interdependence decreases with syntactic distance, stratified by surface distance. we then turn to a hypothesis about how such representations are learned. using a simple synthetic corpus (section 4.2), we allow lstms to learn to represent short sequences before they learn longer sequences that are dependent on them. our goal is to then illustrate how they use representations of short sequences in order to learn longer dependencies-if these smaller constituents are unfamiliar, lstms learn more slowly. further experiments (section 4.3.1) isolate hierarchical behavior from other factors causing local relations to be learned first, indicating that the model tends to build a subtree from its smaller constituents. we conclude that lstms compose hierachically because they learn bottom-up. ## methods our di measure is a natural extension of contextual decomposition (cd; @xcite , a tool for analyzing the representations produced by lstms. to conform with @xcite , our english language experiments use a one layer (400-dim) lstm, with inputs taken from an embedding layer and outputs processed by a softmax layer. ## english language experiments we now apply our measure of di to a natural language setting to see how lstms employ bottom-up construction. in natural language, disentangling the meaning of individual words requires contextual information which is hierarchically composed. for example, in the sentence, "socrates asked the student trick questions", "trick questions" has a clear definition and strong connotations that are less evident in each word individually. however, knowing that "trick" and "student" co-occur is not sufficient to clarify the meaning and connotations of either word or compose a shared meaning. here, we consider whether the lstm observes headedness, by composing meaning between a headword and its immediate modifiersbehavior which a recurrent neural network grammar (rnng; @xcite also learns @xcite . if a standard lstm learns similar behavior in line with syntax, it is implicitly a syntactic language model. these experiments use language models trained on wikitext-2 @xcite , run on the universal dependencies corpus english-ewt @xcite . ## synthetic experiments our next experiments use synthetic data to show how training is bottom-up. lstm training sees long-range connections discovered after shortrange connections; in particular, document-level content topic information is encoded much later in training than local information like part of speech @xcite . these experiments explain such learning phases by showing that the training process is inherently compositional due to bottom-up learning. 4 that is, not only are the shorter sequences learned first, but they form the basis for longer relations learned over them. for example, the model might learn to 4 other phenomena contribute but are outside our current focus. first, long-range connections are less consistent (particularly in a right-branching language like english), and will thus take longer to learn (appendix b. for example, the pattern of a determiner followed by a noun will appear very frequently, as in "the man", while long-range connections like "either/or" are rarer. second, rarer patterns are learned slowly due to vanishing gradients (appendix c). represent sequences like "socrates is mortal" before it can learn to represent the either/or relation around it, building from short constituents to long. this behavior is seen in shift-reduce parsers and their neural derivatives like rnngs. bottom-up training is not a given and must be verified. 5 however, if the hypothesis holds and training builds syntactic patterns hierarchically, it can lead to representations that are built hierarchically at inference time, reflecting linguistic structure, as we have seen. to test the idea of a compositional training process, we use synthetic data that controls for the consistency and frequency of longer-range relations. we find: ## discussion & related work humans learn by memorizing short rote phrases and later mastering the ability to construct deep syntactic trees from them @xcite . lstm models learn by backpropagation through time, which is unlikely to lead to the same inductive biases, the assumptions that define how the model generalizes from its training data. it may not be expected for an lstm to exhibit similarly compositional learning behavior by building longer constituents out of shorter ones during training, but we present evidence in favor of such learning dynamics. lstms have the theoretical capacity to encode a wide range of context-sensitive languages, but in practice their ability to learn such rules from data is limited @xcite . empirically, lstms encode the most recent noun as the subject of a verb by default, but they are still capable of learning to encode grammatical inflection from the first word in a sequence rather than the most recent @xcite . therefore, while inductive biases inherent to the model play a critical role in the ability of an lstm to learn effectively, they are neither necessary nor sufficient in determining what the model can learn. hierarchical linguistic structure may be learned from data alone, or be a natural product of the training process, with neither hypothesis a foregone conclusion. we provide a more precise lens on how lstm training is itself compositional, beyond the properties of data. there is a limited literature on compositionality as an inductive bias of neural networks. @xcite explored how hierarchical ontologies are learned by following their tree structure in 2-layer feedforward networks. lstms also take advantage of some inherent trait of language @xcite . the compositional training we have explored may be the mechanism behind this biased representational power. synthetic data, meanwhile, has formed the basis for analyzing the inductive biases of neural networks and their capacity to learn compositional rules. common synthetic datasets include the dyck languages @xcite , spk @xcite , synthetic variants of natural language @xcite , and others @xcite @xcite . unlike these works, our synthetic task is not designed primarily to test the biases of the neural network or to improve its performance in a restricted setting, but to investigate the internal behavior of an lstm in response to memorization. investigations into learning dynamics like ours may offer insight into selecting training curricula. the application of a curriculum is based on the often unspoken assumption that the representation of a complex pattern can be reached more easily from a simpler pattern. however, we find that effectively representing shorter scaffolds actually makes a language model less effective at generalizing a long-range rule, as found by @xcite . this less generalizable representation is still learned faster, which may be why @xcite found higher performance after one epoch. our work suggests that measures of length, including syntactic depth, may be inappropriate bases for curriculum learning. ## future work while we hope to isolate the role of long range dependencies through synthetic data, we must consider the possibility that the natural predictability of language data differs in relevant ways from the synthetic data, in which the scaffolds are predictable only through pure memorization. because lstm models take advantage of linguistic structure, we cannot be confident that predictable natural language exhibits the same cell state dynamics that make a memorized scaffold promote or inhibit long-range rule learning. future work could test our findings on the learning process through carefully selected natural language, rather than synthetic, data. our natural language results could lead to di as a structural probe for testing syntax. such a probe can be computed directly from an lstm without learning additional parameters as required in other methods @xcite . in this way, it is similar to the probes that have been developed using attention distributions @xcite . by computing associations naturally through di, we can even escape the need to augment models with attention just to permit analysis, as @xcite . some effects on our natural language experiments may be due to the predictable nature of english syntax, which favors right-branching behavior. future work could apply similar analysis to other languages with different grammatical word orders. ## conclusions using our proposed tool of decompositional interdependence, we illustrate how information exchanged between words aligns roughly with syntactic structure, indicating lstms compose meaning bottom-up. synthetic experiments then illustrate that a memorized span intervening between a long distance dependency promotes early learning of the dependency rule, but fails to generalize to new domains, implying that these memorized spans are used as scaffolding in a bottom-up learning process. this combination of behaviors is similar to a syntactic language model, suggesting that the lstm's demonstrated inductive bias towards hierarchical structures is implicitly aligned with our understanding of language and emerges from its natural learning process.