Skip to content

Menu

WorksComputer Science

Predictor-Guided Latent Space Codon Optimization for Maximizing Protein Expression

Download PDFView on arXiv

Ask your agent about this work

Your agent reads this work through Valency, with its citations and similar works. Paste this at the start of a chat.

Use the Valency MCP. Work: W_hywec47v. Fetch it with get_paper_by_id, then find its nearest works with find_similar_papers and tell me what it adds.

Works with any MCP client. Not connected yet? Connect your agent

Abstract

Codon optimization, the process of selecting synonymous codons to improve mRNA translation efficiency and protein expression, is central to therapeutic protein production and mRNA vaccines, yet it remains a hard problem. The design space is discrete and combinatorially large, precluding gradient-based methods, and existing tools rely on heuristic proxies (e.g., Codon Adaptation Index or GC-content) that poorly capture true expression. We introduce Latent-Space Codon Optimization (LSCO), which recasts this discrete problem as a continuous one by mapping sequences into the latent space of a pretrained mRNA language model, enabling efficient gradient-based search. LSCO combines four components: a data-driven expression objective from an uncertainty-aware predictor, a Minimum-Free-Energy regularizer for structural stability, a naturalness prior from a protein-to-codon back-translation model, and constrained decoding for protein fidelity. On a real-world, wet-lab antibody expression dataset, LSCO outperforms simple frequency-based, as well as modern deep generative baselines in predicted expression, while retaining suitable biophysical properties.

Introduction

Synonymous codons, i.e., nucleotide triplets that redundantly encode the same amino acid, create a vast design space for tailoring mRNA without changing the associated protein [7]. This space grows combinatorially with protein length: a therapeutic antibody such as trastuzumab (made of a 449 and 214 amino acid heavy and light chains, respectively) admits on the order of 1030010^{300} synonymous encodings [8]. Codon choice within this space strongly affects translation efficiency and protein yield, so codon optimization is a key lever in applications from monoclonal antibody (mAb) manufacturing to mRNA therapeutics [29, 33].

Codon optimization faces two challenges. First, the synonymous space is discrete and combinatorially vast, ruling out exhaustive search and gradient-based methods. Second, the true objective, an accurate mRNA-to-protein expression model, is inaccessible: the biology is only partly understood and labelled data is scarce, forcing reliance on heuristic proxies (CAI, GC-content, codon-pair bias, “naturalness”) that enable tractable algorithms, but often fail to capture true protein expression [36, 9]. Note that, while the optimization objective is formulated in terms of protein expression, experimental validation typically uses A280 absorbance as a practical proxy for protein yield and abundance [32]. To address both challenges, we propose Latent-Space Codon Optimization (LSCO), which recasts codon optimization as a continuous, gradient-based problem grounded in a data-driven expression objective. LSCO optimizes a continuous latent representation derived from a pretrained mRNA language model, bypassing discrete search, and integrates four components: i) an expression objective from an uncertainty-aware predictor trained on mRNA–protein data that penalizes out-of-distribution drift during optimization; ii) a Minimum Free Energy (MFE) regularizer that avoids near-adversarial, unstable sequences; iii) a naturalness prior from a protein-to-codon back-translation model, learned from the Observed Antibody Space (OAS) data [31], that keeps candidates within plausible codon usages; iv) constrained decoding that ensures protein fidelity. Our contributions can be summarized as follows:

  • We propose LSCO, a continuous latent-space codon optimizer featuring the four novel components listed above that replaces heuristic proxies with reliable expression surrogate as main objective.

  • On a real-world, wet-lab antibody expression dataset, LSCO outperforms frequency-based and modern deep generative baselines on predicted expression, as confirmed by independent held-out predictors, while retaining structural stability and host-appropriate GC content.

  • Ablations show the MFE regularizer offers a controllable expression–stability trade-off, and both the pretrained latent space (vs. a direct input-space search) and the naturalness prior drive the gains.

Background and Related Work

Problem Setup. A protein sequence of length LL is denoted by a=(a1,…,aL)\mathbf{a} = (a_1, \ldots, a_L), where ai∈Aa_i \in\mathcal{A} are the 20 canonical amino acids. Each amino acid aia_i is encoded by many synonymous mRNA sequences c=(c1,…,cL)\mathbf{c} = (c_1, \ldots, c_L), with ci∈C(ai)c_i \in\mathcal{C}(a_i) being the synonymous codons for aia_i. We represent codons in one-hot form R∈[0,1]L×64R \in[0, 1]^{L \times64}, where ri\mathbf{r}_i is the one-hot vector encoding of codon cic_i. Codons can be viewed as drawn from a ci∼Categorical⁡(r~i)c_i \sim\operatorname{Categorical}(\tilde{\mathbf{r}}_i) distribution, with probabilities r~i\tilde{\mathbf{r}}_i. Codon optimization searches the combinatorial design space of codons mapping to the same protein, S(a)=C(a1)×⋯×C(aL)\mathcal{S}(\mathbf{a}) = \mathcal{C}(a_1) \times\cdots\times\mathcal{C}(a_L), for an mRNA sequence c⋆\mathbf{c}^{\star} that maximizes downstream protein expression,

c⋆=arg⁡max⁡c∈S(a) Φ(c),(1)\mathbf{c}^{\star} = \underset{\mathbf{c} \in\mathcal{S}(\mathbf{a})}{\arg\max}\ \Phi(\mathbf{c}), \tag*{(1)}

where Φ\Phi is a surrogate mRNA-to-protein expression model. Both the inaccessibility of Φ\Phi (underlying biology is only partly understood and labelled data is scarce) and the discrete, combinatorial nature of S(a)\mathcal{S}(\mathbf{a}) make this problem intractable for exhaustive or gradient-based search [30, 3].

Related Work. Codon optimization has evolved from frequency-based tools (JCat [16], OPTIMIZER [35]) that maximize CAI and codon-pair bias but neglect determinants such as mRNA stability [48, 33], to deep generative mRNA language models pre-trained to learn codon usage from large scale datasets without optimizing any sequence properties post-hoc (CodonBERT [25], CodonTransformer [13], GEMORNA [47]) and per se multi-objective post-hoc sequence optimizers (RNop [15], ICOR [20]). Despite advances in sequence modeling and optimization, these methods generally optimize surrogate sequence features rather than protein expression, creating a potential gap between optimization objectives and the desired biological outcome.

General-purpose methods for optimizing discrete sequences (not just codon optimization) differ in search space geometry (where they search) and trust mechanism (how they avoid “reward hacking”, i.e., exploiting an unreliable surrogate off-distribution). Sequence-space methods operate directly on sequences or distributions over them [10, 5, 40, 2], and evolve candidates by mutation, selection and screening [10, 44, 46]; whereas latent-space methods operate in a learned continuous space shared by a decoder and a property prediction model [14, 41], with latent-space Bayesian optimization adding a probabilistic surrogate for uncertainty-aware search [37, 17, 1]. We include an extended version of related work in Appendix A.

LSCO belongs to the latent-space family and introduces three novel components: (i) it enforces realistic codon-usage priors using a mRNA foundation autoencoder model pretrained on a large scale dataset; (ii) it constructs a meaningful expression surrogate by leveraging a predictor trained on a domain-specific dataset, instead of relying on heuristic proxies, and embeds this within a multi-criteria optimization objective that further balances stability, naturalness and protein fidelity; (iii) it penalizes out-of-distribution drift during optimization via epistemic uncertainty estimates obtained from a deep ensemble version of the expression surrogate predictive model.

Latent-Space Codon Optimization

We propose Latent-Space Codon Optimization (LSCO) to address the challenges of codon optimization. First, LSCO recasts the discrete search into a continuous one: rather than searching the mRNA sequences space directly, we optimize codon-level embeddings in the latent space of a pretrained mRNA language model, then decode them back to the discrete sequence space. Second, instead of relying on heuristic proxies such as CAI or naturalness, we train a model Ψ:[0,1]L×64→R\Psi: [0,1]^{L \times64} \to\mathbb{R} to predict mRNA-to-protein yield, and use a utility over its predictions, UΨU_{\Psi}—an uncertainty-aware, saturating transform of Ψ\Psi—as main objective. Since optimizing expression alone can yield near-adversarial sequences with poor stability or GC content, we add two regularizers: a predicted Minimum Free Energy term, MFE:[0,1]L×64→R\mathrm{MFE} : [0,1]^{L \times64} \to\mathbb{R}, and a naturalness prior UnatU_{\mathrm{nat}}, together producing sequences that are highly expressed, stable, and within a host-appropriate GC range. The overall LSCO framework is depicted in Figure 1. Given a target protein aa, the LSCO objective is

LSCO framework

