A Framework for Decoding Event-Related Potentials from Text
Shaorong Yan Aaron Steven White


Non-renewal statistics in quantum transport through the eyes of first-passage and waiting time distributions
    Daniel S. Kosov
    December 30, 2023
============================================================================================================


We propose a novel framework for modeling event-related potentials (ERPs) collected during reading that couples pre-trained convolutional decoders with a language model. Using this framework, we compare the abilities of a variety of existing and novel sentence processing models to reconstruct ERPs.  We find that modern contextual word embeddings underperform surprisal-based models but that, combined, the two outperform either on its own. 




§ INTRODUCTION


Understanding the mechanisms by which comprehenders incrementally process linguistic input in real time has been a key endeavor of cognitive scientists and psycholinguists. Due to its fine time resolution, event-related potentials (ERPs) are an effective tool in probing the rapid, online cognitive processes underlying language comprehension. Traditionally, ERP research has focused on how the properties of the language input affect different ERP components <cit.>.[Examples of such components include the N1/P2 <cit.>; N250 <cit.>; N400 <cit.>; and P600 <cit.>]

While this approach has been fruitful, researchers have also long been aware of the potential drawbacks to this component-centric approach: a predictor's effects can be too transient to detect when averaging ERP amplitudes over a wide time window—as is typical in component-based approaches <cit.>. Different predictors can affect ERP in the same time window as an established component but have slightly different temporal <cit.> or spatial <cit.> profiles. This means that the definition of a component strongly affects interpretation.



There are two typical approaches to resolving these issues. The first is to plot the data and use visual inspection to select an analysis plan, introducing uncontrollable researcher degrees of freedom <cit.>. Another approach is to run separate models for each time point (or even each electrode) to look for the emergence of an effect. This necessitates complex statistical tests to monitor for inflated Type I error <cit.> and to control for autocorrelation across time points <cit.>.

We explore an alternative approach to the analysis of ERP data in language studies that substantially reduces such researcher degrees of freedom: directly decoding the raw electroencephalography (EEG) measurements by which ERPs are collected. Inspired by multimodal tasks like image captioning <cit.> and visual question answering <cit.>, we propose to model EEG using standard convolutional neural networks (CNNs) pre-trained under an autoencoding objective. The decoder CNN can then be decoupled from its encoder and recoupled with any language processing model, thus enabling explicit quantitative comparison of such models. We demonstrate the efficacy of this framework by using it to compare existing sentence processing models based on surprisal and/or static word embeddings with novel models based on contextual word embeddings. We find that surprisal-based models actually outperform contextual word embeddings on their own, but when combined, the two outperform either model alone. 



§ MODELS


All of the models we present have two components: (i) a pre-trained CNN for decoding raw EEG measurements time-locked to each word in a sentence; and (ii) a language model from which features can be extracted for each word—e.g. the surprisal of that word given previous words or its contextual word embedding. An example model structure using ELMo embeddings <cit.> is illustrated in Figure <ref>.



  
Convolutional decoder 

For all models, we use a convolutional decoder pre-trained as a component of an autoencoder. To reduce researcher degrees of freedom, the decoder architecture is selected from a set of possible architectures by cross-validation of the containing autoencoder.

The autoencoder consists of two parts: (a) a convolutional encoder that finds a way to best compress the ERP signals; and (b) a convolutional decoder with a homomorphic architecture that reconstructs the ERP data from the compressed representation. ERPs were organized into a 2D matrix (channel × time points). For the encoder, we pass the ERPs through multiple interleaved 1D convolutional and max pooling layers with receptive fields along the time dimension, shrinking the number of latent channels at each step. Correspondingly, for the decoder part, we use a homomorphic series of 1D transposed convolutional layers to reconstruct the ERP data. 

At train time, the decoder weights are frozen, and the encoder is replaced by one of the language models described below. This entails fitting an interface mapping—a linear transformation for each channel produced by the encoder—from the features extracted from the language model into the representation space output by the encoder.



  
Language models

We consider a variety of features that can be extracted from a language model.



    Surprisal


We use the lexical surprisal -log p(w_i | w_1, …, w_i-1) obtained from a RNN trained by <cit.>.



    Semantic distance


Following <cit.>, we point-wise average the GloVe embedding <cit.> of each word prior to a particular word to obtain a context embedding and then calculate the cosine distance between the context embedding and the word embedding for that word. We use the GloVe embeddings trained on Wikipedia 2014 and Gigaword 5 (6B tokens, 400K vocabulary size).



    Static word embeddings
 

