RNA Design as Executable Code, Debugged Against In Vivo Structure

Designing an RNA molecule today is like writing a program and never running it. Automated design tools such as LEARNA, which formulates inverse RNA folding as reinforcement learning, search for a nucleotide sequence that folds into a target shape — but the "compiler" they optimize against is a thermodynamic simulation of an RNA molecule floating alone in a test tube Learning to Design RNA. Inside a living cell, that assumption is simply wrong: RNAs are actively reshaped by helicases, chaperones, and bound proteins, and probing experiments inside living cells show that transcripts adopt systematically more open configurations — larger loops, unwound stems — than any test-tube model predicts Jianyu Zhou et al., Qing-Jun Luo et al.. Meanwhile, in an unrelated line of work, language-model agents have become surprisingly good at fixing code by executing it: they run a program, read the error, edit, and repeat, with rollback mechanisms that undo changes that make things worse MEIC.

This proposal connects the two by treating RNA design itself as a code-refinement problem. Instead of having an agent emit raw nucleotide strings, the agent writes and iteratively debugs an executable design program — a short script in a small domain-specific language that places motifs, constrains stem energies, sets accessibility targets, and applies mutation operators. The program's "runtime" is a stack of structure oracles: a deterministic folding engine, a layer that emulates cellular remodeling, and a learned surrogate that predicts the single-strandedness profile a probing experiment would see inside a specific cell type. The loop's central technical problem is that this runtime, unlike a compiler, is stochastic and gameable — and the literature on iterative self-refinement documents exactly how agents exploit imperfect verifiers Spontaneous Reward Hacking in Iterative Self-Refinement. The proposal therefore has two coupled claims: one biological (in-vivo-aware oracles change what good RNA design means), and one methodological (rollback and adversarial verification are what make refinement survive a gameable oracle).

Core Claim

The claim is that an agent which writes, executes, and debugs RNA design programs against an oracle stack that approximates the intracellular environment will design sequences that existing test-tube-based methods cannot — and that this only works if the loop is protected against the agent learning to exploit flaws in the surrogate oracles rather than actually improving the molecule. Concretely, we predict three results. First, on inverse-folding benchmarks re-scored under a remodeling-aware oracle, a design loop built this way will beat the strongest existing reinforcement-learning designer given the same oracle and the same compute. Second, on a new task we call inverse riboSNitch design — finding the minimal sequence edit that flips the structural accessibility of a target site, the mirror image of the disease-relevant single-nucleotide variants that PrismNet showed can rewire protein binding Predicting dynamic cellular protein–RNA interactions by deep learning using in vivo RNA structures — the loop will succeed where one-shot generation fails. Third, removing the rollback and adversarial-verification machinery will cause measurable reward hacking: scores will rise on the oracle the agent can see while falling on a held-out oracle it cannot.

Nothing in the literature does this. The closest works each stop one step short. LEARNA solves 68% of the Eterna100 benchmark, but its reward comes entirely from a static minimum-free-energy folder, its agent outputs sequences rather than programs, and it restarts from scratch for every target Learning to Design RNA. IRIS reconstructs in vivo structural ensembles from crosslinking data, dramatically outperforming minimum-free-energy modeling, but it is a fixed pipeline with no reasoning loop, no self-correction, and a hard 500-nucleotide length ceiling IRIS. The predictive deep models — PrismNet, HDRNet, and PaRPI — consume in vivo probing data as input and predict protein binding, but none of them can generate or edit a sequence; mRNABERT's authors explicitly name the transition from their discriminative model to generative sequence optimization as an open goal mRNABERT. On the code side, the agentic frameworks — MAGIS for repository issues, MEIC for hardware debugging, POLO for performance optimization — have never been pointed at a biological oracle MAGIS, MEIC, POLO. The gap is real, and it cuts both ways: biology lacks a closed-loop generative mechanism, and code refinement has never been stress-tested against a stochastic, gameable runtime.

Research Program

Three things get built. The first is the domain-specific language. A design program is a short imperative script whose statements place sequence motifs at positions, declare stems with target energy bounds, require loop sizes or accessibility in given regions, and compose mutation and repair operators. The program compiles to candidate sequences through constrained sampling plus a local repair step in the spirit of LEARNA's Local Improvement Step, and — crucially — the program is inspectable and reusable across targets, which is what makes program-level refinement different from per-sequence search. This follows the pattern that worked elsewhere: representing heuristics as evolvable program trees in $A_2$DEPT A₂DEPT, and letting agents build their own tools as executable Python in LearnAct LearnAct.

