RNA 3D structure prediction

Stanford RNA 3D Folding on one 8 GB GPU: a 488M-parameter diffusion model run within its memory, a sequence-aligned TM-score harness, and a 45-stage template folder over 9,564 PDB RNA structures.

At a glance

Question
How much of a modern RNA structure-prediction stack can run on a single 8 GB GPU, and how do you score predictions locally against real PDB structures?
My contribution
Ran the RNAPro diffusion model with MSAs and RibonanzaNet2 features on the competition test sequences, built a Python TM-score harness that pairs residues by sequence alignment against the deposited structures, and built a 45-stage template-based folder over 9,564 PDB RNA structures with a GPU FAISS index.
Result & scope
A complete local pipeline: RNAPro predictions for 24 test sequences with five samples each, a scorer that compares each predicted nucleotide with the same nucleotide in the experimental structure, and a template folder whose every stage writes an inspectable artifact and can be benchmarked on its own.
In this write-up

The problem

The Stanford RNA 3D Folding competition asks for the 3D coordinates of every nucleotide in an RNA molecule, given only its sequence. Entries submit five structures per target and are scored by TM-score against the experimentally determined structure. TM-score runs from 0 to 1: it rewards residues that land close to their true position after the two structures are superimposed, with a distance scale that grows with length, so a long RNA is not punished for small local errors.

It is hard for three reasons. There are far fewer solved RNA structures than protein structures (the competition training set has 5,716 sequences, and the PDB-derived template bank I built has 9,564 entries). RNA folds are dominated by base pairing and long-range tertiary contacts that a sequence alone does not pin down. And the test targets are real recent depositions: the 28 test sequences range from 19 nt to a 4,640-nt complex.

Code and notebooks: github.com/rohit-ravi2/rnafold-v2

What I built

The project has two prediction tracks that share one evaluation stack, all running on a single 8 GB GPU.

RNAPro on an 8 GB card (pipeline1.ipynb, pipeline2.ipynb). RNAPro is a 488-million-parameter diffusion model for RNA structure. Getting it to run on consumer hardware meant rebuilding its chemical-component cache, enabling expandable CUDA memory segments, capping sequence length at 500 nt, and keeping diffusion steps (8) and recycles (2) low. It runs with multiple sequence alignments and RibonanzaNet2 language-model features, and produced five sampled structures for each of 24 test sequences.

A local scorer (evaluation.ipynb through pipeline5.ipynb). The scorer downloads each deposited mmCIF from RCSB, reduces every nucleotide to one point (the centroid of its P, C4′ and C1′ atoms), aligns the predicted chain to the reference sequence so each predicted nucleotide is compared with the same nucleotide in the experimental structure, superimposes the two by least squares (Kabsch), and computes TM-score with the length-dependent distance scale. Pairing by sequence matters: predicted and deposited chains differ in length and numbering, and pairing atoms by position compares the wrong residues.

A template database (pipeline4.ipynb). 9,564 RNA structures parsed from the PDB in about an hour and indexed with GPU FAISS for similarity retrieval.

A template-based folder (pipeline5.ipynb). A 45-stage pipeline with no neural network: retrieve similar structures from the bank, align the query to each, transfer coordinates across, fuse the candidates into a weighted consensus, fill gaps, then refine. Superposing candidates before fusion and reweighting templates by their agreement (recycling) are built in. Every stage writes an inspectable artifact and is benchmarked on its own, so any stage can be switched off and its effect measured.

Where the signal comes from

The two tracks draw on different information. RNAPro learns structure from sequence: its signal comes from co-variation in the multiple sequence alignment, which marks which bases pair, and from RibonanzaNet2’s learned representation of RNA chemistry. The template folder draws on solved structures: when a related RNA is already in the PDB, its coordinates carry the fold directly, and the fusion and recycling stages decide how much to trust each template.

The metric matters too. Because TM-score’s distance scale grows with length, a few ångströms of error costs a 30-nt RNA far more than a 250-nt one, so the longer, well-structured targets are where a prediction can earn the most.

Why this architecture

The memory budget shaped it. On 8 GB, the diffusion model is limited to sequences under 500 nt, which leaves out the largest complexes. The template folder has no such cap: retrieval and coordinate transfer are not bound by the diffusion model’s length cap, and the FAISS index makes searching the whole PDB practical. Building the two side by side, on one shared scorer, means every comparison between them uses the same reference structures, the same residue pairing and the same metric.

Making each template stage separately measurable was a deliberate choice. Structure pipelines tend to become opaque chains of heuristics; here every step leaves an artifact that can be inspected, benchmarked and turned off.

The investigation

kept partial ruled outtap any step to expand

Next step

The natural next experiment is a head-to-head benchmark of the two tracks with each target and its close homologs removed from the template bank, which measures how each does on RNAs with no solved relative.

Code and notebooks: github.com/rohit-ravi2/rnafold-v2. Template folder and scorer: pipeline5.ipynb (PDF).