Figure 1. LSCO framework. (a) mRNA sequences are mapped to codon-latent space using a pretrained variational masked language model. (b) mRNA property predictor reuses the pretrained encoder in (a) and takes the soft and continuous version of the discrete sequence. (c) We generate a natural mRNA sequence using a pretrained protein-to-codon back-translation model, whose representation znatz_{\mathrm{nat}} from the pretrained encoder in (a) is used as the naturalness prior. (d) Latent representations zz are optimized with respect to a data-driven expression predictor Ψ\Psi, an MFE predictor MFE, and a naturalness prior znatz_{\mathrm{nat}} from (c). Constrained decoding ensures valid codon choices, preserving the target protein sequence. The result is an optimized mRNA that balances expression and stability.

z^=arg⁡max⁡z⟨λΨ⋅UΨ(D(z))−λMFE⋅MFE(D(z))+λnat⋅Unat(z)⟩s.t.D(z)∈S(a),(2)\hat{z} = \underset{z}{\arg\max}\left\langle\lambda_{\Psi} \cdot U_{\Psi}(D(z)) - \lambda_{\mathrm{MFE}} \cdot\mathrm{MFE}(D(z)) + \lambda_{\mathrm{nat}} \cdot U_{\mathrm{nat}}(z) \right\rangle\quad\text{s.t.}\quad D(z) \in S(a), \tag*{(2)}

where positive λΨ\lambda_{\Psi}, λMFE\lambda_{\mathrm{MFE}}, λnat\lambda_{\mathrm{nat}} re-weight expression, MFE, and the naturalness prior; DD is the latent-to-sequence decoder (generator); and S(a)S(a) is the synonymous codons space for given protein aa. LSCO builds on four main components (Figure 1; full details in Appendix § 7)

i) Variational mRNA language model: a bidirectional transformer we pretrain on the curated OAS-mRNA dataset [45] (15M+ sequences) with a Variational Masked Auto-Encoder objective [19]. Its encoder E:RL×64→ZLE : \mathbb{R}^{L \times64} \to\mathcal{Z}_{L} maps codons to a continuous latent space ZL\mathcal{Z}_{L}, while its decoder D:ZL→RL×64D : \mathcal{Z}_{L} \to\mathbb{R}^{L \times64} reconstructs codons through a temperature-τ\tau softmax, that can yield a continuous relaxation r~τ\tilde{r}_{\tau} of the codon sequence that is a smooth, differentiable surrogate for the discrete mRNA.

ii) Expression predictor: a deep learning model Ψ:[0,1]L×64→R\Psi: [0,1]^{L \times64} \to\mathbb{R}, built on top of the pretrained encoder EE and trained on mRNA–protein expression data, that takes r~τ\tilde{r}_{\tau} as inputs rather than ZL\mathcal{Z}_{L} (which keeps prediction tied to the sequence and enables constrained decoding). We implement Ψ\Psi as a deep ensemble [24] of M=10M=10 members (Appendix C.5), which outputs an ensemble mean μΨ\mu_{\Psi} and standard deviation σΨ\sigma_{\Psi}. The expression-related optimization utility in Eq. (2) is a Lower Confidence Bound (LCB) constructed on these predictions

UΨ(r~τ)=μΨ(r~τ)−λLCBσΨ(r~τ),(3)U_{\Psi}(\tilde{r}_{\tau}) = \mu_{\Psi}(\tilde{r}_{\tau}) - \lambda_{\mathrm{LCB}} \sigma_{\Psi}(\tilde{r}_{\tau}), \tag*{(3)}

which maximizes protein yield while penalizing high-uncertainty, out-of-distribution designs.

iii) Minimum Free Energy (MFE) regularizer: since optimizing expression alone in Eq. (2) might yield unstable sequences, we add a regularizing terms based on a predictor MFE:[0,1]L×64→R\mathrm{MFE} : [0,1]^{L \times64} \to\mathbb{R} (similar architecture as Ψ\Psi, no ensemble), trained on ViennaRNA-computed MFE labels [27]; lower MFE implies more stable structure [18].

iv) Naturalness prior: We pretrain a CodonBERT back-translation model [12, 25] on the OAS-mRNA data. This model learns a natural conditional codon distribution p(c∣a)=∏ip(ci∣a)p(c|a) = \prod_i p(c_i|a) and produces a plausible reference mRNA sequence cnat=arg⁡max⁡cp(c∣a)c_{\mathrm{nat}} = \arg\max_c p(c|a). We add a naturalness-based regularizer that penalizes sequences far from znatz_{\mathrm{nat}} in the latent-space to keep them within biologically plausible codon usage Unat(z)=−∥E(c)−E(cnat)∥2=−∥z−znat∥2U_{\mathrm{nat}}(z) = -\lVert E(c) - E(c_{\mathrm{nat}})\rVert_2 = -\lVert z - z_{\mathrm{nat}}\rVert_2.

Finally, constrained decoding is implemented to guarantee protein fidelity: a per-position validity mask sets non-synonymous codon logits to −∞-\infty before applying temperature-τ\tau softmax, in order to enforce r~τ∈S(a)\tilde{r}_{\tau} \in S(a) while the optimizer explores synonymous codon choices. More details about LSCO implementation and a LSCO pseudocode (Algorithm 1) are provided in Appendix § 7.

Experiments

We benchmark LSCO against other methods from three different families: i) frequency-based, host-preferred selection [36]; ii) a maximum-naturalness CodonBERT back-translation model [25]; and iii) modern deep generative models/optimizers, including ICOR [20], CodonTransformer [13], and GEMORNA [47]. Random synonymous codon substitution and the Variational Masked Auto-Encoder (VMAE) generator (without optimizing for predicted expression) are included to serve as lower-bound references. We assess generated mRNA sequences using four criteria: protein yield, measured via predicted absorbance at 280 nm (A280) from our native 1D predictor Ψ\Psi and two independent held-out 1D and 2D predictors; thermodynamic stability via Minimum Free Energy (MFE) computed via the ViennaRNA package [27]; host compatibility via GC content (GC%) [23]; and codon adaptation via the Codon Adaptation Index (CAI), reported as a conventional, but coarse, proxy for expression.

LSCO Evaluation. We evaluate LSCO and baselines on 54 starting monoclonal antibodies (mAbs), selected based on their potential margin of improvement and stratified by target antigen (full details on the selection in Appendix § 7). We score every optimized design by predicted A280 with the native 1D predictor and the two independent held-out evaluators, an external 1D transformer with a different backbone and a structure-aware 2D GNN. We test two LSCO variants: LSCO-LCB, optimizing only expression UΨU_{\Psi} and naturalness UnatU_{\mathrm{nat}} (with λMFE=0\lambda_{\mathrm{MFE}} = 0), and LSCO-LCB+MFE, which adds MFE regularization (λMFE=0.1\lambda_{\mathrm{MFE}} = 0.1 unless otherwise specified). As shown in the top row of Figure 2, LSCO attains the highest predicted A280 across both 1D internal and external predictors and scores comparably on the 2D GNN evaluator. The general agreement among the predictors, despite their different inductive biases, indicates the gains are not just an artifact of the optimizer exploiting its own surrogate, but reflect genuinely higher predicted expression as a direct benefit of optimizing expression in a continuous latent space rather than proxy surrogates. The bottom row shows the stability/host-compatibility trade-off. The expression-only LSCO–LCB variant maximizes A280 but delivers weaker MFE than strong baselines like CodonTransformer and GEMORNA. Adding the MFE regularizer (LSCO–LCB+MFE) recovers stability by driving MFE substantially lower and nudging GC and CAI upward, yet well within host-appropriate ranges, at a modest expression cost.

Figure 2. Optimized sequence comparison on 54 mAbs. Top row: predicted A280 from three models: LSCO’s native 1D transformer, an external 1D transformer, and an external structure-aware 2D GNN. LSCO variants attain the highest or comparable expression across all three. Bottom row: biophysical metrics on heavy + light chains: MFE (lower = more stable), GC% (green band = host-appropriate range), CAI. LSCO-LCB+MFE variant recovers stability and nudges GC/CAI upward at a modest expression cost, staying within host-appropriate ranges.

Ablation and Sensitivity Studies. We run two additional experiments on LSCO components: a sensitivity analysis sweeping over different MFE weights, and an ablation study aimed at isolating the effect of pretrained VMAE latent space search vs. direct input-space search. Both report predicted A280 from the three predictors plus MFE, GC%, and CAI.

The MFE Sensitivity block in Table 1 sweeps λMFE\lambda_{\mathrm{MFE}} regularization weight while toggling λLCB\lambda_{\mathrm{LCB}}, which sets the uncertainty penalty strength in Eq. (3). The expression-only variant (λMFE=0\lambda_{\mathrm{MFE}} = 0) gives the highest A280 across all predictors but the weakest stability and lowest GC. A light penalty (λMFE=0.1\lambda_{\mathrm{MFE}} = 0.1) drives MFE substantially lower and lifts GC and CAI into the host-appropriate range at a modest expression cost. Larger weights (λMFE=1\lambda_{\mathrm{MFE}} = 1) yield no further stability. Enabling the uncertainty penalty (λLCB=1\lambda_{\mathrm{LCB}} = 1) only slightly lowers A280 while keeping the optimization from drifting off-distribution. Thus, we set λMFE=0.1\lambda_{\mathrm{MFE}} = 0.1, λLCB=1\lambda_{\mathrm{LCB}} = 1 for LSCO–LCB+MFE (Figure 2).

