Skip to content

optimizer: size UMA batches by n_atoms, configurable via memory_scales_with - #44

Merged
niklashoelter merged 1 commit into
niklashoelter:masterfrom
avnoordenne:fix/uma-n-atoms-batching
Oct 5, 2026
Merged

niklashoelter merged 1 commit into
niklashoelter:masterfrom
avnoordenne:fix/uma-n-atoms-batching

Conversation

@avnoordenne

Copy link
Copy Markdown
Contributor

Adds technical.memory_scales_with ("auto" | "n_atoms" | "n_edges", default "auto"). auto uses n_atoms for UMA (fairchem) and keeps n_edges for ORB and SevenNet.

Why

UMA has a large fixed memory cost per structure (about 7 MiB for uma-s, 26 MiB for uma-m). With n_edges, the autobatcher's probe replicates the smallest structure, so that fixed cost gets charged per edge, and small molecules look far more expensive than they are. On a job that mixes 4-atom and 185-atom molecules, the ceiling ended up below the largest molecule. Every uma-m-1p1 run on the kraken library failed with:

ValueError: Max metric of system with index 178 in states: 7936.0 is greater than max_metric 4035.6

With n_atoms, the same job runs.

Behaviour change

UMA batch sizing changes by default. To get the old behaviour back, set "memory_scales_with": "n_edges". ORB and SevenNet are unchanged.

Caveat

n_atoms fits UMA without D3. With D3 on, uma-m's memory follows edges + atoms, and neither metric alone fits well. If that combination runs out of memory, set n_edges explicitly.

Tests

  • New: tests/optimization/test_memory_metric.py (auto selection per backend, explicit override); config validation in tests/test_config.py.
  • The GPU suite passes on a build that combines this branch with the whole-job probe margin fix.

…s_with

Add technical.memory_scales_with (auto|n_atoms|n_edges). auto picks n_atoms
for UMA, whose large fixed per-structure memory makes edge counts overcharge
small molecules, and keeps n_edges for ORB and SevenNet.
@niklashoelter
niklashoelter merged commit f21c8a1 into niklashoelter:master Oct 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants