# Energy Transformer

###### Abstract

Our work combines aspects of three promising paradigms in machine learning, namely, attention mechanism, energy-based models, and associative memory. Attention is the power-house driving modern deep learning successes, but it lacks clear theoretical foundations. Energy-based models allow a principled approach to discriminative and generative tasks, but the design of the energy functional is not straightforward. At the same time, Dense Associative Memory models or Modern Hopfield Networks have a well-established theoretical foundation, and allow an intuitive design of the energy function. We propose a novel architecture, called the Energy Transformer (or ET for short), that uses a sequence of attention layers that are purposely designed to minimize a specifically engineered energy function, which is responsible for representing the relationships between the tokens. In this work, we introduce the theoretical foundations of ET, explore its empirical capabilities using the image completion task, and obtain strong quantitative results on the graph anomaly detection and graph classification tasks.

## 1 Introduction

Transformers have become pervasive models in various domains of machine learning, including language, vision, and audio processing. Every transformer block uses four fundamental operations: attention, feed-forward multi-layer perceptron (MLP), residual connection, and layer normalization. Different variations of transformers result from combining these four operations in various ways. For instance, [ 1 ] proposes to frontload additional attention operations and backload additional MLP layers in a sandwich-like manner instead of interleaving them, [ 2 ] prepends an MLP layer before the attention in each transformer block, [ 3 ] uses neural architecture search methods to evolve even more sophisticated transformer blocks, and so on. Various methods exist to approximate the attention operation, multiple modifications of the norm operation, and connectivity of the block; see, for example, [ 4 ] for a taxonomy of different models. At present, however, the search for new transformer architectures is driven mostly by empirical evaluations, and the theoretical principles behind this growing list of architectural variations is missing.

Additionally, the computational role of the four elements remains the subject of discussions. Originally, [ 5 ] emphasized attention as the most important part of the transformer block, arguing that the learnable long-range dependencies are more powerful than the local inductive biases of convolutional networks. On the other hand more recent investigations [ 6 ] argue that the entire transformer block is important. The “correct” way to combine the four basic operations inside the block remains unclear, as does an understanding of the core computational function of the entire block and each of its four elements.

On the other hand, Associative Memory models, also known as Hopfield Networks [ 7 , 8 ] , have been gaining popularity in the machine learning community thanks to theoretical advancements pertaining to their memory storage capacity and novel architectural modifications [ 9 ] . Specifically, it has been shown that increasing the sharpness of the activation functions can lead to super-linear [ 10 ] and even exponential [ 11 ] memory storage capacity for these models, which is important for machine learning applications. This new class of Hopfield Networks is called Dense Associative Memories or Modern Hopfield Networks. Study [ 12 ] additionally describes how the attention mechanism in transformers is closely related to a special model of this family with the softmax \mathrm{softmax} activation function.

There are high-level conceptual similarities between transformers and Dense Associative Memories, since both architectures are designed for some form of denoising of the input. Transformers are typically pre-trained on a masked-token task, e.g., in the domain of Natural Language Processing (NLP), certain tokens in the sentence are masked and the model predicts the masked tokens. Dense Associative Memory models are designed for completing the incomplete patterns. They can be trained in a self-supervised way by predicting the masked parts of the pattern, or denoising the pattern.

There are also high-level differences between the two approaches. Associative Memories are recurrent networks with a global energy function so that the network dynamics converges to a fixed point attractor state corresponding to a local minimum of the energy function. Transformers are typically not described as dynamical systems at all. Rather, they are thought of as feed-forward networks built from the four computational elements discussed above. Even if one thinks about them as dynamical systems with tied weights, e.g., [ 13 ] , there is no reason to expect that their dynamics converge to a fixed point attractor (see the discussion in [ 14 ] ).

Additionally, a recent study [ 15 ] uses a form of Majorization-Minimization algorithms [ 16 ] to interpret the forward path in the transformer block as an optimization process. This interpretation requires imposing certain constraints on the operations inside the block, and attempting to find an energy function that describes the constrained block. We take a complementary approach by using the intuition developed in Associative Memory models to start with an energy function that is engineered for the problem of interest. The optimization process and the resulting architecture of the transformer block in our approach is a consequence of this specifically chosen energy function.

Concretely, we use the recent theoretical advancements and architectural developments in Dense Associative Memories to design an energy function tailored to route the information between the tokens. The goal of this energy function is to represent the relationships between the semantic contents of tokens describing a given data point (e.g., the relationships between the contents of the image patches in the vision domain, or relationships between the nodes’ attributes in the graph domain). The core mathematical idea of our approach is that the sequence of these unusual transformer blocks, which we call the Energy Transformer (ET), minimizes this global energy function. Thus, the sequence of conventional transformer blocks is replaced with a single ET block, which iterates the token representations until they converge to a fixed point attractor state. In the image domain, this fixed point corresponds to the completed image with masked tokens replaced by plausible auto-completions of the occluded image patches. In the graph domain, the fixed point reveals the anomaly status of a node given its neighbors, see Figure 1 , or the graph label. The energy function in our ET block is designed with the goal to describe the relationships between the tokens . Examples of relationships in the image domain are: straight lines tend to continue through multiple patches, given a face with one eye being masked the network should inpaint the missing eye, etc. In the graph domain, these are the relationships between the features of nodes; or features of nodes and graph label in graph classification.

The core mathematical principle of the ET block – the existence of the global energy function – dictates strong constraints on the possible operations inside the block, the order in which these operations are executed in the inference pass, and the symmetries of the weights in the network. As a corollary of this theoretical principle, the attention mechanism of ET is different from the attention mechanism commonly used in feed-forward transformers [ 5 ] . Lastly, our network may be viewed as an example of a broader class of Energy-Based Models [ 17 ] frequently discussed in the AI community. The proposed model is defined through the specific choice of the energy function, which, on the one hand, is suitable for the computational task of interest, and, on the other hand, results in optimization equations closely related to the forward pass in feed-forward transformers.

## 2 Energy Transformer Block

We now introduce the theoretical framework of the ET network. For clarity of presentation, we use language associated with the image domain. For the graph domain, one should think about “image patches” as nodes on the graph.

The overall pipeline is similar to the Vision Transformer networks (ViTs) [ 18 ] and is shown in Figure 1 . An input image is split into non-overlapping patches. After passing these patches through the encoder and adding the positional information, the semantic content of each patch and its position is encoded in the token x i ​ A x_{iA} . In the following the indices i , j , k = 1 ​ … ​ D i,j,k=1...D are used to denote the token vector’s elements, indices A , B , C = 1 ​ … ​ N A,B,C=1...N are used to enumerate the patches and their corresponding tokens. It is helpful to think about each image patch as a physical particle, which has a complicated internal state described by a D D -dimensional vector 𝐱 A \mathbf{x}_{A} . This internal state describes the identity of the particle (representing the pixels of each patch), and the particle’s positional embedding (the patch’s location within the image). The ET block is described by a continuous time differential equation, which describes interactions between these particles. Initially, at t = 1 t=1 the network is given a set containing two groups of particles corresponding to open and masked patches. The “open” particles know their identity and location in the image. The “masked” particles only know where in the image they are located, but are not provided the information about what image patch they represent. The goal of ET’s non-linear dynamics is to allow the masked particles to find an identity consistent with their locations and the identities of open particles. This dynamical evolution is designed so that it minimizes a global energy function, and is guaranteed to arrive at a fixed point attractor state. The identities of the masked particles are considered to be revealed when the dynamical trajectory reaches the fixed point. Thus, the central question is: how can we design the energy function that accurately captures the task that the Energy Transformer needs to solve?

The masked particles’ search for identity is guided by two pieces of information: identities of the open particles, and the general knowledge about what patches are in principle possible in the space of all possible images. These two pieces of information are described by two contributions to the ET’s energy function: the energy based attention and the Hopfield Network, respectively, for reasons that will become clear in the next sections. Below we define each element of the ET block in the order they appear in Figure 2 .

### Layer Norm

Each token, or a particle, is represented by a vector 𝐱 ∈ ℝ D \mathbf{x}\in\mathbb{R}^{D} . At the same time, most of the operations inside the ET block are defined using a layer-normalized token representation g i = γ ​ x i − x ¯ 1 D ​ ∑ j ( x j − x ¯ ) 2 + ε + δ i , where x ¯ = 1 D ​ ∑ k = 1 D x k g_{i}=\gamma\frac{x_{i}-\bar{x}}{\sqrt{\frac{1}{D}\sum\limits_{j}\big(x_{j}-\bar{x}\big)^{2}+\varepsilon}}+\delta_{i},\ \ \ \ \ \text{where}\ \ \ \ \ \bar{x}=\frac{1}{D}\sum\limits_{k=1}^{D}x_{k} (1) The scalar γ \gamma and the vector elements δ i \delta_{i} are learnable parameters, ε \varepsilon is a small regularization constant. Importantly, this operation can be viewed as an activation function for the neurons and can be defined as a partial derivative of the Lagrangian function (see [ 19 , 20 , 21 ] for the discussion of this property) L = D ​ γ ​ 1 D ​ ∑ j ( x j − x ¯ ) 2 + ε + ∑ j δ j ​ x j , so that g i = ∂ L ∂ x i L=D\gamma\sqrt{\frac{1}{D}\sum\limits_{j}\big(x_{j}-\bar{x}\big)^{2}+\varepsilon}\ +\ \sum\limits_{j}\delta_{j}x_{j},\ \ \ \ \ \text{so that}\ \ \ \ \ g_{i}=\frac{\partial L}{\partial x_{i}} (2)

