wikillm

Paper · 2026-03-06 · cs.LG, cond-mat.mtrl-sci, cs.CE, physics.chem-ph, q-bio.QM

A recipe for scalable attention-based MLIPs: unlocking long-range accuracy with all-to-all node attention

AllScAIP is an energy-conserving attention interatomic potential. Each block runs local neighbourhood attention, then all-to-all attention over the atoms of a system, with optional angular (LAE) and radial (ERoPE) encodings. Author-reported: on OMol25 validation the 102M-sample medium model has the lowest overall energy MAE (0.64 meV/atom) and force MAE of 5.24 meV/Å.

Machine-learning interatomic potentialAttention mechanismPositional encodingmachine-learning-interatomic-potentialattentionlong-range-interactionsmolecular-dynamicsomol25

arXivPDFCodeMarkdown14 min read

AI-compiled by claude-haiku-5-5 on 2026-11-08, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

In plain words

A machine-learning interatomic potential is a neural network that predicts how much energy a set of atoms has and which way each atom is pushed. Simulations can then run on that prediction instead of an expensive quantum calculation. Most of these networks only let atoms see their close neighbours. That works for small molecules, but big molecules and salts also have effects that span long distances, and a purely local model misses them.

This work takes a plain attention network and adds one global step. Every atom can look at every other atom in the same system, so distant atoms can influence each other in a single step. The model also has a local step that handles the close neighbours in detail. The authors then test two hand-built physics features. One encodes directions between atoms, the other encodes distances. Those features help small models trained on little data. As the data and the model grow, their benefit fades, while the global step keeps helping. The result is a simple model that scales up well on a large molecule dataset, and its simulated liquids come closer to measured densities and vaporisation enthalpies than the baselines it is compared with.

TL;DR

  • AllScAIP is an attention-based interatomic potential that predicts energy and forces with an energy-conserving option §3.3 §3.4.
  • Each block combines local neighbourhood attention with all-to-all attention over the atoms of one system §3.1.
  • Two optional encodings, LAE (angular) and ERoPE (radial), help small, low-data models but their benefit shrinks with scale §4 §6.
  • Author-reported: lowest overall OMol25 validation energy error for the 102M-sample medium model, competitive force error §5.3 tab. 4.
  • Cost grows from O(Nk) to O(N²) with system size, so the model targets roughly 10³–10⁵ atoms §5.1 fig. 4.

Problem

Local message passing with distance cutoffs cannot carry information across long ranges in one step. Explicit long-range physics terms (electrostatics, dispersion, charge models) handle this but add modelling and engineering burden §1. The paper asks whether an attention model can learn long-range behaviour from data at scale, and which hand-built geometric inductive biases still matter once data and parameters grow §1 §4.

Method

Two attention stages per block §3.1. Local neighbourhood attention runs over a fixed stencil per atom: the atom, a self token and up to k neighbours (shape nodes × (k+1) × d_model). It runs two directional passes, centre to neighbours and neighbours back to the centre, and a smooth distance envelope softly fades far pairs. Global node attention packs all atoms of one system into a single sequence and applies standard multi-head self-attention. The local stage costs O(Nk); the global stage costs O(N²) §3.1 fig. 1.

Geometric encodings, optional §3.2. Both encodings add geometric information to attention logits.

  • LAE (neighbourhood attention only): real spherical harmonics of the unit edge direction are computed for degrees l = 0…L. Each degree block is repeated r_l times, with the constraint that the r_l sum to the per-head dimension d_h. Queries and keys are expanded to the same layout and multiplied element-wise by this vector before the usual scaled dot product §3.2 fig. 3.
  • ERoPE (node attention only): a bank of M log-spaced frequencies gives sinc(ω·r) features of the pairwise distance. Each head mixes them with its own weight vector, and the result is added to the attention logit as a bias that depends only on distance §3.2 fig. 3. The paper calls this Euclidean rotary encoding, but the operation is an additive bias, not a rotation of queries and keys §3.2 node_attention.py.

