Transformers Discover Molecular Structure Without Graph Priors
Tobias Kreiman, Yutong Bai, Fadi Atieh, Elizabeth Weaver, Eric Qu, Aditi S. Krishnapriyan
TL;DR
This work questions the necessity of graph priors for molecular modeling by training an unmodified Transformer directly on Cartesian coordinates. On OMol25, a $1\mathrm{B}$-parameter Transformer achieves competitive energy and force MAEs compared to a state-of-the-art equivariant GNN while offering faster training and inference, underscoring the practical benefits of standard Transformer architectures. The study reveals that the Transformer learns physically meaningful patterns, such as inverse-distance attention and adaptive receptive fields, and it exhibits predictable scaling laws akin to other ML domains. Together, these results suggest that graph inductive biases can emerge from data with scalable architectures, motivating broader adoption of graph-free Transformers for molecular modeling and potential extensions to MD and uncertainty quantification.
Abstract
Graph Neural Networks (GNNs) are the dominant architecture for molecular machine learning, particularly for molecular property prediction and machine learning interatomic potentials (MLIPs). GNNs perform message passing on predefined graphs often induced by a fixed radius cutoff or k-nearest neighbor scheme. While this design aligns with the locality present in many molecular tasks, a hard-coded graph can limit expressivity due to the fixed receptive field and slows down inference with sparse graph operations. In this work, we investigate whether pure, unmodified Transformers trained directly on Cartesian coordinates$\unicode{x2013}$without predefined graphs or physical priors$\unicode{x2013}$can approximate molecular energies and forces. As a starting point for our analysis, we demonstrate how to train a Transformer to competitive energy and force mean absolute errors under a matched training compute budget, relative to a state-of-the-art equivariant GNN on the OMol25 dataset. We discover that the Transformer learns physically consistent patterns$\unicode{x2013}$such as attention weights that decay inversely with interatomic distance$\unicode{x2013}$and flexibly adapts them across different molecular environments due to the absence of hard-coded biases. The use of a standard Transformer also unlocks predictable improvements with respect to scaling training resources, consistent with empirical scaling laws observed in other domains. Our results demonstrate that many favorable properties of GNNs can emerge adaptively in Transformers, challenging the necessity of hard-coded graph inductive biases and pointing toward standardized, scalable architectures for molecular modeling.
