Systematicity Emerges in Transformers when Abstract Grammatical Roles Guide Attention (2022)

Abstract: Systematicity is thought to be a key inductive bias possessed by humans that is lacking in standard natural language processing systems such as those utilizing transformers. In this work, we investigate the extent to which the failure of transformers on systematic generalization tests can be attributed to a lack of linguistic abstraction in its attention mechanism. We develop a novel modification to the transformer by implementing two separate input streams: a role stream controls the attention distributions (i.e., queries and keys) at each layer, and a filler stream determines the values. Our results show that when abstract role labels are assigned to input sequences and provided to the role stream, systematic generalization is improved.

## introduction transformers have achieved state-of-the-art performance on many natural language processing (nlp) tasks @xcite @xcite , but it has been suggested that they remain inferior to human language learners when it comes to sample efficiency @xcite and more difficult generalization problems @xcite @xcite . these architectures have proven to scale remarkably well @xcite , but may lack the strong inductive biases that contribute to these human abilities @xcite . systematicity, or the capacity to leverage structural or grammatical knowledge to compose familiar concepts in novel ways @xcite , has been highlighted as one potential inductive bias present in humans * equal contribution @xcite that deep learning architectures may lack (lake and @xcite . it has been argued that in humans, the ability to understand sentences such as "john loves mary" necessarily implies the ability to understand certain other sentences, e.g., those that are constructed from the same elements and grammatical relations such as "mary loves john" @xcite . the scan dataset (lake and @xcite ) was introduced to evaluate the systematic generalization capabilities of deep neural networks. in scan, instructions generated from an artificial grammar must be translated into action sequences, and traintest splits require models to generalize to novel compositions of familiar words. although deep learning models achieve good generalization performance when train and test data are split randomly, their performance suffers on these systematic generalization tests (lake and @xcite , even though humans perform well on analogous generalization problems @xcite . the mechanisms underlying human systematicity remain unclear, but a number of candidates have been proposed, including tensor-product representations @xcite and specialized attention mechanisms @xcite @xcite . attention is central to the transformer architecture @xcite and has been leveraged in mechanisms resembling systematic symbolic processing @xcite , thus making it a key potential target for encouraging systematicity @xcite . in this work, we explore the connection between attention and systematicity using a novel transformer architecture designed to leverage structural or abstract information in its attention mechanism. we hypothesized that systematicity would improve if attention distributions in the transformer were strictly determined from abstract inputs containing minimal token-specific information, as this may prevent memorization of spurious relationships in the training data. previous work has experimented with incorporating additional linguistic inputs into nlp systems (e.g., @xcite , but here we propose a novel way of utilizing additional linguistic knowledge: a separate "role" input stream is introduced to the transformer, which determines the attention distributions at each layer but is kept separate from the typical ("filler") input stream used to directly generate outputs. many kinds of information can be passed to the role input stream (including the original tokens themselves), thereby allowing us to explore the kinds of inputs that, when used to determine attention, result in improved systematicity. in our preliminary work, we explore the use of abstract grammatical roles to determine attention in the transformer on the scan dataset. ## experiments to test our hypothesized link between attention, linguistic abstraction, and systematic generalization, we developed abstract roles to label each token in the scan vocabulary, and performed experiments testing our architecture with and without these abstract roles. we report results on the difficult add-jump split of the scan dataset, and compare against previous work. our main purpose is to show that systematic generalization is improved in the transformer when linguistic abstractions are used as inputs to the role stream for determining attention, and that there is an asymmetry in the transformer such that these abstractions should be used to determine attention (i.e., keys and queries) and not to directly produce outputs (i.e., values). ## conclusion our preliminary work establishes a connection between linguistic abstraction, the attention mechanism used in transformers, and systematic generalization behavior as measured by performance on the scan dataset: when abstract roles are assigned to inputs and used to determine the attention at each layer, systematic generalization improves. we developed an architecture that may facilitate greater understanding of the original transformer @xcite by allowing more precise investigation into the relative contributions of attention distributions and representation learning. future work will test our setup on other compositional or systematic generalization tasks @xcite and determine the kinds of linguistic abstraction that allows success on these tasks. in addition, future work will experiment with using our novel architecture on natural language datasets using varying levels of linguistic abstraction. the extent to which human-level language understanding requires stronger inductive biases than those currently implemented in deep learning systems remains an open question. our work shows that utilizing linguistic abstraction in the attention mechanism of transformers may be a promising approach for improving the systematic generalization capabilities of deep neural networks.