### Multi-Head Energy Attention

The first contribution to the ET’s energy function is responsible for exchanging information between the particles (tokens). Similarly to the conventional attention mechanism, each token generates a pair of queries and keys (ET does not have a separate value matrix; instead the value matrix is a function of keys and queries). The goal of the energy based attention is to evolve the tokens in such a way that the keys of the open patches are aligned with the queries of the masked patches in the internal space of the attention operation. Below we use index α = 1 ​ … ​ Y \alpha=1...Y to denote elements of this internal space, and index h = 1 ​ … ​ H h=1...H to denote different heads of this operation. With these notations the energy-based attention operation is described by the following energy function: E = ATT − 1 β ∑ h = 1 H ∑ C = 1 N log ( ∑ B ≠ C exp ( β A h ​ B ​ C ) ) E{{}^{\text{ATT}}}=-\frac{1}{\beta}\sum\limits_{h=1}^{H}\sum\limits_{C=1}^{N}\textrm{log}\left(\sum\limits_{B\neq C}\textrm{exp}\left(\beta A_{hBC}\right)\right) (3) where the attention matrix A h ​ B ​ C A_{hBC} is computed from query and key tensors as follows: A h ​ B ​ C = ∑ α K α ​ h ​ B ​ Q α ​ h ​ C , 𝐀 ∈ ℝ H × N × N K α ​ h ​ B = ∑ j W α ​ h ​ j K ​ g j ​ B , 𝐊 ∈ ℝ Y × H × N Q α ​ h ​ C = ∑ j W α ​ h ​ j Q ​ g j ​ C , 𝐐 ∈ ℝ Y × H × N \begin{split}A_{hBC}&=\sum\limits_{\alpha}K_{\alpha hB}\;Q_{\alpha hC},\ \ \ \ \ \ \mathbf{A}\in\mathbb{R}^{H\times N\times N}\\ K_{\alpha hB}&=\sum\limits_{j}W^{K}_{\alpha hj}\;g_{jB},\ \ \ \ \ \ \ \ \ \ \ \mathbf{K}\in\mathbb{R}^{Y\times H\times N}\\ Q_{\alpha hC}&=\sum\limits_{j}W^{Q}_{\alpha hj}\;g_{jC},\ \ \ \ \ \ \ \ \ \ \ \mathbf{Q}\in\mathbb{R}^{Y\times H\times N}\end{split} (4) and the tensors 𝐖 K ∈ ℝ Y × H × D \mathbf{W}^{K}\in\mathbb{R}^{Y\times H\times D} and 𝐖 Q ∈ ℝ Y × H × D \mathbf{W}^{Q}\in\mathbb{R}^{Y\times H\times D} are learnable parameters.

From the computational perspective each patch generates two representations: query (given the position of the patch and its current content, where in the image should it look for the prompts on how to evolve in time?), and key (given the current content of the patch and its position, what should be the contents of the patches that attend to it?). The log-sum energy function ( 3 ) is minimal when for every patch in the image its queries are aligned with the keys of a small number of other patches connected by the attention map. Different heads (index h h ) contribute to the energy additively.

### Hopfield Network Module

The next step of the ET block, which we call the Hopfield Network (HN), is responsible for ensuring that the token representations are consistent with what one expects to see in realistic images. The energy of this sub-block is defined as: E HN = − ∑ B = 1 N ∑ μ = 1 K G ( ∑ j = 1 D ξ μ ​ j g j ​ B ) , ξ ∈ ℝ K × D E^{\text{HN}}=-\sum\limits_{B=1}^{N}\sum\limits_{\mu=1}^{K}G\Big(\sum\limits_{j=1}^{D}\xi_{\mu j}\;g_{jB}\Big),\ \ \ \ \ \ \ \ \ \ \mathbf{\xi}\in\mathbb{R}^{K\times D} (5) where ξ μ ​ j \xi_{\mu j} is a set of learnable weights (memories in the Hopfield Network), and G ⁡ ( ⋅ ) G(\cdot) is an integral of the activation function r ⁡ ( ⋅ ) r(\cdot) , so that G ​ ( ⋅ ) ′ = r ⁡ ( ⋅ ) G(\cdot)^{\prime}=r(\cdot) . Depending on the choice of the activation function this step can be viewed either as a classical continuous Hopfield Network [ 8 ] if the activation function grows slowly (e.g., r ⁡ ( ⋅ ) = r(\cdot)= ReLU), or as a modern continuous Hopfield Network [ 10 , 12 , 19 ] if the activation function is sharply peaked around the memories (e.g., r ⁡ ( ⋅ ) = r(\cdot)= power, or softmax). The HN sub-block is analogous to the feed-forward MLP step in the conventional transformer block but requires that the weights of the projection from the token space to the hidden neurons’ space to be the same (transposed matrix) as the weights of the subsequent projection from the hidden space to the token space. Thus, the HN module here is an MLP with shared weights that is applied recurrently . The energy contribution of this block is low when the token representations are aligned with some rows of the matrix ξ \mathbf{\xi} , which represent memories, and high otherwise.

### Dynamics of Token Updates

The inference pass of the ET network is described by the continuous time differential equation, which minimizes the sum of the two energies described above τ ​ d ​ x i ​ A d ​ t = − ∂ E ∂ g i ​ A , where E = E ATT + E HN \tau\frac{dx_{iA}}{dt}=-\frac{\partial E}{\partial g_{iA}},\ \ \ \ \ \text{where}\ \ \ \ \ E=E^{\text{ATT}}+E^{\text{HN}} (6) Here x i ​ A x_{iA} is the token representation (input and output from the ET block), and g i ​ A g_{iA} is its layer-normalized version. The first energy is low when each patch’s queries are aligned with the keys of its neighbors. The second energy is low when each patch has content consistent with the general expectations about what an image patch should look like (memory slots of the matrix ξ \mathbf{\xi} ). The dynamical system ( 6 ) finds a trade-off between these two desirable properties of each token’s representation. For numerical evaluations, equation ( 6 ) is discretized in time.

To demonstrate that the dynamical system ( 6 ) minimizes the energy, consider the temporal derivative d ​ E d ​ t = ∑ i , j , A ∂ E ∂ g i ​ A ∂ g i ​ A ∂ x j ​ A d ​ x j ​ A d ​ t = − 1 τ ∑ i , j , A ∂ E ∂ g i ​ A M A i ​ j ∂ E ∂ g j ​ A ≤ 0 \frac{dE}{dt}=\sum\limits_{i,j,A}\frac{\partial E}{\partial g_{iA}}\ \frac{\partial g_{iA}}{\partial x_{jA}}\ \frac{dx_{jA}}{dt}=-\frac{1}{\tau}\sum\limits_{i,j,A}\frac{\partial E}{\partial g_{iA}}\ M^{A}_{ij}\ \frac{\partial E}{\partial g_{jA}}\leq 0 (7) The last inequality sign holds if the symmetric part of the matrix M i ​ j A = ∂ g i ​ A ∂ x j ​ A = ∂ 2 L ∂ x i ​ A ​ ∂ x j ​ A M^{A}_{ij}=\frac{\partial g_{iA}}{\partial x_{jA}}=\frac{\partial^{2}L}{\partial x_{iA}\partial x_{jA}} (8) is positive semi-definite (for each value of index A A ). The Lagrangian ( 2 ) satisfies this condition.

### Relationship to Modern Hopfield Networks and Conventional Attention

One of the theoretical contributions of our work is the design of the energy attention mechanism and the corresponding energy function ( 3 ). Although heavily inspired by prior work on Modern Hopfield Networks, our approach is fundamentally different from it. Our energy function ( 3 ) may look somewhat similar to the energy function of a continuous Hopfield Network with the softmax \mathrm{softmax} activation function. The main difference, however, is that in order to use Modern Hopfield Networks recurrently (as opposed to applying their update rule only once) the keys must be constant parameters (called memories in the Hopfield language). In contrast, in our energy attention network the keys are dynamical variables that evolve in time with the queries.

To emphasize this further, it is instructive to write explicitly the ET attention contribution to the update dynamics ( 6 ). It is given by (for clarity, assume only one head of attention): − ∂ E ATT ∂ g i ​ A = ∑ C ≠ A ∑ α W α ​ i Q ​ K α ​ C ​ softmax 𝐶 ​ ( β ​ ∑ γ K γ ​ C ​ Q γ ​ A ) + W α ​ i K ​ Q α ​ C ​ softmax 𝐴 ​ ( β ​ ∑ γ K γ ​ A ​ Q γ ​ C ) -\frac{\partial E^{\text{ATT}}}{\partial g_{iA}}=\sum\limits_{C\neq A}\sum\limits_{\alpha}W^{Q}_{\alpha i}\;K_{\alpha C}\;\underset{C}{\text{softmax}}\Big(\beta\sum\limits_{\gamma}K_{\gamma C}\;Q_{\gamma A}\Big)+W^{K}_{\alpha i}\;Q_{\alpha C}\;\underset{A}{\text{softmax}}\Big(\beta\sum\limits_{\gamma}K_{\gamma A}\;Q_{\gamma C}\Big) In both terms the softmax \mathrm{softmax} normalization is done over the token index of the keys, which is indicated by the subscript in the equation. The first term in this formula is the conventional attention mechanism [ 5 ] with the value matrix equal to 𝐕 = ( 𝐖 Q ) T ​ 𝐊 = ∑ α W α ​ i Q ​ K α ​ C \mathbf{V}=(\mathbf{W}^{Q})^{T}\mathbf{K}=\sum_{\alpha}W^{Q}_{\alpha i}K_{\alpha C} . The second term is the brand new contribution that is missing in the original attention mechanism. The presence of this second term is crucial to make sure that the dynamical system ( 6 ) minimizes the energy function if applied recurrently. This second term is the main difference of our approach compared to the Modern Hopfield Networks. The same difference applies compared to the other recent proposals [ 15 ] .