Block structure §3.3 fig. 2. The model embeds atomic numbers, a radial basis expansion of edge distances and node/edge direction features, plus optional charge and spin embeddings. Each block then runs, in order: neighbourhood attention; RMSNorm with a residual path; an edge feed-forward network; the self token is taken as the atom's node feature; all-to-all node attention with residual, RMSNorm; a node feed-forward network. The node feature is put back into slot 0 and concatenated with the edge features for the next block. Once all blocks have run, the node features go to an energy output. Forces can be predicted by their own head, or taken as the negative gradient of the energy so they stay consistent with it. A stress head based on that gradient is added when needed. required §3.3.

Inductive biases §3.4 tab. 1. Translation invariance, permutation equivariance, extensivity, locality, and energy conservation are enforced. Rotational equivariance and long-range effects are left to be learned. LAE and ERoPE are optional soft priors. Energy conservation follows a differentiable kNN construction from Liu et al. (2026) §3.4.

Pseudocode
# One AllScAIP block  [§3.3]
# [code: models/allscaip/modules/graph_attention_block.py#L77-L107]
# Input: neighbor_reps (N_atoms, 1 + k, d)

def allscaip_block(data, neighbor_reps):
    # 1. Local attention over each atom's stencil, two passes  [§3.1]
    neighbor_reps = neighborhood_attention(data, neighbor_reps)
    # 2. The self token becomes the atom's node feature  [§3.3]
    node_reps = neighbor_reps[:, 0]
    # 3. Feed-forward on the neighbour slots  [§3.3]
    edge_reps = edge_ffn(neighbor_reps[:, 1:])
    # 4. Global attention over all atoms of each system  [§3.1] [§3.3]
    node_reps = node_attention(data, node_reps)
    # 5. Feed-forward on the node features  [§3.3]
    node_reps = node_ffn(node_reps)
    # 6. Put node features back into slot 0 and rejoin the edge features  [§3.3]
    return concatenate([node_reps[:, None], edge_reps], axis=1)
Pseudocode
# Legendre angular encoding (LAE) for one directed edge i -> j  [§3.2]
# [code: src/fairchem/core/models/allscaip/utils/data_preprocess.py#L117-L129]

def lae_vector(unit_direction, rep_counts):
    # Real spherical harmonics Y_l for l = 0..L, each scaled by 1/sqrt(2l+1)
    harmonics = real_spherical_harmonics(unit_direction, L)
    # Repeat degree block l exactly rep_counts[l] times
    blocks = [repeat(harmonics[l], rep_counts[l]) for l in range(L + 1)]
    # Length is sum_l rep_counts[l] * (2l+1) = per-head size after expansion
    return concatenate(blocks)                      # (d_lae,)

# Per head: expand query and key the same way, then modulate  [§3.2]
# [code: models/allscaip/modules/neighborhood_attention.py#L192-L277]

def lae_modulate(query, key, gamma):
    # Repeat each query/key dimension 2l+1 times within its degree block
    query_expanded = expand_by_degree(query, rep_counts)
    key_expanded = expand_by_degree(key, rep_counts)
    # Element-wise modulation with the edge code gamma
    return query_expanded * gamma, key_expanded * gamma
Pseudocode
# Distance bias for node attention (ERoPE)  [§3.2]
# [code: models/allscaip/modules/node_attention.py#L91-L137]
# [code: models/allscaip/utils/data_preprocess.py#L207-L271]

def radial_bias(distances, valid_pairs, radial_weight):
    # M log-spaced frequencies omega_k (code bounds: pi/(4*30) to pi/0.25)
    omegas = log_spaced(pi / (4 * 30.0), pi / 0.25, num=M)   # (M,)
    # Sinc features of each pair distance  [§3.2]
    features = sinc(distances[..., None] * omegas)           # (N, N, M)
    # Per-head mix, zero for invalid pairs, softplus for positivity
    mixed = softplus(features @ radial_weight.T)              # (N, N, H)
    mixed = where(valid_pairs, mixed, 0) + 1e-6
    # Code rescales so the mean over all valid pairs in the batch is 1
    mixed = mixed * count(valid_pairs) / sum(mixed, over=valid_pairs)
    # Additive attention-logit bias (paper: linear mix; code: log of mix)
    return log(mixed)                                         # (N, N, H)