The second component is the oracle stack. The bottom layer is a standard thermodynamic folder, the same engine LEARNA and IRIS build on. Above it sits a remodeling layer that emulates what the cell does to the molecule: weak stems are partially unwound and loop regions opened, with parameters calibrated so the layer reproduces the systematically open in vivo configurations reported empirically Qing-Jun Luo et al., Xingli Guo et al.. The top layer is a learned surrogate trained to predict nucleotide-resolution single-strandedness — the quantity that probing assays measure inside living cells — using the transcriptome-wide profiles across seven human cell types that PrismNet and its successors are built on PrismNet, HDRNet. Two disjoint surrogates are trained on disjoint cell lines, so one can always be held out.

The third component is the refinement loop itself, and this is where the methodological claim lives. At iteration $t$, the agent proposes an edit to the program $P_t$; the edit is executed against the oracle stack, producing a score $S(P)$ that combines structural match, accessibility match, and — for binding tasks — the predicted binding of a target protein. The edit is accepted only if the score improves; otherwise the state rolls back to the previous best program, exactly as MEIC reverts hardware code when a change fails to compile or degrades quality MEIC:

$$P_{t+1} = \begin{cases} P' & \text{if } S(P') \geq S(P_t) \text{ on the visible oracle and survives adversarial review,} \\ P_t & \text{otherwise (rollback).} \end{cases}$$

The adversarial review step is a second agent whose only job is to argue that the improvement is fake — that the new program exploits a defect in the visible surrogate rather than genuinely improving the molecule — drawing on the finding that structured disagreement between reviewers prevents premature consensus Adversarial Review. This is necessary because the documented failure modes of iterative refinement — plateauing after two to four iterations Yan et al., cascading new bugs MEIC, and verifier exploitation Spontaneous Reward Hacking in Iterative Self-Refinement, SlopCodeBench — are all expected to be worse when the runtime is a noisy biological surrogate rather than a deterministic compiler. No study has evaluated rollback, scorer agents, or execution-grounded reward models in that setting, and this proposal treats that evaluation as a result in its own right, not just an engineering detail.

Baselines

The "do nothing" reference point is classical thermodynamic design: a minimum-free-energy folder drives the search, exactly as in LEARNA's original setup. Its documented ceiling matters here — against real in vivo data, plain minimum-free-energy modeling scored a Kullback-Leibler distance of 147.7 on human U2 snRNA where the data-driven IRIS ensemble scored 93.0, with lower being better IRIS. We will run MFE-based local search on every task under the identical remodeling-aware oracle, with the same wall-clock budget as our loop, to quantify how much of the gap the oracle alone explains.

The strongest competitor is Meta-LEARNA, which meta-learns a design policy across 65,000 Rfam structures and solves 68% of Eterna100, reaching prior state-of-the-art accuracy in 25 seconds per structure Learning to Design RNA. To make the comparison honest, we will retrain Meta-LEARNA with the same remodeling-aware reward — not its original test-tube reward — and give it an equal or larger compute and architecture-search budget per task. No reported result found on Lacuna for Meta-LEARNA under any in vivo-aware oracle, so this baseline is genuinely unmeasured. Beating it means a success rate at least ten points higher on the re-scored Eterna100 task, and higher minimal-edit success on the inverse riboSNitch task, at matched budget.

Two ablations isolate the proposal's key ingredients. The first removes the program representation: the identical agent and oracle stack edit raw nucleotide strings instead of design programs, testing whether the code-level abstraction and cross-task program reuse actually matter. The second removes rollback and adversarial review, testing whether anti-reward-hacking machinery is necessary; the decisive measurement there is the hack gap — the divergence between score on the visible surrogate and score on the held-out surrogate and held-out cell line over iterations.

Why not just…?

Why not just swap the reward in LEARNA? This is the most serious alternative, and we treat it as the primary baseline rather than arguing around it. The honest expectation is that reward swapping recovers much of the biological gain, because the oracle is where the biology enters. What it does not obviously recover: a fixed neural policy amortizes one reward shape and, per the plateau evidence, iterative correction of the same kind stops paying off after a few rounds Yan et al.; and a policy cannot represent heterogeneous, per-target constraints (an accessibility profile here, a quadruplex-prone region there) the way a program can, nor can it be inspected or rolled back. If retrained Meta-LEARNA matches our loop at equal budget, the program layer is unnecessary and we will say so — that is exactly what the head-to-head experiment is designed to settle.

Why not just prompt a large model to output the sequence directly? One-shot generation collapses on exactly the kind of multi-constraint, verifiable task we are posing. Raw GPT-4 one-shot resolved 1.74% of real GitHub issues where the MAGIS iterative loop resolved 13.94% with the same model MAGIS; on HumanEval, direct Codex generation scored 48.1% where an agentic iterative loop reached 96.3% Code to Think, Think to Code; and in hardware debugging, retrieval-augmented and fine-tuned baselines plateaued at a 66% functional fix rate against MEIC's 78% MEIC. RNA design under five simultaneous structural and accessibility constraints is harder than any of these. We will still run one-shot generation as a baseline on every task.

