Does injecting linguistic structure into language models lead to better alignment with brain recordings?

1 INTRODUCTION . Recent advances in deep neural networks for natural language processing ( NLP ) have generated excitement among computational neuroscientists , who aim to model how the brain processes language . These models are argued to better capture the complexity of natural language semantics than previous computational models , and are thought to represent meaning in a way that is more similar to how it is hypothesized to be represented in the human brain . For neuroscientists , these models provide possible hypotheses for how word meanings compose in the brain . Previous work has evaluated the plausibility of such candidate models by testing how well representations of text extracted from these models align with brain recordings of humans during language comprehension tasks ( Wehbe et al. , 2014 ; Jain & Huth , 2018 ; Gauthier & Ivanova , 2018 ; Gauthier & Levy , 2019 ; Abnar et al. , 2019 ; Toneva & Wehbe , 2019 ; Schrimpf et al. , 2020 ; Caucheteux & King , 2020 ) , and found some correspondences . However , modern NLP models are often trained without explicit linguistic supervision ( Devlin et al. , 2018 ; Radford et al. , 2019 ) , and the observation that they nevertheless learn some linguistic structure has been used to question the relevance of symbolic linguistic theories . Whether injecting such symbolic structures into language models would lead to even better alignment with cognitive measurements , however , has not been studied . In this work , we address this gap by training BERT ( §3.1 ) with structural bias , and evaluate its alignment with brain recordings ( §3.2 ) . Structure is derived from three formalisms—UD , DM and UCCA ( §3.3 ) —which come from different linguistic traditions , and capture different aspects of syntax and semantics . Our approach , illustrated in Figure 1 , allows for quantifying the brain alignment of the structurallybiased NLP models in comparison to the base models , as related to new information about linguistic structure learned by the models that is also potentially relevant to language comprehension in the brain . More specifically , in this paper , we : ( a ) Employ a fine-tuning method utilising structurally guided attention for injecting structural bias into language model ( LM ) representations . ( b ) Assess the representational alignment to brain activity measurements of the fine-tuned and non-fine-tuned LMs . ( c ) Further evaluate the LMs on a range of targeted syntactic probing tasks and a semantic tagging task , which allow us to uncover fine-grained information about their structuresensitive linguistic capabilities . ( d ) Present an analysis of various linguistic factors that may lead to improved or deteriorated brain alignment . 2 BACKGROUND : BRAIN ACTIVITY AND NLP . Mitchell et al . ( 2008 ) first showed that there is a relationship between the co-occurrence patterns of words in text and brain activation for processing the semantics of words . Specifically , they showed that a computational model trained on co-occurrence patterns for a few verbs was able to predict fMRI activations for novel nouns . Since this paper was introduced , many works have attempted to isolate other features that enable prediction and interpretation of brain activity ( Frank et al. , 2015 ; Brennan et al. , 2016 ; Lopopolo et al. , 2017 ; Anderson et al. , 2017 ; Pereira et al. , 2018 ; Wang et al. , 2020 ) . Gauthier & Ivanova ( 2018 ) however , emphasize that directly optimizing for the decoding of neural representation is limiting , as it does not allow for the uncovering of the mechanisms that underlie these representations . The authors suggest that in order for us to better understand linguistic processing in the brain , we should also aim to train models that optimize for a specific linguistic task and explicitly test these against brain activity . Following this line of work , Toneva & Wehbe ( 2019 ) present experiments both predicting brain activity and evaluating representations on a set of linguistic tasks . They first show that using uniform attention in early layers of BERT ( Devlin et al. , 2018 ) instead of pretrained attention leads to better prediction of brain activity . They then use the representations of this altered model to make predictions on a range of syntactic probe tasks , which isolate different syntactic phenomena ( Marvin & Linzen , 2019 ) , finding improvements against the pretrained BERT attention . Gauthier & Levy ( 2019 ) present a series of experiments in which they fine-tune BERT on a variety of tasks including language modeling as well as some custom tasks such as scrambled language modeling and part-of-speechlanguage modeling . They then perform brain decoding , where a linear mapping is learnt from fMRI recordings to the fine-tuned BERT model activations . They find that the best mapping is obtained with the scrambled language modelling fine-tuning . Further analysis using a structural probe method confirmed that the token representations from the scrambled language model performed poorly when used for reconstructing Universal Dependencies ( UD ; Nivre et al. , 2016 ) parse trees . When dealing with brain activity , many confounds may lead to seemingly divergent findings , such as the size of fMRI data , the temporal resolution of fMRI , the low signal-to-noise ratio , as well as how the tasks were presented to the subjects , among many other factors . For this reason , it is essential to take sound measures for reporting results , such as cross-validating models , evaluating on unseen test sets , and conducting a thorough statistical analysis . 3 APPROACH . Figure 1 shows a high-level outline of our experimental design , which aims to establish whether injecting structure derived from a variety of syntacto-semantic formalisms into neural language model representations can lead to better correspondence with human brain activation data . We utilize fMRI recordings of human subjects reading a set of texts . Representations of these texts are then derived from the activations of the language models . Following Gauthier & Levy ( 2019 ) , we obtain LM representations from BERT1 for all our experiments . We apply masked language model fine-tuning with attention guided by the formalisms to incorporate structural bias into BERT ’ s hidden-state representations . Finally , to compute alignment between the BERT-derived representations—with and without structural bias—and the fMRI recordings , we employ the brain decoding framework , where a linear decoder is trained to predict the LM derived representation of a word or a sentence from the corresponding fMRI recordings . 3.1 LM-DERIVED REPRESENTATIONS . BERT uses wordpiece tokenization , dividing the text to sub-word units . For a sentence S made up of P wordpieces , we perform mean-pooling over BERT ’ s final layer hidden-states [ h1 , ... , hP ] , obtaining a vector representation of the sentence Smean = 1P ∑ p hp ( Wu et al. , 2016 ) . In initial experiments , we found that this leads to a closer match with brain activity measurements compared to both max-pooling and the special [ CLS ] token , which is used by Gauthier & Levy ( 2019 ) . Similarly , for a word W made up of P wordpieces , to derive word representations , we apply mean-pooling over hidden-states [ h1 , ... , hP ] , which correspond to the wordpieces that make upW : Wmean = 1P ∑ p hp . For each dataset , DLM ∈ Rn×dH denotes a matrix of n LM-derived word or sentence representations where dH is BERT ’ s hidden layer dimensionality ( dH = 1024 in our experiments ) . 3.2 NEUROIMAGING DATASETS . We utilize two fMRI datasets , which differ in the granularity of linguistic cues to which human responses were recorded . The first , collected in Pereira et al . ( 2018 ) ’ s experiment 2 , comprises a single brain image per entire sentence . In the second , more fine-grained dataset , recorded by Wehbe et al . ( 2014 ) , each brain image corresponds to 4 words . We conduct a sentence-level analysis for the former and a word-level one for the latter.2 Pereira2018 consists of fMRI recordings from 8 subjects . The subjects were presented with stimuli consisting of 96 Wikipedia-style passages written by the authors , consisting of 4 sentences each . The subjects read the sentences one by one and were instructed to think about their meaning . The resulting data for each subject consists of 384 vectors of dimension 200,000 ; a vector per sentence . These were reduced to 256 dimensions using PCA by Gauthier & Levy ( 2019 ) . These PCA projections explain more than 95 % of the variance among sentence responses within each subject . We use this reduced version in our experiments . Wehbe2014 consists of fMRI recordings from 8 subjects as they read a chapter from Harry Potter and the Sorcerer ’ s Stone . For the 5000 word chapter , subjects were presented with words one by one for 0.5 seconds each . An fMRI image was taken every 2 seconds , as a result , each image corresponds 1Specifically : bert-large-uncased trained with whole-word masking . 2Even though the images are recorded at the 4-gram level of granularity , a word-level analysis is applied , as in Schwartz et al . ( 2019 ) . to 4 words . The data was further preprocessed ( i.e . detrended , smoothed , trimmed ) and released by Toneva & Wehbe ( 2019 ) . We use this preprocessed version to conduct word-level analysis , for which we use PCA to reduce the dimensions of the fMRI images from 25,000 to 750 , explaining at least 95 % variance for each participant . 3.3 FORMALISMS AND DATA . To inject linguistic structure into language models , we experiment with three distinct formalisms for representation of syntactic/semantic structure , coming from different linguistic traditions and capturing different aspects of linguistic signal : UD , DM and UCCA . An example graph for each formalism is shown in Figure 2 . Although there are other important linguistic structured formalisms , including meaning representations such as AMR ( Banarescu et al. , 2013 ) , DRS ( Kamp & Reyle , 1993 ; Bos et al. , 2017 ) and FGD ( Sgall et al. , 1986 ; Hajic et al. , 2012 ) , we select three relatively different formalisms as a somewhat representative sample . All three have manually annotated datasets , which we use for our experiments . UD ( Universal Dependencies ; Nivre et al. , 2020 ) is a syntactic bi-lexical dependency framework ( dependencies are denoted as arcs between words , with one word being the head and another the dependent ) , which represents grammatical relations according to a coarse cross-lingual scheme . For UD data , we use the English Web Treebank corpus ( EWT ; Silveira et al. , 2014 ) , which contains 254,830 words and 16,622 sentences , taken from five genres of web media : weblogs , newsgroups , emails , reviews , and Yahoo ! answers . DM ( DELPH-IN MRS Bi-Lexical Dependencies ; Ivanova et al. , 2012 ) is derived from the underspecified logical forms computed by the English Resource Grammar ( Flickinger et al. , 2017 ; Copestake et al. , 2005 ) , and is one of the frameworks targeted by the Semantic Dependency Parsing SemEval Shared Tasks ( SDP ; Oepen et al. , 2014 ; 2015 ) . We use the English SDP data for DM ( Oepen et al. , 2016 ) , annotated on newspaper text from the Wall Street Journal ( WSJ ) , containing 802,717 words and 35,656 sentences . UCCA ( Universal Cognitive Conceptual Annotation ; Abend & Rappoport , 2013 ) is based on cognitive linguistic and typological theories , primarily Basic Linguistic Theory ( Dixon , 2010/2012 ) . We use UCCA annotations over web reviews text from the English Web Treebank , and from English Wikipedia articles on celebrities . In total , they contain 138,268 words and 6,572 sentences . For uniformity with the other formalisms , we use bi-lexical approximation to convert UCCA graphs , which have a hierarchical constituency-like structure , to bi-lexical graphs with edges between words . This conversion keeps about 91 % of the information ( Hershcovich et al. , 2017 ) .

Summary: of paper: the authors explore adding a soft structural attention constraint to BERT, by penalizing attention weights that are substantially different from a head–dependent "adjacency" matrix derived from dependency parses.  BERT is then fine-tuned with and without ("domain-finetuned") this constraint on corpus data for which fMRI recordings from participants during reading are available. A linear classifier from the final layer of BERT's embedding (mean-pooled) is then learned to the fMRI data.  Within this pipeline, domain-finetuned models are not an improvement over unfinetuned BERT, but fine-tuning with the structural attention constraint improves decoding to fMRI data, especially for word-level data (the Wehbe2014 dataset).