Skip to content

Consolidate batched inference, AtomWorks 3, and fast/legacy execution presets - #401

Merged
Ubiquinone-dot merged 33 commits into
RosettaCommons:productionfrom
Ubiquinone-dot:codex/atomworks3-pr397
Oct 14, 2026
Merged

Ubiquinone-dot merged 33 commits into
RosettaCommons:productionfrom
Ubiquinone-dot:codex/atomworks3-pr397

Conversation

@Ubiquinone-dot

@Ubiquinone-dot Ubiquinone-dot commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

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.

  • AtomWorks >=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.
  • RFD3 padded/compiled inference, independent input/sample batching, preprocessing workers, kernel dispatch and rollout caches. One standard Foundry container.
  • Stable grouped pooling with integer counts and FP32 accumulation/division for FP16/BF16, including padded pair pooling under autocast.
  • RFD3 inference_mode=fast is the default. legacy restores 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.
  • RF3 automatically installs exact CUDA LayerNorm on its validated H200/Torch 2.11.0+cu128 cases. No kernel-selection option. Native inference fallbacks warn once per reason, including in quiet mode; training/autograd remain native and silent. Kernel source and required licenses are packaged.

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.

AW3 preset Insertion RMSD <1 Å Mean RMSD
Fast 62/64 0.485 Å
Legacy 63/64 0.447 Å

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

  • Latest review fixes (379ffef): 1,122 CPU tests passed, 188 hardware/checkpoint cases skipped, including 25 focused RF3 preprocessing cases.
  • Ruff check/format passed; mypy passed for 258 source files; Sphinx build succeeded with 10 existing RFD3 documentation warnings; rendered guide links verified.
  • Prior H200 exact-kernel suite: 110 passed; prior RF3 checkpoint integration CI: 25 passed. GPU arithmetic was not changed or rebenchmarked during cleanup.
  • PR CI reruns on the new head; historical green runs are not reported as new-head results.

Public Chaperone pipeline integration (October 14)

  • Fixed RF3 PDB input parsing when AtomWorks 3 returns cif_block=None; optional CIF conditioning categories are read only when a CIF block exists.
  • Added six regression cases covering real PDB/CIF inputs, absent/present conditioning categories, explicit override precedence and applied template masks. The focused RF3 suite passed 23 tests.
  • Confirmed real H200 RF3 inference from a packed LigandMPNN protease design, including substrate template/conformer conditioning. This is pipeline execution evidence, not a protein quality or numerical-equivalence claim.
  • Repeated the protease RF3 run after correcting fixed-atom coordinates in Chaperone packed MPNN outputs; RF3 and both downstream AF3 branches completed. The candidate failed its AF3 quality gates. All five GitHub checks on commit 6d072fa passed (CPU/model tests, RF3 integration, mypy, Ruff and docs).

Review corrections — 379ffef

  • Replaced the RF3 atom-by-atom distance matrix with token-pair minimum reduction directly from bond endpoints. Dense-reference regression cases cover training/inference, implicit/explicit tokens, multiple edges, NaN/Inf and empty bonds. A 50,000-atom regression rejects atom-square allocation before it happens.
  • Documented all new RFD3 CLI keys and the changed compilation default in input.md, including the fast/legacy contract. Added RF3 attention options to its README.
  • Rewrote the PR-report-style AtomWorks page as an upgrade guide, retaining user-facing compatibility/quality limits and keeping development evidence here.
  • Preserved the maintainer's link correction and added the acceleration page to the RFD3 toctree. Verified the built HTML links from the upgrade page, input page and model navigation.
  • Explained the M0255 PDB ordering in the enzyme example: NAI A850 before ACT A900 satisfies residue-order validation. Verified all 84 records are identical as a multiset; atom identifiers and coordinates are unchanged.
  • Removed redundant 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.

Ubiquinone-dot and others added 19 commits October 9, 2026 14:12
…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.
@Ubiquinone-dot
Ubiquinone-dot marked this pull request as ready for review October 14, 2026 00:32
Copilot AI balanced review requested due to automatic review settings October 14, 2026 00:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

RF3 preprocessing introduces an unbounded quadratic allocation that can exhaust inference-worker memory on large structures.

2 open findings

🧠 Review effort: Balanced

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)
Comment thread docs/source/atomworks3_port.md Outdated
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 rclune left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This document largely reads as a report on the PR meant for the repo maintainers. Some of the information here is useful though.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roccomoretti will this license specific to these kernels cause any issues? Foundry itself is under a BSD 3-Clause license.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this change made?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the new parsers in aw3 are order-sensitive

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a copy of the license that is in the root of the repository, why does it need to be here as well?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleted!

@Ubiquinone-dot
Ubiquinone-dot merged commit 2a950ea into RosettaCommons:production Oct 14, 2026
5 checks passed
@Ubiquinone-dot
Ubiquinone-dot deleted the codex/atomworks3-pr397 branch October 14, 2026 21:27
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.

6 participants