Lastly, we want to emphasize that our ET block contains two different kinds of Hopfield Networks acting in parallel, see Figure 2 . The first one is the energy attention module, which is inspired by, but not identical to, Modern Hopfield Networks. The second one is the “Hopfield Network” module, which can be either a classical or Modern Hopfield Network. These two should not be confused.

For completeness, the contribution of the “Hopfield Network” module to the update equation ( 6 ) can be written as − ∂ E HN ∂ g i ​ A = ∑ μ = 1 K ξ μ ​ i ​ G ′ ​ ( ∑ j = 1 D ξ μ ​ j ​ g j ​ A ) -\frac{\partial E^{\text{HN}}}{\partial g_{iA}}=\sum_{\mu=1}^{K}\xi_{\mu i}G^{\prime}\Big(\sum_{j=1}^{D}\xi_{\mu j}g_{jA}\Big) (9) which is applied to every token individually (there no mixing of different tokens).

## 3 Qualitative Inspection of the ET framework on ImageNet

We trained * * * The code is available: https://github.com/bhoov/energy-transformer-jax . the ET network on the masked image completion task using ImageNet-1k dataset [ 22 ] . Each image was broken into non-overlapping patches of 16x16 RGB pixels, which were projected with a single affine encoder into the token space. Half of these tokens were “masked”, by replacing them with a learnable MASK token. A distinct learnable position encoding vector was added to each token. Our ET block then processes all tokens recurrently for T T steps. The token representations after T T steps are passed to a simple linear decoder (consisting of a layer norm and an affine transformation). The loss function is the standard MSE loss on the occluded patches. See more details on the implementation and the hyperparameters in Appendix B .

Examples of occluded/reconstructed images (unseen during training) are shown in Figure 3 . In general, our model learns to perform the task very well, capturing the texture in dog fur (column 3) and understanding meaningful boundaries of objects. However, we observe that our single ET block struggles to understand some global structure, e.g., failing to capture both eyes of the white dog (column 5) and completing irregular brick patterns in the name of extending the un-occluded borders (last column). We additionally inspect the positional encoding vectors associated with every token, Figure 2 , where the model learns a locality structure in the image plane that is very similar to the original ViT [ 18 ] . The positional embedding of each image patch has learned higher similarity values for neighboring tokens than for distant tokens.

Our network is unique compared to standard ViTs in that the iterative dynamics only move tokens around in the same space from which the final fixed point representation can be decoded back into the image plane. This functionality makes it possible to visualize essentially any token representation , weight , or gradient of the energy directly in the image plane. This feature is highly desirable from the perspective of interpretability, since it makes it possible to track the updates performed by the network directly in the image plane as the computation unfolds in time. In Figure 2 this functionality is used for inspecting the learned weights of the HN module directly in the image plane. According to our theory, these weights should represent basis vectors in the space of all possible image patches. These learned representations look qualitatively similar to the representations typically found in networks trained on image datasets, e.g., [ 23 ] .

We additionally visualize the gradients of the energy function (which are equal to the token updates, see Equation 6 ) of both ATTN block and the HN block, see Figure 4 . Early in time, almost all signal to the masked tokens comes from the ATTN block, which routes information from the open patches to the masked ones; no meaningful signal comes from the HN block to the masked patch dynamics. Later in time we observe a different phenomenon: almost all signal to masked tokens comes from the HN module while ATTN contributes a blurry and uninformative signal. Thus, the attention module is crucial early in the network dynamics, feeding signal to masked patches from the visible patches, whereas the HN is crucial later in the dynamics as the model approaches the final reconstruction, sharpening the masked patches. All the qualitative findings presented in this section are in accord with the core computational strategy of the ET block as it was designed theoretically in section 2 .

## 4 Graph Anomaly Detection

Having gained empirical insights in the image domain, we turn to quantitatively evaluating ET’s performance on the graph anomaly detection problem * * * The code is available: https://github.com/zhuergou/Energy-Transformer-for-Graph-Anomaly-Detection/ . , a task with plenty of strong and recently published baselines. Graph Convolutional Networks (GCN) [ 25 ] have been widely used for this task due to their capability of learning high level representations of graph structures and node attributes [ 26 , 27 ] . However, vanilla GCNs suffer from the over-smoothing problem [ 28 ] . In each layer of the forward pass, the outlier node aggregates information from its neighbors. This averaging makes the features of anomalies less distinguishable from the features of benign or normal nodes. Our approach does not suffer from this problem, since the routing of the information between the nodes is done through the energy based attention, and the information aggregation is based on the attention scores.

For anomaly detection on graphs in the ET framework, consider an undirected graph with N N nodes. Every node has a vector of raw attributes 𝐲 A ∈ ℝ F \mathbf{y}_{\!A}\in\mathbb{R}^{F} , where F F is the number of node’s features. Every node also has a binary label l A l_{A} indicating whether the node is benign or anomalous. We focus on node anomaly and assume that all edges are trusted. The task is to predict the label of a node given the graph structure and the node’s features. Since there are far more benign nodes in the graph than anomalous ones, anomaly detection can be regarded as an imbalanced node classification task.

First, similarly to images, the feature vectors for every node are converted to a token representation using a linear embedding 𝐄 \mathbf{E} and adding a learnable positional embedding λ A \mathbf{\lambda}_{A} 𝐱 A t = 1 = 𝐄 ​ 𝐲 A + λ A \mathbf{x}_{A}^{t=1}=\mathbf{E}\;\mathbf{y}_{\!A}+\mathbf{\lambda}_{A} (10) where the superscript t = 1 t=1 indicates the time of the update of the ET dynamics. This token representation is iterated through the ET block for T T iterations. When the retrieval dynamics becomes stable, we have the final representation for each node 𝐱 A t = T \mathbf{x}_{A}^{t=T} (or more precisely 𝐠 A t = T \mathbf{g}_{A}^{t=T} , since the outputs are additionally passed through a layer norm operation after the final ET update). This output is concatenated with the initial (layer normalized) token to form the final output 𝐠 A final = 𝐠 A t = 1 | | 𝐠 A t = T \mathbf{g}_{A}^{\text{final}}=\mathbf{g}_{A}^{t=1}\ ||\ \mathbf{g}_{A}^{t=T} (11) where | ⁣ | || denotes concatenation. Following [ 24 ] , the node representation 𝐠 A final \mathbf{g}_{A}^{\text{final}} is fed into an MLP with a sigmoid activation function to compute the anomaly probabilities p A p_{A} . The weighted cross entropy Loss = ∑ A [ ω ​ l A ​ log ⁡ ( p A ) + ( 1 − l A ) ​ log ⁡ ( 1 − p A ) ] \text{Loss}=\sum_{A}\Big[\omega\;l_{A}\log(p_{A})+(1-l_{A})\log(1-p_{A})\Big] (12) is used to train the network. Above, ω \omega is the ratio of the benign labels ( l A l_{A} = 0) to anomalous ones ( l A l_{A} = 1). Attention is restricted to 1-hop neighbors of the target node.

### 4.1 Experimental Evaluation

Four datasets are used for the experiments. YelpChi dataset [ 29 ] aims at opinion spam detection in Yelp reviews. Amazon dataset is used to detect anomalous users under the Musical Instrument Category on amazon.com [ 30 ] . T-Finance and T-Social datasets [ 24 ] are used for anomalous account detection in transactions and social networks, respectively. For these four datasets, the graph is treated as a homogeneous graph (i.e., all the edges are of the same type), and a feature vector is associated with each node. The task is to predict the label (anomaly status) of the nodes. For each dataset, either 1 % 1\% or 40 % 40\% of the nodes are used for training, and the remaining 99 % 99\% or 60 % 60\% are split 1 : 2 1:2 into validation and testing sets, see Appendix C for details.

We compare with state-of-the-art approaches for graph anomaly detection, which include GraphConsis [ 31 ] , CAREGNN [ 32 ] , PC-GNN [ 33 ] and BWGNN [ 24 ] . Additionally, multi-layer perceptrons (MLP) and Graph Transformer (GT) [ 34 ] are included in the baselines for completeness. Following previous work, macro-F1 score (unweighted mean of F1 score) and the Area Under the Curve (AUC) are used as the evaluation metrics on the test datasets [ 35 ] . See Appendix C for more details on training protocols and the hyperparameters choices. The results are reported in Table 1 . Our ET network demonstrates very strong results across all the datasets.