Pseudocode
# Energy and forces  [§3.3] [§3.4]
# [code: src/fairchem/core/models/allscaip/AllScAIP.py#L371-L389, #L410-L484]

def predict_energy_and_forces(atoms):
    # Per-atom energy from the final node features, masked for padding  [§3.3]
    per_atom_energy = energy_ffn(final_node_features(atoms))
    # Sum the per-atom values within each system (code default: sum)
    energy = scatter_sum(per_atom_energy, by=system_index)
    # Energy-conserving variant: forces are the negative gradient  [§3.4]
    forces = -gradient(energy.sum(), positions)
    return energy, forces

Hyperparameters

Model sizes tab. 10 (paper). The per-head size is hidden_size / heads in every row.

Sizehidden_sizelayersheadsNotes
small51268tab. 10
medium6401010tab. 10
large1024816tab. 10
xlarge20481232tab. 10

Shared settings from tab. 10 (paper): activation GELU; RMSNorm; node direction expansion 10; edge direction expansion 6; edge distance expansion 512; 32 radial frequencies (attn_num_freq); FFN multiplier 2; output multiplier 2; max elements 110; max batch size 96; kNN soft with sigmoid scale 0.2 and LSE scale 0.1; Gaussian distance function; envelope on; dropout 0.0. Attention kernel: memory-efficient md_NeNo.yaml.

SettingValueWhere
Local cutoff (radius graph)6 Åapp. A (paper); omol_4m.yml
Neighbours per atom (kNN k)30 (pad 50)not stated in paper; omol_4m.yml
Max atoms per batch400not stated in paper; omol_all.yml
LAE frequency list r_l[20, 10, 4, 10, 20] for l = 0…4code default configs.py; paper gives only the constraint sum r_l = d_h §3.2
Head size checksum r_l = 64 = d_h (640/10 and 512/8)data_preprocess.py
ERoPE frequency rangeω from π/(4·30) to π/0.25, log-spacedcode data_preprocess.py; paper: M log-spaced, range not stated §3.2
ERoPE radial weight init1/M per headnode_attention.py
Residual scale1/num_layers per branchnode_attention.py

Training settings (OMol25; direct-force, medium):

SettingValueWhere
4M split, direct force80 epochs§5.3 tab. 2 omol_4m.yml
4M split, conservative fine-tune50 epochs direct, then 30 epochs conservative§5.3
102M split, direct force10 epochs§4 §5.3 omol_all.yml
102M split, direct + conservative fine-tune10 + 2 epochs§5.3
102M split, fully conservativetrained from scratch (epochs not stated)§5.3
HardwareV100 32 GB, full fp32§5.3 (paper); H200 142 GB, full fp32 for SPICE app. C
OptimiserAdamW, lr 8e-4, weight decay 1e-3not in paper; omol_all.yml
LR schedulecosine; warmup 0.5 epoch from 0.2×; floor 0.01×not in paper; omol_all.yml
Gradient clipnorm 100not in paper; omol_all.yml
Lossenergy: per-atom MAE, weight 10; forces: per-structure L2 norm, weight 10not in paper; omol_direct.yaml
Target normalisationrmsd 1.433569not in paper; omol_all.yml
PrecisionTF32 enabled in training configomol_all.yml (paper says fp32)

