Designing RNAs with Language Models

Milan Gautam, Ning Dai, Tianshuo Zhou, Bowen Xie, David Mathews, Liang HuangarXiv 2026

TL;DR

This paper reframes RNA design (inverse folding) from a slow, per-instance combinatorial optimization problem into an efficient conditional sequence generation task using an autoregressive language model. By combining a pretrained LLM backbone with constrained decoding and reinforcement learning, the proposed method matches or outperforms state-of-the-art traditional tools across multiple benchmarks while delivering a 1.74x speedup.

What Problem Does This Paper Address?

RNA design, also known as RNA inverse folding, is the challenge of finding an RNA sequence that will naturally fold into a specific target secondary structure. This is a foundational problem for modern biomedicine, with direct applications in designing mRNA vaccines, artificial ribozymes, and diagnostic aptamers.

Computationally, however, RNA design is NP-hard. It suffers from a double combinatorial explosion:

  1. Design Space: There are exponentially many candidate sequences for any given target structure.
  2. Folding Space: For every candidate sequence, there are exponentially many alternative structures that compete with the target.

Traditional approaches rely on heuristic local searches or recursive structural decomposition. Because these methods optimize from scratch for every single new target structure, they are computationally expensive, slow, and struggle to scale to long or highly complex structures.

Methods

The authors introduce RNA-Design-LM, treating RNA design as a conditional sequence generation task where a single, reusable model maps target structures directly to valid sequences.

  • "LLM Surgery" on a Pretrained Backbone: Instead of training a Transformer from scratch, the authors adapt a pretrained general-domain language model (Qwen2.5-0.5B). They keep the core transformer backbone intact but replace the input embedding and output language model heads with downsized, RNA-specific layers matching a compact vocabulary: the four nucleotides (A, C, G, U), dot-bracket structure symbols (., (, )), and control tokens.
LLM Surgery
  • Constrained Decoding: Standard autoregressive generation can easily emit invalid nucleotides that violate basic base-pairing rules. To prevent this, the authors implement a token-by-token logit masking mechanism during inference. This ensures that downstream positions strictly adhere to Watson-Crick-Franklin or wobble pairing constraints relative to their upstream partners, guaranteeing structural validity by construction.
  • Two-Stage Training Pipeline:
    1. Supervised Learning (SL): The model is first trained via maximum likelihood estimation on a massive dataset of structure-sequence pairs to learn the basic mapping.
  • Reinforcement Learning (RL): To directly optimize thermodynamic objectives, the SL model is fine-tune using Group Relative Policy Optimization (GRPO). The reward function scores candidate sequences based on their Boltzmann probability, minimum free energy (MFE) matching, and MFE uniqueness.

Datasets

  • Supervised Training Dataset ($\mathcal{YX}_{\text{train}}$): A massive dataset of 10 million pairs. To avoid test-set contamination, the authors generated 1 million random RNA sequences, computed their MFE structures using ViennaRNA v2 to guarantee designability, and then used a strong traditional solver (SAMFEO) to generate 10 candidate sequences per structure.
  • Reinforcement Learning Dataset ($\mathcal{Y}_{\text{RL}}$): Curated from Eterna-web (22K player-designed puzzles). After filtering out structures too close to the test set and selecting for high-potential diversity, they isolated a refined subset of 2.8K structures.
  • Union Test Set ($\mathcal{Y}_{\text{test}}$): A comprehensive benchmark of 246 unique structures up to 400 nucleotides long, compiled from four diverse sources: Eterna100, Eterna100-v2, Rfam-Taneda-27, and RNAsolo-100.

Key Insights and Ideas

  • Text Pretraining Transfers to Biology: Surprisingly, initializing the model with a general-domain text LLM provides significantly better optimization stability and sample efficiency than training an identical architecture from scratch, proving that text-derived structural biases transfer well to biological sequences.
  • Random Data Generates Real Success: Training the supervised model on completely synthetic, randomly-induced structure-sequence pairs completely unrelated to real biological data still resulted in highly competitive performance on real biological and human-designed puzzle benchmarks.
  • Smart Filtering Supercharges RL: Running RL on every available structure can cause policy degradation. By filtering for targets where the SL model shows moderate success but high sample variance (measured via a metric called Normalized Standard Deviation), the authors achieved a 2.9x training speedup while improving generalization.

Key Results

  • State-of-the-Art Performance: The combined SL+RL model consistently matched or outperformed strong traditional optimization tools (like SAMFEO and NEMO) across all four test sets on critical ensemble-based metrics like Boltzmann probability and Normalized Ensemble Defect (NED).
  • Substantial Speedup: Leveraging parallel GPU sampling allows the model to achieve a 1.74x overall speedup over SAMFEO. Its empirical computational complexity scales much better with structure length ($|y|^{1.3}$ vs. SAMFEO's $|y|^{1.9}$).
  • Effective Constraints: Constrained decoding completely eliminates structurally invalid sequences while adding only a modest ~30% computational overhead.

Limitations and Future Work

  • Decoding Bottleneck: Generating a very large number of designs (e.g., $10^4$) is still bounded by the speed of autoregressive token generation. The authors suggest integrating advanced structured generation engines (like Xgrammar) or using beam search to improve throughput.
  • Slow RL Training: The reinforcement learning phase remains computationally heavy due to the need to call external RNA folding engines for rewards, limiting the scale of exploration during training.
  • Test-Time Scaling: The authors propose exploring Test-Time Reinforcement Learning (TTRL) to dynamically fine-tune a model instance for a specific, highly complex target structure at inference time, further exploiting compute at evaluation.

Summary updated

BibTeX
@misc{gautam2026designing,
  author = {Milan Gautam and Ning Dai and Tianshuo Zhou and Bowen Xie and David Mathews and Liang Huang},
  title = {{Designing RNAs with Language Models}},
  year = {2026},
  eprint = {2602.12470},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.12470},
}
Figure