Relation Classification with Cognitive Attention Supervision (2021)

Abstract: Many current language models such as BERT utilize attention mechanisms to transform sequence representations. We ask whether we can influence BERT’s attention with human reading patterns by using eye-tracking and brain imaging data. We fine-tune BERT for relation extraction with auxiliary attention supervision in which BERT’s attention weights are supervised by cognitive data. Through a variety of metrics we find that this attention supervision can be used to increase similarity between model attention distributions over sequences and the cognitive data without significantly affecting classification performance while making unique errors from the baseline. In particular, models with cognitive attention supervision more often correctly classified samples misclassified by the baseline.

## introduction for humans, the task of determining semantic relationships may entail complicated inference based on concepts' contexts @xcite and commonsense knowledge (e.g., causal relations; @xcite , and for labeling relations between entities in texts the task may depend on the genre of the text (e.g. biomedical, biographical) and constraints indicated by annotator instructions @xcite . the advent of crowdsourcing for machine learning approaches to natural language processing (nlp) creates challenges in collecting high quality annotations @xcite . a platform such as amazon mechanical turk (mturk) allows accessible, sophisticated task design @xcite but defaults to simple templates for nlp tasks, and is susceptible to self-selection bias (raters may not represent the population) and social desirability bias or demand effects, where judges seek to confirm the inferred hypotheses of experimenters @xcite @xcite . cognitive research has shown that self-reports are frequently inaccurate @xcite , and that subjects are unable to effectively introspect about or recall their eye movements during reading @xcite @xcite . this encourages the use of precise, objective recordings of non-conscious language processing behavior to use as model training data, rather than relying solely on reader annotations. as emphasized by @xcite , when reading humans produce reliable patterns that can be recorded, such as tracking gaze trajectories or measuring brain activity. these signals can associate linguistic features with cognitive processing and subsequently be applied to nlp tasks. the recording of eye movements during reading can be traced to psychology and physiology in the late 1800s @xcite , but the use of eye-tracking data in nlp is a relatively new phenomenon @xcite . brain data has a longstanding relationship with language processing and in recent years has been investigated with nlp models @xcite , leveraged notably by @xcite to predict fmri activity from novel nouns. the working intuition in using cognitive data in recent nlp studies is that signals produced by humans during naturalistic reading can be leveraged by artificial neural networks to induce human-like biases and potentially improve natural language task performance. for example, recognizing and relating entities while reading sentences might elicit patterns of activation or particular gaze behaviors in human readers which can be transferred to and recovered by models given the same text sequences as inputs. models might then generalize learned biases to similar text inputs. one route for augmenting neural networks with cognitive data is to regularize attention, such as with eye-tracking @xcite and/or electroencephalography (eeg) data @xcite . eye-phrase @xmath0, immigrants @xmath1; eye-tracking appears to be the more robust and proven measurement modality for augmenting machine learning models. in particular, fixations are the eyes' focused pauses on areas of interest (aois); saccades are rapid movements from one point to another. these movements can be progressive or regressive, moving to later or earlier aois (e.g., the words in a sentence), and occur on the order of milliseconds. @xcite combine the indirect signals of et with eeg data, moving beyond inferences based on eye-screen positioning (e.g., that content words are more likely to be fixated upon, and unfamiliar words have longer fixation durations). in general, eeg provides a high temporal resolution but due to interference from the scalp exhibits a poorer spatial resolution than other brain imaging methods such as magnetoencephalography (meg; @xcite . to understand cognitive processes involved in, e.g., longer fixation durations, eeg can complement et, where larger amplitudes for event-related potentials (erps) such as n400 correspond to less frequent or less predictable words and semantic processing @xcite . a number of studies have applied cognitive data to nlp tasks, among them: sentiment analysis @xcite , part-of-speech (pos) tagging @xcite , and named entity recognition (ner) @xcite . @xcite apply both gaze and brain data to a suite of nlp tasks @xcite , including relation classification. for sentiment analysis, @xcite use mtl for a bidirectional long short-term memory (bilstm) network, learning gaze behavior as the auxiliary task. @xcite predict et data with a variant of bert as an auxiliary to question answering. bautista and naval (2020) predict gaze features with an lstm to evaluate on sentiment classification and ner tasks. @xcite supervise model attentions with et data by adding attention loss to the main classification loss so the model jointly learns a sentence classification task and the auxiliary task of attending more to tokens on which humans typically focus. @xcite follow this paradigm using eeg data. a number of studies impose schemata or mechanisms to encourage bert to learn more structured rc representations: soares et al. (2019) fine-tune bert for rc, experimenting with the use of additional special entity tokens from bert's final hidden states to represent relations, rather than the last layer's classification token, [cls]: the [cls] token is conventionally used as the sentence representation for tasks such as classification @xcite , as well as attention analysis @xcite 3 data @xcite created zuco, a corpus of et and eeg recordings in which 12 adult subjects (fluent english speakers) read full sentences at their own speed, with brain recordings synchronized to eye fixations. the sentences used by the corpus were written english: 400 review excerpts from stanford sentiment treebank @xcite and 707 biographical sentences from a wikipedia relation extraction dataset @xcite . in this work we use a subset of 300 relation sentences (7,737 tokens) divided into 566 phrases 3 by @xcite to encompass the multiple binary relation statements, and annotated with markers around entity mentions. the dataset uses 11 relation types, as seen in for et we had access to five features for each word, including first fixation duration (ffd), gaze duration (sum of fixations), and total reading time (trt: the sum of the word's fixations including regressions to it). the features for eeg we use are the 105 electrode values mapped to first-pass fixation onsets to create fixation-related potentials (frps), so that each word has 105 values. we average et and eeg values over all subjects, which has been shown to reduce variability of results @xcite and overfitting @xcite . to obtain a single et value for each token, @xcite used the mean fixation duration (mfd), by dividing trt by number of fixations. there is no best practice to our knowledge, and in this study we use trt as a proxy for overall 3 https://github.com/ds3lab/zuco-nlp/ tree/master/relation-classification/data attention to a word. for eeg electrode values, we obtain a scalar for each word by taking the mean @xcite , rather than the maximum @xcite . ## method we split the english-language zuco samples into 90% training and 10% test sets. we perform 9-fold cross-validation on the training data for 6 epochs with batch size 16 and otherwise default hyperparameters, averaging validation results over folds. we fine-tune the final models on the full training data, choosing 4 epochs based on cross-validation accuracy, reserving the test data for later comparison. for the main rc task, categorical crossentropy loss l rc is calculated for each sequence j in batches of size m with sequence-level predictions for the c classes, ŷ ∈ r m ×c , and a vector of target class indices @xmath2: we additionally compute auxiliary attention losses. bert takes an input of sequence hidden @xmath3, @xmath4. ## conclusions and future work overall, bert models with multiple modes of human attention supervision converged to accuracy for the relation classification task that does not differ significantly from the fine-tuned base bert model, despite possessing attention distributions that were shifted toward the cognitive data. measured by overlap, attention supervision with eye-tracking data was most influential on the final layer's [cls]-assigned attention weights. in addition, we have shown that the behavior of these models differs from the baseline consistently by misclassifying different samples, exposing pathologies which may be of interest for research in neural network-based human language processing. @xcite have pointed to distinct reading patterns evident in eye-tracking studies for unfamiliar proper nouns which may be more readily apparent in the et values. on the other hand, it may be that the eeg data were too noisy and that dimensionality reduction to find the most predictive electrode values, such as performed by @xcite , is needed to provide a consistent signal. additionally, hollenstein et al. (2019) and muttenthaler et al. (2020) incorporated eeg frequency bands into their zucobased studies; the α frequency band has been associated with attention @xcite and supervision with this band might yield different results. the cognitive data used in this study were not specifically produced from an entity-related reading task, but @xcite has noted the increased difficulty of processing proper names which is reflected in behavioral studies, with a double dissociation between common nouns and proper names where production of one type of noun is impaired but the other is intact. a more careful use of neuroimaging data may be needed to leverage signals reflecting the differing brain mechanisms involved in human lexical access. typically, researchers implicitly seek to induce a human-like bias in classifiers so they correlate more highly with human judgments by using selfreported annotations to supervise learning. this supervision is limited insofar as self-reports can not specify responses inaccessible to annotator introspection, such as the brain's electrical activity or detailed gaze behavior. models additionally biased by non-conscious physiological responses may learn to more robustly reflect human language processing, incorporating both subjective and objective signals. human annotations are conventionally taken as ground truth. yet cognitive data may offer valid judgments, as well. for example, in sentiment analysis, a false negative according to a self-report could be a true negative according to physiological affective responses. cognitive data may reveal inconsistencies and gradations obscured by labels. in the case of relation extraction, cognitive data might uncover patterns more reflective of different, potentially novel categories of semantic relation, or different dynamics, due to linguistic ambiguity and/or changing contexts and readerships. in terms of limitations, we did not investigate the breadth or depth of influence of our method of [cls]-based aggregate attention supervision on the model attentions across layers and heads, nor the supervision of specific layers or heads as done by @xcite . we did not explore trade-off coefficients on the multiple losses, such as the convex combination used by @xcite . we used a relatively small english dataset, which limited generalizability and robustness. @xcite describe some ethical concerns in the recording and use of cognitive data, including voluntary data procured but not recorded by nlp researchers. this includes loss of privacy with the identification of subjects, an overrepresentation and normalization of particular demographics, and the perpetuation of fossilized human prejudices. @xcite have described the potential for human attention supervision to address the validity of attention as a faithful, human-like explanation for model decisions while @xcite have discussed the potential for deception by manipulating attention to make models appear less biased. future work could scrutinize whether human attention supervision can provide a basis for exploring cognitive biases learned by models, or align attention-based explanations to model outcomes: enabling performant models to adhere faithfully to auditor expectations.