Spatial Attention Kinetic Network
with E(n)-Equivariance
Abstract
Neural networks that are equivariant to rotations, translations, reflections, and permutations on -dimensional geometric space have shown promise in physical modeling—from modeling potential energy surfaces to forecasting the time evolution of dynamical systems. Current state-of-the-art methods employ spherical harmonics to encode higher-order interactions among particles, which are computationally expensive. In this paper, we propose a simple alternative functional form that uses neurally parametrized linear combinations of edge vectors to achieve equivariance while still universally approximating node environments. Incorporating this insight, we design spatial attention kinetic networks with E(n)-equivariance, or SAKE, which are competitive in many-body system modeling tasks while being significantly faster.
1 Introduction
Encoding the relevant symmetries of systems of interest into the inductive biases of deep learning architectures has been shown to be crucial in physical modeling. Graph neural networks (GNNs) (Kipf and Welling, 2016; Xu et al., 2018; Gilmer et al., 2017; Hamilton et al., 2017; Battaglia et al., 2018), for instance, preserve permutation equivariance by applying indexing-invariant pooling functions among nodes (particles) and edges (pair-wise interactions) and have emerged to become a powerful workhorse in a wide range of modeling tasks for many-body system (Satorras et al., 2021).
When it comes to describing not only the topology of the system but also the geometry of the state, relevant symmetry groups for three-dimensional systems are SO(3) (rotational equivariance), SE(3) (rotational and translational equivariance), and E(3) (additionally with reflectional equivariance). A ubiquitous and naturally invariant first attempt to encode the geometry of such systems is to employ only radial information, i.e., interparticle distances. This alone has empirically shown utility in predicting quantum chemical potential energies, and considerable effort has been made in the fine-tuning of radial filters to achieve quantum chemical accuracy—1 kcal/mol, the empirical threshold to qualitatively reliably predict the behavior of a quantum mechanical system—and beyond (Schütt et al., 2017).
Nonetheless, radial information alone is not sufficient to fully describe node environments—the spatial distribution of neighbors around individual particles. The relative locations of particles around a central node could drastically change despite maintaining distances to these neighbors unaltered. To describe node environments with completeness, one needs to address these remaining degrees of freedom. Current state-of-the-art approaches encode angular distributions by employing a truncated series of spherical harmonics to generate higher-order feature representations; while these models have been shown to be data efficient for learning properties of physical systems, these features are expensive to compute, with the expense growing rapidly with the order of harmonics included (Thomas et al., 2018; Klicpera et al., 2021a; Fuchs et al., 2020; Batzner et al., 2021; Anderson et al., 2019). The prohibitive cost would prevent this otherwise performant class of models from being employed in materials and drug design, where rapid simulations of large systems are crucial to provide quantitative insights.
Here, we design a simple functional form, which we call spatial attention, that uses the norm of a set of neurally parametrized linear combinations of edge vectors to describe the node environment. Though simple in form, easy to engineer, and ultra-fast to compute, spatial attention is capable of universally approximating any functions defined on local node environment while preserving E(n)-invariance/equivariance in arbitrary -dimensional space.
After demonstrating the approximation universality and invariance of spatial attention, we incorporate it into a novel neural network architecture that uses spatial attention to parametrize fictitious velocity and positions equivariantly, which we call a spatial attention kinetic network with E(n)-Equivariance, or SAKE (pronounced sah-keh, like the Japanese rice wine)111Implementation: https://github.com/choderalab/sake. To demonstrate the robustness and versatility of SAKE, we benchmark its performance on potential energy approximation and dynamical system forecasting and sampling tasks. For all popular benchmarks, compared to state-of-the-art models, SAKE achieves competitive performance on a wide range of invariant (MD17: Table 1, QM9: Table 3, ISO17: Table 2) and equivariant (N-body charged particle Table 4, walking motion: Table 6) while requiring only a fraction of their training and inference time.
2 Background
In this section, we provide some theoretical background on physical modeling, equivariance, and graph neural networks to lay the groundwork for the exposition of spatial attention networks.
2.1 Equivariance: permutational, rotational, translational, and reflectional
A function is said to be equivariant to a symmetry group if
(1) |
and some equivalent transformations on the two spaces respectively and .
If on a -dimensional space , we have permutation and satisfying Equation 1, we say is permutationally equivariant; if where is a rotation matrix , and we say is rotationally equivariant; if and , where we say is translationally equivariant; finally, if and , and is a reflection on -dimensional space, we say is reflectionally equivariant.
2.2 Graph neural networks
Modern GNNs, which exchanges and summarizes information among nodes and edges, are better analyzed through the spatial rather than spectral lens, according to Wu et al. (2019)’s classification. Following the framework from Gilmer et al. (2017); Xu et al. (2018); Battaglia et al. (2018), for a node with neighbors , in a graph , with denoting the feature of node at the -th layer (or -th round of message-passing) and the initial node feature on the embedding space, the -th message-passing step of a GNN can be written as three steps:
First, an edge update,
(2) |
where the feature embeddings of two connected nodes and update their edge feature embedding , followed by neighborhood aggregation,
(3) |
where edges incident to a node pool their embeddings to form aggregated neighbor embedding , and finally a node update,
(4) |
where denotes the operation to return the multiset of neighbors of a node and and are implemented as feedforward neural networks. Since the neighborhood aggregation functions are always chosen to be indexing-invariant functions, namely a or a operator, Equation 3, and thereby the entire scheme, is permutationally invariant.
Problem Statement.
We are interested in designing a class of parametrized functions that map from and to the joint spaces of (-dimensional) geometry and semantic embedding such that it is permutationally, rotationally, translationally, and reflectionally equivariant on and invariant on . That is, for a given coördinate , embedding and any transformation mentioned in Section 2.1 (rotation, translation, and reflection), we have:
(5) |
3 Related Work: Invariant and Equivariant GNNs
Invariant GNN.
Although the notion of graph might not appear in their original publications, a plethora of neural architectures could be viewed as de facto graph neural networks with invariance on geometric space (for a survey, see (Han et al., 2022)). SchNet (Schütt et al., 2017), for example, approximates the potential energy of molecules by applying radially-symmetric convolutions that only operate on the distances between atoms to ensure the model is E(3)-invariant, effectively using a graph neural network architecture where nodes denote atoms and edges denote the distance separation between pairs of atoms within a cutoff radius. In addition to interatomic distances, invariant models could also incorporate information about the angular distribution of atom neighbors by computing atomic features that incorporate angular information of neighbor-atom-neighbor triplets (Smith et al., 2017; Behler, 2011; Klicpera et al., 2020a; Liu et al., 2022). Compared to SAKE, these models are not capable of equivariant modeling; even in an invariant setting, they are empirically less performant (See invariant tasks performance Section 6.1).
Equivariant GNN with spherical harmonics.
Architectures achieving SE(3)-equivariance by leveraging Bessel functions and spherical harmonics to encode higher-order interactions (Thomas et al., 2018; Klicpera et al., 2021a; Fuchs et al., 2020; Anderson et al., 2019; Klicpera et al., 2021b; Brandstetter et al., 2021; Liu et al., 2022) shows outstanding performance and data efficiency, some of which is on par with SAKE (Table 1, 4). Villar et al. (2021) discusses that these higher-order representation is not necessary to construct invariantly and equivariantly universal models. Meanwhile, they tend to be difficult to engineer and expensive to train and run. (See runtime benchmarks in aforementioned tables.)
Equivariant GNN with dot product scalarization.
Recent efforts (Schütt et al., 2021; Thölke and Fabritiis, 2022; Huang et al., 2022) relying on dot product of edge tensors as equivariant nonlinearity have achieved competitive results on machine learning potential construction, among which none has been validated to perform well on both equivariant and invariant tasks. Experimentally, they are consistently outperformed by SAKE in invariant (Section 6.1: Table 1) and equivariant (Section 6.2: Table 6) tasks.
Message passing between emebedding and geometric spaces.
Satorras et al. (2021) has formalized the link between graph neural networks and and equivariance and provided a generalizing framework encompassing iterative geometric-to-embedding and embedding-to-geometric type update. Like our proposed architecture, E(N) Equivariant Graph Neural Networks (EGNN), proposed in Satorras et al. (2021), also uniquely describes the geometry of a -body system, although their argument was based on a global scale given sufficient steps of message passing, while we can sufficiently describe the local geometric environment. This advantage is evidenced by extensive experiments (invariant: Table 3; equivariant: Table 4 and 6). In ablation study (Section 6.3), we show that without spatial attention, EGNN is not competitive in potential energy modeling, even when all other tricks used in this paper were added. Similar to EGNN (Satorras et al., 2021), our model is equivariant w.r.t. a general E(n) group and are not restricted to E(3). Also worth noting is that the Geometric Vector Perceptrons algorithm proposed in Jing et al. (2021) could be regarded as a special case of our framework where the attention weights are learned globally, whereas we learn them in an amortized manner and thus can be transductively generalized across systems.
4 Theory: Spatial Attention
Given a node with embedding (where denotes the embedding dimension) and position (where denotes the geometry dimension) in a graph , its neighbors with connecting edges , with displacement vector and embedding with some aggregation function , we define spatial attention as
(6) |
where is a set of arbitrary attention weights-generating function that operates on the edge embedding, is an equivariant function that operate on the edge vector, is an arbitrary function that takes the norms of linear combinations, and denotes concatenation. We drop the explicit dependence of on both geometric and embedding properties of and for simplicity. We name this functional form attention because it characterizes the alignment between edge vectors in various projections.
When implemented, and take the form of feed-forward neural networks. In other words, for each node , we first parametrize a (is analogous to the number heads in multi-head attention) sets of attention weights based on the edge embeddings . At the same time, we also equivariantly (on E(n) group) transform the edge vector into . Next, we use those sets of attention weights to linearly combine these vectors among edges and take the Euclidean norm of each of these linear combinations, resulting in norms. Lastly, we concatenate these norms and put them into a feed-forward neural network to compute the node embedding. It naturally follows that:
Remark 1.
Spatial attention is permutationally, rotationally, transalationally, and reflectionally invariant on E(n),
since is invariant w.r.t. indexing and the Euclidean norm function is invariant to rotation, translation, and reflection.
With all local degrees of freedom incorporated in spatial attention, it is perhaps intuitive to see that can uniquely define the local environment of nodes up to E(n) symmetry. We formalize this finding (Proof in Appendix Section 8.1):
Theorem 1.
For a node in a graph with neighbors connected to by edges with positions and distinct embeddings , and any E(n)-invariant continuous function spatial attention can approximate with arbitrarily small error with some , and .
It is worth noting here that we only consider the universal approximation power of a mapping from the geometry space to a scalar space, without considering that on the space of node (and edge) embedding; regardless of geometry, GNNs that operate on neighborhood node embeddings are generally not universal (Xu et al., 2018; Corso et al., 2020). This universal approximative power on -invariant functions can lead to universally approximative parametrization of -equivariant functions, which we show in Remark 2. Practically, the inequality condition is not difficult to satisfy: we implement as dependent upon edge length so even if the semantic embedding of edges are identical, the inequality holds as long as the system is not strictly symemtrical at all times (namely the mirror symmetry presented in hydrogen molecule) despite distortions resulted from vibrations.
5 Architecture: Spatial Attention Kinetic Network (SAKE)
Leveraging the simple functional form introduced in Section 4, we design a fast, efficient, and easy-to-implement architecture termed a spatial attention kinetic network with E(n)-equivariance, or SAKE. Here, we introduce the remaining components of SAKE before assembling them in a modular way. The necessity of these designs are experimentally justified with ablation study in Section 6.3.
Edge embedding.
To embed pairwise interactions, combine the SchNet (Schütt et al., 2017)-style continuous filter convolution and the simple concatenation of the scalar-valued distance as in Satorras et al. (2021) to achieve the balance between high radial resolution and large receptive field. The resulting edge embedding is thus
(7) |
where denotes Hadamard product and is a (filter-generating) feed-forward network as in Schütt et al. (2017).
Semantic attention and distance cutoff.
To promote anisotropy (which Dwivedi et al. (2020) finds useful in GNNs) in the pooling operation, apart from spatial attention introduced in Section 4, we compute the attention score on semantic and geometry space to weight interactions among particles based on embedding similarity and distances on -dimensional space. The distance weights are calculated using the function proposed in Unke and Meuwly (2019):
(8) |
to filter out interactions outside a certain range (). And semantic attention weights are calculated similar to Graph Attention Networks (Veličković et al., 2018),
(9) |
To produce models for the purpose of molecular simulation by ensuring continuous forces and gradients, one would need to choose as sigma as at least C2-continuous activation functions, namely (Barron, 2017). These weights are combined and normalzied:
(10) |
It is trivial to expand to multi-head attention with sets of and the resulting combined attention weights concatenated.
Since the edge embedding after mixed Euclidean and semantic attention already encodes the desired inductive bias that nodes farther away from each other would have less impact on each other’s embedding, we directly use this representation and simply set as a linear projection (with weights ) and as identity in Equation 6:
(11) |
We leave more elaborate choices of and functions for future study.
Fictitious velocity integration.
Similar to Satorras et al. (2021), we keep track of a fictitious velocity variable for each node and linearly combine it (with weights ) update it and positions in turns like a Euler-discretized Hamiltonian integration.
(12) | ||||
(13) |
During velocity update, we scale the current velocity and, for the sake of parameter saving, reuse the same set of linear combinations of edge vectors used in Equation 6 as the additive term.
Remark 2.
If is distinct among edges, there exist sets of (even when is the identity) such that Equation 12 can approximate any vector on the subspace spanned by edge vectors and is thus universal up to equivariance thereon.
Equivariance analysis.
We inlay these modular components into the framework of graph neural networks (described in Section 2.2) to produce the SAKE architecture, which we show in Algorithm 1. (A is defined by applying iteratively from to , the depth of the network.) We have previously discussed that spatial attention is E(n)-invariant in Remark 4. With the E(n) equivariance of velocity update and position update (Equation 12) being proved in Satorras et al. (2021) and the rest of the model only takes the norm of edges and is E(n) invariant, SAKE is E(n)-equivariant.
Runtime analysis.
The runtime complexity of spatial attention (Equation 6), which is the bottleneck of this algorithm, is , i.e., linear in the number of graph edges , number of attention weights , embedding dimension , and geometric dimension . When implemented, the loops in Algorithm 1 can be packed into multi-dimensional tensors that could benefit from GPU acceleration.
Relation to spherical harmonics-based models.
Under the framework of TFN (Thomas et al., 2018), the embedding and position input in Algorithm 1 corresponds to the and type tensors. The concatenation followed by neural network in Equation 6 is loosely analogous to the direct sum operation in Clebsch-Gordon decomposition. While Smith et al. (2017); Schütt et al. (2017); Satorras et al. (2021) operates on tensors only, the spatial attention mechanism we propose (Section 4 Equation 6) and velocity/position update (Section 5 Equation 12) corresponds to and type networks, respectively. Klicpera et al. (2021a); Villar et al. (2021) have discovered that are the complete levels of tensor to universally describe geometry on , while higher-order tensors are not necessary to completely describe the node environment. Kovács et al. (2021) also discusses the concept of density projection where body-order functional forms can be recovered by lower-order terms.
6 Experiments
As discussed in Section 2, SAKE provides a mapping from and to the joint space of geometry and embedding , while being equivariant on geometric space and invariant on embedding space. We are therefore interested to characterize the performance of SAKE on two types of tasks: invariant modeling (Section 6.1), where we model some scalar property of a physical system, namely potential energy; and equivariant modeling (Section 6.2), where we predict coördinates conditioned on initial position, velocity, and embedding.
On both classes of tasks, SAKE displays competitive performance while requiring significantly less inference time compared to current state-of-the-art models. See Appendix Section 9 for experimental details and settings.
6.1 Invariant tasks: machine learning potential construction
SchNet Schütt et al.,2017 | DimeNet Klicpera et al.,2020b | sGDML Chmiela et al.,2019 | PaiNN Schütt et al.,2021 | GemNet(T/Q) Klicpera et al.,2021a | NequIP Batzner et al.,2021 | SAKE | ||
Inference time | batch of 32 | 65 | 88/376 | 206 | 12 | |||
batch of 4 | 31 | 38/99 | 197 | 4 | ||||
Aspirin | E | 16.0 | 8.8 | 8.2 | 6.9 | - | 5.3 | |
F | 58.5 | 21.6 | 29.5 | 14.7 | 9.4 | 8.2 | ||
Ethanol | E | 3.5 | 2.8 | 3.0 | 2.7 | - | 2.2 | |
F | 16.9 | 10.0 | 14.3 | 9.7 | 3.7 | 3.8 | ||
Malonaldehyde | E | 5.6 | 4.5 | 4.3 | 3.9 | - | 3.3 | |
F | 28.6 | 16.6 | 17.8 | 13.8 | 6.7 | 5.8 | ||
Naphtalene | E | 6.9 | 5.3 | 5.2 | 5.0 | - | 4.9 | |
F | 25.2 | 9.3 | 4.8 | 3.3 | 2.2 | 1.6 | ||
Salicylic acid | E | 8.7 | 5.8 | 5.2 | 4.9 | - | 4.0 | |
F | 36.9 | 16.2 | 12.1 | 8.5 | 5.4 | 3.9 | ||
Toluene | E | 5.2 | 4.4 | 4.3 | 4.1 | - | 4.0 | |
F | 24.7 | 9.4 | 6.1 | 4.1 | 2.6 | 2.0 | ||
Uracil | E | 6.1 | 5.0 | 4.8 | 4.5 | - | 4.5 | |
F | 24.3 | 13.1 | 10.4 | 6.0 | 4.2 | 3.3 |
MD17 potential energy
(Chmiela et al., 2017) tests the capacity of the model in the extreme small data regime. Its training set contains merely 1000 configurations and quantum chemical energies and forces of single small molecules in vacuum computed using density functional theory (DFT). As summarized in Table 1, SAKE consistently outperforms all benchmarked models with the exception of NequIP (Batzner et al., 2021), which has comparable performance but is noticeably slower. (Note that, to avoid inaccurate report on the suboptimal software configuration, we only report runtime data directly quoted from their original publications and replicate the hardware environment by ourselves. The same applies hereafter.) In terms of training cost, most state-of-the-art models requires days of training, whereas the MD17 experiment was completed within 6 hours. This significant advantage in speed would allow SAKE to be more rapidly trained and deployed on realistic applications involving molecular dynamics simulations.
ISO17
(Schütt et al., 2017) goes beyond the single-molecule regime. It involves a slightly more diverse chemical space containing 5000-step ab initio molecular dynamics simulation trajectories (with energies and forces) of 129 molecules with the same formula C7H10O2. The test set of ISO17 is split into known (which Kovács et al. (2021) argues to be very close to training set) and unknown molecules, based on the chemical identity (topology) at the beginning of the simulation, which could be regarded as interpolative and extrapolative tasks, respectively. As shown in Table 2, SAKE significantly outperforms other models on the unknown molecules in the test set, indicating that SAKE is capable of extrapolating and generalizing onto unseen chemical spaces when trained on limited data.
QM9
(Ramakrishnan et al., 2014) tests the transductive generalizability across distinct small chemical graphs. It entails a very diverse chemical space of 134k molecules with annotated phsyical properties calculated with B3LYP/6-31G(2df,p) level of quantum chemistry, albeit all with at-equilibrium (low energy) conformations. In Table 3, SAKE achieves state-of-the-art performance at predicting HOMO, LUMO, and properties—a class of most crucial molecular properties closely related to reactivity. Interestingly, SAKE performs competitively on predicting extensive physical properties but not intensive ones (also see discussions in Pronobis et al. (2018)). We hypothesize that this will be mitigated by choosing size-invariant pooling functions—we leave this for future study.
ACE Kovács et al.,2021 | SchNet Schütt et al.,2017 | PhysNet Unke and Meuwly,2019 | SAKE | ||
---|---|---|---|---|---|
known | E | 16 | 16 | 4 | |
F | 43 | 43 | 5 | ||
unknown | E | 85 | 104 | 127 | |
F | 85 | 95 | 60 |
Bohr3 | meV | HOMO meV | LUMO meV | D | cal/mol K | |
---|---|---|---|---|---|---|
SchNet
Schütt et al.,2017 |
0.235 | 63 | 41 | 34 | 0.033 | 0.033 |
DimeNet++
Klicpera et al.,2020a |
0.044 | 33 | 25 | 20 | 0.030 | 0.023 |
SE(3)-TF
Fuchs et al.,2020 |
0.142 | 53 | 35 | 33 | 0.051 | 0.054 |
EGNN
Satorras et al.,2021 |
0.071 | 48 | 29 | 25 | 0.029 | 0.031 |
PaiNN
Schütt et al.,2021 |
0.059 | 36 | 46 | 20 | 0.012 | 0.024 |
TorchMD-Net
Thölke and Fabritiis,2022 |
0.059 | 36 | 20 | 17 | 0.011 | 0.023 |
SphereNet
Liu et al.,2022 |
0.030 | 31 | 19 | 23 | 0.025 | 0.022 |
SAKE | 0.068 | 23 | 16 | 13 | 0.014 | 0.087 |
6.2 Equivariant tasks
Charged N-body dynamical system forecasting
(Kipf et al., 2018; Fuchs et al., 2020) tests if a model can predict the evolution of a physical system sufficiently long after initial conditions. This simple system consists of 5 charge-carrying particles with initial positions and velocities, and the position at a given moment is predicted. As shown in Table 4, although the interactions (Coulomb forces) are entirely pairwise, we see here that the additional expressiveness SAKE affords lead to competitive performance on this demonstrative task.
Architecture | MSE | Inference time |
---|---|---|
SE(3)-TF
(Fuchs et al., 2020) |
0.244 | 0.1346 |
TFN
(Thomas et al., 2018) |
0.155 | 0.0343 |
GNN
(Kipf and Welling, 2016) |
0.0107 | 0.0032 |
EGNN
(Satorras et al., 2021) |
0.0071 | 0.0062 |
SAKE | 0.0049 | 0.0079 |
SEGNN
(Brandstetter et al., 2021) |
0.0043 | 0.0260 |
MD17 forecast
(Chmiela et al., 2017; Huang et al., 2022) involves a simulation forecast task with slightly more complicated systems compared to Table 4. It uses the same dataset in Table 1, but predicts the time evolution of the molecular dynamics simulation directly, rather than predicting the mapping from the geometry to potential energy. Following the protocol in Huang et al. (2022), we predict the atom position based on the velocity and coördinate 3000 steps prior. As shown in Table 5, SAKE achieves superior performance on 6 out of 8 systems, without leveraging spherical harmonics (as in TFN (Thomas et al., 2018) or SE(3)-TF (Fuchs et al., 2020)) or hand-coded edges (as in GMN (Huang et al., 2022)).
Aspirin | Benzene | Ethanol | Malonaldehyde | Naphthalene | Salicylic | Toluene | Uracil | |
---|---|---|---|---|---|---|---|---|
TFN Thomas et al.,2018 | 12.37
±0.18 |
58.48
±1.98 |
4.81
±0.04 |
13.62
±0.08 |
0.49
±0.01 |
1.03
±0.02 |
10.89
±0.01 |
0.84
±0.02 |
SE(3)-TF Fuchs et al.,2020 | 11.12
±0.06 |
68.11
±0.67 |
4.74
±0.13 |
13.89
±0.02 |
0.52
±0.01 |
1.13
±0.02 |
10.88
±0.06 |
0.79
±0.02 |
EGNN Satorras et al.,2022 | 14.41
±0.15 |
62.40
±0.53 |
4.64
±0.01 |
13.64
±0.01 |
0.47
±0.02 |
1.02
±0.02 |
11.78
±0.07 |
0.64
±0.01 |
GMN Huang et al.,2022 | 9.76
±0.11 |
48.12 ±0.40 | 4.63
±0.01 |
12.82 ±0.03 | 0.40
±0.01 |
0.88
±0.01 |
10.22 ±0.08 | 0.59
±0.01 |
SAKE | 9.33 ±0.02 | 137.20
±0.06 |
4.63 ±0.00 | 12.81 ±0.03 | 0.38 ±0.00 | 0.82 ±0.01 | 10.98
±0.01 |
0.53 ±0.00 |
Walking motion capture
(CMU, 2003) has a higher system complexity and noise and is adopted to demonstrate SAKE’s general capacity to forecast dynamic systems beyond microscopic scale. In this task, again closely following the experiment setting of Huang et al. (2022); Kipf et al. (2018), we predict the position of a walking person (subject 35 in CMU motion capture database (CMU, 2003)) based on their initial position. Again, we observe that SAKE outperform other models by a large margin (Table 6) and is significantly faster.
6.3 Abalation study
Spatial attention Eq. 6 | Semantic attention Eq. 10 | Speed and position update Eq. 12 | Energy RMSE (meV) | Force RMSE (meV/Å) |
---|---|---|---|---|
Y | Y | Y | ||
N | Y | Y | ||
\hdashlineY | Y | N | ||
N | Y | N | ||
\hdashlineY | N | Y | ||
N | N | Y | ||
\hdashlineY | N | N | ||
N | N | N |
To elucidate each component’s contribution towards the final performance, we perform an ablation study on one of the most popular tasks studied so far—MD17 potential energy modeling (Section 6.1, Table 1). More specifically, we focus on the most complicated molecular system in the dataset, aspirin. We inspect three components proposed in the paper—spatial attention (Equation 6), which we argue is the main novelty of the paper, as well as semantic attention (Equation 10) and velocity and position update (Equation 12). As is shown in Table 7, spatial attention improves the performance regardless of the rest of the configuration. To clearly demonstrate the utility of these auxiliary modules, we also add these components (except spatial attention) to the backbone of EGNN (Satorras et al., 2022), and summarize the results in Appendix Table 10—qualitatively, with these modules, EGNN achieves decent performance on par with SchNet (Schütt et al., 2017), with the performance gap comes primarily from its inability to conceive the node angular environments.
7 Discussion
Conclusions
In this paper we have introduced an invariant/equivariant functional form termed spatial attention that uses neurally parametrized linear combinations of edge vectors to equivariantly yet universally characterize node environments at a fraction of the cost of state-of-the-art equivariant approaches that makes use of spherical harmonics. Equipped with this spatial attention module, we use it to build a spatial attention kinetic network (SAKE) architecture which is permutationally, translationally, rotationally, and reflectionally equivariant. We have demonstrated the utility of this model in -body physical modeling tasks ranging from potential energy prediction to dynamical system forecasting.
Limitations
Theoretical: The universality condition is only discussed w.r.t. node geometry, without considering node embeddings; moreoever, the inequality condition in Theorem 1, although rarely violated in physical modeling (even when system is highly symmetrical), can be potentially over-restricting. We plan to generalize this framework to consider the expressive power of functions on the joint space of node embedding and geometry in future works. Experimental: Herein, apart from the novel functional form spatial attention (Equation 6), the rest of the architecture has not been thoroughly optimized and analyzed in the context of the growing design space of equivariant neural networks.
Future directions
We plan to conduct more thorough experiments on (bio)molecular systems to explore the potential of SAKE in building general protein/small molecule force fields and enhanced sampling methods that could facilitate large-scale simulations useful in therapeutics and material discovery.
Social impact and ethics statement
This work provide an accurate and extremely efficient way to approximate properties and dynamics of molecular systems and physical states. It may advances research in a wide range of disciplines, including physics, chemistry, biochemistry, biophysics, and drug and material discovery. As with all molecular machine learning methods, negative implications may be possible if used in the design of explosives, toxins, chemical weapons, and overly addictive recreational narcotics.
Reproducibility statement
The software package containing the algorithm proposed here is distributed open source under MIT license. All necessary code, data, and details to reproduce the experiments can be found in Appendix Section 9.
Funding
Research reported in this publication was supported by the National Institute for General Medical Sciences of the National Institutes of Health under award numbers R01GM132386 and R01GM140090. YW acknowledges funding from NIH grant R01GM132386 and the Sloan Kettering Institute. JDC acknowledges funding from NIH grants R01GM132386 and R01GM140090.
Disclaimer
The content is solely the responsibility of the authors and does not necessarily represent the official views of the National Institutes of Health.
Disclosures
JDC is a current member of the Scientific Advisory Board of OpenEye Scientific Software, Redesign Science, Ventus Therapeutics, and Interline Therapeutics, and has equity interests in Redesign Science and Interline Therapeutics. The Chodera laboratory receives or has received funding from multiple sources, including the National Institutes of Health, the National Science Foundation, the Parker Institute for Cancer Immunotherapy, Relay Therapeutics, Entasis Therapeutics, Silicon Therapeutics, EMD Serono (Merck KGaA), AstraZeneca, Vir Biotechnology, Bayer, XtalPi, Interline Therapeutics, the Molecular Sciences Software Institute, the Starr Cancer Consortium, the Open Force Field Consortium, Cycle for Survival, a Louis V. Gerstner Young Investigator Award, and the Sloan Kettering Institute. A complete funding history for the Chodera lab can be found at http://choderalab.org/funding.
Acknowledgments
The authors would like to thank the ICLR reviewers for providing constructive feedback that substantially improved the quality and clarity of this manuscript. YW thanks Theofanis Karaletsos, Insitro, and Andrew D. White, University of Rochester, for useful discussions and Leo Klein, Freie Universität Berlin, for catching an embarrassing bug.
References
- Kipf and Welling [2016] Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. CoRR, abs/1609.02907, 2016. URL http://arxiv.org/abs/1609.02907.
- Xu et al. [2018] Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? arXiv preprint arXiv:1810.00826, 2018.
- Gilmer et al. [2017] Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. arXiv preprint arXiv:1704.01212, 2017.
- Hamilton et al. [2017] Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Advances in neural information processing systems, pages 1024–1034, 2017.
- Battaglia et al. [2018] Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, 2018.
- Satorras et al. [2021] Victor Garcia Satorras, Emiel Hoogeboom, and Max Welling. E(n) equivariant graph neural networks. CoRR, abs/2102.09844, 2021. URL https://arxiv.org/abs/2102.09844.
- Schütt et al. [2017] Kristof T. Schütt, Pieter-Jan Kindermans, Huziel E. Sauceda, Stefan Chmiela, Alexandre Tkatchenko, and Klaus-Robert Müller. Schnet: A continuous-filter convolutional neural network for modeling quantum interactions, 2017.
- Thomas et al. [2018] Nathaniel Thomas, Tess Smidt, Steven M. Kearnes, Lusann Yang, Li Li, Kai Kohlhoff, and Patrick Riley. Tensor field networks: Rotation- and translation-equivariant neural networks for 3d point clouds. CoRR, abs/1802.08219, 2018. URL http://arxiv.org/abs/1802.08219.
- Klicpera et al. [2021a] Johannes Klicpera, Florian Becker, and Stephan Günnemann. Gemnet: Universal directional graph neural networks for molecules. In Conference on Neural Information Processing Systems (NeurIPS), 2021a.
- Fuchs et al. [2020] Fabian B. Fuchs, Daniel E. Worrall, Volker Fischer, and Max Welling. Se(3)-transformers: 3d roto-translation equivariant attention networks. In Advances in Neural Information Processing Systems 34 (NeurIPS), 2020.
- Batzner et al. [2021] Simon Batzner, Albert Musaelian, Lixin Sun, Mario Geiger, Jonathan P. Mailoa, Mordechai Kornbluth, Nicola Molinari, Tess E. Smidt, and Boris Kozinsky. E(3)-equivariant graph neural networks for data-efficient and accurate interatomic potentials, 2021.
- Anderson et al. [2019] Brandon Anderson, Truong-Son Hy, and Risi Kondor. Cormorant: Covariant molecular neural networks, 2019.
- Wu et al. [2019] Zonghan Wu, Shirui Pan, Fengwen Chen, Guodong Long, Chengqi Zhang, and Philip S. Yu. A comprehensive survey on graph neural networks. CoRR, abs/1901.00596, 2019. URL http://arxiv.org/abs/1901.00596.
- Han et al. [2022] Jiaqi Han, Yu Rong, Tingyang Xu, and Wenbing Huang. Geometrically equivariant graph neural networks: A survey, 2022. URL https://arxiv.org/abs/2202.07230.
- Smith et al. [2017] J. S. Smith, O. Isayev, and A. E. Roitberg. Ani-1: an extensible neural network potential with dft accuracy at force field computational cost. Chemical Science, 8(4):3192–3203, 2017. ISSN 2041-6539. doi: 10.1039/c6sc05720a. URL http://dx.doi.org/10.1039/C6SC05720A.
- Behler [2011] Jörg Behler. Atom-centered symmetry functions for constructing high-dimensional neural network potentials. The Journal of Chemical Physics, 134(7):074106, 2011. doi: 10.1063/1.3553717. URL https://doi.org/10.1063/1.3553717.
- Klicpera et al. [2020a] Johannes Klicpera, Shankari Giri, Johannes T. Margraf, and Stephan Günnemann. Fast and uncertainty-aware directional message passing for non-equilibrium molecules. CoRR, abs/2011.14115, 2020a. URL https://arxiv.org/abs/2011.14115.
- Liu et al. [2022] Yi Liu, Limei Wang, Meng Liu, Yuchao Lin, Xuan Zhang, Bora Oztekin, and Shuiwang Ji. Spherical message passing for 3d molecular graphs. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=givsRXsOt9r.
- Klicpera et al. [2021b] Johannes Klicpera, Chandan Yeshwanth, and Stephan Günnemann. Directional message passing on molecular graphs via synthetic coordinates. CoRR, abs/2111.04718, 2021b. URL https://arxiv.org/abs/2111.04718.
- Brandstetter et al. [2021] Johannes Brandstetter, Rob Hesselink, Elise van der Pol, Erik Bekkers, and Max Welling. Geometric and physical quantities improve E(3) equivariant message passing. CoRR, abs/2110.02905, 2021. URL https://arxiv.org/abs/2110.02905.
- Villar et al. [2021] Soledad Villar, David W. Hogg, Kate Storey-Fisher, Weichi Yao, and Ben Blum-Smith. Scalars are universal: Equivariant machine learning, structured like classical physics, 2021. URL https://arxiv.org/abs/2106.06610.
- Schütt et al. [2021] Kristof T. Schütt, Oliver T. Unke, and Michael Gastegger. Equivariant message passing for the prediction of tensorial properties and molecular spectra, 2021.
- Thölke and Fabritiis [2022] Philipp Thölke and Gianni De Fabritiis. Torchmd-net: Equivariant transformers for neural network based molecular potentials. CoRR, abs/2202.02541, 2022. URL https://arxiv.org/abs/2202.02541.
- Huang et al. [2022] Wenbing Huang, Jiaqi Han, Yu Rong, Tingyang Xu, Fuchun Sun, and Junzhou Huang. Equivariant graph mechanics networks with constraints. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=SHbhHHfePhP.
- Jing et al. [2021] Bowen Jing, Stephan Eismann, Patricia Suriana, Raphael J. L. Townshend, and Ron Dror. Learning from protein structure with geometric vector perceptrons, 2021.
- Corso et al. [2020] Gabriele Corso, Luca Cavalleri, Dominique Beaini, Pietro Liò, and Petar Velickovic. Principal neighbourhood aggregation for graph nets. CoRR, abs/2004.05718, 2020. URL https://arxiv.org/abs/2004.05718.
- Dwivedi et al. [2020] Vijay Prakash Dwivedi, Chaitanya K. Joshi, Thomas Laurent, Yoshua Bengio, and Xavier Bresson. Benchmarking graph neural networks. CoRR, abs/2003.00982, 2020. URL https://arxiv.org/abs/2003.00982.
- Unke and Meuwly [2019] Oliver T. Unke and Markus Meuwly. PhysNet: A neural network for predicting energies, forces, dipole moments, and partial charges. Journal of Chemical Theory and Computation, 15(6):3678–3693, may 2019. doi: 10.1021/acs.jctc.9b00181. URL https://doi.org/10.1021%2Facs.jctc.9b00181.
- Veličković et al. [2018] Petar Veličković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Liò, and Yoshua Bengio. Graph attention networks, 2018.
- Barron [2017] Jonathan T. Barron. Continuously differentiable exponential linear units, 2017. URL https://arxiv.org/abs/1704.07483.
- Kovács et al. [2021] Dávid Péter Kovács, Cas van der Oord, Jiri Kucera, Alice EA Allen, Daniel J Cole, Christoph Ortner, and Gábor Csányi. Linear atomic cluster expansion force fields for organic molecules: beyond rmse. Journal of chemical theory and computation, 17(12):7696–7711, 2021.
- Klicpera et al. [2020b] Johannes Klicpera, Janek Groß, and Stephan Günnemann. Directional message passing for molecular graphs. CoRR, abs/2003.03123, 2020b. URL https://arxiv.org/abs/2003.03123.
- Chmiela et al. [2019] Stefan Chmiela, Huziel E. Sauceda, Igor Poltavsky, Klaus-Robert Müller, and Alexandre Tkatchenko. sGDML: Constructing accurate and data efficient molecular force fields using machine learning. Computer Physics Communications, 240:38–45, jul 2019. doi: 10.1016/j.cpc.2019.02.007. URL https://doi.org/10.1016%2Fj.cpc.2019.02.007.
- Chmiela et al. [2017] Stefan Chmiela, Alexandre Tkatchenko, Huziel E. Sauceda, Igor Poltavsky, Kristof T. Schütt, and Klaus-Robert Müller. Machine learning of accurate energy-conserving molecular force fields. Science Advances, 3(5), May 2017. ISSN 2375-2548. doi: 10.1126/sciadv.1603015. URL http://dx.doi.org/10.1126/sciadv.1603015.
- Ramakrishnan et al. [2014] Raghunathan Ramakrishnan, Pavlo O Dral, Matthias Rupp, and O Anatole Von Lilienfeld. Quantum chemistry structures and properties of 134 kilo molecules. Scientific data, 1(1):1–7, 2014.
- Pronobis et al. [2018] Wiktor Pronobis, Kristof T Schütt, Alexandre Tkatchenko, and Klaus-Robert Müller. Capturing intensive and extensive dft/tddft molecular properties with machine learning. The European Physical Journal B, 91(8):1–6, 2018.
- Kipf et al. [2018] Thomas Kipf, Ethan Fetaya, Kuan-Chieh Wang, Max Welling, and Richard Zemel. Neural relational inference for interacting systems, 2018. URL https://arxiv.org/abs/1802.04687.
- Satorras et al. [2022] Victor Garcia Satorras, Emiel Hoogeboom, Fabian B. Fuchs, Ingmar Posner, and Max Welling. E(n) equivariant normalizing flows, 2022.
- CMU [2003] CMU. Cmu motion capture database. http://mocap.cs.cmu.edu, 2003.
- Havel [1998] Timothy F Havel. Distance geometry: Theory, algorithms, and chemical applications. Encyclopedia of Computational Chemistry, 120:723–742, 1998.
- Hornik et al. [1989] Kurt Hornik, Maxwell Stinchcombe, and Halbert White. Multilayer feedforward networks are universal approximators. Neural Networks, 2(5):359–366, 1989. ISSN 0893-6080. doi: https://doi.org/10.1016/0893-6080(89)90020-8. URL https://www.sciencedirect.com/science/article/pii/0893608089900208.
- Bolaño [2004] Roberto Bolaño. 2666. Anagrama, Barcelona, 2004.
- Rezende and Mohamed [2016] Danilo Jimenez Rezende and Shakir Mohamed. Variational inference with normalizing flows, 2016.
- Papamakarios et al. [2021] George Papamakarios, Eric Nalisnick, Danilo Jimenez Rezende, Shakir Mohamed, and Balaji Lakshminarayanan. Normalizing flows for probabilistic modeling and inference, 2021.
- Köhler et al. [2020] Jonas Köhler, Leon Klein, and Frank Noé. Equivariant flows: Exact likelihood generative learning for symmetric densities, 2020.
- Rezende et al. [2019] Danilo Jimenez Rezende, Sébastien Racanière, Irina Higgins, and Peter Toth. Equivariant hamiltonian flows, 2019. URL https://arxiv.org/abs/1909.13739.
- Chen et al. [2018] Changyou Chen, Chunyuan Li, Liqun Chen, Wenlin Wang, Yunchen Pu, and Lawrence Carin. Continuous-time flows for efficient inference and density estimation, 2018.
- Chen et al. [2019] Ricky T. Q. Chen, Yulia Rubanova, Jesse Bettencourt, and David Duvenaud. Neural ordinary differential equations, 2019.
- Huang et al. [2020] Chin-Wei Huang, Laurent Dinh, and Aaron Courville. Augmented normalizing flows: Bridging the gap between generative flows and latent variable models, 2020.
- Dinh et al. [2017] Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using real nvp, 2017.
8 Proofs
8.1 Proof for Theorem 1
Proof.
(Informal) An appropriate set of choices to satisfy the requirement is:
, and takes the set of elements:
(14) |
where is the Iverson bracket. The first -set of one-indexed functions give the node-to-neighbor distances whereas the second -set of two-indexed functions give the distances among neighbors. This recovers the distance matrix among the node and its neighbors and . As such, the relative positions of the node and its neighbors are uniquely defined up to E(n) symmetry [Havel, 1998]. In other words, and can be uniquely embedded on an arbitrary coördinate system on which is evaluated. Since is neural, by the universal approximation theorem [Hornik et al., 1989], can still be recovered, at least through recovering the set of discussed above. Considering again the universal approximation of , any function of the geometric node environment can be approximated by . ∎
9 Detailed Methods
9.1 Code Availability
The corresponding software package and all scripts used to conduct the experiments in this paper are distributed open source under MIT license at: https://github.com/choderalab/sake
9.2 Hardware Configuration
All models are trained on NVIDIA Tesla V100 GPUs. Following the settings reported in the publications of baseline models, the inference time benchmark experiments (Section 6.2, 6.1) are done on NVIDIA GeForce GTX 1080 Ti GPU (For Table 1 and Table 6) and NVIDIA GeForce GTX 2080 Ti GPU (For Table 4).
9.3 Architecture and Optimization Details
One-layer feed-forward neural networks are used as in Equation 2 (edge update); two-layer feed-forward neural networks are used as in Equation 2 (edge update), in Equation 4 (node update), in Equation 12 (velocity update), and in Equation 6 (spatial attention). SiLU is used everywhere as activation, except in Equation 12 (velocity update) where the last activation function is chosen as to constraint the velocity scaling to between 0 and 2 and in Equation 10 where CeLU is used before attention; additionally, is applied on the additive part of Equation 12 to constraint it to between -1 and 1. 4 attention heads are used with in Equation 10 spaced evenly between 0 and 5 Å. 50 RBF basis are used, spacedly evenly between 0 and 5 Å. All models are optimized with Adam optimizer. We summarize the hyperparameters used in these experiments in Table 8. All random seeds are fixed as 2666, as an homage to Bolaño [2004].
Experiment | Depth | Width | Learning Rate | Epochs | Batch Size | L2 Regularization | Cutoff |
---|---|---|---|---|---|---|---|
MD17 (Table 1) Aspirin | 8 | 32 | 5000 | 4 | 5.0 | ||
MD17 (Table 1) Ethonal | 8 | 32 | 5000 | 4 | 10.0 | ||
MD17 (Table 1) Malonaldehyde | 8 | 64 | 5000 | 4 | 10.0 | ||
MD17 (Table 1) Naphthalene | 4 | 64 | 5000 | 4 | 5.0 | ||
MD17 (Table 1) Salicylic Acid | 6 | 64 | 5000 | 4 | 5.0 | ||
MD17 (Table 1) Toluene | 8 | 32 | 5000 | 4 | 5.0 | ||
MD17 (Table 1) Uracil | 8 | 64 | 5000 | 4 | 5.0 | ||
MD17 Trajectory Forcast (Table 5) | 2 | 8 | 1000 | 4 | |||
ISO17 (Table 2) | 6 | 64 | 100 | 128 | |||
QM9 (Table 3) | 6 | 32 | 5000 | 32 | |||
N-Body Forecast (Table 4) | 4 | 32 | 1000 | 100 |
9.4 Data Availability
The source and details of benchmark datasets are summarized in Table.
Experiment | License | Size | Split |
---|---|---|---|
MD17 http://quantum-machine.org/gdml/#datasets (Table 1) | 8 Systems; 100K-1M snapshots | Random: 1K Train | |
ISO17 http://quantum-machine.org/datasets/(Table 2) | 129 Molecules; 5000 snapshots | Fixed | |
QM9 http://quantum-machine.org/datasets/ | 135k molecules | Fixed | |
N-Body Forecast 222https://github.com/vgsatorras/egnn/(Table 4) | MIT | 5 particles | Fixed: 3K Train; 2K Valid; 2K Test |
10 Abaltion study on EGNN
11 Brief introduction of equivariant normalizing flows
Normalizing flows [Rezende and Mohamed, 2016, Papamakarios et al., 2021] are a family of learnable bijections that transform a tractable distribution on latent space to another on the target space (dropping dependency on parameter thereafter) whose density can be analytically written as
(15) |
and conversely from a sample on the target space to the latent space whose likelihood is given by
(16) |
where . To close the gap between the intractable and the tractable , so that one can sample on the target space efficiently, the flow is then trained by maximizing either Equation 15, if an unnormalized target distribution is given, or Equation 16, if samples are given.
The concept of equivariant normalizing flow was first introduced in Köhler et al. [2020], Rezende et al. [2019], Satorras et al. [2022], where they adopted the framework of continuous normalizing flow [Chen et al., 2018] to define the bijection as
(17) |
and restrict as E(n)-equivariant w.r.t. . Integration, or the sum over infinitely many equivariant functions, does not alter the equivariance. To numerically approximate this integration Chen et al. [2019] involves evaluating multiple times and is therefore expensive.
12 Equivariant exact likelihood sampling with SAKE Flow.
Current equivariant normalizing flow models [Satorras et al., 2022, Köhler et al., 2020] (brielfy reviewed in Appendix Section 11), relies on ODE-based numerical integration[Chen et al., 2019], are computationally expensive. We propose a much simpler invertible flow model that uses our SAKE model, termed SAKE Flow. First, following a scheme introduced in Huang et al. [2020] (in which it is argued that with flexible enough kernels Equation 17 could be approximated arbitrarily well), we extend the space with an auxiliary space . Correspondingly, we extend the tractable distribution to be and the target distribution to be . We then change the problem statement of Equation 16 to: find a parametrized function that is a bijection on the space to maximize the joint likelihood:
(18) |
which is, up to a constant, an evidence lower bound for :
(19) | |||
(20) | |||
(21) |
The equality holds when the (non-negative) Kullback–Leibler divergence between the tractable distribution and the conditional distribution given samples is zero. As such, an unbiased estimate of the marginal likelihood can be given by
(22) |
Similar to Huang et al. [2020], Dinh et al. [2017], we define as a series of alternating affine coupling:
(23) |
with analytic inverse. Composing these transformations , we get our bijection .
Now, it only remains to define the structure of the translation functions and scaling functions . As is outlined in Satorras et al. [2022], if is translation-invariant, it is impossible to have , so we drop the translation invariance requirement and design , as well as the composing , to be only rotation and reflection equivariant. Correspondingly, we require all tractable distributions to be confined on a -dimensional subspace with gravity center. (Note that this reduces the symmetry group we work on from E(n) to SO(n).) A valid choice both for and with is a centered Gaussian distribution [Satorras et al., 2022]:
(24) |
with . Moreover, to keep the gravity center at , we require that shall not change the gravity center. A general recipe to construct such is to use the equivariant and invariant outputs of SAKE to parametrize and respectively.
(25) |
To preserve the center of gravity, we center the translation to have zero center of gravity and enforce the same scalar to be used across particles as the scaling factor.