Introduction
For years, the standard approach to molecular machine learning has relied on Graph Neural Networks (GNNs). These models use hard-coded "inductive biases"—such as predefined atom connectivity and distance cutoffs—to reflect the physical structure of molecules. However, these constraints can limit a model's receptive field and computational efficiency. This paper demonstrates that pure, unmodified Transformers can learn the underlying physics of molecules directly from raw Cartesian coordinates, matching or exceeding the performance of specialized GNNs without any prior knowledge of molecular graphs.
Methods: Tokenizing the Molecule
The researchers utilized a standard LLaMA2 architecture as the backbone for their "graph-free" model. To adapt the Transformer for chemistry, they implemented two key changes: removing traditional positional embeddings (since 3D coordinates provide inherent spatial information) and employing a hybrid input format. This format uses discretized tokens for categorical data and continuous embeddings to handle the wide range of energy and force values.
The training process consists of two distinct phases:
- Pre-training: The model performs autoregressive next-token prediction on molecular sequences, similar to how large language models (LLMs) are trained.
- Fine-tuning: The model is switched to a bidirectional mode, allowing every atom to attend to every other atom, to directly regress continuous energy and force values.
Key Insights: Emergent Physics and Scaling
A significant discovery of this work is that Transformers naturally "discover" physical laws. Even without being told which atoms are bonded, the model's attention weights in early layers decay inversely with interatomic distance. This indicates that the model autonomously learns that nearby atoms are generally more important for determining local structure.
Furthermore, molecular Transformers exhibit the same predictable scaling laws as LLMs. The authors found that doubling parameters and data leads to a predictable drop in error, following a power-law trend. This scaling is often less consistent in GNNs, giving Transformers a long-term advantage as compute and data availability grow.
Key Results
On the massive OMol25 dataset, a 1B parameter Transformer achieved superior accuracy compared to eSEN, a state-of-the-art equivariant GNN. The Transformer reached an Energy Mean Absolute Error (MAE) of 117.99 meV, outperforming the GNN's 129.77 meV.
Beyond accuracy, the Transformer architecture proved more efficient on modern hardware. It recorded a forward latency of 17.2ms, compared to 26.3ms for the GNN. This speed advantage stems from the highly optimized nature of Transformer kernels on GPUs, which handle dense computations more effectively than the sparse operations required by graphs.
Limitations and Future Outlook
While powerful, these models are "data-hungry," requiring more training data than GNNs to learn the physical rules that GNNs receive as hard-coded priors. Additionally, because they are unconstrained, they do not perfectly obey rotational equivariance by default, though they learn to approximate it with high precision (>0.99 cosine similarity). Future research may explore "teaching" physical laws during training or using these large models as foundations to be distilled into smaller, specialized architectures.
Summary updated