StudySpaceλMFE\lambda_{\mathrm{MFE}}λLCB\lambda_{\mathrm{LCB}}λnat\lambda_{\mathrm{nat}}1D Internal1D External2D ExternalMFEGC%CAI
MFE SensitivityLSCO000.019.585 ± 0.2184.518 ± 0.2233.492 ± 0.203−235.187 ± 3.55553.303 ± 0.4230.816 ± 0.008
010.019.156 ± 0.2414.400 ± 0.2543.485 ± 0.212−236.711 ± 3.60353.601 ± 0.3900.815 ± 0.009
0.100.018.180 ± 0.2373.900 ± 0.2243.175 ± 0.217−266.274 ± 2.78357.756 ± 0.2850.830 ± 0.009
0.110.017.858 ± 0.2353.935 ± 0.2653.099 ± 0.187−267.050 ± 3.21157.916 ± 0.3000.837 ± 0.008
100.018.065 ± 0.2323.887 ± 0.2003.319 ± 0.201−263.765 ± 3.12258.003 ± 0.3040.825 ± 0.009
110.017.899 ± 0.2563.951 ± 0.2712.923 ± 0.182−266.365 ± 3.38158.018 ± 0.3170.838 ± 0.008
Naturalness AblationLSCO0109.024 ± 0.2474.564 ± 0.2403.248 ± 0.193−236.491 ± 3.90053.428 ± 0.4650.808 ± 0.008
0.1107.956 ± 0.2083.885 ± 0.2493.259 ± 0.254−265.006 ± 3.06657.860 ± 0.3050.836 ± 0.009
Search-Space AblationDISO010.018.547 ± 0.3144.423 ± 0.2403.220 ± 0.192−239.578 ± 3.90453.594 ± 0.4610.829 ± 0.007
0108.528 ± 0.3054.393 ± 0.2303.036 ± 0.174−239.561 ± 3.67853.688 ± 0.4210.829 ± 0.007
0.110.017.631 ± 0.2683.828 ± 0.2412.939 ± 0.206−264.987 ± 3.62557.428 ± 0.3530.839 ± 0.010
0.1107.598 ± 0.2463.840 ± 0.2472.923 ± 0.187−264.994 ± 3.63957.382 ± 0.3550.840 ± 0.010

Table 1. Sensitivity and ablation studies. Predicted protein yield (A280) from the internal 1D Transformer and two held-out evaluators, together with biophysical metrics for the joint heavy and light chains, on the same 54 starting mAbs as Figure 2. Values are means with 95% confidence bands. LSCO searches in the pretrained VMAE latent space, whereas DISO optimizes codon logits directly in input space. The λMFE\lambda_{\mathrm{MFE}} and λLCB\lambda_{\mathrm{LCB}} columns respectively control MFE regularization and the uncertainty penalty; λnat=0\lambda_{\mathrm{nat}} = 0 denotes removal of the naturalness prior. Overall, λMFE=0.1\lambda_{\mathrm{MFE}} = 0.1 provides good expression–stability trade-off, and LSCO generally outperforms DISO.

The Search-Space Ablation block of Table 1 compares LSCO against Direct Input-Space Optimization (DISO), which optimizes per-position codon logits directly, with no VMAE decoder in the loop, sharing all else with LSCO (details in Appendix § 9). LSCO generally exceeds DISO on predicted A280 across evaluators and on biophysical metrics, showing that optimizing in the pretrained latent space is beneficial. Ablating the naturalness prior (λnat=0\lambda_{\mathrm{nat}} = 0), corresponding to the Naturalness Ablation block of Table 1, leaves the native predictor’s A280 largely unchanged but degrades the held-out 2D-GNN score—its expected signature as an on-manifold regularizer that keeps designs plausible to independent evaluators rather than inflating the optimizer’s own objective.

Conclusion

We introduced Latent-Space Codon Optimization (LSCO), which recasts codon optimization as a continuous, data-driven search in the latent space of a pretrained mRNA language model, steered by an uncertainty-aware expression predictor, MFE regularization, a naturalness prior, and constrained decoding to guarantee protein fidelity. On antibody data, LSCO outperforms frequency-based and modern deep generative methods on predicted expression from internal and two external models. Ablation and sensitivity studies demonstrate the benefits of balancing translation efficiency (A280) and stability (MFE) and operating in the pretrained VMAE latent space. As reliable mRNA–protein expression data are scarce, our evaluation relies on predicted rather than empirical yield. Future work will include wet-lab validation and design of a lab-in-the-loop Bayesian optimization framework.

Extended Related Work

Codon Optimization Codon optimization is a longstanding challenge in synthetic biology and biotechnology, aiming to boost recombinant protein expression by tailoring gene sequences to a host’s codon preferences. A visual depiction of the codon optimization problem is provided in Figure 3. Early strategies focused heavily on maximizing the use of highly frequent codons within the host organism, leading to tools like JCat [16] and OPTIMIZER [35] that emphasize codon adaptation index (CAI) and codon pair bias as key metrics. However, such traditional approaches have shown limitations, including insufficient attention to other genomic features such as mRNA stability and resulting protein expression [48, 11, 33].

Figure 3. Generative Codon optimization problem. Starting from a protein sequence, we navigate the combinatorial codon design space by mapping to and optimizing in a continuous latent space. LSCO integrates differentiable predictors for expression and stability, a naturalness prior, and constrained decoding to produce host-compatible, high-expression mRNA sequences.

Recent advances have seen the incorporation of deep learning into the codon optimization pipeline. Pretrained mRNA language models based on transformer architectures, such as CodonBERT [25], CodonTransformer [13] and GEMORNA [47], leverage large-scale, multi-species datasets to learn complex codon usage patterns across diverse organisms via amino-acid–codon pair representations and novel tokenization, ensuring species specificity and preservation of regulatory elements. Similarly, RNop [15] employs a suite of custom loss functions that target fidelity, tRNA availability, mRNA secondary structure, and codon adaptation within a transformer architecture. Other recent work further leverages recurrent networks and active learning to improve translational efficiency across expression systems [20, 26]. These advances achieve superior computational efficiency, fidelity, and improved protein expression compared to earlier methods. Comparative analyses have also highlighted the importance of integrating multiple metrics in the objective, such as CAI, GC content, mRNA folding energy, and codon pair bias, rather than relying on single-metric approaches [48].

Discrete Sequence Optimization Methods for optimizing discrete sequences vary along two axes. The first is the search space geometry: whether the optimizer works directly in sequence space, or in a learned continuous latent space that is decoded back into sequences. The second is the trust mechanism: what stops the optimizer from exploiting the surrogate model where it is unreliable, i.e., on out-of-distribution designs (e.g., via a conservative surrogate, posterior uncertainty, etc.). We organize prior work by search space geometry, and comment on the trust mechanism in each case.

Sequence-Space Search The first geometry operates directly on sequences (or distributions over them). Population-based methods evolve candidates through mutation and selection: Genetic Algorithms (GA) [10] are simple but sample-inefficient when evaluations are costly [42], and model-based variants add a learned model to screen proposals [44] or guide mutation [46]. Estimation-of-distribution methods instead maintain a learned distribution qθ(x)q_{\theta}(x) over sequences, repeatedly sampling, reweighting toward high fitness, and refitting [5, 6]. The VAE in [6] acts only as a density prior to keep sampling on the same manifold, so the search still lives in sequence space. A second line of work trains a fitness surrogate and runs gradient ascent on a continuous relaxation of the sequence. This approach can fail miserably as the surrogate tends to over-predict on the very inputs the optimizer discovers, since they drift off the training distribution: a failure mode known as reward hacking [40, 39, 22]. The proposed remedies adjust the trust mechanism rather than the geometry: conservative objective models regularize the surrogate to under-predict off-distribution [40]; Reinforcement Learning methods generate tokens under a surrogate reward with per-round model selection [2]; and Bayesian optimization over string kernels or embeddings uses posterior uncertainty and trust regions [4].

Latent-Space Optimization The second geometry learns a continuous latent space, shared by a decoder that reconstructs sequences and a model that predicts their properties, and optimizes in that latent space [14, 21, 41]. Latent-Space Bayesian Optimization (LSBO) adds a probabilistic surrogate, typically a Gaussian process or Deep Ensemble, to quantify epistemic uncertainty and balance exploration-exploitation across rounds of propose, test, and update [37, 17, 1]. The upside is that a smooth, low-dimensional space makes gradient-based and Bayesian search easy to apply and additionally acts as a prior that keeps candidates realistic. The downside is the extra decoder, which needs to be trained and can potentially mis-decode, creating the chance for a design to fall off-distribution. ‘Reward hacking’ is therefore not unique to sequence-space search, and motivates the use of uncertainty safeguards.