We also consider the GloVe embedding dimensions as features. We do not tune the GloVe embeddings using an additional recurrent neural network (RNN), instead just passing the them through a multi-layer perceptron with one hidden layer of tanh nonlinearities. The idea here is that the GloVe-only model tells us how much the distributional properties of a word, outside of the current context, contribute to ERPs.



    Contextual word embeddings
 

We consider contextual word embeddings generated from ELMo <cit.> using the  package <cit.>. ELMo produces contextual word embeddings using a combination of character-level CNNs and bidirectional RNNs trained against a language modeling objective, and thus it is a useful contrast to GloVe, since it captures not only a word's distributional properties, but how they interact with the current context. 

We take all three layers of the hidden layer output in the ELMo model and concatenate them. To ensure a fair comparison with the surprisal- and GloVe-based models, we use the same tuning procedure employed for the static word embeddings. Further, because sentences are presented incrementally in ERP experiments and because ELMo is bidirectional and thus later words in the sentence will affect the word embeddings of previous words, we do not obtain an embedding for a particular word on the basis of the entire sentence, instead using only the portion of the sentence up to and including that word to obtain its embedding.



    Combined models


We also consider models that combine either static or contextual word embedding features with frequency, surprisal, and semantic distance. The latter features were concatenated onto the tuned word embeddings before being passed to the interface mapping.



§ EXPERIMENTS



We use the EEG recordings collected and modeled by <cit.>. In their study, 24 subjects read sentences drawn from natural text. Sentences were presented word-by-word using a rapid serial visual presentation paradigm. 
We use the ERPs of each word epoched from -100 to 700ms and time-locked to word onset from all the 32 recorded scalp channels. After artifact rejection (provided by  with the data), this dataset contains 41,009 training instances.







  
Pre-training

To select which decoder to use, we compare the performance of two CNN architectures motivated by well-known properties of EEG. The first architecture has 5 latent channels and 9 time steps. Given the sampling rate and size of the input (250Hz, 200 time steps), this roughly corresponds to filtering the EEG data with alpha band frequency (∼10Hz). The other has 10 latent channels and 20 time steps, thus lying within the range of beta band activity (∼25Hz). In addition to these two architectures, we also examine whether including subject- and electrode-specific random intercepts improves model performance. 

We conduct a 5-fold cross-validation for each architecture to find the one that has the best performance in reconstructing ERP data. As shown in Table <ref>, the beta models perform better overall than alpha models, since they likely capture both alpha and beta band activities. Adding subject-specific intercept, on the other hand, did not greatly improve the model performance. 



Figure <ref> shows the reconstructed ERPs of the beta model on one trial. The autoencoder can reconstruct the ERP signal very well. The selected channels are illustrative of the reconstruction accuracy across all channels. We thus selected the beta model without subject-specific intercept as the decoder for our consequent models. 




  
Training

The interface mapping and (where applicable) word embedding tuner are trained under an MSE loss using mini-batch gradient descent (batch size = 128) with the Adam optimizer ( and default settings for , , and ) implemented in  <cit.>. Each model is trained for 200 epochs. Since we need at least one preceding word to compute contextual word embeddings, we do not include the first word of the sentence. This left ERPs for 1,618 word tokens per subject (638 word types). After excluding trials containing artifacts, a total of 37,112 training instances remain.



  
Development

To avoid overfitting, we use early stopping and report the models with the best performance on the development set. We did a parameter search over three different weight decays: , , . For each model, we chose the weight decay that produced the best mean performance on held-out data in a 5-fold cross-validation. 



  
Baselines

As a baseline we train an intercept-only model that passes a constant input (optimized to best predict the data) to the decoder. In addition, we fit a baseline model that only has word frequency as a feature. Frequency is also included as an additional feature in all models.



  
Metrics

To account for the fact that our model performance is bounded by the performance of the autoencoder, we report a modified form of R^2 to evaluate the overall model performance.




    R^2_mod = 1 - MSE_model - MSE_autoencoder/MSE_intercept - MSE_autoencoder
 







§ RESULTS


Table <ref> shows the R^2_mod metric for each model. We see that both surprisal and semantic distance outperform both types of word embedding features, all of which outperform frequency alone. When combined, surprisal and semantic distance outperform either alone, and further gains can be made with the addition of either static (GloVe) or contextual (ELMo) embedding features. The addition of contextual embedding features increases performance more than the addition of static word embedding features, such that there is some benefit to capturing context over and above that provided by surprisal and semantic distance. 



  
Time course analysis

