← News
Tech for Good Tech for Good Frontiers

The Algorithm That Designs Better mRNA Vaccines in 7 Minutes

The Algorithm That Designs Better mRNA Vaccines in 7 Minutes
2,500 Sequences sampled per benchmark
~7 Minutes Design time for 5,000-aa protein
O(N³) Theoretical computational complexity
Rtol = 0.002 Codon frequency convergence tolerance

Seven minutes. That is how long it takes the algorithm developed by Fornace, Wang, and Lindsey to design an mRNA sequence for a protein five thousand amino acids long — fully optimized for structural stability, using the most accurate thermodynamic model available (Fornace et al., 2026). For context, a 5,000-amino-acid protein has roughly possible mRNA encodings. The universe is about nanoseconds old. The combinatorial gulf between those numbers is precisely the problem this paper sets out to cross.

mRNA vaccines work by instructing your cells to produce a viral protein, triggering an immune response. The mRNA-1273 vaccine that protected millions during the COVID-19 pandemic, the BNT162b2 shot developed by Pfizer and BioNTech — these were designed, in part, by making careful choices about which genetic letters to use. But "careful choices" has historically meant heuristics, simplified models, and educated guesses. This paper proposes something more rigorous: a mathematically exact method that, for the first time, performs global sequence optimization against a physically accurate model of how RNA folds.

The Science

Every protein is built from a sequence of amino acids. And every amino acid is encoded by a codon — a triplet of RNA bases (A, U, G, or C). Because the genetic code is redundant, most amino acids can be spelled multiple ways. Leucine, for instance, can be encoded by six different codons. This redundancy means that for any given protein, there are exponentially many mRNA sequences that will produce exactly the same chain of amino acids.

This isn't just a theoretical curiosity. The choice of codon spelling has real biological consequences. An mRNA strand with a stable, well-folded secondary structure — meaning its bases pair up into tightly organized loops and stems, like a crumpled paper clip — is more resistant to degradation by cellular enzymes called RNases, and tends to be translated more efficiently into protein. Secondary structure stability is measured as a free energy (specifically, Gibbs free energy): the more negative the value, the more thermodynamically stable the structure. Designing an mRNA sequence therefore means navigating a combinatorial labyrinth to find the spelling that minimizes this free energy.

The challenge, computationally, is that you cannot just test every spelling. You cannot even test a tiny fraction of them. Previous approaches fell into three camps: dynamic programming methods that used simplified, inaccurate energy models; local search methods that mutated sequences one codon at a time without guarantees of convergence; and deep learning approaches that learned codon patterns from genomic data but operated as black boxes with limited physical interpretability.

Fornace, Wang, and Lindsey, working at Lawrence Berkeley National Laboratory and the University of California, Berkeley, take a different route (Fornace et al., 2026). They build on a recently developed tensor-based formulation of RNA secondary structure thermodynamics — a mathematical framework where the physical properties of every possible fold are encoded as a network of multi-dimensional arrays called tensors. The key insight is that the constraint "this sequence must encode a specific protein" can itself be expressed as a tensor train — a compact chain of matrices whose product encodes which RNA sequences are legal. By fusing these two tensor structures, the algorithm can simultaneously integrate over all possible sequences and all possible folds in a single coherent computation.

Figure 1: 
a. An example mRNA strand colored by codon (word of three consecutive bases), with an arrowhead marking the 3′ end.
The first and last codons (black) are the start and stop codons, while each interior codon codes for a specific amino acid.
b. Base pair diagram for an example secondary structure with the same sequence as (a), in which the strand is laid out horizontally from 5′ to 3′ and base pairs appear as arcs between bases.
Pseudoknots appear as crossing arcs in this type of diagram.
c. Secondary structure diagram equivalent to (b), formed by contorting (b) such that the backbone curves around clockwise, unpaired bases appear as ticks, and base pairs appear as short line segments.
d. Tensor network model for the partition function of the secondary structure shown in (b-c).
Each circle indicates a matrix associated with an unpaired base ii, while each rectangle indicates a four-legged tensor associated with a base pair i⋅ji\cdot j.
Each joining segment indicates an index to be summed over in order to compute the secondary structure partition function.
Figure 1: a. An example mRNA strand colored by codon (word of three consecutive bases), with an arrowhead marking the 3′ end. The first and last codons (black) are the start and stop codons, while each interior codon codes for a specific amino acid. b. Base pair diagram for an example secondary structure with the same sequence as (a), in which the strand is laid out horizontally from 5′ to 3′ and base pairs appear as arcs between bases. Pseudoknots appear as crossing arcs in this type of diagram. c. Secondary structure diagram equivalent to (b), formed by contorting (b) such that the backbone curves around clockwise, unpaired bases appear as ticks, and base pairs appear as short line segments. d. Tensor network model for the partition function of the secondary structure shown in (b-c). Each circle indicates a matrix associated with an unpaired base ii, while each rectangle indicates a four-legged tensor associated with a base pair i⋅ji\cdot j. Each joining segment indicates an index to be summed over in order to compute the secondary structure partition function. Source: Mark Fornace, Christina Wuyan Wang

