HamFormer: A Hamiltonian Flow-based SE(3)-Transformer for Conformation Optimization
Organizations: Gaoling School of Artificial Intelligence, Renmin University of China · Laboratory for Human-Oriented Mobility Eco-system, École Polytechnique Fédérale de Lausanne · Beijing Key Laboratory of Research on Large Models and Intelligent Governance · Engineering Research Center of Next-Generation Intelligent Search and Recommendation, MOE
Abstract
The Transformer architecture plays a central role in modern deep learning, and its SE(3)-equivariant variants have been widely applied to molecular conformation modeling and optimization. Given its importance, many methods attempt to interpret and improve the Transformer through the lens of dynamics. However, they mainly focus on a single attention head rather than the full Transformer architecture and seldom consider SE(3)-equivariance in their proposed models. In this study, we propose an improved SE(3)-Transformer architecture, called HamFormer, which revisits the design of SE(3)-Transformer through the lens of Hamiltonian flow. In particular, we define a parametrized Hamiltonian flow in the phase space of position and velocity, corresponding to optimizing an energy functional that combines an optimal transport-based potential with a damped momentum. The Lie-Trotter splitting framework of the Hamiltonian flow leads to the proposed HamFormer architecture, whose feedforward computation achieves the optimization step of the proposed energy functional. Furthermore, we combine HamFormer with Equivariant Graph Neural Network (EGNN), build a new model for molecular conformation optimization. Extensive experiments on molecular ground-state conformation prediction show that HamFormer provides a strong and physically interpretable surrogate for classic SE(3)-Transformer and generally outperforms state-of-the-art competitors.
Figures & tables
| Component | Form | Physics | State | Molecular Role |
| OT Attention | Force | Atom Interactions | ||
| Kinetic Map | Velocity | Feature Motion | ||
| Retention | Signed Carry | Refinement Memory | ||
| Relations | Coupling | Pair Information | ||
| EGNN | Direction | Coordinate Refinement |
| Model | Reference dynamics | Interaction | Momentum parametrization | Pair memory | SE(3) |
| Sinkformers ( 2022 ) | Wasserstein PDE: | OT | – | ||
| WGFormer ( 2025 ) | Wasserstein PDE: | OT | – | ||
| YuriiFormer ( 2026 ) | Nesterov: | Softmax | Learned coefficients | ||
| SympFormer ( 2026 ) | Hamiltonian PDE: | Softmax | Metric, damping | ||
| HamFormer (ours) | Hamiltonian PDE: | OT | Kinetic map, signed retention |
| Dataset | Model | Validation | Test | ||||
| D-MAE | D-RMSE | C-RMSD | D-MAE | D-RMSE | C-RMSD | ||
| Molecule3D (Random) | GINE(2D) | 0.590 | 1.014 | 1.116 | 0.592 | 1.018 | 1.116 |
| GATv2(2D) | 0.563 | 0.983 | 1.082 | 0.564 | 0.986 | 1.083 | |
| GPS(2D) | 0.528 | 0.909 | 1.036 | 0.529 | 0.911 | 1.038 | |
| GTMGC(2D) | 0.432 | 0.719 | 0.712 | 0.433 | 0.721 | 0.713 | |
| SE(3)-Transformer | 0.466 | 0.712 | 0.800 | 0.467 | 0.774 | 0.802 | |
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
| Setting | QM9 | Molecule3D random |
| Peak learning rate | ||
| Scheduled epochs | 500 | 40 |
| Warmup fraction | 0.06 | 0.05 |
| Evaluated checkpoint epoch | 294 | 40 |
| Training GPUs | 8 | 2 |
| Batch size per GPU | 32 | 64 |
| Feature | QM9 | Molecule3D random | ||||||
| Variant | block | branch | D-MAE | D-RMSE | C-RMSD | D-MAE | D-RMSE | C-RMSD |
| Full model | HamFormer | 0.218 | 0.419 | 0.198 | 0.387 | 0.656 | 0.654 | |
| EGNN-only | 0.233 | 0.427 | 0.239 | 0.399 | 0.666 | 0.697 | ||
| Validation | Test | |||||
| Inference setting | D-MAE | D-RMSE | C-RMSD | D-MAE | D-RMSE | C-RMSD |
| Learned | 0.386 | 0.653 | 0.652 | 0.387 | 0.656 | 0.654 |
| 0.418 | 0.684 | 0.712 | 0.420 | 0.716 | 0.714 | |
Transformer
Transformers are neural architectures that use attention to model relationships among sequence elements in language, vision, and scientific data.
See all 551 papers