Dataset Method PROTEINS NCI1 NCI109 DD ENZYMES MUTAG MUTAGENICITY FRANKENSTEIN WKPI (kmeans) 78.5 ± 0.4 78.5_{\pm 0.4} ▼ \blacktriangledown ( 6.4 ) (6.4) 87.5 ± 0.5 87.5_{\pm 0.5} 85.9 ± 0.4 85.9_{\pm 0.4} ▼ \blacktriangledown ( 1.5 ) (1.5) 82.0 ± 0.5 82.0_{\pm 0.5} ▼ \blacktriangledown ( 13.7 ) (13.7) - 85.8 ± 2.5 85.8_{\pm 2.5} ▼ \blacktriangledown ( 14.2 ) (14.2) - - WKPI (kcenters) 75.2 ± 0.4 75.2_{\pm 0.4} ▼ \blacktriangledown ( 9.7 ) (9.7) 84.5 ± 0.5 84.5_{\pm 0.5} ▼ \blacktriangledown ( 3.0 ) (3.0) 87.4 ± 0.3 87.4_{\pm 0.3} 80.3 ± 0.4 80.3_{\pm 0.4} ▼ \blacktriangledown ( 15.4 ) (15.4) - 88.3 ± 2.6 88.3_{\pm 2.6} ▼ \blacktriangledown ( 11.7 ) (11.7) - - Spec-GN - 84.8 ± 1.6 84.8_{\pm 1.6} ▼ \blacktriangledown ( 2.7 ) (2.7) 83.6 ± 0.8 83.6_{\pm 0.8} ▼ \blacktriangledown ( 3.8 ) (3.8) - 72.5 ± 5.8 72.5_{\pm 5.8} ▼ \blacktriangledown ( 5.9 ) (5.9) - - - Norm-GN - 84.9 ± 1.7 84.9_{\pm 1.7} ▼ \blacktriangledown ( 2.6 ) (2.6) 83.5 ± 1.3 83.5_{\pm 1.3} ▼ \blacktriangledown ( 3.9 ) (3.9) - 73.3 ± 8.0 73.3_{\pm 8.0} ▼ \blacktriangledown ( 5.1 ) (5.1) - - - GWL-WL 75.8 ± 0.6 75.8_{\pm 0.6} ▼ \blacktriangledown ( 9.1 ) (9.1) - - - 71.3 ± 1.1 71.3_{\pm 1.1} ▼ \blacktriangledown ( 7.1 ) (7.1) - - 78.9 ± 0.3 {78.9_{\pm 0.3}} HGP-SL 84.9 ± 1.6 84.9_{\pm 1.6} 78.5 ± 0.8 78.5_{\pm 0.8} ▼ \blacktriangledown ( 9.1 ) (9.1) 80.7 ± 1.2 80.7_{\pm 1.2} ▼ \blacktriangledown ( 6.7 ) (6.7) 81.0 ± 1.3 81.0_{\pm 1.3} ▼ \blacktriangledown ( 14.7 ) (14.7) 68.8 ± 2.1 68.8_{\pm 2.1} ▼ \blacktriangledown ( 9.6 ) (9.6) - 82.2 ± 0.6 {82.2_{\pm 0.6}} - DSGCN 77.3 ± 0.4 {77.3_{\pm 0.4}} ▼ \blacktriangledown ( 7.6 ) (7.6) - - - 78.4 ± 0.6 {78.4_{\pm 0.6}} - - - U2GNN 80.0 ± 3.2 80.0_{\pm 3.2} ▼ \blacktriangledown ( 4.9 ) (4.9) - - 95.7 ± 1.9 95.7_{\pm 1.9} - 88.5 ± 7.1 88.5_{\pm 7.1} ▼ \blacktriangledown ( 11.5 ) (11.5) - - NDP 73.4 ± 3.1 73.4_{\pm 3.1} ▼ \blacktriangledown ( 11.5 ) (11.5) 74.2 ± 1.7 74.2_{\pm 1.7} ▼ \blacktriangledown ( 13.3 ) (13.3) - 72.8 ± 5.4 72.8_{\pm 5.4} ▼ \blacktriangledown ( 22.9 ) (22.9) 44.5 ± 7.4 44.5_{\pm 7.4} ▼ \blacktriangledown ( 34.9 ) (34.9) 87.9 ± 5.7 87.9_{\pm 5.7} ▼ \blacktriangledown ( 12.1 ) (12.1) 77.9 ± 1.4 77.9_{\pm 1.4} ▼ \blacktriangledown ( 4.3 ) (4.3) - ASAP 74.2 ± 0.8 74.2_{\pm 0.8} ▼ \blacktriangledown ( 10.7 ) (10.7) 71.5 ± 0.4 71.5_{\pm 0.4} ▼ \blacktriangledown ( 16.0 ) (16.0) 70.1 ± 0.6 70.1_{\pm 0.6} ▼ \blacktriangledown ( 17.3 ) (17.3) 76.9 ± 0.7 76.9_{\pm 0.7} ▼ \blacktriangledown ( 18.8 ) (18.8) - - - 66.3 ± 0.5 66.3_{\pm 0.5} ▼ \blacktriangledown ( 12.6 ) (12.6) EvoG - - - - 55.7 55.7 ▼ \blacktriangledown ( 22.7 ) (22.7) 100.0 \mathbf{100.0} - - ET (Ours) 90.3 ± 0.7 \mathbf{90.3_{\pm 0.7}} ▲ \blacktriangle (5.4) 90.1 ± 0.1 \mathbf{90.1_{\pm 0.1}} ▲ \blacktriangle (2.6) 90.5 ± 0.1 \mathbf{90.5_{\pm 0.1}} ▲ \blacktriangle (3.1) 95.9 ± 0.8 \mathbf{95.9_{\pm 0.8}} ▲ \blacktriangle (0.2) 99.8 \mathbf{99.8} ▲ \blacktriangle (21.4) 96.6 ± 0.2 96.6_{\pm 0.2} ▼ \blacktriangledown (3.4) 98.7 ± 0.1 \mathbf{98.7_{\pm 0.1}} ▲ \blacktriangle (16.5) 99.8 ± 0.1 \mathbf{99.8_{\pm 0.1}} ▲ \blacktriangle (20.9)

## 5 Graph Classification with ET

To fully explore the efficacy of ET, we further evaluate its performance on the graph classification problem * * * The code is available: https://github.com/Lemon-cmd/Energy-Transformer-For-Graph . . Unlike the anomaly detection task, where we predict a label for every node, in the graph classification task, a single label is predicted for the entire graph.

Consider a graph G G , where each node has a raw feature vector 𝐲 A ∈ ℝ F \mathbf{y}_{A}\in\mathbb{R}^{F} with F F feature-dimension. Each vector is projected to the token space yielding 𝐱 A ∈ ℝ D \mathbf{x}_{A}\in\mathbb{R}^{D} , where D D is the token dimension. A learnable CLS token 𝐱 CLS \mathbf{x}_{\text{CLS}} is concatenated to the set of tokens resulting in the token matrix 𝐗 ∈ ℝ ( N + 1 ) × D \mathbf{X}\in\mathbb{R}^{(N+1)\times D} , and a learnable linear projection of the top k k smallest eigen-vectors of the normalized Laplacian matrix, following [ 37 ] , is added to 𝐗 \mathbf{X} . Graph structural information is provided to ET within the attention operation. We also use a stacked version of the Energy Transformer consisting of S S ET blocks, where each block has the same number of temporal unfolding steps T T and its own LayerNorm. The final representation of the CLS token 𝐱 CLS ℓ = S , t = T \mathbf{x}^{\ell=S,\;t=T}_{\mathrm{CLS}} is projected via a linear embedding into the predictor space. A softmax over the number of classes is applied to this predictor representation, and the cross-entropy loss is used to train the network. See Appendix D for full details.

### 5.1 Experimental Evaluation

Eight graph datasets from the TUDataset [ 36 ] collection are used for experimentation. NCI1, NCI109, MUTAG, MUTAGENICITY, and FRANKENSTEIN are a common class of graph datasets consisting of small molecules with class labels representing toxicity or biological activity determined in drug discovery projects [ 36 ] . Meanwhile, DD, ENZYMES, and PROTEINS represent macromolecules. The task for both DD and PROTEINS is to classify whether a protein is an enzyme. Lastly, for ENZYMES, the task is to assign enzymes to one of the six classes, which reflect the catalyzed chemical reaction [ 36 ] . See Table 8 for more details of the datasets.

We compare ET with the current state-of-the-art approaches for the mentioned datasets, which include WKPI-kmeans [ 38 ] , WKPI-kcenters [ 38 ] , DSGCN [ 39 ] , HGP-SL [ 40 ] , U2GNN [ 41 ] , and EvoG [ 42 ] . Additionally, approaches [ 39 , 43 , 44 , 45 , 46 ] , which are close to the baselines, are included to further contrast the performance of our model. Following the 10-fold cross validation process delineated in [ 36 ] , accuracy score is used as the evaluation metric and reported in Table 2 . In general, we have observed that the modified ET demonstrates strong performance across the eight datasets. With the exception of MUTAG, ET beats other methods on all the baselines by a substantial margin.

## 6 Discussion and Conclusions

A lot of recent research has been dedicated to understanding the striking analogy between Hopfield Networks and the attention mechanism in transformers. At a high level, the main message of our work is that the entire transformer block (including feed-forward MLP, layer normalization, and residual connections) can be viewed as a single large Hopfield Network, not just attention alone. At a deeper level, we use recent advances in the field of Hopfield Networks to design a novel energy function that is tailored for dynamical information routing between the tokens; and representation of a large number of relationships between those tokens. We have tested the ET network qualitatively on the image completion task, and quantitatively on node anomaly detection and graphs classification. The qualitative investigation reveals the perfect alignment between the theoretical design principles of our network and its empirical computation. The quantitative evaluation demonstrates strong results, which stand in line or exceed the methods recently developed specifically for these tasks. We believe that the proposed network will be useful for other tasks and domains (e.g., NLP, audio, and video), which serve as future directions for a comprehensive investigation.

