ConceptioArchivearXiv CS
arXiv CSopen access

Energy-Based Transformers as Predictors of Reading Difficulty

Unknown · 2026 · arxiv_cs
arXiv CS · Papers · License: Open Access · 2026
Open Source ↗Direct PDF ↓
artificialintelligenceknowledgerepresentationreasoning
artificial intelligence, reasoning, knowledge representation

Energy-Based Transformers as Predictors of Reading Difficulty Jakub Dotlačil Utrecht University [email protected]

Abstract

arXiv:2606.23382v1 [cs.CL] 22 Jun 2026

Transformer language models have become established tools for modeling human sentence processing, with measures such as surprisal and attention entropy serving as effective predictors of reading difficulty that together capture complementary aspects of processing load. Here, we explore a related class of transformer models: energy-based transformers, which provide a principled formal link to associative memory models, bringing processing research into direct contact with the broader literature on Hopfield networks and dense associative memory. To our knowledge, this is the first exploration of an energy-based transformer measure in computational psycholinguistics. Across reading-time corpora (Natural Stories, UCL eye-tracking, UCL self-paced reading), the energy measure is a robust predictor of reading times, providing significant fit beyond surprisal in all three. In a controlled experiment on relative clause processing, energy at a single layer captures the well-known object/subject asymmetry. We find evidence that it subsumes effects attributable to both attention entropy and surprisal, suggesting that energy may serve as a single unified predictor where multiple complementary measures have previously been required.

1

Introduction

Transformers are dominant models not only in natural language processing and machine learning, but also in computational psycholinguistics as models of human sentence processing. The link to human sentence processing literature has been established in two main ways. First, the surprisal theory of processing (Hale, 2001; Levy, 2008) made an argument that the surprisal (i.e., the log of the inverse probability) of the next token can be used to predict neurobehavioral data. Surprisal from transformer models can be easily collected and used for this prediction. Second, it has been noticed that

Ece Takmaz Utrecht University [email protected]

the attention mechanism in transformers conceptually resembles memory processing accounts like cue-based memory (Lewis and Vasishth, 2005). In support of that, some summarizing measures of attention, like attention entropy, have been successfully used as a predictor of memory interference in human processing (Ryu and Lewis, 2025). There are currently at least two challenges for the link between transformers and human sentence processing. Most importantly, we do not have one overarching measure that would fit processing data such as reading times. For instance, as we will see in Experiment 1 below, attention entropy and surprisal are both useful and needed for modeling reading-time data. Finding a single measure that on its own captures predictions of both of these measures would substantially strengthen the link between the models and sentence processing. Relatedly, while the conceptual link between memorybased models and attention is intuitively appealing, we lack a clearer link between transformers and human memory (see also Oh and Linzen 2025). Having such a link would allow us to investigate the connection between memory and processing in transformers beyond the appeal to just our conceptual understanding and intuitions. In a different tradition, cognitive scientists and machine learning researchers developed and implemented models of associative memory called Hopfield Networks (Hopfield, 1982). There are two recent developments that should make computational psycholinguists consider such models. First, theoretical advancements showed that with architectural modification, the memory storage of Hopfield networks can grow super-linearly with the size. Such models, called modern Hopfield networks or dense associative memory (Krotov and Hopfield, 2016), are particularly well suited to cognitive tasks requiring large memory storage, of which human sentence processing is a prime example. Second, very recent theoretical investi-

gations showed that dense associative memory is closely related to transformer attention (Ramsauer et al., 2020) and some versions of energy-based transformers can in fact be seen as particular implementations of the dense associative memory theoretical framework (Hoover et al., 2023a; Krotov et al., 2025). The last link is the starting point of this work. We explore one particular implementation of energybased transformers, namely energy GPT (NRGPT, Dehmamy et al. 2026) and study how it can be linked to predicting processing. We show that the scalar function that is at the core of NRGPT, energy, can naturally be connected to reading-time data and we provide evidence that the energy of NRGPT captures at least some processing difficulties that currently require the combination of surprisal and attention entropy, thus replacing a mixture of measures with a single, straightforward link between transformers and processing. Finally, we fit NRGPT to reading-time corpora to show that the energy measure is competitive with surprisal and can capture reading patterns beyond the surprisal measure.

2

Related work

Using transformers as models of human sentence processing has been popular in recent years in psycholinguistics, with the main focus on surprisal (Hao et al., 2020; Hahn et al., 2022; Hoover et al., 2023b; Wilcox et al., 2023). Beyond surprisal, a number of other measures have been considered for reading-time data, often based on the attention mechanism, such as attention entropy (Ryu and Lewis, 2021; Oh and Schuler, 2022; Ryu and Lewis, 2025). A recurring complication for the surprisal-based approach is that, with increasing model size, transformers actually get worse at predicting reading-time data (Oh and Schuler, 2023; Kuribayashi et al., 2024; Michaelov and Levy, 2026). This scaling behavior has shaped which models are used. GPT-2, and in particular GPT-2-small, has become the standard choice for predicting human sentence processing, since it was found to sit in the best spot (Oh and Schuler, 2023): it fits the data better than smaller models, while larger models show a decrease in fit. Further, the decrease in fit with the growth of model size led to investigations into whether memory is the culprit here. There are various attempts to limit the memory

of transformers to make their next-word predictions more human-like (Hahn et al., 2022; Timkey and Linzen, 2023; Lesci et al., 2024; Thamma and Heilbron, 2025; Michaelov and Levy, 2026). In contrast to that research, we use models that were inspired by the properties of human associative memory from the start, and study how versions of them adapted to the transformer architecture can be useful in predicting human processing data. To the best of our knowledge, this article is the first investigation of energy-based transformers in computational psycholinguistics for the purpose of fitting them to human sentence processing.