Medium model used in the headline results: the released config disables LAE and ERoPE and keeps neighbourhood and node attention [code: configs/allscaip/backbone/md_NeNo.yaml#L13-L15]. This matches the NeNo row of tab. 2 (see Results).

Results

Author-reported. Setup: OMol25 (Open Molecules 2025), validation split by chemical domain §5.3 tab. 4. Units: energy MAE in meV/atom, force MAE in meV/Å.

Component ablation §4 tab. 2. Medium 85M and small 35M models, OMol25 4M (80 epochs) and 102M (10 epochs). Totals across the four domains, converted from the source macros (×1000 to meV). Throughput is ns/day on one H200 with 1000 atoms, graph generation off tab. 2 caption.

SizeDataComponents onE (meV/atom)F (meV/Å)Thrpt
35M4Mall four1.4669.3572.279
35M4MNeiAtt + NodeAtt1.75610.2137.623
85M4Mall four1.1656.8891.124
85M4Mno LAE1.2247.6043.333
85M4Mno ERoPE1.2937.1021.392
85M4MNeiAtt + NodeAtt1.2587.5484.014
85M4MNeiAtt + LAE1.5637.9381.281
85M4MNeiAtt only1.7268.4894.327
35M102Mall four0.8496.6122.279
35M102MNeiAtt + NodeAtt0.9717.2237.623
85M102Mall four0.6655.0961.124
85M102Mno LAE0.7255.5053.333
85M102Mno ERoPE0.7175.1331.392
85M102MNeiAtt + NodeAtt0.6415.2374.014
85M102MNeiAtt only0.9686.1484.327

Throughput is the same number in both data blocks for the same architecture tab. 2.

Symmetry and conservation checks §5.2 tab. 3. PBC and non-PBC energy additivity errors, force cosine under random rotation, and NVE energy drift on MD22 (meV/atom/ps).

ModelTraining setPBC Δ (meV)non-PBC Δ (meV)Cos. sim.NVE drift
UMA-M-1p1UMA-459M2.41e-23.83e-30.99991.5e-3
AllScAIP-mdrandom init3.62e-22.49e-30.6827-
AllScAIP-mdOMol-102M4.18e-24.73e-30.99994.3e-3

OMol25 validation by domain §5.3 tab. 4 (selected rows, E / F).

SetModelBiomol.ElytesMetal Cplx.Neutral Org.Total
All (102M)AllScAIP-md-d.0.15 / 2.910.52 / 4.701.83 / 22.310.72 / 6.290.64 / 5.24
All (102M)AllScAIP-md-cons.0.22 / 3.230.53 / 5.291.86 / 22.400.59 / 7.550.67 / 5.78
All (102M)eSEN-md-d.0.34 / 2.610.69 / 4.401.73 / 19.990.59 / 5.630.84 / 4.76
All (102M)GemNet-OC0.15 / 3.880.56 / 5.981.83 / 25.120.86 / 10.380.66 / 6.52
4MAllScAIP-md-ft-cons.0.20 / 3.010.75 / 6.792.06 / 29.410.78 / 9.450.90 / 7.67
4MeSEN-md-d.0.47 / 3.381.18 / 6.512.53 / 27.311.21 / 9.261.32 / 6.78

Bold marks the best total energy in each block. The paper states the direct force medium model has the best energy overall and remains competitive in force §5.3. The 4M conservative fine-tune is the best overall energy on that split §5.3.

OMol25 evaluation suite §5.3 tab. 5. Energy MAE (meV) per category, models sorted by average rank (lower is better). Selected rows:

ModelCons.Training setAvg. rankPocketStrainConf.Prot.Dist.IE/EASpin
AllScAIP-md-d.OMol-102M3.4329.4964.1494.98516.10410.082143.035350.825
AllScAIP-md-cons.✓OMol-102M4.1450.5324.1033.87417.09236.145148.976317.400
eSEN-md-d.OMol-102M4.1464.2463.1133.56614.988109.767145.776303.883
UMA-M-1p1✓UMA-459M4.8676.7782.9622.53218.457138.094136.386335.058
UMA-S-1p2✓UMA-520M5.0066.6044.3653.73818.91432.174176.939246.565
GemNet-OC-r12OMol-102M9.7119.3738.38112.04931.64577.074177.457373.831

Column key: Pocket = ligand pocket interaction energy; Strain = ligand strain energy; Conf. = conformers; Prot. = protonation; Dist. = distance scaling (LR test); IE/EA; Spin = spin gap. All values are energy MAE in meV.

Distance-scaling (LR) test: the author-reported claim is about 90% lower error than the second-best model §5.3. See Paper vs code for why that number is hard to reproduce from this table.

Other OMol25 results. Long-range binning by system diameter and charge shows AllScAIP's error stays low while eSEN and UMA grow app. A fig. 10. Density and enthalpy of vaporisation from NPT and NVT runs on 39 liquids are plotted, not tabulated; the text reports lower MAE and higher R² than MACELES and eSEN §5.3 fig. 7.

Efficiency §5.1 fig. 4 fig. 8. Speed falls roughly as 1/N once O(N²) node attention dominates. Profiling puts the crossover earlier for larger models app. A. The authors target 10³–10⁵ atoms.

OC20 and OMat24 app. B tab. 8. Total-energy MAE on OC20 validation (ID / OOD-Both) and OMat24 per-atom energy. Units are not given in the table.

ModelOC20 ID EOC20 ID FOC20 OOD EOMat24 E/atomOMat24 F
UMA-S63.624.1107.011.357.1
UMA-M43.115.870.010.047.3
AllScAIP-md-d.59.317.692.211.456.6
AllScAIP-md-ft-cons.(blank in table)(blank)(blank)10.754.3

SPICE app. C tab. 9. Small conservative AllScAIP (34M per the appendix) trained on SPICE with MACE-OFF splits. Energy / force MAE, meV and meV/Å, on seven test subsets. Selected:

DataseteSEN E / FEScAIP E / FAllScAIP E / F
PubChem0.15 / 4.210.53 / 5.860.13 / 3.21
DES370K monomers0.13 / 1.240.41 / 3.480.07 / 0.97
Dipeptides0.25 / 3.680.31 / 5.120.06 / 1.54
Solvated amino acids0.25 / 3.680.61 / 11.520.13 / 4.86
QMugs0.12 / 3.780.41 / 8.740.11 / 2.73

Solvated amino acids forces are better for eSEN (3.68 vs 4.86); the table does not match a blanket "lowest across splits" claim for forces. See Paper vs code.

Model configs app. E tab. 10: see Hyperparameters.

Paper vs code

Code: official repository linked on the paper's cover at facebookresearch/fairchem, commit d9716429092b4339dded8fd8e64fd3fdec261204, MIT licence. Everything below was checked against the medium and small AllScAIP files under src/fairchem/core/models/allscaip/ and configs/allscaip/.

  • ERoPE form. Paper: a per-head linear mix of sinc features, added to the logit §3.2. Code: a softplus of the mix, masked, normalised over all valid pairs in the batch, then a log before adding to the logit [code: src/fairchem/core/models/allscaip/modules/node_attention.py#L114-L131].
  • ERoPE frequency range. Paper: M log-spaced frequencies in an unspecified range §3.2. Code: 32 frequencies between π/(4·30) and π/0.25 [code: src/fairchem/core/models/allscaip/utils/data_preprocess.py#L250-L256].
  • ERoPE initial weights. Code: 1/M per head [code: src/fairchem/core/models/allscaip/modules/node_attention.py#L46-L50].
  • LAE in both passes. Paper describes LAE on neighbourhood attention in general §3.2. Code applies it to both the source and destination passes neighborhood_attention.py.
  • LAE scaling. Code divides the spherical harmonics by sqrt(2l+1) before expansion; the extra sqrt rescaling of q and k is commented out [code: src/fairchem/core/models/allscaip/utils/data_preprocess.py#L129] neighborhood_attention.py.
  • Frequency list. Paper: constraint only §3.2. Code default [20, 10, 4, 10, 20] with head-dim check configs.py.
  • Headline medium config. Released medium config disables LAE and ERoPE [code: configs/allscaip/backbone/md_NeNo.yaml#L14-L15]. The paper's NeNo ablation row gives the same totals as the headline 102M model in tab. 4 (0.641 vs 0.64 meV/atom; 5.237 vs 5.24 meV/Å). This match is an inference from the numbers, not a statement by the paper.
  • Energy reduction. Code default is sum over atoms [code: src/fairchem/core/models/allscaip/configs.py#L71]. Paper does not state it.
  • Epoch count, 102M. Figure 5's caption says 12 epochs fig. 5; the text and the ablation caption say 10 §5.3 tab. 2; the code config uses 10 [code: configs/allscaip/omol_all.yml#L35].
  • Precision. Paper: full fp32 on V100 and H200 §5.3 app. C. Code config: TF32 on omol_all.yml.
  • Loss and optimiser. Not in the paper. Code: per-atom MAE energy loss with weight 10, L2-norm force loss with weight 10, AdamW lr 8e-4, wd 1e-3, cosine schedule omol_direct.yaml omol_all.yml.
  • Energy-conservation kNN. Paper cites a differentiable kNN construction §3.4. Code: soft kNN ranks with sigmoid scale 0.2 and LSE scale 0.1 [code: configs/allscaip/backbone/md_NeNo.yaml#L24-L26], built in src/fairchem/core/models/allscaip/utils/allscaip_radius_graph.py.
  • SPICE and forces. Paper text: lowest errors "across splits" app. C. The table has eSEN better on solvated amino-acid forces tab. 9.
  • Distance-scaling claim. Paper: about 90% reduction vs second-best §5.3. In tab. 5 the second-best distance-scaling entry is AllScAIP-sm-ft-cons. at 15.473 meV, a reduction of about 35%. The 90% figure matches the eSEN-md-d. entry (109.767) instead. Inference from the table, not a claim by the paper.
  • Per-atom metric bug. The paper footnotes a known FAIRChem per-atom MAE bug and gives total-energy tables §5.1 footnote tab. 6.
  • No discrepancies found: none of the layer-count, width or head settings in tab. 10 differ from the configs.

Pitfalls

  • ERoPE naming. Despite the name, ERoPE does not rotate queries and keys. It adds a distance-only bias to each head's logits. Implement it as a bias, not as RoPE.
  • Batch-dependent ERoPE (inferred from code). The rescaling in ERoPE divides by the sum over all valid pairs in the whole padded batch, not per system. A system's logits can therefore change with the other systems in its batch. The encodings are only used by the small configs, not the medium default node_attention.py.
  • Log-space bias. The code takes the log of a softplus of the mix. Use the code's form if you want to reproduce released behaviour, not the paper's linear form §3.2.
  • Unstated ranges. The ERoPE frequency range, the LAE rep counts and the neighbour count k are not in the paper. The code values above are defaults or config values, not paper values.
  • Quadratic cost. Global attention costs O(N²) per system. Memory and time grow with the largest system, not just the total atom count §5.1 fig. 4. Plan batching around that.
  • Compilation needs fixed shapes. The code disables compilation when max_atoms is unset, and the model's padding depends on it [code: src/fairchem/core/models/allscaip/AllScAIP.py#L131-L155].
  • Conservative training is slower. The paper notes the gradient-based energy path is slower than direct force because the differentiable kNN is not yet optimised fig. 5.
  • Hidden precision choice. The training config enables TF32 while the paper says fp32. Results may differ slightly; check which you run.
  • Table and figure numbers here were counted from the LaTeX source in order, not checked against the rendered PDF.
  • Blank table cells. The OC20 numbers for the 4M medium fine-tuned conservative row are blank in tab. 8.
  • Untuned OC20 and OMat24 runs. The authors say they did not tune these runs much app. B, so the comparison with UMA is not a tuned result.

Lineage

  • Builds on: EScAIP for the neighbourhood attention stage §3.1; Euclidean rotary-style radial encoding from Frank et al. (2024) §3.2; differentiable kNN from Liu et al. (2026) for energy conservation §3.4.
  • Compared against: UMA (Wood et al., 2025) §5.2 tab. 4 tab. 5; eSEN (Fu et al., 2025) tab. 4 tab. 5; MACE and MACELES (Kim et al., 2025) app. C fig. 7; GemNet-OC tab. 4 tab. 5.
  • Superseded by: not known from the content of this wiki.

Source and license

Adapted from “A recipe for scalable attention-based MLIPs: unlocking long-range accuracy with all-to-all node attention” by Eric Qu, Brandon M. Wood, Aditi S. Krishnapriyan, Zachary W. Ulissi (arXiv:2603.06567), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/facebookresearch/fairchem at commit d9716429092b (MIT). Any quoted code is shown under that license.