There are two metrics describing computational costs of our architecture: memory footprint of the model and the number of flops. In terms of the memory footprint our model wins (is smaller) compared to feedforward transformers with independent weights and even ALBERT-style shared-weight transformers (see Appendix G and Table 15 ). Regarding the number of flops, our model has the same parametric scaling as the conventional transformers (quadratic in the number of tokens), but the energy attention has a constant factor of two more flops (due to the second term in the attention-induced updates of the tokens).

Finally, we have developed an auto-grad framework called HAMUX [ 47 ] that makes building flexible energy-based architectures, including ET, convenient and efficient (see HAMUX ).

## Appendix A Notations Used in the Main Text and Appendices

Table 3 lists all the notations used in this paper.

## Appendix B Details of Training on ImageNet

We trained the ET network on a masked-image completion task on the ImageNet-1k (IN1K) dataset. We treat all images in IN1K as images of shape 224 × 224 224\times 224 that are normalized according to standard IN1K practices (mean 0, variance 1 on the channel dimension) and use data augmentations provided by the popular timm library [ 48 ] (See Table 4 ). Following the conventional ViT pipeline [ 18 ] , we split these images into non-overlapping patches of 16x16 RGB pixels which are then projected with a single affine encoder into the token dimension D D for a total of 196 196 encoded tokens per image. We proceed to randomly and uniformly assign 100 of these tokens as “occluded” which are the only tokens considered by the loss function. “Occluded” tokens are designated as follows: of the 100 100 tokens, 90 90 tokens are replaced with a learnable MASK token of dimension D D and 10 10 we leave untouched (which we find important for the HN to learn meaningful patch representations). To all tokens we then add a distinct learnable position bias.

These tokens are then passed to our Energy Transformer block which we recur for T T steps (the “depth” of the model in conventional Transformers). At each step, the feedback signal (the sum of the energy gradients from our attention block and HN block) is subtracted from our original token representation with a scalar step size α = d ​ t τ \alpha=\frac{dt}{\tau} which we treat as a non-learnable hyperparameter in our experiments. The token representations after T T steps are passed to a simple linear decoder (consisting of a layer norm and an affine transformation) to project our representations back into the image plane. We then use the standard MSE Loss between the original pixels and reconstructed pixels for only the 100 100 occluded patches. We allow self attention as in the following formula for the energy of multiheaded attention E = ATT ∑ h − 1 β ∑ C log ( ∑ B exp ( β ∑ α K α ​ h ​ B Q α ​ h ​ C ) ) E{{}^{\text{ATT}}}=\sum\limits_{h}-\frac{1}{\beta}\sum\limits_{C}\textrm{log}\left(\sum\limits_{B}\textrm{exp}\left(\beta\sum\limits_{\alpha}K_{\alpha hB}\;Q_{\alpha hC}\right)\right) (13)

We give details of our architectural choices in Table 4 . In the main paper we present our Energy Transformer with a configuration similar to the standard base Transformer configuration (e.g., token dimension 768 768 , 12 12 heads each with Y = 64 Y=64 , softmax ’s β = 1 Y \beta=\frac{1}{\sqrt{Y}} , …), with several considerations learned from the qualitative image evaluations:

• The d ​ t τ \frac{dt}{\tau} (step size) of 1 1 implicitly used in the traditional transformer noticeably degrades our ability to smoothly descend the energy function. We find that a step size of 0.1 0.1 provides a smoother descent down the energy function and benefits the image reconstruction quality.

• We observe that our MSE loss must include some subset of un-occluded patches in order for the HN to learn meaningful filters.

• Values of β \beta in the energy attention that are too high prevent our model from training. This is possibly due to vanishing gradients in our attention operation from a softmax operation that is too spiky.

• Without gradient clipping, our model fails to train at the learning rates we tried higher than 1e-4. We observe that gradient clipping not only helps our model train faster at the trainable learning rates, it also allows us to train at higher learning rates.

Our architecture and experiments for the image reconstruction task were written in JAX [ 49 ] using Flax [ 50 ] . This engineering choice means that our architecture definitions are quite lightweight, as we can define the desired energy function of the ET and use JAX’s autograd to automatically calculate the desired update.

### B.1 Exploring the Hopfield Memories

A distinctive aspect of our network is that any variable that has a vector index i i of tokens can be mapped into the data domain by applying the decoder network to this variable. This makes it possible to inspect all the weights in the model. For instance, the concept of “memories” is crucial to understanding how Hopfield networks function. The memories within the HN module represent the building blocks of all possible image patches in our data domain, where an encoded image patch is a superposition of a subset of memories. The complete set of memory vectors from the HN module is shown in Figure 5 . The same analysis can be applied to the weights of the ET-attention module. In Figure 6 , we show all the weights from this module mapped into the image plane.

### B.2 Positional Bias Correlations

The relationships between our position embeddings exhibit similar behavior to the position correlations of the original ViT in that they are highly susceptible to choices of the hyperparameters (Figure 10 of [ 18 ] ). In particular, we consider the effect of weight decay and the β \beta parameter that serves as the inverse temperature of the attention operation (see Equation 3 ). The lower the temperature (i.e., the higher the value of β \beta ), the spikier the softmax distribution. By using a lower β \beta , we encourage the attention energy to distribute its positional embeddings across a wider range of patches in the model.

## Appendix C Details of ET training on Anomaly Detection Task

Graph anomaly detection refers to the process of detecting outliers that deviate significantly from the majority of the samples. Neural network based methods are very popular due to their capability of learning sophisticated data representations. DOMINANT [ 26 ] utilizes an auto-encoder framework, using a GCN as an encoder and two decoders for structural reconstruction and attribute reconstruction. ALARM [ 27 ] aggregates the encoder information from multiple view of the node attributes. Another study [ 51 ] , propose a novel loss function to train graph neural networks for anomaly-detectable node representations. In [ 52 ] generative adversarial learning is used to detect anomaly nodes where a novel layer is designed to learn the anomaly-aware node representation. Recently, [ 24 ] pointed out that anomalies can lead to the “rightshift” of the spectral energy distribution – the spectral energy concentrates more on the high frequencies. They designed a filter that can better handle this phenomenon. We propose a new anomaly detection model from the perspective of Associative Memory (pattern matching), which does not have the over-smoothing problem often faced by GCNs, and has better model interpretability (outliers should be far from the common pattern). We also notice that Modern Hopfield Networks have been used before for node classification, link prediction, and graph coarsening tasks [ 53 ] .

### C.1 Detailed Model Structure for the Graph Anomaly Detection

First, we compute the features that are passed to our energy-based transformer. Each node’s features 𝐲 A ∈ R F \mathbf{y}_{A}\in R^{F} are mapped into the token space 𝐱 A ∈ R D \mathbf{x}_{A}\in R^{D} , using a linear projection 𝐄 \mathbf{E} . Learnable positional embeddings λ A \mathbf{\lambda}_{A} are added to this token at t = 1 t=1 , 𝐱 A t = 1 = 𝐄𝐲 A + λ A \mathbf{x}_{A}^{t=1}=\mathbf{Ey}_{A}+\mathbf{\lambda}_{A} (14) At each time step the input to the ET-block is layer normalized: 𝐠 A t = LayerNorm ​ ( 𝐱 A t ) \mathbf{g}_{A}^{t}=\text{LayerNorm}(\mathbf{x}_{A}^{t}) (15) Let 𝐖 Q ∈ R Y × H × D \mathbf{W}^{Q}\in R^{Y\times H\times D} and 𝐖 K ∈ R Y × H × D \mathbf{W}^{K}\in R^{Y\times H\times D} be the query and key weight matrices, respectively. Here Y Y is the projection dimension in the attention operation, H H is the number of heads. We define K α ​ h ​ B = ∑ j W α ​ h ​ j K ​ g j ​ B Q α ​ h ​ C = ∑ j W α ​ h ​ j Q ​ g j ​ C \begin{split}K_{\alpha hB}&=\sum\limits_{j}W^{K}_{\alpha hj}\;g_{jB}\\ Q_{\alpha hC}&=\sum\limits_{j}W^{Q}_{\alpha hj}\;g_{jC}\end{split} (16) If we let h h indicate the index of the head, we have Δ ​ x i ​ A t = ∑ C ∈ 𝒩 A ∑ h , α [ W α ​ h ​ i Q ​ K α ​ h ​ C ​ ω C ​ A + W α ​ h ​ i K ​ Q α ​ h ​ C ​ ω A ​ C ] + ∑ μ ξ μ ​ i ​ r ​ ( ∑ j ξ μ ​ j ​ g j ​ A ) \Delta x_{iA}^{t}=\sum\limits_{C\in\mathcal{N}_{A}}\sum\limits_{h,\alpha}\Big[W^{Q}_{\alpha hi}\;K_{\alpha hC}\;\omega_{CA}+W^{K}_{\alpha hi}\;Q_{\alpha hC}\;\omega_{AC}\Big]+\sum\limits_{\mu}\xi_{\mu i}\;r\Big(\sum\limits_{j}\;\xi_{\mu j}g_{jA}\Big) (17) where ω C ​ A = softmax 𝐶 ​ ( β ​ ∑ γ K γ ​ h ​ C ​ Q γ ​ h ​ A ) \omega_{CA}=\underset{C}{\text{softmax}}\Big(\beta\sum\limits_{\gamma}K_{\gamma hC}\;Q_{\gamma hA}\Big) (18)

Here β \beta controls the temperature of the softmax, 𝒩 A \mathcal{N}_{A} stands for the neighbors of node A A —a set of all the nodes connected to node A A , r r is the ReLU function. Restriction of the attention operation to the neighborhood of a given node is similar to that used in the Graph Attention Networks (GAT), see [ 54 ] . Finally, we have residual connection (which is a natural consequence of the discretized differential equation dynamics) 𝐱 A t + 1 = 𝐱 A t + 𝚫 ​ 𝐱 A t \mathbf{x}_{A}^{t+1}=\mathbf{x}_{A}^{t}+\mathbf{\Delta x}_{A}^{t} (19)

