Repository navigation
Consolidate batched inference, AtomWorks 3, and fast/legacy execution presets - #401
Conversation
…tching Squash the complete foundry-batched fork delta through 2f9071f onto public production 8bffbcb. Include RFD3 inference acceleration, cache controls, workers, metrics, benchmarks and image packaging, plus CPU/MPS support and RF3 improvements. Preserve upstream RFoptimization and cyclic-peptide changes. Validation: 67 integration-focused tests passed for virtual-atom padding, cyclic encoding/input, runtime settings and preprocessing workers. Prior fast-image validation: 47 targeted CUDA tests and generation smoke test.
(cherry picked from commit 72276d9)
(cherry picked from commit ab9db77)
(cherry picked from commit aa97ded)
(cherry picked from commit e042026)
| distance = np.linalg.norm( | ||
| atom_array.coord[bonds[:, 0]] - atom_array.coord[bonds[:, 1]], axis=-1 | ||
| ) | ||
| distances = np.full((len(atom_array), len(atom_array)), np.inf) |
| a ligand reference conformer after UFF failure where AW2 masked it. Restoring | ||
| only that old mask reproduced eight diagnostic AW2 outputs, but the expanded | ||
| quality results do not justify forcing it. See the | ||
| [inference guide](models/rfd3/inference_acceleration.md) |
Updated link formatting for inference guide in documentation.
rclune
left a comment
There was a problem hiding this comment.
There are also some new options attached to this PR that are not in the documentation. For example, in the input.md document for RFD3 inference_mode should be added.
There was a problem hiding this comment.
This document largely reads as a report on the PR meant for the repo maintainers. Some of the information here is useful though.
There was a problem hiding this comment.
@roccomoretti will this license specific to these kernels cause any issues? Foundry itself is under a BSD 3-Clause license.
There was a problem hiding this comment.
The one issue would be that Apache is more restrictive than the BSD 3-Clause. (In that I believe you can effectively re-license BSD 3-clause code with an Apache license, but you can't re-license Apache code under a BSD 3-clause license.) -- So anyone using the code in this directory would have to follow the Apache license.
That said, from the __init__.py, these are apparently optional and lazily loaded, which provides a bit of separation. Additionally, Open Source licenses are generally permissive for combining packages on the users' machines, and really only apply to redistribution. And Apache v2.0 doesn't impose that many additional restrictions over BSD 3-Clause - certainly none that would be of major issue for use or standard redistribution.
So I think we're fine, so long as the Apache Licensed code is confined particular subdirectories. We may want to double check the packaging process, to make sure that the LICENSE files from subdirectories is included in the PyPI package, versus just the root LICENSE file. Also, I don't know if we want to include mention in the README/main LICENSE that the repo contains code under a different license. (I'm not sure if that's necessary - I think the standard convention is that providing a LICENSE file in a subdirectory is sufficient, and notification at the top level isn't necessary.)
There was a problem hiding this comment.
the new parsers in aw3 are order-sensitive
There was a problem hiding this comment.
That's concerning. In general, these would be coming from user data, and we don't really have any control of how, exactly, the user is going to have the input structure laid out. (e.g. Many structures from the PDB are 'out of order'.)
While I understand the necessity to make the change for this PR, I'd say that the need to make the change in the first place points to a bug in aw3.
There was a problem hiding this comment.
This is a copy of the license that is in the root of the repository, why does it need to be here as well?


Scope
Consolidates #397's batched RFD3 inference, corrected pooling, and the AtomWorks 3 port for RFD3, RFD3NA, MPNN and RF3. Supersedes #397, #400 and the stacked fork port PR. Chaperone installation/scheduler changes remain in RosettaCommons/chaperone#8.
>=3.0.1,<4, with 3.0.1 pinned in CI; Torch >=2.11. Migrated parser/configuration APIs, bonds, charges, templates, conditioning annotations and dataset loading.inference_mode=fastis the default.legacyrestores serial eager execution, original atom pooling, native kernels, vanilla attention and the global RNG path. Metadata records resolved settings and actual execution. Legacy cannot reproduce historical coordinates reliably: the old reduction is nondeterministic, and AtomWorks 3 preprocessing remains active.Regression conclusions
RFD3: Final 1euv enzyme benchmark used 32 seeds × two designs per preset, the public 200-step sampler, and native JSON insertion RMSD without refolding or filtering.
Mean difference +0.038 Å; paired seed-group 95% interval [−0.051, +0.131] Å. No clear quality separation on this fixture, and no demonstrated quality improvement. Acceleration is not bitwise exact. Earlier pre-final pooling-only studies had adverse signals: the 16-backbone refolding pilot passed 15/16 original AW2 versus 14/16 corrected eager AW2, and the 64-output enzyme comparison had a +0.050 Å mean penalty (95% interval +0.009 to +0.094 Å). Those results predate the final batched precision correction. Full training convergence remains untested. User-facing compatibility and quality limits are documented in the upgrade/inference guides.
RF3/MPNN: With matched corrected pooling, RF3 AW2/AW3 fixed-feature replay reproduced all 154 output tensors in 21 cases; MPNN features/logits/sequences matched in 36 comparisons. RF3 native preprocessing passed confidence/geometry gates, but one peptide–DNA fixture failed structural equivalence (3.044 Å CA RMSD, with 33 fewer severe clashes in AW3). These bounded fixtures do not establish broad folding or training-quality equivalence.
RF3 LayerNorm: All 154 output tensors matched in the four-length/two-seed audit under deterministic algorithms and a fixed cuBLAS workspace. The measured 512-residue/five-sample H200 prediction improved from 10.495 s to 9.094 s. These historical GPU measurements are unchanged by the cleanup; no broader approximate kernels are enabled.
Review cleanup
Removed all newly added performance JSON reports, campaign artifacts, benchmark/plot/audit scripts and standalone quality documents. Removed the audit-only RF3 jobs API and unused LayerNorm adapter options. Shortened the inference guide and retained concise regression conclusions, installation/compatibility instructions, permanent tests, required licenses and the small AW2 golden input fixtures.
The previous two artifact cleanups remove roughly 20,500 net lines. Historical reports remain in Git history; they are not shipped in the PR tree. No new JSON/CSV/figure artifacts or benchmark scripts remain in the diff.
Validation
379ffef): 1,122 CPU tests passed, 188 hardware/checkpoint cases skipped, including 25 focused RF3 preprocessing cases.Public Chaperone pipeline integration (October 14)
cif_block=None; optional CIF conditioning categories are read only when a CIF block exists.6d072fapassed (CPU/model tests, RF3 integration, mypy, Ruff and docs).Review corrections — 379ffef
input.md, including the fast/legacy contract. Added RF3 attention options to its README.FOUNDRY_LICENSE; native kernel notices now reference Foundry's root license. Verified the built wheel retains that BSD license plus all RF3/RFD3 third-party licenses/notices. The question about accepting the third-party kernel licenses remains for maintainer sign-off; those licenses were not changed or removed.Local tests, mypy, Ruff, docs and wheel checks above passed. All five CI checks passed on
379ffef: 1,122 CPU tests, 25 RF3 checkpoint integration tests, mypy, Ruff and docs. CPU/mypy, RF3 integration.