The result is an algorithm that computes the partition function of the entire sequence-structure space — a quantity that captures, in one number, the collective thermodynamic weight of every valid mRNA sequence folded into every valid secondary structure. From that, sequences can be sampled exactly from a Boltzmann distribution — meaning the probability of drawing any given sequence is precisely proportional to , where is the free energy of that sequence. This is not an approximation. It is exact statistical mechanics applied to a combinatorially vast biological problem.

What They Found

The algorithm delivers on several fronts, and the benchmarks are striking.

Cost of Sequence Design vs. Sequence Analysis

Ratio of wall-clock time to compute the full design partition function (qψ) versus analyzing a single fixed sequence of equal length. Values near 1× mean design costs the same as analysis; the paper reports a ceiling of ≲4× across all tested lengths.

Cost of Sequence Design vs. Sequence Analysis
LabelValue
300 nt1.5
600 nt2
1500 nt2.8
3000 nt3.3
6000 nt3.8
15000 nt3.9

First, consider the computational cost. Analyzing a single fixed RNA sequence — computing its partition function over secondary structures — already requires time, where is the length of the sequence in nucleotides. The design problem, which must sum over all valid sequences simultaneously, might be expected to be far more expensive. In practice, Fornace et al. find that the cost overhead of design over analysis is less than for all tested problem sizes. Designing a sequence incurs roughly the same computational burden as analyzing four fixed sequences. That is a remarkably tight bound for a problem of this combinatorial scale.

Figure 7: 
Algorithm performance and observed complexities in computing qψq_{\psi} as a function of sequence length (in nucleotides (nt) on bottom and in amino acids (aa) on top), illustrating the effects of GPU acceleration and parallelization.
a. Wall clock time to compute qψq_{\psi}.
Inset: same, with linear axes.
b. Cost of computing qψq_{\psi} divided by the cost of computing qψ​(ϕ)q_{\psi}(\phi) for an equal length sequence, showing that design is within a cost factor of ≈4\approx 4 of analysis for this problem.
c. Speedup of parallelized and GPU algorithms over serial CPU.
d. Empirical computational complexity by approximating the slope of log⁡t\log t vs log⁡n\log n via backwards finite difference.
While all algorithms have a theoretical complexity of O​(n3)O(n^{3}), GPU acceleration ameliorates the empirical complexity to ≈O​(n2)\approx O(n^{2}) or lower for many problem sizes.
See Section 5b and Section S4f for more details.
Figure 7: Algorithm performance and observed complexities in computing qψq_{\psi} as a function of sequence length (in nucleotides (nt) on bottom and in amino acids (aa) on top), illustrating the effects of GPU acceleration and parallelization. a. Wall clock time to compute qψq_{\psi}. Inset: same, with linear axes. b. Cost of computing qψq_{\psi} divided by the cost of computing qψ​(ϕ)q_{\psi}(\phi) for an equal length sequence, showing that design is within a cost factor of ≈4\approx 4 of analysis for this problem. c. Speedup of parallelized and GPU algorithms over serial CPU. d. Empirical computational complexity by approximating the slope of log⁡t\log t vs log⁡n\log n via backwards finite difference. While all algorithms have a theoretical complexity of O​(n3)O(n^{3}), GPU acceleration ameliorates the empirical complexity to ≈O​(n2)\approx O(n^{2}) or lower for many problem sizes. See Section 5b and Section S4f for more details. Source: Mark Fornace, Christina Wuyan Wang

Second, GPU acceleration changes the practical complexity dramatically. While the theoretical complexity is , GPU-parallelized runs empirically approach for many problem sizes — meaning a 5,000-amino-acid protein (15,000 nucleotides) can be designed in approximately 7 minutes.

GPU Speedup Over Serial CPU for Sequence Design

Speedup factor of GPU-accelerated computation over serial CPU for computing the design partition function qψ, as a function of sequence length. Larger proteins benefit dramatically from GPU parallelization.

GPU Speedup Over Serial CPU for Sequence Design
LabelValue
300 nt2
600 nt5
1500 nt15
3000 nt30
6000 nt50
15000 nt80

Serial CPU computation is substantially slower; parallelization across CPUs and GPUs provides speedups of an order of magnitude or more.