3

Theoretical background: NRGPT

NRGPT (Dehmamy et al., 2026) is a recent reformulation of the GPT architecture that recasts a transformer’s forward pass as gradient descent on a scalar energy function defined over token states. At each step, the token representations are directed downhill along the energy landscape, so running the model can be understood as moving toward a low-energy configuration for the input. Figure 1 illustrates this: as layer iterations proceed, the energy decreases and the predicted next token becomes progressively more plausible. Architecturally, NRGPT stays close to a standard GPT: it operates on the same input embeddings, uses multi-head causal attention, has a feedforward sublayer, and produces next-token logits at the output. There are, however, some structural changes. We discuss the two significant differences from conventional transformers: NRGPT uses a parallel structure, and it applies the transformer block recurrently. In the discussion below, x ∈ RD×N is the input sequence with N tokens and D dimensions and x(t) represents the input sequence at the layer t (for standard GPT) or the layer iteration t (for NRGPT). Parallel-style transformer. A conventional transformer is sequential: a layer-normed input sequence is inserted into an attention layer (AT), and the output is fed into a layer-norm (LN) and a feed-forward layer (FF): x(t+1) = x(t) + FF(LN(x(t) + AT(g (t) ))), (1) where g (t) = LN(x(t) ) is the (layer-)normalized hidden state. By contrast, NRGPT is a parallelstyle transformer, i.e., the attention and feedforward layer apply in parallel:

x(t+1) = x(t) + AT(g (t) ) + FF(g (t) )

(2)

The adherence to the parallel structure is strictly speaking not necessary for energy-based transformers, but this design choice makes it easier to implement next-token prediction as a descent through the energy landscape; see below. Recurrence. A standard transformer applies a stack of distinct layers in a single forward pass, whereas NRGPT applies the transformer block recurrently for k iterations. Each iteration corresponds to one descent step on an energy landscape, which we introduce next.

also Figure 1 for a concrete visualization in a 2D PCA reduction, with a label that would be obtained if the language model head were applied). We AT (g), is note that the first energy component, EA a negated log-sum-exp over the attention scores. FF (g), is dense The second energy component, EA associative memory with a non-linear link function. Further details on these components and on how their gradients reproduce the standard attention and feedforward sublayers are discussed in (Dehmamy et al., 2026) and are briefly summarized here in Appendix A.

Energy. NRGPT associates a scalar energy EA with each token position A, decomposed into the AT and the feedforward energy attention energy EA FF , EA AT FF EA (g) = EA (g) + EA (g).

(3)

Intuitively, the energy can be seen as a processing effort. It is low when the token at position A is easy to integrate and fits the context and the past knowledge, and high when it is difficult to integrate. Inference as gradient descent. The generation of tokens in NRGPT proceeds by minimizing each per-token energy EA with respect to its own token state. The update rule that replaces a conventional transformer layer is (t+1)

xA

(t)

= xA − η (t)

∂EA (t)

,

(4)

∂gA