Why not just optimize directly against the structure predictor? This is the tempting shortcut — treat the surrogate as a differentiable or RL-trainable objective and skip the agent entirely. But optimizing hard against an imperfect verifier is precisely the failure mode documented as spontaneous reward hacking Spontaneous Reward Hacking in Iterative Self-Refinement and code erosion under repeated refinement SlopCodeBench. A sequence that perfectly satisfies the visible surrogate may fail in a different cell line, where 3–5% of transcriptome regions remodel differently PrismNet. The held-out-surrogate evaluation is designed to catch this: the shortcut's signature is a large hack gap, and measuring that gap with and without our safeguards is itself a deliverable.

Why not just use sequence motif scanning to place binding sites? Linear motif scanning ignores the physical fact that a motif buried in a double-stranded helix cannot be bound by a protein Gerald Quon et al., and structure-informed models demonstrably beat sequence-only ones on in vivo binding PrismNet, Sanghamitra Bandyopadhyay et al.. Our inverse riboSNitch task is built so that sequence-only methods cannot succeed by construction: the wild-type and edited sequences share their motifs and differ only in predicted accessibility.

Proposed Experiments

Task A re-scores the Eterna100 inverse-folding benchmark under the remodeling-aware oracle. Meta-LEARNA's published 68% success rate was achieved against the test-tube folder Learning to Design RNA; no reported result found on Lacuna for any method on Eterna100 under an in vivo-aware oracle. We report success rates for MFE local search, one-shot generation, retrained Meta-LEARNA, the raw-string ablation, and the full loop, all at matched compute per puzzle. The headline number is the full loop's success rate versus retrained Meta-LEARNA, with the ten-point margin as the pre-registered success criterion.

Task B is inverse riboSNitch design. From the transcriptome-wide in vivo probing profiles across seven human cell types used by PrismNet and HDRNet, plus the dbSNP and ClinVar variant sets they validated on, we construct paired problems: given a wild-type window and a target accessibility flip at a specified site, produce the minimal edit. Scoring uses a held-out cell line's probing profile and a held-out surrogate, plus the change in predicted protein binding from PrismNet-style models. The same baselines run here; for Meta-LEARNA we adapt its action space to allow single-nucleotide edits with the identical reward, so the comparison stays fair. Secondary metrics are edit distance to the natural causal variant where one is known (as in the PNPO epilepsy case PrismNet validated), which tests whether the loop independently rediscovers biology.

Task C measures the refinement dynamics themselves. We track score trajectories over iterations for the loop with and without rollback and adversarial review, reporting the hack gap (visible-surrogate score minus held-out-surrogate score) and an erosion measure in the spirit of SlopCodeBench, for which no reported numeric result found on Lacuna. This directly tests whether program-level edits extend the productive iteration horizon beyond the two-to-four-iteration plateau Yan et al., and whether MEIC-style rollback generalizes from deterministic compilers to stochastic biological runtimes MEIC. A final scaling check applies the loop to targets beyond 500 nucleotides — the length at which IRIS's candidate enumeration collapses IRIS — to see whether program-level decomposition, in the spirit of MAGIS's task decomposition across files MAGIS, pushes past that ceiling. If the retrained Meta-LEARNA baseline matches the full loop on Tasks A and B, the honest conclusion is that the oracle, not the program representation, carries the gain — and the methodological contribution then rests entirely on Task C's demonstration of safe refinement under gameable biological oracles, which no existing work provides.

References

  1. Learning to Design RNA
  2. IRIS: A method for predicting in vivo RNA secondary structures using PARIS data
  3. RNA structure probing reveals the structural basis of Dicer binding and cleavage
  4. MEIC: Re-thinking RTL Debug Automation using LLMs
  5. Spontaneous Reward Hacking in Iterative Self-Refinement
  6. Predicting dynamic cellular protein–RNA interactions by deep learning using in vivo RNA structures
  7. mRNABERT: advancing mRNA sequence design with a universal language model and comprehensive dataset
  8. MAGIS: LLM-Based Multi-Agent Framework for GitHub Issue Resolution
  9. POLO: An LLM-Powered Project-Level Code Performance Optimization Framework
  10. $A_2$DEPT: Large Language Model–Driven Automated Algorithm Design via Evolutionary Program Trees
  11. Empowering Large Language Model Agents through Action Learning
  12. Advances in long noncoding RNAs: identification, structure prediction and function annotation
  13. Dynamic characterization and interpretation for protein-RNA interactions across diverse cellular conditions using HDRNet
  14. Adversarial Review: Structured Disagreement for Grounded Agentic Code Review
  15. CodeTransOcean: A Comprehensive Multilingual Benchmark for Code Translation
  16. SlopCodeBench: Measuring Code Erosion Under Iterative Specification Refinement
  17. Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMs
  18. Predicting in vivo binding sites of RNA-binding proteins using mRNA secondary structure
  19. MBSTAR: multiple instance learning for predicting specific functional binding sites in microRNA targets