Third, the quality of the designed sequences is demonstrably better than existing alternatives. When the researchers benchmark their method against four example systems, the sequences sampled from their distribution have substantially lower free energies (meaning more stable structures) than sequences drawn uniformly at random from the space of valid codon sequences, . They also compare against sequences optimized under a simplified additive free energy model — the kind of approximation used by previous dynamic programming methods. The simplified model's "optimal" sequences look worse under the true, detailed energy model. The point is not merely that this algorithm is faster; it is that simpler models were systematically misleading.

Importantly, the paper argues that sampling is more useful than minimization. Finding the single minimum-free-energy sequence — the "best" spelling — is tempting, but can yield pathological sequences that are thermodynamically extreme and potentially brittle in practice. Sampling from the Boltzmann distribution instead produces an ensemble of sequences that balance stability with diversity, giving downstream experimentalists a rich portfolio of candidates to filter and test. The researchers demonstrate exact computation of marginal statistics across this ensemble: for any position in the protein, you can compute exactly which codon is most likely to appear, and with what probability. You can compute the expected base pairing probability at every nucleotide site. These are not approximations but exact consequences of the underlying probability model.

Fraction of Unpaired Bases by Design Method

Equilibrium fraction of unpaired bases f(ϕ) for sequences generated by different methods. Lower values indicate more stable, better-folded structures. Results averaged across four benchmark systems from the paper.

Fraction of Unpaired Bases by Design Method
LabelValue
Uniform random (𝒰)0.52
Simplified model optimum (ϕ⁰min)0.38
Simplified model sample (𝒟⁰)0.44
Full model sample (𝒟)0.33
Full model optimum (ϕmin)0.28

The framework also natively supports soft constraints — design objectives layered on top of the hard requirement of amino acid coding. The codon adaptation index (CAI), for example, rewards codons that appear frequently in a host organism's genome, on the theory that the cell's translational machinery will handle them more fluently. Codon pair bias (CPB) rewards certain adjacent codon combinations. Both can be incorporated as tunable free energy bonuses in the tensor train formulation, without modifying the core algorithm at all. The researchers demonstrate codon frequency matching via a fixed-point iteration method that converges reliably within a small number of iterations.

Figure 8: 
Demonstration of codon frequency matching via fixed point iteration with Anderson acceleration (with no history size limit).
Single codon frequencies were fit for each of benchmark systems 1-4 (Section S5a), with the target frequencies matching those used to construct CAI bonuses.
Calculations were run in single precision using up to two GPUs.
a. Maximum absolute logarithmic error (∥log⁡(b/b∗)∥∞\lVert\log(b/b_{*})\rVert_{\infty}) as a function of iteration.
Iterations were terminated once this error was below rtol=0.002r_{\mathrm{tol}}=0.002.
b. Same as (a), with yy-values plotted logarithmically.
Figure 8: Demonstration of codon frequency matching via fixed point iteration with Anderson acceleration (with no history size limit). Single codon frequencies were fit for each of benchmark systems 1-4 (Section S5a), with the target frequencies matching those used to construct CAI bonuses. Calculations were run in single precision using up to two GPUs. a. Maximum absolute logarithmic error (∥log⁡(b/b∗)∥∞\lVert\log(b/b_{*})\rVert_{\infty}) as a function of iteration. Iterations were terminated once this error was below rtol=0.002r_{\mathrm{tol}}=0.002. b. Same as (a), with yy-values plotted logarithmically. Source: Mark Fornace, Christina Wuyan Wang

Why This Changes Things

The significance here runs deeper than computational efficiency. For years, a frustrating gap has existed between what physicists know about RNA thermodynamics and what computational biologists could actually use in sequence design. The most accurate free energy models — the "nearest-neighbor" thermodynamic parameters developed by the Turner lab and others, encoded in software like NUPACK and Vienna RNA — are routinely used to analyze fixed sequences. But designing sequences against those models was considered computationally intractable at scale. The field compensated with simpler approximations: additive base-pair bonuses, codon-by-codon greedy choices, or machine learning surrogates trained on secondary structure outputs.

This paper closes that gap. The tensor-based framework of Fornace et al. makes the fully detailed energy model tractable for design — not by approximating the model, but by restructuring the computation so that sequences and structures are explored together in one integrated dynamic program. The mathematical machinery is elegant: the codon constraints are expressed as a tensor train (a chain of matrix multiplications whose trace counts valid sequences), which can be fused with the structural tensor network without changing the topology of the underlying dynamic programming recursion. The dimensionality of the blocks changes, but the algorithm's logical skeleton stays the same.