Intuitively, the first term in Equation 17 describes the influence (attention score) of the neighbor nodes with respect to the target node, the second term describes the influence of the target node with respect to each of its neighbor, and the third term is the contribution of the Hopfield Network module. It can be shown that the forward pass of our energy-based transformer layer minimizes the following energy function: E = − 1 β ∑ C ∑ h log ( ∑ B ∈ 𝒩 C exp ( β ∑ α K α ​ h ​ B Q α ​ h ​ C ) ) − 1 2 ∑ C , μ G ( ∑ j ξ μ ​ j g j ​ C ) E=-\frac{1}{\beta}\sum\limits_{C}\sum\limits_{h}\textrm{log}\left(\sum\limits_{B\in\mathcal{N}_{C}}\textrm{exp}\left(\beta\sum\limits_{\alpha}K_{\alpha hB}\;Q_{\alpha hC}\right)\right)-\frac{1}{2}\sum\limits_{C,\mu}G\Big(\sum\limits_{j}\xi_{\mu j}\;g_{jC}\Big) (20) This energy function will decrease as the forward pass progresses until it reaches a local minimum.

After T T iterations when the retrieval is stable, we have the final representation for each node 𝐠 A final \mathbf{g}_{A}^{\text{final}} as 𝐠 A final = 𝐠 A t = 1 | | 𝐠 A t = T \mathbf{g}_{A}^{\text{final}}=\mathbf{g}_{A}^{t=1}\ ||\ \mathbf{g}_{A}^{t=T} (21) where | ⁣ | || is the concatenation sign. Following [ 24 ] , we treat anomaly detection as semi-supervised learning task in this work. The node representation 𝐠 A final \mathbf{g}_{A}^{\text{final}} is fed to another MLP with the sigmoid function to compute the abnormal probability p A p_{A} , weighted log-likelihood is then used to train the network. The loss function is as follow: Loss = ∑ A [ ω ​ l A ​ log ⁡ ( p A ) + ( 1 − l A ) ​ log ⁡ ( 1 − p A ) ] \text{Loss}=\sum_{A}\Big[\omega\;l_{A}\log(p_{A})+(1-l_{A})\log(1-p_{A})\Big] (22) where ω \omega is the ratio of normal labels ( l A l_{A} = 0) to anomaly labels ( l A l_{A} = 1).

### C.2 Experimental Details

We train all models for 100 epochs using the Adam optimizer with a learning rate of 0.001, and use the model with the best Macro-F1 on the validation set for reporting the final results on the test set. Following [ 24 ] , we use training ratios 1% and 40% respectively (randomly select 1% and 40% nodes of the dataset to train the model, and use the remaining nodes for the validation and testing). These remaining nodes are split 1:2 for validation:testing. The statistics of the datasets are listed in Table 5 . For the four datasets used in the experiments, Amazon and Yelp datasets can be obtained from the DGL library, T-Finance and T-Social can be obtained from [ 24 ] .

We report the average performance of 5 runs on the test datasets. The hyperparameters of our model are tuned based on the validation set, selecting the best parameters within 100 epochs. To speedup the training process, for the large graph datasets T-Finance and T-Social, we sample a different subgraph to train for each epoch (subgraphs have 5 % 5\% of the nodes with respect to the whole training data). The hyperparameters include the number of hidden dimensions in ET-attention Y Y , the number of neurons K K in the hidden layer within the Hopfield Network Module, the number of time iterations T T , and the number of heads H H . The weights are learned via backpropagation, which includes embedding projection 𝐄 \mathbf{E} , positional embedding λ A \mathbf{\lambda}_{A} , softmax inverse temperature parameter β \beta , ET-attention weight tensors 𝐖 Q \mathbf{W}^{Q} and 𝐖 K \mathbf{W}^{K} . The optimal hyperparameters used in Table 1 are reported in Table 6 . The last row in that table summarizes the range of the hyperparameter search that was performed in our experiments. In general, we have observed that for small datasets (Yelp, Amazon, T-Finance) a 1 or 2 applications of our network is sufficient for achieving strong results, for larger datasets (T-Social) more iterations (3) are necessary. For even bigger dataset (ImageNet) our network needs about 12 12 iterations.

## Appendix D Graph Classification with ET

Recently, there have been attempts of leveraging Transformer into the graph domain, but only certain key modules, such as feature aggregation, are replaced in GNN variants by the softmax attention [ 55 ] . However, there remains an interesting and open question about suitability of the Transformer architecture to model graphs and how to apply it in the graph classification domain. In this section we explain how ET can be used for graph classification.

### D.1 Details of Graph Classification ET Model

Given a graph G = ( V , 𝐀 , ℰ ) G=(V,\mathbf{A},\mathcal{E}) , we have the set of nodes V = { v 1 , v 2 , … , v N } V=\{v_{1},v_{2},\dots,v_{N}\} , the adjacency matrix 𝐀 ∈ { 0 , 1 } N × N \mathbf{A}\in\{0,1\}^{N\times N} , and if it exists, the edge feature matrix ℰ ∈ ℝ N × N × P ′ \mathcal{E}\in\mathbb{R}^{N\times N\times P^{\prime}} where each edge has P ′ P^{\prime} raw features. Each feature vector 𝐲 A ∈ ℝ F \mathbf{y}_{A}\in\mathbb{R}^{F} corresponding to a node v A v_{A} is first projected to the token space 𝐱 𝐀 ∈ ℝ D \mathbf{x}_{\mathbf{A}}\in\mathbb{R}^{D} via a linear embedding. Then, the CLS token 𝐱 CLS \mathbf{x}_{\text{CLS}} is concatenated to the set of tokens resulting in 𝐗 ∈ ℝ ( N + 1 ) × D \mathbf{X}\in\mathbb{R}^{(N+1)\times D} and the positional embedding λ ∈ ℝ ( N + 1 ) × D \lambda\in\mathbb{R}^{(N+1)\times D} is added to it afterwards.

To obtain the positional embedding λ ∈ ℝ ( N + 1 ) × D \lambda\in\mathbb{R}^{(N+1)\times D} , the adjacency matrix 𝐀 \mathbf{A} is first padded in the upper left corner with ones resulting in 𝐀 ~ ∈ { 0 , 1 } ( N + 1 ) × ( N + 1 ) \tilde{\mathbf{A}}\in\{0,1\}^{(N+1)\times(N+1)} as a means to provide the CLS token full connectivity with all of the nodes in a given graph. Following [ 37 ] , the top k k smallest eigen-vectors λ ~ ∈ ℝ ( N + 1 ) × k \tilde{\lambda}\in\mathbb{R}^{(N+1)\times k} are extracted from the normalized Laplacian matrix 𝐋 ~ \tilde{\mathbf{L}} obtained from 𝐀 ~ \tilde{\mathbf{A}} 𝐋 ~ = 𝐈 − 𝐃 ~ − 1 2 ​ 𝐀 ~ ​ 𝐃 ~ − 1 2 , \tilde{\mathbf{L}}=\mathbf{I}-\tilde{\mathbf{D}}^{-\frac{1}{2}}\tilde{\mathbf{A}}\tilde{\mathbf{D}}^{-\frac{1}{2}}, (23) and projected to the token space via a linear embedding to form λ \lambda . Note, 𝐈 \mathbf{I} and 𝐃 ~ \tilde{\mathbf{D}} are the identity matrix and the degree matrix of 𝐀 ~ \tilde{\mathbf{A}} .

Meanwhile, the attention in ET is modified to take in 𝐀 ^ ∈ ℝ ( N + 1 ) × ( N + 1 ) × H \mathbf{\hat{A}}\in\mathbb{R}^{(N+1)\times(N+1)\times H} the parameterized adjacency tensor, which acts as the weighted ‘attention mask’ that enables the model to consider the graph structural information. To obtain 𝐀 ^ \mathbf{\hat{A}} , a 2D-convolutional layer with H H filters equals to the number of heads in the attention block, ‘SAME’ padding, and a stride of one is performed on the outer product of 𝐗 \mathbf{X} to itself. The result is then multiplied with the tensor 𝐀 ′ ∈ ℝ ( N + 1 ) × ( N + 1 ) × H \mathbf{A}^{\prime}\in\mathbb{R}^{(N+1)\times(N+1)\times H} element-wise (denoted by ⊙ \odot ) via broadcasting

𝐀 ^ = Conv2D ​ ( 𝐗 ⊗ 𝐗 ) ⊙ 𝐀 ′ . \mathbf{\hat{A}}=\text{Conv2D}(\mathbf{X}\otimes\mathbf{X})\odot\mathbf{A}^{\prime}. (24)