where η (t) ∈ RD×D is an (optionally learnable) (t) inference-rate matrix and gA is the normalized state at position A. Applying (4) for k steps pro(0) (1) (k) duces a trajectory xA , xA , . . . , xA on token A’s (k) energy landscape. The final state xA is then mapped to next-token logits in the usual way. Attention and feedforward components. The AT (g) and E FF (g) are two energy components, EA A built so that differentiating them recovers the ordinary attention and feedforward operations of a transformer. Intuitively, one NRGPT iteration behaves much like one parallel-style transformer layer (with weights tied across iterations), except that the layer is now obtained by descending an energy rather than being stipulated directly (see

Figure 1: Descent through the energy landscape. L1. . . L6 - layer iterations at the word his in the sentence prefix He unlocked the door with his . . . The predicted words show the projection of LM head per layer.

Why energy is informative. Two properties of this construction matter for our purposes. First, energy is a single scalar summary of the network’s state at each token and each iteration, well defined for any model trained with the NRGPT objective. Second, NRGPT can be shown to be asymptotically stable: under mild conditions, the energy of each token decreases along the trajectory and converges to a fixed value once the preceding tokens have settled (Dehmamy et al., 2026). The trained model used in practice is not constrained to satisfy these conditions, so the descent is asymptotic rather than strict and individual iterations need not lower EA ; energy nevertheless remains a well-defined and well-behaved scalar summary of each token’s processing trajectory. The energy profile across iterations t = 1, . . . , k therefore provides a principled, dynamical view of how the model integrates each token into the ongoing representation. In the

experiments below, we use NRGPT with k = 6 iterations and treat the energy at intermediate iterations as a candidate predictor of human reading times. Energy and transition probability. A key interpretive point connects NRGPT’s energy to the surprisal literature. Within the energy-based modeling framework, an energy function is intended by convention to play the role of a negative log-likelihood, so that low-energy configurations correspond to high-probability ones. Dehmamy et al. (2026) appeal to this convention for NRGPT: at each position A, the state gA starts from the previous token’s embedding and is moved by the dynamics in (4) to a state of lower energy, and the per-token energy EA at that position can be read as scoring the (negative log) transition probability for the upcoming token given its preceding context. The interpretation is most cleanly motivated in the simplified regime where η = I. This does not hold in our setup, where η is a learnable matrix. For the model below, we thus treat the identification as an interpretive frame rather than a strict equality. With that caveat, energy is the natural analog of surprisal: surprisal scores the lexical identity of the upcoming word under a discrete softmax readout, while energy scores the cost of the continuous-state integration trajectory that produces it. Both quantities are tied to the same underlying conditional dynamics, but they need not coincide. A predictable word reached via a costly integration can have low surprisal and high energy, and a surprising word that fits readily into the parse can have high surprisal and relatively low energy. This is the basis for our hypothesis that energy captures integration-driven difficulty that surprisal misses, while still tracking the predictability-driven component that surprisal is sensitive to. Energy and attention entropy. The attention energy is also tied to attention entropy, the measure that Ryu and Lewis (2025) use as a predictor of integration difficulty. Let sB denote the per-head attention score that position A assigns to a preceding position B, scaled by the usual softmax temperature β (the explicit form for per-head attention is given in Appendix A). Let p denote the resulting attention distribution over preceding positions, i.e. the causal softmax with entries pB ∝ exp(sB ). As AT (g), is the we noted, one energy component, EA negated log-sum-exp over the attention scores. Because p is the softmax of s, the log-sum-exp can be

decomposed (for a single head) into LSE(s) = ⟨s⟩p + H(p),

(5)

with the expected attention score ⟨s⟩p = P B pB sB and the attention entropy H(p) = P − B pB log pB . Tying this to the attention enAT decomposes into two ergy, we thus see that EA pieces with distinct interpretations: the negative of the expected score, −⟨s⟩p , capturing how well the keys the model attends to match the query at A on average, and a negated attention entropy, −H(p) capturing how spread-out the attention is over the preceding context. The attention-entropy predictor of Ryu and Lewis (2025) is, up to a scaling parameter, one of these two terms. A subtlety must be flagged here. It is tempting to read the decomposition as “energy contains, as one addend, attention entropy, so naturally, it will track its effects”. The situation is more complicated, AT with opposite because the two terms enter EA signs of contribution to difficulty. Ryu and Lewis (2025) find that higher attention entropy predicts more difficulty (longer reading times), but in the decomposition higher attention entropy makes the AT more negative, i.e. lower. attention energy, EA The expected-score term, by contrast, has the intuitive sign: when no preceding key matches the query well, the expected score is low and the energy is high. Because hard-to-integrate positions tend to have both low expected scores and spread-out attention, the two terms are correlated across items, but they push energy in opposite directions. Energy can therefore track difficulty effects via the expectedscore term, with the attention-entropy term partially offsetting it; which term dominates an observed energy gap is an empirical question that we return to when interpreting our experiments.

4

Experiments

4.1

Models

We consider one NRGPT model with two training regimes. The model had 6 layer iterations, 12 heads, context length 1,024 tokens, embedding dimension 1,536. It was trained on OpenWebText (Gokaslan and Cohen, 2019). The parameters used in the model were found using grid search in (Dehmamy et al., 2026) who showed that the trained model is competitive with GPT-2 and GPTrecursive-parallel models. For more details on the model parameters, see Appendix B.

We checked the model with two training regimes: one model trained in (Dehmamy et al., 2026), downloaded from huggingface,1 which was trained for 500,000 iterations. Next to it, we also trained our own model with the same parameters but only for 100,000 iterations. The latter model is tested for practical reasons. Its training required around 60 hours on four H100s, which is within reach of NLP and psycholinguistic researchers. We wanted to see whether this amount of training is already sufficient for a good fit to psycholinguistic data. Such information is hopefully useful for researchers who want to develop and test their own energy-based models on human sentence processing. The results of the 100,000-iteration model are very similar to the model trained for 500,000 iterations and we do not discuss them further in the main text, but interested readers can find them in Appendix C.2 4.2

Experiment 1: Relative Clause Processing

As we noted, surprisal theory and attention entropy do not track the same effects in processing. If we claim that energy in NRGPT can potentially subsume both, we should look at instances where one, but not the other, is the dominant explanation. One such well-known case concerns relative clauses. Consider the following pair of subject relative clause (SRC) and object relative clause (ORC): (1)

a.

b.

The firemen that called the residents attacked the house with high-powered hoses. (SRC) The firemen that the residents called attacked the house with high-powered hoses. (ORC)

It has been shown that the embedded verb is processed slower in ORC, (1-b), compared to SRC, (1-a) (Grodner and Gibson, 2005; Staub, 2010; Levy and Gibson, 2013). Surprisal theory has a hard time explaining this effect. Object relative clauses are less frequent than subject relative clauses, but higher surprisal should be present already at the noun phrase, the residents, in (1-b), since that already signals the ORC. At the verb, (1-b) should be unambiguously ORC, so surprisal should play little role there. Indeed, it has been 1 https://huggingface.co/bsaha205/ NRGPT-H-FF2W-128M-OWT 2 Code for the experiments available at https://github.com/jakdot/ energy-transformers-reading-difficulty.

shown that the surprisal collected from GPT-2 does not show a difference between the verbs in SRC and ORC, contrary to human sentence processing. This is a point made clearly in (Ryu and Lewis, 2025), who furthermore show that attention entropy predicts processing difficulties for the embedded verb in ORC compared to SRC. On the other hand, (Staub, 2010) shows that the noun phrase the residents is harder to process as the subject in ORC than the object in SRC, in line with surprisal, but not predicted by attention entropy (Ryu and Lewis, 2025). We explore how energy in NRGPT captures the contrasts in SRC and ORC. Materials. We used the 24 sentence pairs from Staub (2010), which contrast SRCs and ORCs matched for argument structure. To ensure equal token counts across conditions, we modified a subset of items by adding tokens at the start of the sentence, following the procedure of Ryu and Lewis (2025). Representative examples are given in (2) and (3). (2)

Embedded verb contrasts: a. Yesterday at early afternoon, the firemen that called the residents attacked the house with high-powered hoses. (SRC) b. Yesterday afternoon, the firemen that the residents called attacked the house with high-powered hoses. (ORC)

(3)

Noun phrase contrasts: a. Yesterday early afternoon, the firemen that called the residents attacked the house with high-powered hoses. (SRC) b. Yesterday very early afternoon, the firemen that the residents called attacked the house with high-powered hoses. (ORC)

Analysis. While energies from various layers might be informative, we want to use the one that is close to converging, i.e., where the energy descent is stabilizing. We explore relative-clause examples and see that across words, the fifth layer iteration is the one where energy descent flattens out, followed by a bigger jump in the sixth iteration; see Fig. 2 and the top of Fig. 3. We therefore focus on the last two layers: energy values in the fifth and the sixth layer iterations. We evaluate two contrasts: the embedded verb,

Figure 2: Energy trajectories across layer iterations per word for one relative clause.

(2), and the in the embedded noun phrase, (3). For each position, we compare surprisal, energy at the two layers, and its decomposition into E FF , expected score and attention entropy between conditions across the 24 items. Just like for surprisal, which calculates, for the word at position n, the predictive measure for the word n + 1, we think of energy and derived measures causally: we study whether energy for the word at position n is predictive for the word n + 1, i.e., the following word. Results: embedded verb. For the embedded verb, surprisal of NRGPT does not differentiate the two conditions (t = 0.1), consistent with previous findings for GPT-2 (Ryu and Lewis, 2025). Energy at layer 5 predicts the contrast in the expected direction: the mean energy difference (ORC minus SRC) is 55 units (t = 15.3, p ≪ .001). This is a large and highly significant effect. As shown in Figure 3, the effect peaks at the fifth layer iteration and is nullified at the sixth. In fact, energy at layer 6 does not reach significance. We now break down the possible cause of the highly significant effect of energy in layer 5. Attention entropy in that layer also predicts the effect (ORC minus SRC: 3.9, t = 12.8, p ≪ .001), but recall that attention entropy has the opposite sign in the energy calculation. The effect in energy is instead driven by the (opposite sign of the) expected score in layer 5 (ORC minus SRC: -50.6, t = −9.3, p ≪ .001) and E FF (ORC minus SRC: 8.7, t = 2.7, p < .01). Results: embedded noun phrase onset. At the embedded noun phrase onset (the), surprisal predicts ORC difficulty strongly (ORC minus SRC: 4.5 bits, t = 15.8). Energy at layer 5 also predicts this contrast (ORC minus SRC: 16.7 units, t = 4.7, p < .001). Just as in the previous case, energy at

layer 6 does not reach significance. Breaking down the effect of layer 5 energy, we see that attention entropy does not predict this effect (ORC minus SRC: -0.06, t = −0.3, p > .1). The effect is driven by the (opposite sign of the) expected score (ORC minus SRC: -15.5, t = −2.8, p < .01). Energy is thus a significant predictor at both difficulty loci in relative-clause processing. Surprisal predicts only the embedded-subject effect; attention entropy predicts only the embedded-verb effect. Energy predicts both. 4.3

Experiment 2: Reading-time corpora

We study whether the energy measure in NRGPT can be used to predict reading times in psycholinguistic corpora. We compare the effect of energy (collected again at the fifth and sixth layers) to surprisal, collected from two models: NRGPT (for the closest comparison to energy) and GPT-2-small (Radford et al., 2019). The latter is used for closer comparison with previous research. Data. We use two corpora: the Natural Stories (NSC) corpus (Futrell et al., 2021), which consists of 10 texts read in a self-paced reading paradigm; and eye-tracking and self-paced reading data from the UCL corpus (Frank et al., 2013). From both corpora, we excluded reading times shorter than 100 ms and greater than 3,000 ms. We also excluded reading times for a NSC story if the participant answered 4 or fewer out of 6 comprehension questions correctly. From the UCL, we excluded reading times for those participants who answered less than 80 per cent of comprehension questions correctly. We calculated energy and surprisal measures on the corpora. The stories in the NSC are slightly larger than the context window of NRGPT. We decided to use only the part of each story that fits the context window. For multi-token words, we use the mean energy.3 We fit linear mixedeffects models predicting log-transformed reading times, following standard practice in the literature. The models were constructed on the 703,720 observations for the NSC corpus, 36,823 for the UCL eye-tracking corpus, and 217,683 observations for the UCL self-paced reading corpus. Models. We fit eight linear mixed-effects models. All models included fixed-effect covariates for word position in the text (word position), log 3 To ensure the effects are not driven by this decision, we also show results for single-token words only in Appendix D. These show the same pattern as the results reported here.

Figure 3: Top: Gradient descent in the context of the 6th layer for one example of the subject relative (SR, left) and the object relative (OR, right) clause. L1. . . L6 - layer iterations right before the critical word (the verb). The predicted words next to the labels show the projection of LM head per layer. Middle and bottom: Energy trajectory across layer iterations for the embedded verb (top) and noun phrase onset (bottom) in SRC vs. ORC conditions. Each tick on the x-axis corresponds to one layer iteration in NRGPT.

unigram frequency (log unigram), log bigram frequency (log bigram), and word length (wordlength). They also included by-participant and by-story (bysentence in the case of UCL) random intercepts. The models have, as fixed-effect predictors, surprisal (from one or the other model), energy (from one or the other layer), and surprisal+energy. We are interested in the predictive effect of surprisal, energy, and their combination. The dependent variable was reading time based on key-press duration (spr data) and go-past reading time (eye tracking), both log-transformed. Results. Results are summarized in Table 1. The table shows model log likelihoods and the direction of the predictor effect, i.e., whether it was positive (+) or negative (-). 0 indicates non-significance. We expect both surprisal and energy to be positively correlated with reading times. This is not always the case: surprisal of GPT-2 is negative in the UCL self-paced reading data, and layer 6 energy often

appears as a negative predictor. Layer 5 energy always goes in the expected direction. Surprisal provides a better fit than energies in the NSC corpus, while energies provide a better fit in the UCL (et) and UCL (spr) corpora. Energies furthermore remain significant predictors even when combined with surprisal in one model. Energy thus accounts for substantial variance in reading times over and above surprisal. As we noted before, the attention energy consists of two parts: expected score and attention entropy. We break down the energy contribution of those models that have the highest log likelihood and where the energy contribution goes in the expected direction. For NSC, we see that the positive effect of the fifth layer energy is driven by the negative effect of the expected attention score (t = −23.4). In the case of UCL eye tracking, the positive effect of the sixth layer energy is driven by the negative effect of attention entropy (t = −14.5).

Model with

+/-/0? NSC

LogLik NSC

Surprisal Surprisal-GPT2 Energy (L5) Energy (L6) Surprisal + Energy (L5) Surprisal + Energy (L6) Surprisal-GPT-2 + Energy (L5) Surprisal-GPT-2 + Energy (L6)

+ + + +,+ +,+,+ +,-

−133,672 −133,662 −134,020 −134,217 −133,536 −133,667 −133,528 −133,660

+/-/0? UCL (et) + + + + +,+ +,+ +,+ +,+

LogLik UCL (et) −33,636 −33,638 −33,783 −33,405 −33,625 −33,303 −33,625 −33,333

+/-/0? UCL (spr) 0 + 0,+ 0,0,+ 0,-

LogLik UCL (spr) −13,135 −13,132 −13,108 −13,131 −13,108 −13,131 −13,105 −13,128

Table 1: Mixed-effects model results for the Natural Stories (NSC) corpus and the self-paced reading (spr) and eye-tracking (et) portions of the UCL corpus. LogLik=log likelihood. +/- is the estimate in the model positive (+), negative (-), or non-significant (0)? Linear mixed-effects models lack degrees of freedom to calculate precise p-values. As is common, we take values |t| > 2 as significant.

5

Discussion

Across the experiments, we see that the energy of NRGPT is a robust predictor of reading difficulty. Energy at the fifth layer is particularly predictive of the reading-time pattern. In our first case study, we see that it can capture effects of both surprisal and attention entropy. In our experiments on corpora, we see that it is a strong predictor of self-paced reading data. For eye-tracking, the model with energy of the sixth layer explains variance the best. While it might be tempting to assume that the fifth layer energy is more representative for self-paced reading data and the sixth layer energy is more representative for eye-tracking data, we have to note that the UCL eye-tracking results have far fewer observations than the self-paced reading data, so one should be careful about the interpretation of these differences. Interestingly, it is also the fifth layer that most strongly correlates with surprisal values and this correlation goes down in the sixth layer (for NSC data: r = 0.41 for the fifth layer, r = 0.33 for the sixth layer). The decreased correlation of the sixth layer suggests that the sixth layer moves to the space that is partially undone by the LM head which connects the latent vector to actual tokens. The correlation of the fifth layer suggests that the energy is approximating surprisal, but is doing something else as well. Our results from Experiment 1 suggest that in addition to surprisal, the fifth-layer energy also captures memory-related aspects of processing. It remains to be seen whether other attempts to limit transformer models with human-like memory constraints to make surprisal

a better fit, for instance, by using lossy-context surprisal (Futrell and Levy, 2017; Futrell et al., 2020; Hahn et al., 2022), align with our research. In our studies, we mainly focused on the whole energy of a layer. As we noted, the total energy that we considered has two components: the attention energy, EAT , and the feedforward energy, EFF . The former, in turn, can be decomposed into (scaled) expected attention score and attention entropy. We saw that expected attention score was particularly useful in fitting reading-time data. This result is relevant also for researchers who work with classical transformers and are not interested in energy models. While researchers have proposed that there is an intuitive link between cue-based retrieval memory and attention entropy (Ryu and Lewis, 2025), expected attention score, to the best of our knowledge, has not been studied in sentence processing from this perspective. Based on our results, it seems possible that the latter measure would be a better proxy for reading-time data. It remains to be seen whether this also holds for classical transformers.

6

Conclusion

We investigated the energy function of NRGPT as a predictor of human reading difficulty, to our knowledge the first such use of an energy-based transformer measure in computational psycholinguistics. The energy scalar provides a principled link to associative memory models and, as our results show, a practically useful predictor of reading times. Across three corpora, NRGPT energy is a robust predictor that contributes significantly over and above surprisal. In a controlled experiment

on relative clause processing, energy captures the object/subject asymmetry. This suggests that energy may be a valuable new tool for computational psycholinguists. We hope this work encourages further exploration of energy-based transformers in psycholinguistics and motivates closer theoretical ties between sentence processing research and associative memory.

Limitations This study is a first exploration of energy-based transformers as predictors of human sentence processing, and its scope is correspondingly narrow in several respects. First, we study a single model in just one configuration and at two training checkpoints. We do not know how our findings generalize to other energy-based transformers, to other architectural choices within NRGPT, or to other model sizes. Given that classical transformers show systematic shifts in reading-time fit as model size and training change, similar dependencies are plausible here and remain to be mapped out. Second, our empirical base is limited. We evaluate on three reading-time corpora (Natural Stories, UCL eye-tracking, UCL self-paced reading) and one controlled relative-clause manipulation. Broader testing across languages, constructions, and reading paradigms would be needed before drawing strong conclusions about the generality of energy as a processing predictor. Third, we examine only selected measures derived from the model: the total layer energy and its decomposition into expected attention score and attention entropy, compared against surprisal. Other measures could be derived from the energy landscape (for example, the number of descent steps to convergence, or properties of the trajectory), and these may carry additional processing-relevant information that we have not explored. Finally, we restrict the dependent measure to reading times. Other behavioral and neural measures, such as brain activation from fMRI or EEG, are an important target for future work and would provide a stronger test of whether energy tracks processing difficulty in general rather than reading time specifically.

Ethical statement This work relies entirely on previously published, publicly available resources. The behavioral data come from the Natural Stories corpus (Futrell et al.,

2021) and the UCL corpus (Frank et al., 2013), both of which were collected and released by the original authors under appropriate ethical approvals and participant consent. We did not collect any new data from human participants. The data we use contain no personally identifying information. The models we use, NRGPT (Dehmamy et al., 2026) and GPT-2 (Radford et al., 2019), and their training data are publicly available and were used in accordance with their licenses and intended research use. We foresee no harmful applications or risks to individuals arising from this work.

Acknowledgments The research reported in this paper was supported by the European Research Council (ERC), grant 101088098 - MEMLANG. Views and opinions expressed are however those of the authors only and do not necessarily reflect those of the European Union or the European Research Council Executive Agency. Neither the European Union nor the granting authority can be held responsible for them. We thank the members of the MEMLANG group for their comments. We used AI tools for help with coding and for text editing.

References Nima Dehmamy, Benjamin Hoover, Bishwajit Saha, Leo Kozachkov, Jean-Jacques Slotine, and Dmitry Krotov. 2026. Nrgpt: An energy-based alternative for gpt. Proceedings of ICLR. arXiv preprint arXiv:2512.16762. Stefan L. Frank, Irene Fernandez Monsalve, Robin L. Thompson, and Gabriella Vigliocco. 2013. Reading time data for evaluating broad-coverage models of English sentence processing. Behavior Research Methods, 45(4):1182–1190. Richard Futrell, Edward Gibson, and Roger P Levy. 2020. Lossy-context surprisal: An informationtheoretic model of memory effects in sentence processing. Cognitive science, 44(3):e12814. Richard Futrell, Edward Gibson, Harry J. Tily, Idan Blank, Anastasia Vishnevetsky, Steven T. Piantadosi, and Evelina Fedorenko. 2021. The Natural Stories corpus: A reading-time corpus of English texts with accompanying recorded narratives. Language Resources and Evaluation, 55:63–77. Richard Futrell and Roger Levy. 2017. Noisy-context surprisal as a human sentence processing cost model. In Proceedings of the 15th conference of the european chapter of the association for computational linguistics: Volume 1, long papers, pages 688–698.

Aaron Gokaslan and Vanya Cohen. 2019. OpenWebText corpus. http://Skylion007.github.io/ OpenWebTextCorpus. Daniel Grodner and Edward Gibson. 2005. Consequences of the serial nature of linguistic input for sentential complexity. Cognitive Science, 29(2):261– 290. Michael Hahn, Richard Futrell, Roger Levy, and Edward Gibson. 2022. A resource-rational model of human processing of recursive linguistic structure. Proceedings of the National Academy of Sciences, 119(43):e2122602119. John Hale. 2001. A probabilistic Earley parser as a psycholinguistic model. In Proceedings of the Second Meeting of the North American Chapter of the Association for Computational Linguistics on Language Technologies, Pittsburgh, PA. Yiding Hao, Simon Mendelsohn, Rachel Sterneck, Randi Martinez, and Robert Frank. 2020. Probabilistic predictions of people perusing: Evaluating metrics of language model performance for psycholinguistic modeling. In Proceedings of the Workshop on Cognitive Modeling and Computational Linguistics, pages 75–86, Online. Association for Computational Linguistics. Benjamin Hoover, Yuchen Liang, Bao Pham, Rameswar Panda, Hendrik Strobelt, Duen Horng Chau, Mohammed Zaki, and Dmitry Krotov. 2023a. Energy transformer. Advances in neural information processing systems, 36:27532–27559. Jacob Louis Hoover, Morgan Sonderegger, Steven T Piantadosi, and Timothy J O’Donnell. 2023b. The plausibility of sampling as an algorithmic theory of sentence processing. Open Mind, 7:350–391. John J Hopfield. 1982. Neural networks and physical systems with emergent collective computational abilities. Proceedings of the national academy of sciences, 79(8):2554–2558. Dmitry Krotov, Benjamin Hoover, Parikshit Ram, and Bao Pham. 2025. Modern methods in associative memory. arXiv preprint arXiv:2507.06211. Dmitry Krotov and John J Hopfield. 2016. Dense associative memory for pattern recognition. Advances in neural information processing systems, 29. Tatsuki Kuribayashi, Yohei Oseki, and Timothy Baldwin. 2024. Psychometric predictive power of large language models. In Findings of the Association for Computational Linguistics: NAACL 2024, pages 1983–2005, Mexico City, Mexico. Association for Computational Linguistics. Pietro Lesci, Clara Meister, Thomas Hofmann, Andreas Vlachos, and Tiago Pimentel. 2024. Causal estimation of memorisation profiles. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 15616–15635.

Roger Levy. 2008. Expectation-based syntactic comprehension. Cognition, 106(3):1126–1177. Roger Levy and Edward Gibson. 2013. Surprisal, the pdc, and the primary locus of processing difficulty in relative clauses. Frontiers in Psychology, 4:229. Richard L. Lewis and Shravan Vasishth. 2005. An activation-based model of sentence processing as skilled memory retrieval. Cognitive Science, 29(3):375–419. James A Michaelov and Roger P Levy. 2026. N-gramlike language models predict reading time best. arXiv preprint arXiv:2603.09872. Byung-Doh Oh and Tal Linzen. 2025. To model human linguistic prediction, make llms less superhuman. arXiv preprint arXiv:2510.05141. Byung-Doh Oh and William Schuler. 2022. Entropyand distance-based predictors from gpt-2 attention patterns predict reading times over and above gpt-2 surprisal. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pages 9324–9334. Byung-Doh Oh and William Schuler. 2023. Why does surprisal from larger transformer-based language models provide a poorer fit to human reading times? Transactions of the Association for Computational Linguistics, 11:336–350. Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, and 1 others. 2019. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9. Hubert Ramsauer, Bernhard Schäfl, Johannes Lehner, Philipp Seidl, Michael Widrich, Thomas Adler, Lukas Gruber, Markus Holzleitner, Milena Pavlović, Geir Kjetil Sandve, and 1 others. 2020. Hopfield networks is all you need. arXiv preprint arXiv:2008.02217. Soo Hyun Ryu and Richard L Lewis. 2021. Accounting for agreement phenomena in sentence comprehension with transformer language models: Effects of similarity-based interference on surprisal and attention. In Proceedings of the workshop on cognitive modeling and computational linguistics, pages 61– 71. Soo Hyun Ryu and Richard L Lewis. 2025. Memory for prediction: A transformer-based theory of sentence processing. Journal of Memory and Language, 145:104670. Adrian Staub. 2010. Eye movements and processing difficulty in object relative clauses. Cognition, 116(1):71–86. Abishek Thamma and Micha Heilbron. 2025. Humanlike fleeting memory improves language learning but impairs reading time prediction in transformer language models.

William Timkey and Tal Linzen. 2023. A language model with limited memory capacity captures interference in human sentence processing. In Findings of the Association for Computational Linguistics: EMNLP 2023, pages 8705–8720, Singapore. Association for Computational Linguistics. Ethan G Wilcox, Tiago Pimentel, Clara Meister, Ryan Cotterell, and Roger P Levy. 2023. Testing the predictions of surprisal theory in 11 languages. Transactions of the Association for Computational Linguistics, 11:1451–1470.

A

Energy, attention and feedforward components

This appendix gives the full construction underlying the sketch given in the main text: the two energy components are designed so that their gradients reproduce, up to a reparametrization of the weights, the standard attention and feedforward operations. Throughout, g denotes the normalized token states, i.e. g = LN(x) where LN is a normalization operation (LayerNorm or RMSNorm); we refer the reader to Dehmamy et al. (2026) for the precise form and its role in the stability of the dynamics. For multi-head attention with H heads and hidden per-head dimension Y = D/H, with query and key projections W Q , W K ∈ RH×Y ×D , the per-token attention energy at position A takes the form

H

  1X ⊤ LSEB<A β gB (WhK )⊤ WhQ gA , β h=1 (6) √ P with β = 1/ Y . Here LSE(z) = log i exp(zi ) is the log-sum-exp, and LSEB<A restricts the sum to preceding positions B < A. This restriction enAT depends on g (the codes the causal mask, so EA A query) and on gB for B < A (the keys). Taking AT with respect to g yields an the gradient of EA A expression familiar as the standard attention operation in the transformer block, namely, −

AT (g) ∂EA = ∂gA H   X η (WhQ )⊤ WhK g SM g⊤ (WhK )⊤ WhQ gA ,

AT(gA ) = −η

h=1

(7) where SM g⊤ (WhK )⊤ WhQ gA is the softmax over positions B < A, treated as a vector that multiplies the projected token states η (WhQ )⊤ WhK g in (7). 

(8)

This has the same structure as a causal multihead attention layer, with the conventional valueand-output projection [W P ]⊤ W V replaced by η (WhQ )⊤ WhK . The feedforward energy is constructed analogously. The feedforward energy is a sum of pertoken contributions in the dense associative memory form, E

FF

(g) = −

N X

 1⊤ F W 1 g A ,

s.t. F ′ = σ,

A=1

(9) where W 1 ∈ RM ×D is the first feedforward weight matrix mapping the per-token state gA into a hidden dimension M , 1 is an M -dimensional vector of ones, and F is a scalar nonlinearity whose derivaFF depends tive is the activation σ. Because each EA only on gA , differentiating the total energy with respect to gA picks out the A-th term and yields a two-layer feedforward sublayer, FF(gA ) = −η

AT (g) = EA



Its B-th entry is   SM g⊤ (WhK )⊤ WhQ gA = B   K )⊤ W Q g exp β g⊤ (W B h h A .  P ⊤ (W K )⊤ W Q g exp β g C<A C h h A

 ∂E FF = η W 1⊤ σ W 1 gA . (10) ∂gA

Both the standard MLP in transformers and the update in (10) have the form ( · ) σ(W 1 gA ). A standard MLP applies an independently learned second weight matrix W 2 ∈ RD×M , whereas in (10) the effective second matrix is η W 1⊤ . η is itself learnable. More general feedforward energies that retain a separate W 2 are also possible, and are in fact what we use in our experiments; see Dehmamy et al. (2026) for further details. AT and E FF gives In short, taking gradients of EA A back an attention sublayer and a feedforward sublayer, and one NRGPT iteration is therefore very close to one parallel-style transformer layer with weights tied across iterations.

B

Model parameters and packages

We use the NRGPT_H_FF2W variant of Dehmamy et al. (2026) (energy attention combined with the two-weight feedforward energy), trained on OpenWebText. The architecture and training configuration are summarized in Table 2; all values are

taken from Dehmamy et al. (2026) (their Table 5 for the model-specific settings and Table 7 for the shared OpenWebText hyperparameters). The two models in our experiments share this configuration and differ only in the number of training iterations: 100,000 for the model we trained ourselves and 500,000 for the publicly released checkpoint.

since the energy scale depends on the amount of training, but the direction and significance of both contrasts match the main results. This indicates that 100,000 training iterations already suffice for NRGPT energy to capture the relative-clause processing contrasts.

Parameter Architecture Variant Embedding dim. Layer iterations Attention heads Context length Feedforward hidden dim. Normalization Tokenizer Total parameters Training (OpenWebText) Optimizer (β1 , β2 ) Learning rate LR schedule Weight decay Batch size Grad. accumulation steps Warmup iterations Dropout Training iterations

Table 3 replicates Experiment 2 with the 100,000iteration model for single-token words (see also Appendix D). The overall pattern largely mirrors the results of the 500,000-iteration model. In the NSC corpus, Surprisal-GPT-2 + Energy (L5) remains the best-fitting model, and energy is a strong predictor over and above surprisal. For UCL eye tracking, Surprisal-GPT-2 + Energy (L6) achieves the best fit, with energy contributing positively as in the 500,000-iteration model. For UCL self-paced reading, Energy (L6) again provides the best singlepredictor fit, and Surprisal-GPT-2 + Energy (L6) is the best-fitting combined model. One difference from the main model is that Energy (L5) does not significantly improve fit over surprisal alone in the UCL spr corpus at this training stage.

Value NRGPT_H_FF2W 1,536 6 12 1,024 4× embed. (6,144) LayerNorm GPT-2 BPE (50,257) 128M AdamW (0.9, 0.99) 3×10−5 cos decay to 3×10−6 10−2 12 40 2,000 0.0 100,000 / 500,000

Table 2: Architecture and training configuration of the NRGPT model used in our experiments.

For all experiments, we used Python 3.12 with PyTorch version 2.8.0 and transformers 4.46.3. For the mixed-effects model analysis, we used R 4.3.3 with lme4 version 1.1.

C

Results: the 100,000 model

C.1 Experiment 1: Relative Clause Processing We repeat the relative-clause analysis of Experiment 1 with the model trained for only 100,000 iterations. The pattern of the main (500,000-iteration) model replicates: energy at layer 5 significantly predicts both difficulty contrasts in the expected direction (ORC > SRC). At the embedded verb, the mean energy difference (ORC minus SRC) is 290 units (t = 13.2); at the embedded noun-phrase onset (the), it is 69.2 units (t = 3.7). Both effects are highly significant. The absolute energy values are not directly comparable across the two models,

C.2

D

Experiment 2: Reading-time corpora

Results: single token

See Table 4 for the results on the corpora limited to single-token words. These results closely align with the results that included multi-token words (Table 1).

Model with Surprisal Surprisal-GPT-2 Energy (L5) Energy (L6) Surprisal + Energy (L5) Surprisal + Energy (L6) Surprisal-GPT-2 + Energy (L5) Surprisal-GPT-2 + Energy (L6)

+/-/0? (NSC) + + + +,+ +,+,+ +,-

LogLik (NSC) −94,543 −94,487 −94,589 −94,798 −94,379 −94,538 −94,323 −94,481

+/-/0? UCL (et) + + 0 + +,0 +,+ +,0 +,+

LogLik UCL (et) −24,444 −24,440 −24,511 −24,501 −24,444 −24,438 −24,439 −24,435

+/-/0? UCL (spr) 0 0 0 0,0 0,0,0 0,-

LogLik UCL (spr) −6,607 −6,605 −6,606 −6,601 −6,606 −6,601 −6,605 −6,600

Table 3: Mixed-effects model results for the 100,000-iteration model filtered on single-token words. Format as in Table 1.

Model with Surprisal Surprisal-GPT-2 Energy (L5) Energy (L6) Surprisal + Energy (L5) Surprisal + Energy (L6) Surprisal-GPT-2 + Energy (L5) Surprisal-GPT-2 + Energy (L6)

+/-/0? (NSC) + + + +,+,+,+ +,-

LogLik (NSC) −94,496 −94,487 −94,592 −94,780 −94,343 −94,475 −94,333 −94,470

+/-/0? UCL (et) + + + +,+,+ +,+,+

LogLik UCL (et) −24,453 −24,440 −24,460 −24,410 −24,399 −24,374 −24,391 −24,374

+/-/0? UCL (spr) 0 0 + 0,+ 0,-,+ 0,-

LogLik UCL (spr) −6,606 −6,605 −6,601 −6,592 −6,600 −6,592 −6,600 −6,592

Table 4: Mixed-effects model results for the Natural Stories (NSC) corpus and the self-paced reading (spr) and eye-tracking (et) portions of the UCL corpus filtered on single-token words. Format as in Table 1.

Record · ID 299984 · SHA-256 f372f29f778a640c
Retrieved via Conceptio — every document is proof-bundled with source, license, and retrieval metadata.