Figure 2: 
a. Conceptual idea of partition function dynamic programs, in which an additional 3′-most base jj is added and incorporated.
That base may remain unpaired (orange), or it may close a base pair i⋅ji\cdot j originating from any earlier base i<ji<j (blue).
Considering all possibilities incurs an O​(n)O(n) summation for the recursion.
Recursing through all O​(n2)O(n^{2}) subsequences gives an overall O​(n3)O(n^{3}) cost.
b. Block matrix layout implied by our dynamic programs for sequence sampling.
Each block Qi,j,Q_{i,j}, is the partition function matrix of subsequence [i​:​j)[i\mathord{:}j) if i≤ji\leq j or else the partition function matrix of [j​:​i)[j\mathord{:}i) constrained such that bases jj and i−1i-1 are paired (or unpaired, in the case of j=i−1j=i-1).
Compared to the simpler problem of sequence analysis, in which each recursion block Qi,jQ_{i,j} is square Fornace2025-new, the different dimensionalities furnished from codon constraints (Fig. 3) imply non-square blocks.
Figure 2: a. Conceptual idea of partition function dynamic programs, in which an additional 3′-most base jj is added and incorporated. That base may remain unpaired (orange), or it may close a base pair i⋅ji\cdot j originating from any earlier base i<ji<j (blue). Considering all possibilities incurs an O​(n)O(n) summation for the recursion. Recursing through all O​(n2)O(n^{2}) subsequences gives an overall O​(n3)O(n^{3}) cost. b. Block matrix layout implied by our dynamic programs for sequence sampling. Each block Qi,j,Q_{i,j}, is the partition function matrix of subsequence [i​:​j)[i\mathord{:}j) if i≤ji\leq j or else the partition function matrix of [j​:​i)[j\mathord{:}i) constrained such that bases jj and i−1i-1 are paired (or unpaired, in the case of j=i−1j=i-1). Compared to the simpler problem of sequence analysis, in which each recursion block Qi,jQ_{i,j} is square Fornace2025-new, the different dimensionalities furnished from codon constraints (Fig. 3) imply non-square blocks. Source: Mark Fornace, Christina Wuyan Wang

The implications for mRNA medicine are real. mRNA therapeutics are no longer solely vaccines; they are increasingly proposed for cancer immunotherapy, rare genetic diseases, and protein replacement therapy. In each case, the design of the mRNA sequence is a foundational step that affects how much protein is produced, for how long, and how safely. Methods that can rigorously optimize this step — not approximately, but exactly — have direct translational value. They also produce interpretable outputs: the marginal codon probabilities, base pairing maps, and free energy landscapes are scientifically meaningful quantities, not black-box scores.

The approach also generalizes. While the paper focuses on single-stranded mRNA design for protein-coding applications, the authors note that the framework extends to non-coding regions and, in principle, to broader classes of sequence-based objectives. Any objective that can be expressed as a tensor train — a broad class — can be folded into the same algorithm. This makes it a platform, not just a solution to one specific problem.

What's Next

The authors are candid about limitations. The current algorithm handles unpseudoknotted secondary structures — folds where base pairs don't cross each other when drawn on a flat diagram. This is a standard and well-motivated assumption (pseudoknots are relatively rare and computationally intractable in general), but it means the algorithm cannot capture the full richness of RNA three-dimensional structure. Extending to pseudoknots, or to multi-strand systems, remains an open problem.

The paper also focuses on the coding region of the mRNA. Real therapeutic mRNAs include untranslated regions, cap structures, and poly-A tails that influence stability and expression. Incorporating these non-coding regions is noted as straightforward in principle but is left for future work.

There is also the question of experimental validation. The benchmarks in this paper are computational: free energy comparisons across methods, convergence of fixed-point iterations, timing measurements. The proof that these computationally optimized sequences actually perform better in cells — producing more protein, surviving longer, eliciting stronger immune responses — requires wet-lab experiments that have not yet been reported. That validation gap is not a criticism of the paper's contributions; it is the natural next step. The researchers have built a rigorous engine. What it produces in a cell remains to be measured.

More broadly, this work sits at the intersection of two accelerating trends. First, mRNA medicine is expanding rapidly: the success of COVID-19 mRNA vaccines has unlocked massive investment in the platform, and dozens of clinical trials are underway for mRNA-based cancer vaccines, flu shots, and rare disease therapies. Second, GPU-accelerated scientific computing is making previously intractable physical simulations routine. The confluence of those trends — better hardware, better math, and a burning medical need — makes the timing of this paper feel significant.

The algorithm Fornace, Wang, and Lindsey have developed is not the final word on mRNA sequence design. But it is the first time the field has had a tool that is simultaneously exact, physically rigorous, computationally tractable at therapeutic scales, and statistically interpretable. In a domain where every percentage point of stability can mean the difference between a viable drug and a failed one, that combination matters. The black box era of codon optimization may be drawing to a close.