Our approach LSCO belongs to the latent-space family but differs in three ways. First, we optimize for predicted expression directly, not proxy metrics, within a multi-criteria objective that also weighs mRNA stability and naturalness while maintaining target protein fidelity. Second, rather than training a task-specific autoencoder, we pre-train and reuse an mRNA foundation model and conduct search in its latent space, inheriting realistic codon-usage priors. Third, our expression surrogate model is trained as a deep ensemble, whose model/epistemic uncertainty steers the search away from unreliable regions.

Implementation details

Back-translation model The back-translation model uses the standard BERT architecture with absolute position embeddings, configured with a hidden dimension of 777, 9 transformer layers, 21 attention heads per layer, a feed-forward dimension of 777, and a maximum sequence length of 2048 tokens. It operates over a joint vocabulary of 91 tokens: 27 amino-acid tokens (20 canonical amino acids plus 7 special tokens [BOS], [EOS], [CLS], [SEP], [MASK], [PAD], and [UNK]) as the input alphabet, and 64 codon tokens (one per sense codon) as the output alphabet. During training, amino-acid input tokens are masked with probability p=0.2p = 0.2.

Variational mRNA language model We use a 12-layer ModernBERT architecture [43] with Rotary Position Embeddings (RoPE) [38]. The model uses a vocabulary of 70 tokens (64 codons plus 6 special tokens [BOS], [EOS], [CLS], [SEP], [MASK], and [PAD]), a hidden dimension of 768, 12 attention heads per layer, and a feed-forward dimension of 3072. The VMAE masking ratio is set to p=0.15p = 0.15. The model is split at layer k=6k = 6, using the first six layers as the encoder EE and the remaining six as the decoder DD. We use a standard Gaussian prior N(0,I)\mathcal{N}(0,I) over the latent variables z∈Z\mathbf{z} \in\mathcal{Z}. Pretraining is performed for 40 epochs using AdamW [28] with a batch size of 256, an initial learning rate of 10−410^{-4}, linear warmup over the first 10% of training steps, and cosine learning-rate decay thereafter.

Expression predictor We implement Ψ\Psi as a dual-chain transformer that models heavy and light chain mRNA separately, then aggregates the two chain representations using Multiple Instance Learning (MIL) attention before a final linear layer predicts antibody expression. In practice, we found that reusing the pretrained language model encoder EE as the backbone for Ψ\Psi improves the expression prediction. To enable this, we replace the first nn.Embedding layer of EE with a dense nn.Linear layer to handle soft non-one-hot sequences. Once trained, Ψ\Psi is differentiable with respect to the soft-sequence inputs r~\tilde{\mathbf{r}}, allowing gradient-based optimization. Training proceeds for 120 epochs with Negative Log-Likelihood loss (for each member mm of the ensemble) on the mAb expression (absorbance measured at 280 nm) data [34, 45]. We use AdamW optimization with a batch size of 64, initial learning rate of 5×10−55 \times10^{-5}, and the same warmup and decay schedule as the

Algorithm 1 Latent-Space Codon Optimizer (LSCO)

Require: Protein sequence aa, pretrained encoder EE, decoder DD, predictors Ψ\Psi and Υ\Upsilon, weights λΨ,λΥ,λnat\lambda_{\Psi}, \lambda_{\Upsilon}, \lambda_{\mathrm{nat}}, initial τhigh\tau_{\mathrm{high}}, final τlow\tau_{\mathrm{low}}, optimization steps TT, learning rate η\eta

Ensure: Optimized mRNA sequence c⋆\mathbf{c}^{\star}

  1. Initialize z∈ZL\mathbf{z} \in\mathcal{Z}_{L} ▹\triangleright randomly from N(0,I)\mathcal{N}(0,I)

  2. for t=1t = 1 to TT do

  3. τ←τhigh+(t/T)(τlow−τhigh)\tau\leftarrow\tau_{\mathrm{high}} + (t/T)(\tau_{\mathrm{low}} - \tau_{\mathrm{high}}) ▹\triangleright temperature annealing

  4. r~τ←softmax⁡τ(D(z)+M(a))\tilde{\mathbf{r}}_{\tau} \leftarrow\operatorname{softmax}_{\tau}(D(\mathbf{z}) + M(a)) ▹\triangleright constrained soft sequence

  5. L←λΨΨ(r~τ)−λMFEΥ(r~τ)+λnatUnat(z,znat)\mathcal{L} \leftarrow\lambda_{\Psi}\Psi(\tilde{\mathbf{r}}_{\tau}) - \lambda_{\mathrm{MFE}}\Upsilon(\tilde{\mathbf{r}}_{\tau}) + \lambda_{\mathrm{nat}}U_{\mathrm{nat}}(\mathbf{z},\mathbf{z}_{\mathrm{nat}})

  6. z←z+η∇zL\mathbf{z} \leftarrow\mathbf{z} + \eta\nabla_{\mathbf{z}}\mathcal{L} ▹\triangleright gradient ascent on the objective

  7. end for

  8. r←arg⁡max⁡(D(z)+M(a))\mathbf{r} \leftarrow\arg\max(D(\mathbf{z}) + M(a)) ▹\triangleright discrete one-hot mRNA

  9. c⋆←\mathbf{c}^{\star} \leftarrow map r\mathbf{r} to codon sequence

  10. return c⋆\mathbf{c}^{\star}

language model. The Spearman’s rank correlation between the predicted and ground truth expression on the test split reaches 0.65.

We operate Ψ\Psi on the relaxed sequence r~τ\tilde{\mathbf{r}}_{\tau} rather than the latent space ZL\mathcal{Z}_{L} for two reasons: (i) early experiments showed that optimizing directly in ZL\mathcal{Z}_{L} can cause large shifts in predicted expression and latent values without corresponding changes at the sequence level; and (ii) the softmax representation admits the simple constrained-decoding step used to enforce r~τ∈S(a)\tilde{\mathbf{r}}_{\tau} \in S(a).

MFE predictor Analogously, the MFE predictor Υ\Upsilon mirrors Ψ\Psi’s architecture. It is trained for 50 epochs using MSE loss on 50,000 sub-sampled OAS mRNA sequences, with ground-truth MFE labels computed using the ViennaRNA package. Optimization follows identical settings to Ψ\Psi. The Spearman’s rank correlation between the predicted and ground truth MFE on the test split reaches 0.91.

Constrained Decoding Both the back-translation model and the optimizer require that every decoded sequence translates exactly to the target protein aa, enforced with a shared masking mechanism. Let l=D′(z)∈RL×64\mathbf{l} = D'(\mathbf{z}) \in\mathbb{R}^{L \times64} be the pre-softmax decoder logits. For each position aja_j we define a validity mask

