Exploring BERT ’s Sensitivity to Lexical Cues using Tests from Semantic Priming (2020)

Abstract: Models trained to estimate word probabilities in context have become ubiquitous in natural language processing. How do these models use lexical cues in context to inform their word probabilities? To answer this question, we present a case study analyzing the pre-trained BERT model with tests informed by semantic priming. Using English lexical stimuli that show priming in humans, we find that BERT too shows “priming”, predicting a word with greater probability when the context includes a related word versus an unrelated one. This effect decreases as the amount of information provided by the context increases. Follow-up analysis shows BERT to be increasingly distracted by related prime words as context becomes more informative, assigning lower probabilities to related words. Our findings highlight the importance of considering contextual constraint effects when studying word prediction in these models, and highlight possible parallels with human processing.

## introduction the field of natural language processing (nlp) has recently seen a dramatic shift toward the use of language model (lm)-based pre-training @xcite )-training based on estimating word probabilities in context-as a foundation for learning of a wide range of tasks. leading this charge was the bert model @xcite , which is optimized in part to use context information to predict masked words. because of the impressively strong performance of bert and its successors @xcite @xcite , there has been increasing need for understanding how these types of models work, and what linguistic properties lm-based pre-training confers upon them. in this paper, we focus on the question of how bert uses individual lexical relations to inform word probabilities in context. for example, if a word like airplane is prepended to ( 1a ), to what extent does this increase the model's probability for the word pilot in the blank position in (1b)? this question is particularly relevant because human brains show a robust phenomenon of semantic priming @xcite , in which the presence of a word such as "airplane" will give rise to faster reactions to a related word like "pilot". we explore whether the same lexical relations that show priming in humans will also be utilized by bert to influence word predictions in context. our analysis includes three experiments. first, we test bert's sensitivity to single-word lexical cues for word prediction in context, using word pairs that show priming in humans, and testing for influence of contextual constraint. we find clear priming in bert, but this effect is primarily localized to contexts that are relatively unconstraining. next, we examine how bert's use of these lexical cues varies depending on the type of lexical relation. we find that certain relationsparticularly antonymy, synonymy, and category relations-evoke more sensitivity in bert than others. finally, we take a closer look at lexical cue dynamics in cases of high-constraint contexts, and we find that in such contexts we often see a phenomenon of "distraction" rather than priming, such that related words actively demote probabilities of counterpart target words. our paper has two main contributions. first, we introduce a methodology for fine-grained exploration of lexical cue sensitivity in predictive models, grounded in lexical relation phenomena observed in humans. second, we apply these methods to shed light on word prediction dynamics of the bert model. we discuss implications of these findings for considerations of contextual constraint, and for parallels with human processing. we release our datasets and code for further testing. foot_0 2 bert as a semantic priming subject ## analysis and results to test for statistical significance between facilitation in bert and the contextual constraints imposed by stimuli, we use a linear mixed-effects model with constraint scores as fixed effects and include random intercepts for target words. the pre-trained bert models were accessed using the transformers library @xcite . ## general discussion in the experiments above, we show that when using word pairs informed by human semantic priming, the bert model is reliably sensitive to individ-ual lexical cues in its context-if the context is minimally constraining, such that there is little predictive information beyond that lexical cue. as the predictive constraint applied by the context increases, bert's level of sensitivity to a given lexical cue decreases. these results suggest that bert uses lexical cues as needed: when informative sentence cues are available, single lexical items are of less value, and so they exert less influence on bert's expectations for a masked word. examining patterns across different types of lexical relations, we find that this general effect of constraint holds across relation types, but synonym, category, and antonym relations elicit larger lexical sensitivities in bert, as compared to other relations (when the context is unconstraining). this suggests that bert has identified these relationsor the particular words that share these relationsas being more reliably predictive. this may be because words sharing these relations are simply more likely to co-occur during bert's training, or bert may have formed higher-order relational associations that inform these sensitivities. while we see that these priming-based lexical relations can have facilitatory effects on bert's word predictions when the context is otherwise unconstraining, we see conversely that when the context is constraining, prime words can actually have a "distractor" effect-actively demoting the target word in the probability distribution. this finding builds on recent evidence of bert's sensitivity to such distractions when predicting completions to factual queries @xcite . we find in our analyses that the nature of this distraction depends critically on the interaction of contextual constraint and the strength of the lexical relation: when the context is unconstraining, the probability of a word is likely to be promoted by a related lexical item more than by an unrelated lexical item. if the context is constraining, a related lexical item may demote the probability of a target word in the predicted distribution, while an unrelated word is likely to have less impact. the effectiveness of human priming pairs in influencing bert's lexical sensitivities, as well as the impact of contextual constraint on bert's use of lexical context cues, suggest possible parallels with mechanisms in human language processing. not only do humans show priming with the same word pairs that we show to impact bert's predictions here, but like bert, humans also show more limited semantic priming in constraining contexts, and wider scope of priming in low-constraint contexts @xcite . this suggests that the mechanisms that dictate bert's lexical sensitivity may be optimized in a manneror at least to an outcome-comparable to those underlying priming effects in humans. in practical terms, our results highlight the importance of contextual constraint in the dynamics of word prediction and information usage in the bert model. future work studying these dynamics should be mindful of this fact, as any observed prediction dynamics may change with the predictiveness of the context. this further emphasizes parallels with the study of human processing, as the predictive constraint of context has long been an important consideration and instrument in studying human sentence processing @xcite @xcite . our results show a similarly important role played by the amount of constraint imposed on a masked word during word probability estimation, which can lead to substantially different outcomes in behavioral analysis of pre-trained models. ## conclusion and future work in this paper, we presented a framework to test how bert uses individual lexical relationships as cues for word prediction. our framework is inspired by the psycholinguistic phenomenon of semantic priming, and our lexical cues are derived from a large collection of human priming experiments. we examine the dynamics of bert's word prediction in context, and relate its sensitivity towards lexical cues with contextual constraints and finergrained lexical relations. our findings establish the importance of considering predictive constraint effects of context in studies that behaviorally analyze language processing models, and highlight possible parallels with human processing. the tests here are limited to the bidirectional masked language modeling framework used for training bert, as opposed to autoregressive lm architectures such as rnns, or gpt-2 @xcite . in future work it will be informative to establish whether different architectures and training objectives will produce differences in sensitivities towards contextual cues. our paradigm can be extended by complementing our sampling procedure with hand-crafted templates of simple sentences that place all context to the left of target words. this will enable testing in the context of incremental language processing and help compare priming across various lm strategies.