To understand where in time each predictor improved model performance, we examine the increase in correlation over the intercept model at each time point (Figure <ref>). There are roughly three regions where the language models outperform the intercept model. The first is right after 100ms post word onset: corresponding to the N1 component, which is typically considered to reflect perceptual processing; the second is between 200 and 350ms: corresponding to the N250 component, which correlates with lexical access <cit.>; and the third is between 300ms and 500ms: corresponding to the N400, which is typically associated with semantic processing. 

Consistent with previous findings <cit.>, adding frequency into the model improved model performance in all three time windows. Also consistent with the literature, adding surprisal and semantic distance improved model performance in the N400 time window <cit.>.  



Models with word embeddings do not differ much from the models containing only frequency, surprisal, and semantic distance, with the biggest difference around 300ms post word onset. This might indicate an effect in the early N400 time window. This could also indicate that processes commonly associated with the N250 may be better captured by the models containing word embeddings. If so, it is less expected and potentially interesting, since most of our models have no access to perceptual properties of the input—with the possible exception of ELMo, whose charCNN may capture orthographic regularities. These effects could reflect our models' ability to capture top-down lexical processing <cit.> or possibly systematic correlations between higher-level features and perceptual features.


  
Part-of-speech analysis

Prior work on ERP during reading distinguishes function word—such as determiners, conjunctions, pronouns, prepositions, numerals, particles—from content words—such as (proper) nouns, verbs, adjectives, adverbs <cit.>. As such, we also examine whether each model's performance differs for content words and function words. We calculate the Pearson's correlation between the predicted and actual ERPs for each word of each model and used linear mixed-effects model to examine the influence on model fit with the inclusion of different information. If a model included a specific type of information, the corresponding predictor is coded as 1, otherwise it was coded as -1. For example, the surprisal model was trained with surprisal but not semantic distance, so the surprisal predictor is 1 for this model and the semantic distance predictor is -1. We further included the interaction between models and word types (function=-1, content=1).

Table <ref> shows the resulting coefficients. Overall, models display better performance for content words than for function words (β̂ = 0.003 , t = 2.01 , p < 0.05), consistent with previous findings <cit.>. Including each type of information also significantly increased model fit (ts > 10.1 , p < 0.01). There was a significant interaction between frequency and word type (β̂ = -0.001 , t = -2.43 , p < 0.02): including frequency increased model performance for function words more than for content words. There was also a marginally significant interaction between ELMo and word type (β̂ = 0.0007 , t = -1.85 , p < 0.064), suggesting that including ELMo embeddings increased model performance for content words more than for function words. 



We also examine the interaction between each type of information and each part-of-speech. Overall, the models had worse performance for particles (β̂ = -0.017 , t = -3.37 , p < 0.01), nouns (β̂ = -0.007 , t = -1.95 , p < 0.051) and pronouns (β̂ = -0.012 , t = -1.76 , p < 0.08). Including each type of information increased overall model fit (ts > 6.05 , p < 0.01). While including frequency increased overall model fit, it increased the model fit for verbs less (β̂ = -0.003 , t = -2.04 , p < 0.05). No other effects reached significance. 



§ RELATED WORK


Traditionally, ERP studies of language processing use coarse-grained predictors like cloze rates,
which often lack the precision to differentiate different neural computational models <cit.>. To overcome such limitations, a main line of attack has been to extract measures from probabilistic language models and evaluate them against ERP amplitudes <cit.>.

While prior studies have also predicted ERPs from language model-based features <cit.>, they fit to aspects of the EEG signals that are unlikely to be related to language processing. Our approach threads the needle by first finding abstract structure in the ERPs with a CNN, then using that knowledge in predicting that structure from linguistic features. We are not the first to use CNNs to model EEG/ERPs <cit.>, but to our knowledge, no other work has yet used CNNs for modeling ERPs during reading.



§ CONCLUSION


We proposed a novel framework for modeling ERPs collected during reading. Using this framework, we compared the abilities of a variety of existing and novel sentence processing models to reconstruct ERPs, finding that modern contextual word embeddings underperform surprisal-based models but that, combined, the two outperform either on its own. 

ERP data provides a rich testbed not only for comparing models of language processing, but potentially also for probing and improving the representations constructed by natural language processing (NLP) systems. We provided one example of how such probing might be carried out by analyzing the differences among models as a function of processing time, but this analysis only scratches the surface of what is possible using our framework, especially for understanding the more complex neural models used in NLP.



§ ACKNOWLEDGMENTS

We are grateful to Dr. Stefan Frank for sharing the EEG data, sentence materials, and language model predictors. We would also like to thank three anonymous CMCL reviewers as well as the the FACTS.lab and HLP lab at UR for providing valuable feedback on the draft.


acl_natbib