M(aj)[i]={0,if codon i∈C(aj),−∞,otherwise,(4)M(a_j)[i] = \begin{cases} 0, & \text{if codon } i \in C(a_j),\\ -\infty, & \text{otherwise}, \end{cases} \tag*{(4)}

and compute masked logits lj,i←lj,i+M(aj)[i]l_{j,i} \leftarrow l_{j,i} + M(a_j)[i], then apply the temperature-τ\tau softmax r~τ=softmax⁡τ(l)\tilde{\mathbf{r}}_{\tau} = \operatorname{softmax}_{\tau}(\mathbf{l}). This guarantees r~τ∈S(a)\tilde{\mathbf{r}}_{\tau} \in S(a) while allowing free exploration of synonymous codons at each position.

LSCO hyperparameters We determined the weights λΨ\lambda_{\Psi} and λΥ\lambda_{\Upsilon} via grid search on each dataset to maximize predicted A280 while ensuring the optimized sequence’s MFE is generally lower than the wild-type/original MFE, with flexibility to relax this constraint when predicted A280 ≤1\leq1. In practice, LSCO proved robust to a wide range of these weights. Grid search identified λΨ=10\lambda_{\Psi} = 10 and λΥ=0.1\lambda_{\Upsilon} = 0.1 as effective. For decoding, we set the initial temperature τhigh=3\tau_{\mathrm{high}} = 3 and the final temperature τlow=0.01\tau_{\mathrm{low}} = 0.01. These temperature parameters showed higher sensitivity, particularly τlow\tau_{\mathrm{low}}; excessively high values caused significant rounding errors, reducing expression, while overly low values hindered optimization progress. We ran LSCO for T=3000T = 3000 iterations, observing that additional iterations improved convergence marginally. The learning rate was set to η=10−4\eta= 10^{-4}, and, leveraging the differentiability of the LSCO objective, we employed the Adam optimizer for robust gradient-based updates.

Decoding Temperature In practice, we also observed the importance of carefully selecting the decoding temperature τ\tau. Too high temperature allows for broader exploration of the synonymous sequence space but can introduce significant rounding errors when mapping r~τ\tilde{\mathbf{r}}_{\tau} to the nearest discrete mRNA sequence r\mathbf{r} via argmax. Conversely, too low temperature hinders exploration of the soft-sequence space by creating high-energy barriers between sequences. Empirically, we found that linearly annealing τ\tau from a high to a low value during optimization strikes the best balance. This strategy allows the optimizer to first explore the domain freely to identify promising candidates and then commit to a single solution at the end of the process

Additional Results and Experiments

Pretrained mRNA language models comparison

To evaluate whether pretrained mRNA language models learn biologically meaningful codon patterns, we compared four sequence generation strategies: random codon assignment (Random), codon sampling according to empirical codon frequencies (Freq Sample), an amino-acid-to-codon translation model (CodonBERT) pretrained on OAS sequences, and a codon-to-codon Variational Masked Auto-Encoder (VMAE) also pretrained on the OAS data. For VMAE generation, we include two variants, one that samples new sequences starting from the prior latent space (VMAE – Prior) and one that samples sequences starting from the encoded CodonBERT generated sequences (VMAE – BERT). All sequences are evaluated on Minimum Free Energy (MFE), GC content, Codon Adaptation Index (CAI), and codon-level Hamming distance from the reference starting sequence.

As shown in Figure 4, modern pretrained mRNA language models generate sequences with substantially improved biological properties than other baselines. CodonTransf, GEMORNA and VMAE – BERT all score favorably in terms of lower MFE, higher GC content (with GEMORNA falling just above the ideal host-specific GC range), higher CAI values, and lower codon Hamming distances. This indicates that modern transformer-based pretrained models efficiently learn context-dependent synonymous codon substitutions that improve quality without unnecessary sequence changes.

Figure 4. Sequence-level biophysical proxies across generation methods. Minimum Free Energy (MFE; lower = more stable), GC Content (GC%; shaded band marks host-appropriate range), Codon Adaptation Index (CAI; higher is better), and codon Hamming distance (Δ\Delta) from the reference sequence (lower = fewer codon edits), for non-contextual baselines (Random, Freq Sample), modern learned generators (CodonBERT, CodonTransf, GEMORNA), and our pretrained models (VMAE–Prior, decoding from Gaussian latent prior; VMAE–BERT, decoding from CodonBERT generated sequence’s latent space).

LSCO Optimization Trajectory

Figure 5 illustrates how LSCO reshapes the distribution of sequences in the learned latent space. The starting sequences (red triangles) reside in a cluster (C7) with low averaged predicted expression (aˉ=1.808\bar{a} = 1.808), whereas the LSCO-optimized sequences (gold stars) are consistently relocated toward clusters with substantially higher averaged predicted A28 (aˉ≈3.0\bar{a} \approx3.0–3.43.4). All optimization trajectories follow a similar direction, indicating that LSCO discovers coherent ascent paths on the underlying fitness landscape rather than arbitrary sequence perturbations. The companion uncertainty panel (right) shows that the optimized sequences stay in regions of low epistemic uncertainty, confirming that the LCB utility keeps the search in-distribution rather than exploiting the predictor off-manifold.

Figure 5. LSCO optimization trajectories in latent space. UMAP projection of the pretrained VMAE latent space on a holdout fold, coloured by predicted A280 (left) and by predictor epistemic uncertainty (right). Starting sequences (red triangles) lie in a low-expression cluster (C7, aˉ=1.808\bar{a}=1.808); LSCO-optimized sequences (gold stars) are relocated toward high-expression clusters (aˉ≈3.0\bar{a}\approx3.0–3.43.4). Trajectories (grey arrows) follow a consistent direction and remain in low-uncertainty regions.

Codon-Usage Analysis

To interpret the strategy learned by LSCO−LCB+MFELSCO - LCB + MFE, Figure 6 shows codon-level transition probabilities between original and optimized sequences, broken down by amino acid, over the 54 selected mAbs, i.e. which synonymous codons LSCO tends to replace and which it preserves. Several amino-acid families exhibit strong off-diagonal structure, indicating that optimization consistently redirects codon usage toward a preferred subset of alternatives rather than making random synonymous substitutions. There is also a moderate shift toward GC-richer codons across multiple families, consistent with the GC-content and MFE improvements of LSCO – LCB + MFE in Figure 2. However, the transition patterns are highly amino-acid-specific, suggesting a more nuanced strategy than simple GC maximization; the Symmetrized KL values confirm that the magnitude of redistribution varies substantially across families, as LSCO concentrates its modifications on specific synonymous groups.

Codon substitutions induced by LSCO optimization

Figure 6. Codon substitutions induced by LSCO optimization. Rows denote original codons, columns optimized codons; colours show row-normalized transition probabilities for synonymous substitutions produced by LSCO – LCB + MFE, over the 54 starting mAbs. Strong diagonal structure indicates codon conservation, while off-diagonal transitions reveal learned preferences. The Symmetrized KL (SKL) divergence quantifies the magnitude of codon redistribution per amino-acid family (higher SKL → larger redistribution).

A280 Predictors and Agreement

1D Sequence-Based Predictors. Both 1D predictors follow the same dual-chain design: heavy and light chain mRNAs are encoded separately, each chain is reduced to a fixed-size representation, and the two are aggregated with a Multiple Instance Learning (MIL) attention module before a final linear layer predicts A280. The two variants then differ mainly in the encoder backbone. The native predictor (Ψ\Psi) reuses the pretrained VMAE encoder EE as its backbone (with the first embedding layer replaced by a dense layer so it accepts the relaxed, soft-sequence input r~τ\tilde{r}_{\tau}); this is the model whose gradients drive LSCO. The external 1D predictor keeps similar dual-chain + MIL head but swaps in a different, shallower autoencoder backbone that never takes part in optimization. It therefore provides an independent read-out that shares the 1D sequence view but not the representation LSCO is optimized against.

2D Structure-Based Predictor. The external “2D GNN” predictor takes a genuinely different view of each sequence. For each chain, the mRNA is folded and its dot-bracket secondary structure is converted into a graph, with one-hot nucleotide node features and edges from both the backbone and the predicted base pairs. A graph neural network encodes this structure, and the same MIL-attention aggregation combines the two chains before the regression head. Because it consumes secondary-structure graphs rather than raw sequence embeddings, the 2D GNN carries a structural inductive bias absent from both 1D models, making it the most independent of the three evaluators.

Cross-predictor agreement. Figure 7 plots, for every optimized sequence, the native 1D A280 against each external predictor. In both panels the LSCO points (blue) sit clearly at the center-right, separated from all baselines: this implies they are rated highest by the native predictor and rated comparably or slightly higher by the external 1D and the structure-aware 2D GNN. The external predictors are more conservative in absolute terms in that most points lie below the diagonal, so agreement is more on ranking rather than exact value prediction. Overall ordering is more or less preserved across all three, despite distinct structural views. This consistency across predictors with different backbones and inductive biases presents some evidence that the gains are not an artifact of Ψ\Psi being exploited off-distribution, but reflect genuinely higher predicted expression.

Predicted-A280 agreement across evaluators

Figure 7. Predicted-A280 agreement across evaluators. Each dot is one optimized sequence, coloured by method; the dashed line marks perfect agreement. The horizontal axis is the native 1D predictor Ψ\Psi; the vertical axis is an independent external predictor withheld from optimization, the 1D Shallow-AE model (a) and the structure-aware 2D GNN (b). LSCO variants (blue) are rated highest by the native model, but score favorably also under the two external models in terms of ordering/ranking preserving.

Deep-Ensemble and Epistemic Uncertainty Aware Objective

Probabilistic Deep Ensemble. We implement the expression predictor Ψ\Psi as a deep ensemble of M=10M = 10 probabilistic members [24]. Each member mm does not output a point estimate but a full Gaussian predictive distribution over A280:

pm(y∣r~τ)=N(y;μm(r~τ),σm2(r~τ)),(5)p_m(y \mid\tilde{r}_{\tau}) = \mathcal{N}\left(y; \mu_m(\tilde{r}_{\tau}), \sigma_m^2(\tilde{r}_{\tau})\right), \tag*{(5)}
λMFE\lambda_{MFE}λLCB\lambda_{LCB}1D Transf (Internal)1D Transf (External)2D GNNMFEGC%CAI
009.585 ± 0.2184.518 ± 0.2233.492 ± 0.203−235.187 ± 3.55553.303 ± 0.4230.816 ± 0.008
19.156 ± 0.2414.400 ± 0.2543.485 ± 0.212−236.711 ± 3.60353.601 ± 0.3900.815 ± 0.009
0.108.180 ± 0.2373.900 ± 0.2243.175 ± 0.217−266.274 ± 2.78357.756 ± 0.2850.830 ± 0.009
17.858 ± 0.2353.935 ± 0.2653.099 ± 0.187−267.050 ± 3.21157.916 ± 0.3000.837 ± 0.008
108.065 ± 0.2323.887 ± 0.2003.319 ± 0.201−263.765 ± 3.12258.003 ± 0.3040.825 ± 0.009
17.899 ± 0.2563.951 ± 0.2712.923 ± 0.182−266.365 ± 3.38158.018 ± 0.3170.838 ± 0.008
507.921 ± 0.2603.729 ± 0.2203.057 ± 0.220−265.006 ± 3.44357.959 ± 0.3070.824 ± 0.009
17.635 ± 0.2713.852 ± 0.2283.161 ± 0.249−263.954 ± 3.37757.973 ± 0.3210.832 ± 0.008
1007.490 ± 0.2483.514 ± 0.2633.089 ± 0.248−267.381 ± 3.03358.494 ± 0.2820.818 ± 0.008
17.390 ± 0.2643.500 ± 0.2563.169 ± 0.241−265.220 ± 2.73558.233 ± 0.2580.829 ± 0.009

Table 2. MFE sensitivity analysis for LSCO variants. Predicted A280 values from three surrogate models (1D Transformer (Internal), 1D Transformer (External), 2D GNN) and biophysical metrics (minimum free energy, GC content, codon adaptation index) reported for the joint heavy + light chain construct on the 54 starting sequences. The second row (λMFE=0\lambda_{MFE} = 0, λLCB=1\lambda_{LCB} = 1) is the LCB-only LSCO baseline (‘LSCO – LCB’ in Figure 2). The fourth row (λMFE=0.1\lambda_{MFE} = 0.1, λLCB=1\lambda_{LCB} = 1) is the LCB+MFE baseline (‘LSCO – LCB + MFE’ in Figure 2) that best balances A280 and MFE objectives. Bold indicates the best value per column: highest for A280 predictions and CAI, most negative for MFE. GC% is not bolded as “best” is target-dependent. Values are mean ± 95% confidence bands across starting sequences.

where the head outputs both a mean μm\mu_m and a variance σm2\sigma_m^2. Members are trained independently, each with its own random initialization, optimizer, and backward pass, by minimizing the Gaussian negative log-likelihood loss:

LNLL(m)=12log⁡σm2(r~τ)+(y−μm(r~τ))22σm2(r~τ),(6)\mathcal{L}_{\mathrm{NLL}}^{(m)} = \frac{1}{2}\log\sigma_m^2(\tilde{r}_{\tau}) + \frac{\left(y-\mu_m(\tilde{r}_{\tau})\right)^2}{2\sigma_m^2(\tilde{r}_{\tau})}, \tag*{(6)}

so that the predicted variance is calibrated to each member’s own residuals. The variance head itself is configurable (constant, scalar, per-group, or fully heteroscedastic); we use the scalar σm2\sigma_m^2 setting, as we noticed data exhibit somehow uniform noise.

Aleatoric/Epistemic Uncertainty Decomposition. Treating the ensemble as a uniformly-weighted Gaussian mixture, the ensemble mean and total predictive variance are

μΨ(r~τ)=1M∑m=1Mμm(r~τ),(7)\mu_{\Psi}(\tilde{r}_{\tau}) = \frac{1}{M}\sum_{m=1}^{M}\mu_m(\tilde{r}_{\tau}), \tag*{(7)}
σΨ2(r~τ)=1M∑m=1Mσm2(r~τ)⏟aleatoric+1M∑m=1M(μm(r~τ)−μΨ(r~τ))2⏟epistemic.(8)\sigma_{\Psi}^{2}(\tilde{r}_{\tau}) = \underbrace{\frac{1}{M}\sum_{m=1}^{M}\sigma_m^{2}(\tilde{r}_{\tau})}_{\text{aleatoric}} + \underbrace{\frac{1}{M}\sum_{m=1}^{M}\left(\mu_m(\tilde{r}_{\tau})-\mu_{\Psi}(\tilde{r}_{\tau})\right)^2}_{\text{epistemic}}. \tag*{(8)}

The two terms have distinct meanings. The aleatoric term is the average of the members’ own predicted variances and captures irreducible noise in the measurement/data. The epistemic term is the variance across the members’ means and captures model uncertainty: it is large where the ensemble members disagree, which happens precisely in regions of sequence space that are under-represented in the training data. Because epistemic uncertainty shrinks as designs stay close to the training distribution and grows off-distribution, it is exactly the signal the LCB utility Uτ=μτ−λLCBστU_{\tau} = \mu_{\tau} - \lambda_{LCB}\sigma_{\tau} (Eq. 3) exploits: penalizing σΨ\sigma_{\Psi} steers the optimizer away from over-optimistic, out-of-distribution sequences. The same probabilistic ensemble construction is used for all three predictors (1D native, 1D external, 2D GNN); the 2D GNN members simply own an independent structure-graph backbone each.

Epistemic uncertainty of the optimized sequences. Figure 8 reports the epistemic standard deviation (epistemic\sqrt{\text{epistemic}}) of each predictor on the same 9 optimized mAbs as Figure 2. Two patterns stand out. First, under the native predictor (left), the LSCO variants sit at low and tightly-concentrated epistemic uncertainty, comparable to the optimized VMAE sequences and well below frequency-based, ICOR, CodonTransformer, and GEMORNA. This confirms that the LCB penalty keeps the search in-distribution rather than chasing high-variance designs. Second, under the two *external predictors (middle, right), LSCO’s epistemic uncertainty rises to a level similar to the other high-expression methods. This is because the external models were never optimized against, so any strong-expression design is somewhat novel to them, and LSCO is no more off-distribution for them than the competing optimizers. Read together with Figure 2, LSCO therefore attains the highest predicted A280 across all three predictors while keeping the lowest epistemic uncertainty under the predictor that actually guides optimization, i.e., its gains do not come from exploiting high-uncertainty regions of its own surrogate.

Figure 8. Epistemic uncertainty of the optimized sequences. Epistemic standard deviation (across-member disagreement, epistemic\sqrt{\mathrm{epistemic}}) of the three probabilistic deep-ensemble predictors — 1D Transformer Internal/Native (left), 1D Transformer External (middle), 2D GNN External (right) — evaluated on the same 9 optimized mAbs as Figure 2; each dot is one mAb. Under the native predictor, LSCO variants (blue) show low, concentrated epistemic uncertainty, comparable to the unoptimized VMAE and well below the other optimizers, confirming the LCB utility keeps the search in-distribution. Under the external predictors — never seen during optimization — LSCO’s uncertainty is comparable to other high-expression methods, as expected for held-out evaluators.

MFE regularization sensitivity

Table 2 reports the full sweep over the MFE weight λMFE\lambda_{\mathrm{MFE}} and the uncertainty-penalty toggle λLCB\lambda_{\mathrm{LCB}}, extending the two settings shown in the main text (Figure 2). Increasing λMFE\lambda_{\mathrm{MFE}} from 0 drives MFE substantially lower and lifts GC and CAI into the host-appropriate range, at a modest cost in predicted A280; gains in stability saturate beyond λMFE=0.1\lambda_{\mathrm{MFE}} = 0.1, confirming it as the sweet spot used throughout.

Seed sensitivity study

To assess how much results depend on the random seed for stochastic codon optimization methods, we fix a single representative starting mAb (chosen near the median A280 of the dataset) and re-run each stochastic method across 10 seeds. Since the evaluators are deterministic given a sequence, the spread in Figure 9 reflects methods’ stochasticity alone. Deterministic methods (original, natural, frequency, ICOR) are seed-inert and therefore omitted from the boxes. We report both LSCO variants (LSCO−LCBLSCO-LCB, LSCO−LCB+MFELSCO-LCB+MFE) alongside the stochastic baselines CodonTransformer (temperature 0.4) and GEMORNA, plus the LSCO random-substitution baseline.

Figure 9. Seed sensitivity on a single mAb (10 seeds). Boxes show the spread over different 10 seeded runs, reflecting the stochasticity behind different codon optimization methods. Top: predicted A280 from the native 1D transformer (internal), an external 1D transformer, and an external 2D GNN. Bottom: biophysical metrics for the joint heavy+light construct (VH+VL): MFE (lower = more stable), GC% (shaded band = host-appropriate 50–60%), and CAI. Both LSCO variants remain above the stochastic baselines on the 1D predictors across all seeds with bounded spread, keep GC within the admissible band, and LSCO – LCB + MFE consistently lowers MFE relative to LSCO – LCB; seed spread is largest under the more conservative 2D GNN evaluator.

Across seeds, the results in terms of performance generally hold with some caveats. Under the two 1D predictors, both LSCO variants stay above the stochastic baselines on predicted A280 for every seed, with bounded spread; LCB variant is tightest, while LCB+MFELCB+MFE shows slightly more variability and slightly lower absolute A280. Under the more conservative and less aligned 2D GNN, the boxes overlap more and seed spread is larger for all methods. Biophysical metrics are stable: both LSCO variants keep GC within the 50–60% band on every seed, and LCB+MFELCB+MFE consistently yields lower MFE than LCBLCB. These results are limited to a single starting mAb and characterize generator stochasticity rather than variation across antibodies.

LSCO vs. Direct Input-Space Optimization (DISO)

DISO is an ablation of LSCO designed to isolate the contribution of the pretrained VMAE mRNA language model. The two methods share everything except where the optimization happens: DISO reuses the exact same expression-predictor ensemble Ψ\Psi, MFE head Υ\Upsilon, tokenizers, valid-codon mask, and candidate-selection gate as LSCO. The only thing that changes is the set of variables being optimized, and, as a direct consequence, how the naturalness prior is expressed. The empirical outcome of this comparison is reported in the main text (Table 1): LSCO generally matches or exceeds DISO across evaluators, confirming that the pretrained latent space, and not merely the shared components, drives the gains.

What is being optimized (search geometry). LSCO optimizes a continuous latent code zz in the VMAE latent space, and turns it into a codon sequence by passing it through the pretrained decoder DτD_{\tau} at every step. DISO removes the decoder from the loop entirely: it optimizes one set of per-position codon logits directly in sequence space, one logit vector for each position of the heavy and light chains. In other words, LSCO moves through the smooth, learned manifold of the language model, while DISO moves through the raw codon-logit space with no generative model shaping the trajectory. Everything downstream — the temperature-controlled softmax, the valid-codon masking that keeps the sequence translating back to the target protein, the expression and MFE predictors — is identical.

Naturalness prior: latent anchoring vs. distribution matching. This is the component that changes most, and it changes because it has to. In LSCO the naturalness prior lives in the latent space: we encode the BERT back-translated “natural” sequence to a reference code znatz_{\mathrm{nat}} and pull the current code toward it with a squared-distance penalty, Unat(z)=−∥z−znat∥22U_{\mathrm{nat}}(z) = -\lVert z - z_{\mathrm{nat}}\rVert_2^2. DISO has no latent space, so this anchor cannot be defined the same way. Instead, DISO anchors the sequence directly in codon space: it builds a fixed per-position categorical distribution from the BERT-natural sequence (using a fixed reference temperature τBERT=0.5\tau_{\mathrm{BERT}} = 0.5) and, at each step, penalizes the Kullback–Leibler divergence between the current per-position codon distribution and this fixed reference, KL⁡(pcurrent∥pBERT)\operatorname{KL}(p_{\mathrm{current}} \mathbin{\|} p_{\mathrm{BERT}}). For a two-chain antibody the term is the average of the heavy- and light-chain KL divergences. Conceptually both do the same job — keep candidates close to biologically plausible codon usage — but LSCO measures “closeness” as a distance between latent codes, whereas DISO measures it as a distance between probability distributions over codons. Setting λnat=0\lambda_{\mathrm{nat}} = 0 removes the anchor in both methods.

LSCODISO
Optimized variablelatent code zzper-position codon logits
Generative decoder in loopYes (DτD_{\tau})No
Naturalness anchorlatent ℓ2\ell^2 distance ∥z−znat∥2\lVert z-z_{\mathrm{nat}}\rVert^2KL to fixed BERT distribution
Naturalness weight λnat\lambda_{\mathrm{nat}}10−210^{-2} (0 to disable)10−210^{-2} (0 to disable)
Initializationz∼N(0,I)z \sim\mathcal{N}(0,I)BERT-natural warm start (or N(0,0.52)\mathcal{N}(0,0.5^2))
Temperature schedule τ\tau0.5→0.030.5 \to0.030.5→0.030.5 \to0.03
Optimization steps30003000
Learning rate5×10−35 \times10^{-3}5×10−35 \times10^{-3}
MFE weight λMFE\lambda_{\mathrm{MFE}}{0,0.1,1}\{0,0.1,1\}{0,0.1,1}\{0,0.1,1\}
OptimizerAdamWAdamW

Table 3. Configuration differences between LSCO and DISO. All model components (expression ensemble, MFE head, tokenizers, valid-codon mask, candidate gate) are shared; only the search geometry and its downstream consequences differ.

Initialization. LSCO initializes the latent code zz from a standard Gaussian and lets the decoder map it to a starting sequence. DISO offers two starting points. The default (init_mode=bert) warm-starts the logits at the BERT-natural codon for each position (a logit of 0 for the natural codon and −δ-\delta for the others, with δ=3.0\delta= 3.0), so DISO begins from a natural sequence. The “fairer-ablation” variant (init_mode=random_gauss) instead draws logits from N(0,σ2)\mathcal{N}(0,\sigma^2) with σ=0.5\sigma= 0.5 and no bias toward the natural codon, immediately suppressing invalid codons via the valid-codon mask so optimization still starts from a protein-consistent point. Importantly, the naturalness anchor target is always the BERT-natural distribution regardless of where the logits are initialized — initialization only decides the starting point, not the anchor.

Optimization schedule and other hyperparameters. To keep the comparison as clean as possible, both methods share the same optimization budget and schedule: an identical decoding-temperature anneal from a high value (broad exploration) down to a low value (commit to a single codon per position), the same ramp on the constraint that enforces protein consistency, the same number of steps, learning rate, optimizer, and range of MFE weights. This is deliberate — because DISO differs from LSCO only in the search geometry (raw codon logits vs. the pretrained latent code) and the induced form of the naturalness anchor, matching all remaining settings ensures that any performance gap is attributable to those two factors rather than to differing training budgets. Table 3 lists the settings for both.

References

  1. [1]A. N. Amin, N. Gruver, Y. Kuang, L. Li, H. Elliott, C. McCarter, A. Raghu, P. Greenside, and A. G. Wilson. Bayesian optimization of antibodies informed by a generative model of evolving sequences. arXiv preprint arXiv:2412.07763, 2024.arxiv.org/abs/2412.07763
  2. [2]C. Angermueller, D. Dohan, D. Belanger, R. Deshpande, K. Murphy, and L. Colwell. Model-based reinforcement learning for biological sequence design. In International Conference on Learning Representations (ICLR), 2020.
  3. [3]C. Arbib, M. C. Pinar, F. Rossi, and A. Tessitore. Codon optimization by 0-1 linear programming. Computers & Operations Research, 119:104932, 2020.DOI
  4. [4]C. Benjamins, S. Surana, O. Bent, M. Lindauer, and P. Duckworth. Bayesian optimization for protein sequence design: Back to simplicity with gaussian processes. In NeurIPS 2024 AI4MAT Workshop, 2024.
  5. [5]D. H. Brookes and J. Listgarten. Design by adaptive sampling. In NeurIPS Workshop on Machine Learning for Molecules and Materials, 2018.arxiv.org/abs/1810.03714
  6. [6]D. H. Brookes, H. Park, and J. Listgarten. Conditioning by adaptive sampling for robust design. In Proceedings of the 36th International Conference on Machine Learning (ICML), volume 97 of Proceedings of Machine Learning Research, pages 773–782. PMLR, 2019.arxiv.org/abs/1901.10060
  7. [7]C. E. Brule and E. J. Grayhack. Synonymous codons: choose wisely for expression. Trends in Genetics, 33(4):283–297, 2017.DOI
  8. [8]P. Carter, L. Presta, C. M. Gorman, J. B. B. Ridgway, D. Henner, W. L. T. Wong, A. M. Rowland, C. Kotts, M. E. Carver, and H. M. Shepard. Humanization of an anti-p185HER2 antibody for human cancer therapy. Proceedings of the National Academy of Sciences of the USA, 89(10):4285–4289, 1992.pubmed.ncbi.nlm.nih.gov/1350088
  9. [9]D. A. Constant, J. M. Gutiérrez, A. V. Sastry, R. Viazzo, N. R. Smith, J. Hossain, D. A. Spencer, H. Carter, A. B. Ventura, M. T. Louie, et al. Deep learning-based codon optimization with large-scale synonymous variant datasets enables generalized tunable protein expression. bioRxiv, pages 2023–02, 2023.DOI
  10. [10]K. Deb, A. Pratap, S. Agarwal, and T. Meyarivan. A fast and elitist multiobjective genetic algorithm: NSGA-II. IEEE transactions on evolutionary computation, 6(2):182–197, 2002.DOI
  11. [11]E. A. Demissie, S.-Y. Park, J. H. Moon, and D.-Y. Lee. Comparative analysis of codon optimization tools: Advancing toward a multi-criteria framework for synthetic gene design. Journal of Microbiology and Biotechnology, 35:e2411066, 2025.DOI
  12. [12]J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding, 2019.arxiv.org/abs/1810.04805
  13. [13]A. Fallahpour, V. Gureghian, G. J. Filion, A. B. Lindner, and A. Pandi. CodonTransformer: a multispecies codon optimizer using context-aware neural networks. Nature Communications, 16(1):3205, 2025.DOI
  14. [14]R. Gómez-Bombarelli, J. N. Wei, D. Duvenaud, J. M. Hernández-Lobato, B. Sánchez-Lengeling, D. Sheberla, J. Aguilera-Iparraguirre, T. D. Hirzel, R. P. Adams, and A. Aspuru-Guzik. Automatic chemical design using a data-driven continuous representation of molecules. ACS central science, 4(2):268–276, 2018.
  15. [15]Z. Gong, Z. Jiang, W. Gao, D. Zhuo, and L. Ma. A new deep-learning-based approach for mRNA optimization: High fidelity, computation efficiency, and multiple optimization factors. arXiv preprint arXiv:2505.23862, 2025.
  16. [16]A. Grote, K. Hiller, M. Scheer, R. Münch, B. Nörtemann, D. C. Hempel, and D. Jahn. JCat: a novel tool to adapt codon usage of a target gene to its potential expression host. Nucleic acids research, 33(suppl_2):W526–W531, 2005.pubmed.ncbi.nlm.nih.gov/15980527
  17. [17]N. Gruver, S. D. Stanton, N. C. Frey, T. G. J. Rudner, I. Hotzel, J. Lafrance-Vanasse, A. Rajpal, K. Cho, and A. G. Wilson. Protein design with guided discrete diffusion. In Thirty-seventh Conference on Neural Information Processing Systems, 2023.arxiv.org/abs/2305.20009
  18. [18]P. G. Higgs. RNA secondary structure: physical and computational aspects. Quarterly reviews of biophysics, 33(3):199–253, 2000.pubmed.ncbi.nlm.nih.gov/11191843
  19. [19]D. Hu, X. Hou, X. Du, M. Zhou, L. Jiang, Y. Mo, and X. Shi. Varmae: Pre-training of variational masked autoencoder for domain-adaptive language understanding. In Findings of the Association for Computational Linguistics: EMNLP 2022, pages 6276–6286, 2022.arxiv.org/abs/2211.00430
  20. [20]R. Jain, A. Jain, E. Mauro, K. LeShane, and D. Densmore. ICOR: improving codon optimization with recurrent neural networks. BMC bioinformatics, 24(1):132, 2023.
  21. [21]W. Jin, J. Wohlwend, R. Barzilay, and T. Jaakkola. Iterative refinement graph neural network for antibody sequence-structure co-design. arXiv preprint arXiv:2110.04624, 2021.arxiv.org/abs/2110.04624
  22. [22]M. Kim, J. Gu, Y. Yuan, T. Yun, Z. Liu, Y. Bengio, and C. Chen. Offline model-based optimization: Comprehensive review. Transactions on Machine Learning Research (TMLR), 2025. Survey Certification.arxiv.org/abs/2503.17286
  23. [23]G. Kudla, A. W. Murray, D. Tollervey, and J. B. Plotkin. Coding-sequence determinants of gene expression in escherichia coli. science, 324(5924):255–258, 2009.DOI
  24. [24]B. Lakshminarayanan, A. Pritzel, and C. Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. Advances in neural information processing systems, 30, 2017.arxiv.org/abs/1612.01474
  25. [25]S. Li, S. Moayedpour, R. Li, M. Bailey, S. Riahi, L. Kogler-Anele, M. Miladi, J. Miner, F. Pertuy, D. Zheng, et al. CodonBERT large language model for mRNA vaccines. Genome research, 34(7):1027–1035, 2024.DOI
  26. [26]Y. Li, F. Wang, J. Yang, Z. Han, L. Chen, W. Jiang, H. Zhou, T. Li, Z. Tang, J. Deng, et al. Deep generative optimization of mRNA codon sequences for enhanced protein production and therapeutic efficacy. bioRxiv, pages 2024–09, 2024.DOI
  27. [27]R. Lorenz, S. H. Bernhart, C. Höner zu Siederdissen, H. Tafer, C. Flamm, P. F. Stadler, and I. L. Hofacker. Viennarna package 2.0. Algorithms for molecular biology, 6(1):26, 2011.DOI
  28. [28]I. Loshchilov and F. Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.arxiv.org/abs/1711.05101
  29. [29]V. P. Mauro and S. A. Chappell. A critical analysis of codon optimization in human therapeutics. Trends in molecular medicine, 20(11):604–613, 2014.DOI
  30. [30]G. L. Moore and C. D. Maranas. e codonopt: a systematic computational framework for optimizing codon usage in directed evolution experiments. Nucleic acids research, 30(11):2407–2416, 2002.pubmed.ncbi.nlm.nih.gov/12034828
  31. [31]T. H. Olsen, F. Boyles, and C. M. Deane. Observed antibody space: A diverse database of cleaned, annotated, and translated unpaired and paired antibody sequences. Protein Science, 31(1):141–146, 2022.DOI
  32. [32]C. N. Pace, F. Vajdos, L. Fee, G. Grimsley, and T. Gray. How to measure and predict the molar absorption coefficient of a protein. Protein science, 4(11):2411–2423, 1995.pubmed.ncbi.nlm.nih.gov/8563639
  33. [33]A. I. Paremskaia, A. A. Kogan, A. Murashkina, D. A. Naumova, A. Satish, I. S. Abramov, S. G. Feoktistova, O. N. Mityaeva, A. A. Deviatkin, and P. Y. Volchkov. Codon-optimization in gene therapy: promises, prospects and challenges. Frontiers in Bioengineering and Biotechnology, 12:1371596, 2024.DOI
  34. [34]M. Prakash, A. Moskalev, P. D. Jr., S. Combs, T. Mansi, J. Scheer, and R. Liao. Bridging biomolecular modalities for knowledge transfer in bio-language models. In Neurips 2024 Workshop Foundation Models for Science: Progress, Opportunities, and Challenges, 2024.DOI
  35. [35]P. Puigbo, E. Guzmán, A. Romeu, and S. Garcia-Vallvé. OPTIMIZER: a web server for optimizing the codon usage of DNA sequences. Nucleic acids research, 35(suppl_2):W126–W131, 2007.
  36. [36]P. M. Sharp and W.-H. Li. The codon adaptation index—a measure of directional synonymous codon usage bias, and its potential applications. Nucleic acids research, 15(3):1281–1295, 1987.pubmed.ncbi.nlm.nih.gov/3547335
  37. [37]S. Stanton, W. Maddox, N. Gruver, P. Maffettone, E. Delaney, P. Greenside, and A. G. Wilson. Accelerating bayesian optimization for biological sequence design with denoising autoencoders. In International conference on machine learning, pages 20459–20478. PMLR, 2022.arxiv.org/abs/2203.12742
  38. [38]J. Su, M. Ahmed, Y. Lu, S. Pan, W. Bo, and Y. Liu. Roformer: Enhanced transformer with rotary position embedding. Neurocomputing, 568:127063, 2024.arxiv.org/abs/2104.09864
  39. [39]B. Trabucco, X. Geng, A. Kumar, and S. Levine. Design-bench: Benchmarks for data-driven offline model-based optimization. In Proceedings of the 39th International Conference on Machine Learning (ICML), volume 162 of PMLR, pages 21658–21676, 2022.arxiv.org/abs/2202.08450
  40. [40]B. Trabucco, A. Kumar, X. Geng, and S. Levine. Conservative objective models for effective offline model-based optimization. Proceedings of the 38th International Conference on Machine Learning (ICML), 2021.arxiv.org/abs/2107.06882
  41. [41]A. Tripp, E. Daxberger, and J. M. Hernández-Lobato. Sample-efficient optimization in the latent space of deep generative models via weighted retraining. Advances in Neural Information Processing Systems, 33:11259–11272, 2020.arxiv.org/abs/2006.09191
  42. [42]R. Turner, D. Eriksson, M. McCourt, J. K. Kill, E. Laaksonen, Z. Xu, and I. Guyon. Bayesian optimization is superior to random search for machine learning hyperparameter tuning: Analysis of the black-box optimization challenge 2020. In NeurIPS 2020 competition and demonstration track, pages 3–26. PMLR, 2021.
  43. [43]B. Warner, A. Chaffin, B. Clavié, O. Weller, O. Hallström, S. Taghadouini, A. Gallagher, R. Biswas, F. Ladhak, T. Aarsen, N. Cooper, G. Adams, J. Howard, and I. Poli. Smarter, better, faster, longer: A modern bidirectional encoder for fast, memory efficient, and long context finetuning and inference, 2024.arxiv.org/abs/2412.13663
  44. [44]K. K. Yang, Z. Wu, and F. H. Arnold. Machine-learning-guided directed evolution for protein engineering. Nature methods, 16(8):687–694, 2019.DOI
  45. [45]M. Yazdani-Jahromi, M. Prakash, T. Mansi, A. Moskalev, and R. Liao. HELM: Hierarchical encoding for mRNA language modeling. In The Thirteenth International Conference on Learning Representations, 2025.
  46. [46]D. Zhang, J. Fu, Y. Bengio, and A. Courville. Unifying likelihood-free inference with black-box optimization and beyond. arXiv preprint arXiv:2110.03372, 2021.arxiv.org/abs/2110.03372
  47. [47]H. Zhang, H. Liu, Y. Xu, H. Huang, Y. Liu, J. Wang, Y. Qin, H. Wang, L. Ma, Z. Xun, et al. Deep generative models design mRNA sequences with enhanced translational capacity and stability. Science, 390(6773):eadr8470, 2025.DOI
  48. [48]H. Zhang, L. Zhang, A. Lin, C. Xu, Z. Li, K. Liu, B. Liu, X. Ma, F. Zhao, H. Jiang, et al. Algorithm for optimized mRNA design improves stability and immunogenicity. Nature, 621(7978):396–403, 2023.DOI

AI tools statement

No AI-use declaration is available for this version in Valency.

The available record does not establish whether AI systems or models contributed to this work.

How AI tools are recorded

Paper details

Cite this paper

Publication

Published
Version
Latest

Data & code

No code, data or supplementary files were declared for this version.

Pick where to look, or just type