Repository navigation
Notebooks to alphafold3-colabfold 3.1.18; RGI via its DENOISED_HOOK - #864
Merged
Merged
Conversation
RGI restrains each denoised prediction of the diffusion sampler. Until now it reached that point by SHA256-checking diffusion_head.sample's source and rewriting four lines of it in memory, which tied it to alphafold3-colabfold==3.1.11: 3.1.17's sampler already hashes differently, and from 3.1.18 none of the four lines exist. alphafold3-colabfold 3.1.18 exposes the same point as diffusion_head.DENOISED_HOOK -- hook(positions_denoised, sigma, step), applied after the denoiser and after chai's second-order call, with sigma the step's pre-churn noise level and step its zero-based index, as the source patch did. sampler.guided() now picks the hook when present and otherwise instruments the 3.1.11 sampler exactly as before, and install() skips the 3.1.11 pin when the hook exists. The published notebook (pinned to 3.1.11) is unaffected. Tested: tests/test_rgi_sampler.py passes against both alphafold3 3.1.11 and 3.1.18. End to end with rgi_toolkit on 3.1.18, an 8 A harmonic distance restraint lands at 8.0 A in every sample on all 11 RGI-supported models (11-15 A without RGI), and ligand conformer restraints give the SMILES' stereocentres in 5/5 samples (2/5 alphafold3, 1/5 boltz2 without). Written with Claude Code (Claude Opus 5.5).
Both ColabFold2_preview.ipynb and AlphaFold3_of3.ipynb move from 3.1.11 to 3.1.18. The RGI change in this branch is what lets RGI follow them: 3.1.18 has DENOISED_HOOK, and the notebook installs colabfold.rgi from this repo. ColabFold2_preview gains protenix1, helixfold3, esmfold2_fast and bioemu2, with rows in the Instructions table. helixfold3's weights are non-commercial (NC-SA); the table and the Licence section say so. RGI supports protenix1, helixfold3 and esmfold2_fast -- an 8 A distance restraint lands at 8.0 A in every sample on each, as RGI measures it -- and they join SUPPORTED_MODELS. bioemu2 samples with its own sampler, which RGI does not reach, so it stays vanilla only. Written with Claude Code (Claude Opus 5.5).
…ot 0 bioemu2 has no confidence head, and its outputs carry all-zero per-atom pLDDTs. The plots cell averaged them and printed "Mean pLDDT: 0.000" -- which reads as a confident wrong structure. It now treats all zeros as not predicted: "Mean pLDDT: n/a", as pTM already does, and the plot says so. Run on a Colab T4 with alphafold3-colabfold 3.1.18 from PyPI, through every cell but the download: helixfold3 (mean pLDDT 96.0, pTM 0.93), openbind0 with an RGI distance restraint (8.000 A in all 5 samples), bioemu2, and AlphaFold3_of3 with openfold3. Written with Claude Code (Claude Opus 5.5).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves both notebooks to
alphafold3-colabfold3.1.18 (released today) and keeps RGI working on it.RGI
RGI currently reaches the diffusion sampler by SHA256-checking
alphafold3.model.network.diffusion_head.sample's source and rewriting four lines of it in memory. That pins it to 3.1.11. 3.1.17's sampler already hashes differently, and from 3.1.18 the sampler loop is refactored, so none of the four lines exist.3.1.18 exposes the same point as a supported hook,
diffusion_head.DENOISED_HOOK:hook(positions_denoised, sigma, step).sigmais the step's pre-churn noise level andstepits zero-based index, exactly what the source patch passed.Changes:
colabfold/rgi/sampler.py:guided(diffusion_head, minimize)uses the hook when the installed release has it, and otherwise instruments the 3.1.11 sampler exactly as before.colabfold/rgi/runtime.py: usesguided(). The 3.1.11 pin applies only when the hook is absent.tests/test_rgi_sampler.py: the sampler tests go throughguided(), so they hold the same expectations against either release.SUPPORTED_MODELSgainsprotenix1,helixfold3andesmfold2_fast. RGI was tested on each; see below.Notebooks
VERSION = '3.1.18'inColabFold2_preview.ipynbandAlphaFold3_of3.ipynb.ColabFold2_previewmodels: addsprotenix1,helixfold3,esmfold2_fastandbioemu2, each with a row in the Instructions table.helixfold3's weights are non-commercial (NC-SA). Its table row and the Licence section say so.bioemu2) now shows "Mean pLDDT: n/a" instead of averaging its all-zero pLDDTs to "0.000".Testing
On a real Colab T4 (Python 3.13, JAX 0.11.1), with 3.1.18 installed from PyPI and
colabfold.rgifrom this branch, every cell ran except the download cell:helixfold3, MMseqs2 serveropenbind0with an 8 Å RGI distance restraintbioemu2AlphaFold3_of3.ipynb,openfold3tests/test_rgi_sampler.pypasses against both alphafold3 3.1.11 and 3.1.18. These tests skip in this repo's CI, which doesn't install alphafold3.Locally (A10, 3.1.18), the distance test pulled residues 1–5 of a 47-residue bundle to 8 Å from residues 40–46. RGI's own measurement gave 8.0 Å in every sample on 14 models: alphafold3, chai1, boltz2, protenix2, protenix1, openbind0, openfold3, opendde, rosettafold3, helixfold3, esmfold2, esmfold2_fast, esmfold2_lm600m and esmfold2_lm300m. Without RGI these were 11–15 Å. bioemu2 is unaffected because its own sampler isn't the one the hook reaches, so it stays vanilla only.
Ligand conformer restraints on a SMILES with three stereocentres gave correct stereochemistry in 5/5 samples on alphafold3 and boltz2, against 2/5 and 1/5 without RGI.
Unrelated, and present on
mainbefore this change:tests/test_rgi_notebook.py::test_native_form_runs_without_widgets_and_reads_every_edit[ColabFold2_preview.ipynb-openbind0]fails whereverrgi_toolkitis installed (CI skips it), because the notebook's form text no longer matches the test's expected copy.cc @YoshitakaMo: this changes how RGI reaches the sampler.