The tensor 𝐀 ′ \mathbf{A}^{\prime} is a linear projection, via a linear embedding layer, of the edge feature matrix ℰ \mathcal{E} if it exists, where P ′ P^{\prime} is projected to H H dimension; or the padded adjacency matrix 𝐀 ~ \tilde{\mathbf{A}} where P ′ = 1 P^{\prime}=1 . Altogether, the resulting energy equation is E = ATT − 1 β ∑ h ∑ C log ( ∑ B ≠ C exp ( β ∑ α K α ​ h ​ B Q α ​ h ​ C ⊙ A ^ h ​ C ) ) . E{{}^{\text{ATT}}}=-\frac{1}{\beta}\sum\limits_{h}\sum\limits_{C}\textrm{log}\left(\sum\limits_{B\neq C}\textrm{exp}\left(\beta\sum\limits_{\alpha}K_{\alpha hB}\;Q_{\alpha hC}\odot\hat{A}_{hC}\right)\right). (25) Moreover, to only consider the energy of edges in G G , we set non-connected entries in 𝐀 ^ \hat{\mathbf{A}} to be − ∞ -\infty , such that the gradient of such entries would be zero following the dynamics. Note, if non-connected entries are not ignored, the gradient of such entries would be non-zero and hence, the resultant attention energy might violate some of the graph structural information.

Meanwhile, in this implementation, the overall model consists of S S vertically stacked ET blocks, where each block shares the same number of T T depth and has its own LayerNorm. Similarly, the token representation 𝐗 ℓ , t \mathbf{X}^{\ell,\;t} at dynamic step t t corresponding to a block ℓ \ell is layer-normalized, 𝐠 ℓ , t = LayerNorm ​ ( 𝐗 ℓ , t ) . \mathbf{g}^{\ell,\;t}=\text{LayerNorm}(\mathbf{X}^{\ell,\;t}). (26) Keep in mind, 𝐗 = 𝐗 ℓ = 1 , t = 1 \mathbf{X}=\mathbf{X}^{\ell=1,\;t=1} is the initial token representation.

Following the dynamic equations 6 , we inject a small amount of noise ϵ ℓ , t ∈ ( 0 , 1 ) \epsilon^{\ell,\;t}\in(0,1) , generated from a normal distribution using a standard deviation σ ϵ \sigma_{\epsilon} and zero mean, into the gradient of energy function to produce 𝐗 ℓ , t + 1 \mathbf{X}^{\ell,\;t+1} , the new token representation of block ℓ \ell . The premise of this noise injection is to ‘robustify’ the model and help it escape saddle points of the energy function. 𝐗 ℓ , t + 1 = 𝐗 ℓ , t − α ​ ∇ 𝐠 E ℓ , t + α ​ ϵ ℓ , t , ϵ ℓ , t ∼ 𝒩 ⁡ ( 0 , σ ϵ 2 ) . \mathbf{X}^{\ell,\;t+1}=\mathbf{X}^{\ell,\;t}-\alpha\nabla_{\mathbf{g}}E^{\ell,\;t}+\sqrt{\alpha}\,\epsilon^{\ell,\;t},\qquad\epsilon^{\ell,\;t}\sim\mathcal{N}(0,\sigma_{\epsilon}^{2}). (27) Once stability is reached in the retrieval dynamics of a block ℓ \ell , the final representation 𝐗 ℓ , t = T \mathbf{X}^{\ell,\;t=T} is then passed on to the next block ℓ + 1 \ell+1 and the whole process is repeated again. When the final token representation 𝐗 ℓ = S , t = T \mathbf{X}^{\ell=S,\;t=T} is computed by the last block S S , the resultant CLS token 𝐱 CLS ℓ = S , t = T ∈ ℝ D ′ \mathbf{x}_{\text{CLS}}^{\ell=S,\;t=T}\in\mathbb{R}^{D^{\prime}} , extracted from 𝐗 ℓ = S , t = T \mathbf{X}^{\ell=S,\;t=T} , is utilized as the predictor of the current graph G G .

### D.2 Experimental Evaluation

As mentioned prior, eight datasets from TUDataset [ 36 ] are used for experimentation. Based on the collected results in Table 2 , we observed that the modified ET demonstrates the best performance across all datasets with the exception of MUTAG. Additionally, as a means to contrast ET with other graph transformers, ET is trained and evaluated with five datasets from GNNBenchmark [ 37 ] . Specifically, PATTERN and CLUSTER for node classification; CIFAR10 and MNIST for graph classification; and lastly, ZINC for graph-regression. We compare ET to the recently introduced graph transformers – namely, EGT [ 56 ] , Graphormer [ 57 ] , Exphormer [ 58 ] , GT [ 59 ] , and GAT [ 54 ] . The results are depicted in table 7 .

Dataset Method CIFAR10 MNIST PATTERN CLUSTER ZINC (Accuracy) ↑ \uparrow (Accuracy) ↑ \uparrow (Accuracy) ↑ \uparrow (Accuracy) ↑ \uparrow (MAE) ↓ \downarrow GT - - 84.808 ± 0.068 84.808_{\pm 0.068} ▼ \blacktriangledown ( 2.013 ) (2.013) 73.169 ± 0.622 73.169_{\pm 0.622} ▼ \blacktriangledown ( 6.063 ) (6.063) 0.226 ± 0.014 0.226_{\pm 0.014} ▼ \blacktriangledown ( 0.112 ) (0.112) GAT 64.223 ± 0.455 64.223_{\pm 0.455} ▼ \blacktriangledown ( 10.531 ) (10.531) 95.535 ± 0.205 95.535_{\pm 0.205} ▼ \blacktriangledown ( 2.879 ) (2.879) 78.271 ± 0.186 78.271_{\pm 0.186} ▼ \blacktriangledown ( 8.550 ) (8.550) 70.587 ± 0.447 70.587_{\pm 0.447} ▼ \blacktriangledown ( 8.645 ) (8.645) 0.384 ± 0.007 0.384_{\pm 0.007} ▼ \blacktriangledown ( 0.276 ) (0.276) EGT 68.702 ± 0.409 68.702_{\pm 0.409} ▼ \blacktriangledown ( 6.052 ) (6.052) 98.173 ± 0.087 98.173_{\pm 0.087} ▼ \blacktriangledown ( 0.241 ) (0.241) 86.821 ± 0.020 86.821_{\pm 0.020} 79.232 ± 0.348 \mathbf{79.232_{\pm 0.348}} 0.108 ± 0.009 0.108_{\pm 0.009} Graphormer 65.978 ± 0.579 65.978_{\pm 0.579} ▼ \blacktriangledown ( 8.776 ) (8.776) 97.905 ± 0.176 97.905_{\pm 0.176} ▼ \blacktriangledown ( 0.509 ) (0.509) 86.650 ± 0.033 86.650_{\pm 0.033} ▼ \blacktriangledown ( 0.171 ) (0.171) 74.660 ± 0.236 74.660_{\pm 0.236} ▼ \blacktriangledown ( 4.572 ) (4.572) 0.122 ± 0.006 0.122_{\pm 0.006} ▼ \blacktriangledown ( 0.014 ) (0.014) Exphormer 74.754 ± 0.194 \mathbf{74.754_{\pm 0.194}} 98.414 ± 0.038 \mathbf{98.414_{\pm 0.038}} 86.734 ± 0.008 86.734_{\pm 0.008} ▼ \blacktriangledown ( 0.087 ) (0.087) 78.220 ± 0.045 78.220_{\pm 0.045} ▼ \blacktriangledown ( 1.012 ) (1.012) - ET (Ours) 63.920 ± 0.173 63.920_{\pm 0.173} ▼ \blacktriangledown ( 10.834 ) (10.834) 97.011 ± 0.045 97.011_{\pm 0.045} ▼ \blacktriangledown ( 1.403 ) (1.403) 90.690 ± 0.013 \mathbf{90.690_{\pm 0.013}} ▲ \blacktriangle ( 3.869 ) (3.869) 77.169 ± 0.044 77.169_{\pm 0.044} ▼ \blacktriangledown ( 2.063 ) (2.063) 0.096 ± 0.000 \mathbf{0.096_{\pm 0.000}} ▲ \blacktriangle ( 0.012 ) (0.012)

Based on the collected results, ET outperforms its baselines on PATTERN and ZINC datasets, and has competitive performance on MNIST and CLUSTER datasets. Meanwhile, ET performs the worst on the CIFAR10 dataset, in which its performance is relatively close to GAT [ 54 ] and Graphformer [ 57 ] . The reason for such a bad performance can be attributed to the overfitting problem seen during the training of the model, which is also experienced by [ 56 , 59 ] . Hence, while ET performs very well on TUDataset, further explorations are required to enable ET to work better on CIFAR10, MNIST, and CLUSTER datasets. However, ET has overall demonstrated great performance on node binary-classification and graph-regression tasks.

### D.3 Experimental Details

In the graph domain, it is common to concatenate all of the feature vectors of all graphs in a batch together. However, in order for ET to work, we form the batch dimension by separating the feature vectors of all graphs in a given batch and utilize the largest node count to pad all graphs such that they all share the same number of nodes. Additionally, we set a limit on the number of nodes equal to 500, to prevent out-of-memory error. Specifically, if a graph has a node count exceeding the limit, the number of utilized nodes is equal to the limit. Hence, a portion of the graph structural information is ignored as a result. However, it is worth mentioning such a graph is rare in the experimental datasets. Additionally, instead of ignoring the padded entries, they are altered to be sink nodes in a graph, such that they are connected to the actual nodes of the graph but not vice versa. We found this approach to be helpful when it comes to computing the positional embedding and training the model. Additionally, following [ 37 , 56 ] , the sign of the top k k eigen-vectors is flipped randomly during training and fixed during evaluation. The whole experiment is implemented using JAX [ 49 ] , Flax [ 50 ] , Optax [ 60 ] , and PyTorch Geometric [ 61 ] frameworks.

