Machine-learned interatomic potentials are neural networks that predict the energy of a group of atoms and the forces on each atom. They stand in for expensive quantum-mechanical calculations (density functional theory, or DFT) and make long molecular dynamics (MD) simulations possible. The current practice is to take a large "foundation" potential pre-trained across the periodic table and fine-tune it on a few dozen DFT calculations for a new material. Several of the strongest of these models, including EquiformerV2 and DPA-2, use attention: each atom decides how much weight to give each neighbor. There is direct evidence that this weighting is a source of failure. When bonds stretch, attention weights can switch abruptly, and the result is force spikes and spurious energy wells that make simulations blow up even when test error is low. Nobody has asked what fine-tuning on 30 configurations does to that attention in the regions of geometry the 30 configurations never cover.
We propose to fine-tune so that the model is free to change what it predicts but is discouraged from changing how atoms route information to one another. The fine-tuned model's attention is anchored to the frozen foundation model's attention. The anchor is enforced on geometries chosen adversarially: small, bounded displacements of unlabeled configurations, picked by gradient ascent to make the two models' attention disagree as much as possible. The method borrows its mechanism from the adversarial-attention literature in vision, where attacks redirect a transformer's attention and defenses penalize departures from clean attention maps. It applies that mechanism to a different goal, which is keeping the potential energy surface smooth and simulations stable after few-shot transfer, and it needs no DFT labels beyond the fine-tuning set.
Core Claim
Few-shot fine-tuning of attention-based atomistic foundation models reorganizes attention routing away from the training configurations. This damages the smoothness of the predicted energy landscape in ways that static force error does not detect. A label-free penalty on attention divergence from the foundation model, evaluated at adversarially chosen nearby geometries, should restore smoothness and MD stability at matched accuracy on the target system. We expect it to do better than output distillation from the foundation model, because distillation also pulls the energies back toward the foundation model's known biases, which is exactly what fine-tuning is supposed to correct.
Where This Sits
The motivating evidence comes from two papers. The first, From Evaluation to Design, introduces a one-dimensional rigid bond-scan test (BSCT) with a force smoothness deviation score (FSD). It shows that rapid non-local attention changes as bonds break cause force spikes in transformer potentials. Its fix is architectural: temperature-controlled attention and differentiable neighbor lists, applied to models trained from scratch. It leaves multidimensional distortions unprobed and does not use adversarial search. The second, MatterTune, shows that fine-tuning on about 30 samples can reproduce water radial distribution functions obtained with 900. It also shows that minimizing force error alone can yield models that fail in dynamics. That failure was attributed to non-conservative forces, not to attention, so our premise that attention drift is a separate failure mode has to be tested before anything else.
Two further papers constrain the design. Systematic softening finds that universal potentials underpredict curvature: more than 90% of 229 materials show phonon frequencies below DFT. Fine-tuning is therefore meant to change the foundation model's outputs in high-energy regions, and any regularizer that pins outputs to the foundation model works against that goal. This is why we anchor attention rather than energies. EquiformerV2 adds attention re-normalization to stabilize training at high angular resolution, but it evaluates stability only on training dynamics, not under geometric perturbation. DPA-2 routes atomic information through attention layers (its Repformer) and reports 10x to 100x reductions in downstream labels, without examining what fine-tuning does to that attention.
The method itself comes from vision. Attacking Attention of Foundation Models shows that a label-free loss minimizing agreement between clean and perturbed attention maps disrupts every downstream task of CLIP and DINOv2. We reuse that attention-divergence objective as the inner search. Text-Guided Attention (TGA-ZSR) anchors adversarial attention maps to a frozen pre-trained CLIP during fine-tuning and raises zero-shot robust accuracy from 4.90% to 42.09%. Attention, Please! likewise penalizes clean-versus-adversarial attention divergence. Our proposal differs from both in three ways. The perturbations are physical atomic displacements, not pixel noise. The anchor is the foundation model's attention at the same perturbed geometry, not a clean input's attention. The target property is energy-surface smoothness, not classification robustness. Patch-Fool provides a cautionary result: plain adversarial data augmentation did not remove vision transformers' attention vulnerability. That is a reason to regularize attention directly rather than only augment inputs.
Research Program
Let $A_\theta(x)$ denote the per-atom attention distributions over neighbors, at every layer and head, of the fine-tuned model with parameters $\theta$ at geometry $x$. Let $A_0(x)$ be the same quantity for the frozen foundation model. In EquiformerV2 and DPA-2 these weights are rotation-invariant scalars, so comparing them does not break equivariance. Fine-tuning minimizes
$$\mathcal{L}(\theta) = \mathcal{L}_{EF}(\theta) + \lambda \, \mathbb{E}_{x \in U} \max_{\|\delta\| \le \epsilon} D\big(A_\theta(x+\delta),\, A_0(x+\delta)\big).$$
Here $\mathcal{L}_{EF}$ is the usual energy-and-force regression loss on the small labeled set. $U$ is a pool of unlabeled target configurations, taken from the labeled set plus short MD runs of the foundation model on the target system, which are cheap because they need no DFT. $\delta$ is a displacement of all atomic coordinates bounded in root-mean-square norm by $\epsilon$ (swept from 0.05 to 0.3 Å). $D$ is the average per-atom Kullback–Leibler divergence between attention distributions. $\lambda$ sets the strength of the anchor. The inner maximization is a few steps of projected gradient ascent on coordinates. It is warm-started from random displacements and restricted to exclude near-collisions below a minimum interatomic distance, so that the search does not simply rediscover the short-range repulsive regime.
The program has three stages. The first is diagnostic. We fine-tune EquiformerV2 and DPA-2 on few-shot target sets and measure attention drift and smoothness away from the training points. The same adversarial search, run without training, serves as a multidimensional probe that extends the one-dimensional bond scan. Its purpose is to find distortions where the fine-tuned model's attention and forces change abruptly. We check whether adversarial attention divergence localizes the force spikes that FSD and MD later reveal. The second stage is the regularized fine-tuning above. The third stage separates the ingredients. We ask whether the adversarial choice of $\delta$ matters, whether anchoring attention differs from anchoring outputs, and whether the effect disappears in MACE, whose message passing has no attention. MACE therefore serves as a control.
Baselines
The naive reference point is standard fine-tuning with the MatterTune recipe on the same labeled set and the same unlabeled pool, with the pool left unused. For water, MatterTune reports that 30 samples give radial distribution functions "nearly identical" to those from 900. This is the strongest reported few-shot result in the file, but it is qualitative. For FSD or MD failure rates of fine-tuned foundation models, no reported result was found on Lacuna, so we will measure these ourselves. Our method beats the naive baseline if it lowers FSD and the MD failure rate while keeping force error within 5% of the naive value.
The strongest competitor is output distillation. It adds a term matching the fine-tuned model's energies and forces to the frozen foundation model's predictions on the same unlabeled pool, including the same adversarially perturbed geometries. We consider it the strongest because it uses identical unlabeled data and directly preserves the foundation model's smoothness. It receives the same inner-search budget and a $\lambda$ sweep of the same size, and we select its setting on the same held-out validation split. Our method beats it if, at matched stability, it achieves lower error on the target system. The clearest place to see this is phonons in the softening suite, where distillation should drag frequencies back toward the softened foundation values.
We also run three other baselines. Weight-space anchoring penalizes squared distance from the pre-trained weights, a standard transfer-learning regularizer that is the natural parameter-level analogue of our proposal. Freezing, in which attention layers are frozen and only the remaining layers and output heads are trained, is the cheapest way to preserve routing. A retrofit of temperature-controlled attention, the fix from From Evaluation to Design, is applied at fine-tuning time. All use equal GPU-hours and tuning budgets. Two ablations isolate our key ingredient. The first replaces the adversarial $\delta$ with random displacements of the same norm. The second removes perturbation entirely, anchoring attention only on the unlabeled pool as given. As a further reference, the scalar force multiplier from Systematic softening, which reduced force MAE from 0.190 to 0.166 eV/Å on an iodide structure, is included as the zero-training correction for softening.
Why not just…?
Why not just distill the foundation model's forces on perturbed geometries? This is the most serious threat. If the foundation model is already smooth there, distillation copies that smoothness directly. Its problem is that it also copies the foundation model's energies. The softening study shows those energies are systematically too flat in exactly the high-energy regions that perturbations visit, so distillation should trade correction for stability. The head-to-head on softening-suite phonons and target force error at matched FSD will settle this. If distillation matches us on both, the attention-specific claim fails, and we will say so.
Why not just freeze the attention layers or penalize weight drift? Freezing preserves routing but also blocks legitimate adaptation to new chemistry. Weight-space penalties treat all parameters alike and do not target the geometries where routing matters. Both are cheap and are run as baselines under the same budget. If freezing matches our method, the conclusion becomes the simpler and still useful finding that attention should not be fine-tuned at all.
Why not just attack force smoothness directly instead of attention? A search that maximizes the change in forces along a direction needs no labels and does not depend on attention. We include it as a variant of the inner search, using the same outer anchor and alternatively a smoothness penalty on forces. The attention objective has two possible advantages: it points to the neighbor pair responsible for a spike, and a divergence between probability distributions may be easier to optimize than third derivatives of energy. Whether those advantages matter is an empirical question that this comparison answers.
Why not just buy more DFT labels through active learning? Uncertainty-driven active learning, as in Uncertainty-driven dynamics, addresses coverage. However, the regime DPA-2 and MatterTune target has budgets of 30 to 100 labels. Our method adds no labels, so it is complementary. We will report whether our method with 30 labels reaches the stability of naive fine-tuning with 100.
Proposed Experiments
The target systems are the ambient-water few-shot set used by MatterTune and DPA-2, a subset of DPA-2's downstream datasets, and 3BPA, with training at 300 K and testing at 600 K, 1200 K, and on dihedral slices. Smoothness is measured with FSD on BSCT-SPICE, which has 485 molecules with DFT bond scans, after fine-tuning on SPICE subsets. Dynamics are measured by the fraction of MD22 and water NVE runs that stay stable and by energy drift. Correctness of the softening fix is measured on phonons and defect energetics from the 229-material softening suite, where the MPtrj-trained foundation models are fine-tuned on about 10 high-energy structures per material.
The first decisive check tests the premise. Naive few-shot fine-tuning of EquiformerV2 and DPA-2 must raise FSD or the MD failure rate relative to the foundation model and relative to a 900-sample model, and adversarial attention divergence must rank the configurations where force spikes appear. If attention models and MACE degrade equally, attention drift is not the mechanism, and the proposal reduces to a regularization study. The second check is the distillation comparison on phonons at matched FSD. The third is the random-versus-adversarial ablation. Adversarial perturbation must beat random perturbation at equal compute, or the attack component is not doing any work.
References
- From Evaluation to Design: Using Potential Energy Surface Smoothness Metrics to Guide ML Interatomic Potential Architectures
- MatterTune: an integrated, user-friendly platform for fine-tuning atomistic foundation models to accelerate materials simulation and discovery
- Systematic softening in universal machine learning interatomic potentials
- EquiformerV2: Improved Equivariant Transformer for Scaling to Higher-Degree Representations
- DPA-2: a large atomic model as a multi-task learner
- Attacking Attention of Foundation Models Disrupts Downstream Tasks
- Text-Guided Attention is All You Need for Zero-Shot Robustness in Vision-Language Models
- Attention, Please! Adversarial Defense via Activation Rectification and Preservation
- Patch-Fool: Are Vision Transformers Always Robust Against Adversarial Perturbations?
- Uncertainty-driven dynamics for active learning of interatomic potentials