For the eight datasets of TUDataset, we train all models for 300 epochs using AdamW [ 62 ] and Gradient Centralization [ 63 ] . The best model is selected based on its performance obtained from the 10-fold cross validation process delineated in [ 36 ] . Since the task is classification, all models are trained with the cross-entropy loss function and label smoothing [ 64 ] , where the smoothing parameter is set to 0.05. Additionally, the cosine-annealing with warm-up learning rate scheduler [ 65 ] is utilized, where the initial and end learning rates are both set as 5 ​ e − 6 5e-6 while the peak learning rate is 0.001 0.001 . The number of warm-up steps is set to 50 epochs while the batch size is 32 for all datasets. We report the average performance of 100 runs on the 10-fold cross validation process with random seeding. The hyperparameters of our model are tuned based on the performance of the cross validation, selecting within 100 epochs. The optimal hyper-parameters are reported in Table 9 and the statistics of the used datasets are reported in Table 8 . We also include the number of gpu-devices used for training ET.

Similarly, for the five datasets of GNNBenchmark, we train all models using using AdamW [ 62 ] and Gradient Centralization [ 63 ] . The best model is selected based on its performance obtained from the validation set across 10 runs. For the CIFAR10 and MNIST datasets, the additional node positional features are concatenated to the node features (i.e., pixel values coordinates). All models, with the exception of ZINC, CIFAR10, and MNIST models, are trained using the cross-entropy loss function with label smoothing, where the smoothing parameter is set to 0.05. The ZINC model is trained with the mean absolute error function. Meanwhile, as a means to reduce overfitting, for the CIFAR10 and MNIST models, the mean squared error loss function is utilized to reconstruct the edge feature matrix ℰ \mathcal{E} in addition to the cross entropy loss function. Specifically, the parameterized adjacency tensor 𝐀 ^ \hat{\mathbf{A}} is projected to match P ′ P^{\prime} raw feature dimension of ℰ \mathcal{E} , where both tensors are as part of the mean squared error function. In addition, all models are trained with the cosine-annealing with warm-up learning rate scheduler, where the number of warm-up steps is 50. We report the average performance of 100 evaluation runs on the testing set with random seeding. The hyperparameters of each model are tuned based on the performance of cross validation, selecting within 50 epochs. The optimal hyper-parameters are reported in Tables 10 and 11 and the statistics of the used datasets are reported in [ 37 ] .

Dataset Parameter CIFAR10 MNIST PATTERN CLUSTER ZINC batch_size 128 128 128 128 128 epochs 150 150 100 300 500 initial lr 1e-3 1e-3 1e-3 1e-3 5e-7 ending lr 5e-5 5e-5 5e-7 5e-7 5e-7 peak lr 1e-3 1e-3 1e-3 1e-3 1e-3 warmup_epochs 50 50 50 50 50 b1, b2 (ADAM) (0.9, 0.99) (0.9, 0.99) (0.9, 0.99) (0.9, 0.99) (0.9, 0.99) weight_decay 0.05 0.05 0.05 0.05 0.05 grad_clipping None None None None None num. of gpu devices 4 4 1 1 8

Dataset Parameter CIFAR10 MNIST PATTERN CLUSTER ZINC token_dim 128 128 128 128 128 num_heads 12 12 12 12 12 head_dim 64 64 64 64 64 β \beta 1 64 \frac{1}{\sqrt{64}} 1 64 \frac{1}{\sqrt{64}} 1 64 \frac{1}{\sqrt{64}} 1 64 \frac{1}{\sqrt{64}} 1 64 \frac{1}{\sqrt{64}} train_betas Yes Yes Yes Yes Yes step size α \alpha 0.25 0.25 0.1 0.1 0.1 k eigenvalues 15 15 15 15 15 noise σ ϵ \sigma_{\epsilon} 0.02 0.02 0.005 0.005 0.005 depth 4 4 4 4 1 block_size 2 2 2 2 4 kernel_size [3, 3] [3, 3] [3, 3] [3, 3] [3, 3] dilation_size [1, 1] [1, 1] [1, 1] [1, 1] [1, 1] hidden_dim HN 512 512 512 512 512 bias in HN None None None None None bias in ATT None None None None None bias in LNORM Yes Yes Yes Yes Yes total num. of params 529224 528968 527936 528964 1052409

## Appendix E ET for heterogeneous Graph

In this section, we show the performance of our ET model in the heterogeneous graph case. For the heterogeneous graph case (where more than one type of edges exist in the graph), we first run our ET model for different subgraphs (corresponding to different types of edges), and then aggregate the final representations using two methods. We have tried max pooling and concatenation for the aggregation step. Max pooling means to pick the largest value across all the subgraph representations, and concatenation means to concatenate the representations obtained from different subgraphs. Table 12 shows the comparison between these two variants of our model and BWGNN (heterogeous case). ET performs better than heterogeneous BWGNN on Amazon, but loses to heterogeneous BWGNN on Yelp. Interestingly, BWGNN in the heterogeneous setting performs worse than BWGNN in the homogeneous setting on Amazon.

## Appendix F Ablation Study for Attention and Hopfield Network Modules

As we described in the main text the the ET network consists of two modules processing the tokens in parallel: the attention module (ATT) and the Hopfield Network module (HN). The ATT module is responsible for routing the information between the tokens, while the HN module is responsible for reinforcing the token representation to be consistent with the general expectation about the particular data domain. It is interesting to explore the contribution that these two subnetworks produce on the task performed by the network. In this section we ablate the ET architecture by dropping each of the two subnetworks and measuring the impact of the ablation on the performance.

### F.1 On Graphs

The results on graphs are reported in Table 13 . From this table it is clear that most of the computation is performed by the ATT block on this task, which pools the information about other tokens to the token of interest. When ATT block is kept, but HN block is removed the network looses 1 % 1\% or less relative to the full ET (occasional improvements of the ablated model compared to the full ET are within the statistical error bars). In contrast, removing ATT module and keeping only the HN, the ET network effectively turns into an MLP with shared weights that is recurrently applied. In this regime the network can only use the features of a given node for that node’s anomalous status prediction. This results in a more significant drop in performance, which is about 5 % 5\% on average.

### F.2 On Images

The ablation results for image reconstruction are shown in Table 14 . Each experiment was trained using the same hyperparameter settings as shown in Table 4 . After training the model on IN1K, we calculate the average MSE on the reconstructed masked tokens for the validation set (using the same 50 50 % masking ratio used for training) across 10 10 different random seeds for the masking.

We make several conclusions from these ablation studies.

• We gain several insights regarding the use of “self-attention” in our ET (when a token patch query is allowed to consider itself as a key in the attention weights). When both self-attention and HN are present (ET-Full+Self), there is no noticeable benefit over ET-Full for a token to attend to itself. In fact, preventing the ATTN energy module from attending to itself slightly improves the performance. However, when the HN is removed (ET-NoHN*), we notice that allowing self-attention (ET-NoHN+Self) outperforms the version that prevents self-attention (ET-NoHN).

• On its own, allowing self-attention (ET-NoHN+Self) in the ATTN module performs nearly as well as the full ET at a fraction of the total parameters. However, MSE is a forgiving metric for blurry reconstructions. While ATTN can capture the global structure of the image quite well, it does so at the expense of image sharpness ( Figure 4 ).

• As expected, removal of the ATTN energy module performs the worst, because the HN operates tokenwise and has no way to aggregate token information across the global image without ATTN.

Figure 8 shows our best performing model (ET-Full) on the qualitative image reconstructions corresponding to the largest errors across IN1K validation images, averaged across all masking seeds. Likewise, Figure 9 shows the lowest errors across IN1K validation images and masking seeds. In general, image reconstructions that require ET to produce sharp, high frequency, and high contrast lines negatively impact MSE performance.

## Appendix G Parameter comparison

The energy function enforces symmetries in our model, which means ET has fewer parameters than its ViT counterparts. In particular, ET has no “Value Matrix” 𝐖 V \mathbf{W}^{V} in the attention mechanism, and the HN module has only one of the two matrices in the standard MLP of the traditional Transformer block. We report these differences in Table 15 . We take the ET configuration used in this paper, which has an architecture fully comparable to the original ViT-base [ 18 ] with patch_size=16 , and report the number of parameters against ViT-base and an “ALBERT” version of ViT [ 14 ] where a single ViT block is shared across layers. We saw no benefit when including biases in ET, so we also exclude the biases from the total parameter count in the configuration of ViT and ALBERT-ViT. We report both the total number of parameters and the number of parameters per Transformer block. Furthermore, as a means for a fairer comparison, we reduce the parameters of ViT-Base such that the parameter count is similar to that of ET. We contrast ET and the reduced ViT on the image reconstruction task using PSNR (Peak-Signal-to-Noise-Ratio) and SSIM (Structural-SIMilarity) [ 66 ] as the evaluation metrics of the reconstructions. The results are demonstrated in Table 16 , where the performance of ET is very close to that of the reduced ViT, which has a slight advantage in parameter count.

## Appendix H Formal Algorithm for Training and Inference of ET

## Instructions for reporting errors

We are continuing to improve HTML versions of papers, and your feedback helps enhance accessibility and mobile support. To report errors in the HTML that will help us improve conversion and rendering, choose any of the methods listed below:

Click the "Report Issue" ( ) button, located in the page header.

Tip: You can select the relevant text first, to include it in your report.

Our team has already identified the following issues . We appreciate your time reviewing and reporting rendering errors we may not have found yet. Your efforts will help us improve the HTML versions for all readers, because disability should not be a barrier to accessing research. Thank you for your continued support in championing open access for all.

Have a free development cycle? Help support accessibility at arXiv! Our collaborators at LaTeXML maintain a list of packages that need conversion , and welcome developer contributions .
