Upload README.md
Browse files21 unmodified lines22232425262728293031323 unmodified lines3637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651721 unmodified lines- masked-language-modeling---<!-- Typographic wordmark, accepted as-is. Swap in a design asset here if one is ever produced. --><p align="center"><picture><source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1/resolve/main/assets/codonfm-wordmark-dark.svg"><img src="https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1/resolve/main/assets/codonfm-wordmark.svg" width="300" alt="CodonFM"></picture></p>3 unmodified lines<a href="https://github.com/NVIDIA-BioNeMo/CodonFM">Code</a> ·<a href="https://research.nvidia.com/labs/dbr/assets/data/manuscripts/nv-codonfm-preprint.pdf">Preprint</a> ·<a href="https://huggingface.co/collections/nvidia/codonfm">All CodonFM models</a> ·<a href="https://catalog.ngc.nvidia.com/orgs/nvidia/teams/clara/models/nv_codonfm_encodon">NGC</a> ·<a href="https://developer.nvidia.com/blog/introducing-the-codonfm-open-model-for-rna-design-and-analysis/">Blog</a></p><p align="center"><img src="https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1/resolve/main/assets/codonfm-hero.svg" width="1060" alt="Three mRNA strands encoding the same protein, differing only at one leucine codon: CUU, CUC and CUA, highlighted in yellow, tan and blue. Each passes through stylised model layers and emerges as a protein structure tinted to match its codon, showing that synonymous choices change the outcome."></p># CodonFM-5BCodonFM is a family of open RNA foundation models that read protein-coding sequences at **codon**resolution. Most protein models treat synonymous codons (the different three-letter words thatencode the same amino acid) as interchangeable, discarding the signal they carry. CodonFM keepsit, learning the context-dependent grammar of codon usage from evolution-scale data.That grammar is shaped by GC content, tRNA availability, RNA structure and host or tissue context,and it shows up in translation efficiency, RNA stability, protein folding and pathogenicsynonymous variants. From coding sequence alone, CodonFM recovers synonymous variant effects,missense pathogenicity and mRNA properties.CodonFM-5B is the largest member of the family. It is released together with[CodonFM-5B-CDWT](https://huggingface.co/nvidia/CodonFM-Encodon-5B-CDWT-v1), which is pretrained withcodon-frequency-weighted masking instead of uniform random masking. See[the two training objectives](#the-two-training-objectives) below.<picture><source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1/resolve/main/assets/codonfm-overview-dark.svg"><img src="https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1/resolve/main/assets/codonfm-overview.svg" width="1060" alt="A coding sequence tokenised two ways. Amino-acid models collapse the synonymous codons GAA and GAG into a single token E, losing the distinction. CodonFM keeps each codon as its own token, which feeds codon optimization, variant effect prediction and sequence embeddings."></picture>## Why codon resolution mattersA synonymous substitution is often called a silent mutation, because the protein it encodes isunchanged. It is rarely silent in practice. Swapping a common leucine codon for a rare one leavesthe amino acid sequence identical while changing how the transcript folds, how quickly theribosome moves along it, and whether the finished protein folds correctly.<picture><source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1/resolve/main/assets/codonfm-consequences-dark.svg"><img src="https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1/resolve/main/assets/codonfm-consequences.svg" width="1060" alt="A synonymous change from CTA to CTG keeps the same amino acid but triggers three downstream consequences: mRNA structure instability shortens mRNA half-life, affecting how much protein is made; altered translational kinetics disrupt folding rhythm, affecting how fast it is made; protein misfolding and aggregation cause loss of function or toxicity, affecting whether it works at all."></picture>A model that tokenises to amino acids cannot represent the left-hand side of that picture, so itcannot reason about any of the consequences on the right.The second problem is scale. Because most amino acids have several codons, a typical 300-residueprotein can be written roughly 10<sup>128</sup> different ways without altering a single residue:more encodings than there are atoms in the observable universe. A wet-lab cycle tests a few dozenconstructs, so the search has always been settled by frequency tables or expert intuition. Gettingit right matters: a major cliff in RNA-based therapeutic design is reaching good protein expressionat tolerable doses, and an exceptionally well-designed protein still fails if it cannot be producedin the cell type you need it in.## What makes CodonFM work<picture><source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1/resolve/main/assets/codonfm-pillars-dark.svg"><img src="https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1/resolve/main/assets/codonfm-pillars.svg" width="1060" alt="Three ingredients make CodonFM work: evolutionary data from over 130 million coding sequences across more than 22,000 species; a codon-level model that captures synonymous codon usage; and downstream validation on protein expression, translation efficiency and variant effect."></picture>## At a glance| | Details ||---|---|| **What it does** | Predicts masked codons from surrounding codon context; the resulting likelihoods and embeddings drive codon optimization, variant effect prediction and expression modelling || **Architecture** | BERT-style transformer encoder, trained at four scales from 80M to 5B parameters || **Input** | A protein-coding sequence (CDS) as a string of codons, up to 2,046 codons; longer sequences are truncated || **Output** | Per-position codon probabilities, sequence likelihoods, and encoder embeddings || **Training objective** | Masked language modelling over codons, with uniform random masking (5B-CDWT uses frequency-weighted masking) || **Training data** | The largest codon corpus assembled to date: ~130M non-viral coding sequences from >22,000 species across the tree of life, from NCBI RefSeq || **Who it is for** | mRNA and cell-therapy design, protein expression and biomanufacturing, clinical variant interpretation, genomics research || **License** | Code: Apache-2.0 · Weights: [NVIDIA Open Model License](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/) |## Which model should I use?| Model | Params | Masking | Use this one if… ||---|---|---|---|| [CodonFM-5B](https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1) ★ | 5B | Random | You want the strongest all-round model for mRNA design, expression prediction and somatic variant analysis || [CodonFM-5B-CDWT](https://huggingface.co/nvidia/CodonFM-Encodon-5B-CDWT-v1) | 5B | Codon-frequency-weighted | You are scoring **germline** variants. Best in the family on ClinVar synonymous variants; for somatic variants and expression, plain 5B is at least as strong || [Encodon-1B](https://huggingface.co/nvidia/NV-CodonFM-Encodon-1B-v1) | 911M | Random | You need the previous flagship, or 5B does not fit your GPU || [Encodon-Cdwt-1B](https://huggingface.co/nvidia/NV-CodonFM-Encodon-Cdwt-1B-v1) | 911M | Codon-frequency-weighted | You need germline variant scoring at 1B. Weakest in the family on protein expression, so use Encodon-1B for that || [Encodon-600M](https://huggingface.co/nvidia/NV-CodonFM-Encodon-600M-v1) | 609M | Random | You are trading accuracy for throughput || [Encodon-80M](https://huggingface.co/nvidia/NV-CodonFM-Encodon-80M-v1) | 77M | Random | You are testing a pipeline, not making calls, since it is close to chance on variant interpretation |All CodonFM models are listed in the [CodonFM collection](https://huggingface.co/collections/nvidia/codonfm).## The two training objectivesBoth 5B models are trained by masking 15% of the codons in a sequence and predicting them fromcontext. They differ in how much each prediction counts toward the loss.**CodonFM-5B** uses uniform random masking: every codon is weighted equally. Because real codingsequences are dominated by a handful of preferred codons, the model spends most of its trainingsignal on codons it already knows well.**CodonFM-5B-CDWT** weights the loss by inverse codon frequency, pushing the model to learn therare-codon long tail. Leucine shows why that matters: it has six synonymous codons, and humanusage is heavily skewed:| Codon | Usage in human CDS | Cdwt loss weight ||---|---|---|| `CTG` | 40% | 0.3× || `CTC` | 20% | 0.6× || `CTT` | 13% | 0.9× || `TTG` | 13% | 0.9× || `TTA` | 7% | 1.7× || `CTA` | 7% | 1.7× |A rare `CTA` therefore contributes roughly **6× more gradient** than a common `CTG`. The result isa model that is more sensitive to species-specific codon preference, which is why 5B-CDWT leads ongermline pathogenicity while the uniformly-masked 5B is the better general-purpose choice.## What goes in, what comes outOne input format, three kinds of output. All of it is the same underlying capability, amasked codon language model, consumed three different ways.### InputA protein-coding sequence (CDS): uppercase `A`/`C`/`G`/`T`, length divisible by three. Notgenomic DNA with introns, not UTR-only sequence, and not protein.The model tokenises by codon rather than by base, using a 69-token vocabulary covering the 64codons plus special tokens, with a default context of 2048 tokens including the start andseparator tokens. That is roughly 2,000 codons, or about 6,000 nucleotides, in one pass.### Files in| File | What it is ||---|---|| One CSV | Your sequences. Columns depend on the task || `.safetensors` + `config.json` | The checkpoint pair, side by side in one folder. A `.ckpt` also works || An empty output directory | The writer scans for `.npy` files, so leftovers from an earlier run corrupt the merge |For embeddings, the CSV needs `id`, `ref_seq`, `value`, `split`. For variant scoring it needs`id`, `ref_seq`, `ref_codon`, `alt_codon`, `codon_position`. Extra columns are allowed in both.### Files outEverything returns as NumPy `.npy` arrays in the predictions directory.| Task | Files | What they hold ||---|---|---|| Embeddings | `embeddings_merged.npy`, `ids_merged.npy` | One frozen CLS vector per sequence, width matching the checkpoint's hidden size: 1024 for 80M, 2048 for 600M and 1B, 4096 for 5B || Variant scoring | `ref_likelihoods_merged.npy`, `alt_likelihoods_merged.npy`, `likelihood_ratios_merged.npy`, `ids_merged.npy` | Log-likelihood ratio per variant: `log p(ref) - log p(alt)` |Join results back to your CSV on `ids_merged.npy`, and do not assume row order survives, because itoften does not. Embeddings are a starting point rather than an answer; the public repo'snotebooks `4-EnCodon-Downstream-Task-riboNN`, `5-EnCodon-Downstream-Task-mRFP-expression` and`6-EnCodon-Downstream-Task-mRNA-stability` show the downstream regressor step.### Three things that will bite you**The `split` column filters silently.** Only rows whose `split` value is exactly `test` areprocessed. Blank or any other value is dropped without an error, so fewer rows come back thanyou sent and nothing says why.**Duplicate IDs are not rejected.** They pass validation and then make the join back to yourCSV ambiguous. Assign unique IDs and keep your own mapping to the original rows.**`ref_codon` must match the sequence.** The extractor asserts that the three bases at`codon_position` in `ref_seq` equal `ref_codon`, and halts the job if they do not. Validatingthe CSV costs nothing; the failure costs a queue slot.### What a variant score does not tell youThe likelihood ratio says how probable the alternate codon is in context, and a larger positivevalue means the model finds it less plausible. It does **not** predict whether expression goesup or down, and it is a research signal rather than a clinical call.## Quick start### 1. Set up the environment```bashgit clone https://github.com/NVIDIA-BioNeMo/CodonFMcd CodonFMbash run_dev.sh````run_dev.sh` builds the development image from the repository's `Dockerfile` and drops you into ashell, with GPU access and your local code mounted at `/workspace`. It needs Docker and theNVIDIA container toolkit. Pass `--data-dir` and `--checkpoints-dir` to mount your own paths.### 2. Download the weights```bashhf download nvidia/CodonFM-Encodon-5B-v1 --local-dir ./encodon_5b```The directory contains `model.safetensors` and `config.json`.### 3. Optimize a coding sequenceRewrite a CDS for higher predicted expression without changing the protein. The model scores awhole sequence by its mean log-likelihood, so optimization is: propose synonymous rewrites, scorethem in a batch, keep what improves.```pythonimport randomimport numpy as npimport torchfrom Bio.Data.CodonTable import standard_dna_tablefrom src.inference.encodon import EncodonInferencefrom src.data.preprocess.codon_sequence import process_item# synonymous codons per amino acid; stop codons are absent, so they are never touchedSYNONYMS = {}for codon, aa in standard_dna_table.forward_table.items():SYNONYMS.setdefault(aa, []).append(codon)model = EncodonInference(model_path="./encodon_5b/", task_type="fitness_prediction")model.configure_model()model = model.to("cuda").eval()def fitness(seqs):"""Mean log-likelihood the model assigns to each sequence, scored as one batch."""items = [process_item(s, context_length=2048, tokenizer=model.tokenizer) for s in seqs]batch = {k: torch.as_tensor(np.stack([it[k] for it in items]), device="cuda")for k in items[0]}with torch.inference_mode():return model.predict_fitness(batch).fitnessdef propose(seq, n, rate=0.1):"""Random synonymous rewrites. The amino acid sequence never changes."""codons = [seq[i:i + 3] for i in range(0, len(seq), 3)]out = []for _ in range(n):c = list(codons)for i, codon in enumerate(c):aa = standard_dna_table.forward_table.get(codon) # None for stop codonsif aa and random.random() < rate:c[i] = random.choice(SYNONYMS[aa])out.append("".join(c))return outcds = "ATGGAATTTCTAGCACGTCTACCAGGTTCAAAATTAGCTTCTTTACCACGTATTGGATAA"best, best_score = cds, float(fitness([cds])[0])print(f"start {best_score:.4f}")for generation in range(10):candidates = propose(best, n=32)scores = fitness(candidates)top = int(np.argmax(scores))if scores[top] > best_score:best, best_score = candidates[top], float(scores[top])print(f"gen {generation:<2} {best_score:.4f}")print(best)```> **Two notes.** This is a short hill-climb that shows the scoring loop, not a production> optimizer; a serious search would also weigh CAI, ENC and predicted translation efficiency,> and would restart from several seeds. And `Bio` is [Biopython](https://biopython.org), used> here only for the standard codon table; it is not a CodonFM dependency.### 4. Score a synonymous variantDoes a silent mutation matter? This scores a GAA → GAG substitution, where both codons encode glutamate,by the ratio of the model's likelihoods for the two codons in context.```pythonimport torchfrom src.inference.encodon import EncodonInferencefrom src.data.preprocess.mutation_pred import mlm_process_itemmodel = EncodonInference(model_path="./encodon_5b/",task_type="mutation_prediction",)model.configure_model()model = model.to("cuda").eval()cds = "ATGGAATTTTAA"variant = mlm_process_item(ref_seq=cds,codon_position=1, # Zero-based codon index.ref_codon="GAA",alt_codon="GAG",context_length=2048,tokenizer=model.tokenizer,mask_mutation=True,)batch = {k: torch.as_tensor(v, device="cuda").unsqueeze(0)for k, v in variant.items()}with torch.inference_mode():score = model.predict_mutation(batch).likelihood_ratios.item()print(f"Synonymous variant score: {score:.6f}")```### 5. Extract embeddingsThe third thing the model gives you is a vector per sequence: the `[CLS]` representation fromthe final layer. These are the input to your own regressor when you have assay data of your ownand want to predict translation efficiency, expression or stability from sequence.```pythonimport numpy as npimport torchfrom src.inference.encodon import EncodonInferencefrom src.data.preprocess.codon_sequence import process_itemmodel = EncodonInference(model_path="./encodon_5b/",task_type="embedding_prediction",)model.configure_model()model = model.to("cuda").eval()sequences = ["ATGGAATTTTAA", "ATGGAGTTTTAA"]items = [process_item(s, context_length=2048, tokenizer=model.tokenizer)for s in sequences]batch = {k: torch.as_tensor(np.stack([it[k] for it in items]), device="cuda")for k in items[0]}with torch.inference_mode():embeddings = model.extract_embeddings(batch).embeddingsprint(embeddings.shape) # (2, 4096): one 4096-wide vector per sequence```Extracting them is only half the job. The repository's notebooks`4-EnCodon-Downstream-Task-riboNN`, `5-EnCodon-Downstream-Task-mRFP-expression` and`6-EnCodon-Downstream-Task-mRNA-stability` show the other half: fitting a light regressor onfrozen embeddings, which is how the benchmarks above were produced.For codon optimization, variant scoring at scale and the downstream expression tasks, see the[notebooks](https://github.com/NVIDIA-BioNeMo/CodonFM/tree/main/notebooks) in the repository.## What scaling to 5B buys you> **Figures are from the 5B tech blog, which is still in review.** They need Ankit's and> Laksshman's sign-off before this page goes public.### Scale buys comprehensionValidation loss keeps falling with model size, and the 5B models separate clearly from the restof the family rather than converging with them.<img src="https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1/resolve/main/assets/fig1-validation-loss.png" width="1060" alt="Validation loss against training samples seen, for EnCodon 80M, 600M, 1B, 1B CDWT, 5B and 5B CDWT. Every model's loss falls as training continues, and the 5B models sit lowest throughout, reaching about 1.95 against roughly 2.25 for 1B and 2.9 for 80M.">*Figure 1. Larger EnCodon models achieve lower validation loss as training continues.*That shows up directly as fewer synonymous mix-ups. Codon confusion, how often the modelmispredicts one synonymous codon for another, falls steadily with scale across almost everyamino acid.<img src="https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1/resolve/main/assets/fig2-codon-confusion.png" width="1060" alt="Heatmap of synonymous codon confusion by amino acid for each EnCodon model size. Darker green means less confusion. Rows grow darker from EnCodon 80M at the top through to 5B and 5B CDWT at the bottom.">*Figure 2. Synonymous codon confusion across model scales. Darker green is a lower confusionscore, so larger models show a firmer grip on codon usage.*### Variant interpretationAcross 129,384 synonymous variants in ClinVar, the 5B models give the highest AUROC forseparating pathogenic from benign, and **5B-CDWT leads**, so the rare-codon weighting earns itsplace on this germline task.<img src="https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1/resolve/main/assets/fig3-clinvar-auroc.png" width="1060" alt="Box plot of AUROC for distinguishing pathogenic from benign matched synonymous variants. EnCodon 5B CDWT is highest at about 0.67, followed by 5B, then 1B CDWT and 1B near 0.62, with SOTA-Best-1 at about 0.61 and EnCodon 80M lowest at about 0.51.">*Figure 3. CodonFM 5B CDWT and 5B achieve the highest AUROC for separating pathogenic frombenign synonymous variants in ClinVar.*The same holds for somatic mutations. Across 1,471 cancer-observed synonymous variants matchedbetween COSMIC and gnomAD, the larger models beat both the PhyloP conservation score and the bestpublished model on this benchmark. CodonFM also recovers known loss-of-function synonymousmutations in *KRAS*.<img src="https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1/resolve/main/assets/fig4-cosmic-cancer.png" width="1060" alt="Two box plots comparing COSMIC synonymous mutations against matched gnomAD common variants. On the Mann-Whitney U test the 5B models reach about 10 on the negative log-10 p scale against roughly 6 for 1B, 2 for PhyloP and 1.5 for SOTA-Best-2. The AUROC panel shows the same ordering.">*Figure 4. Across 1,471 curated cancer-observed synonymous variants, larger EnCodon modelsoutperform the PhyloP conservation score and the best state-of-the-art model on this test.*Separately, on de novo variant prioritization across three trio-sequenced disease cohorts,including 42,607 autism cases and 2,871 congenital heart disease probands, CodonFM gives thebest separation of disease from control, from coding sequence alone.### mRNA designRandom forests trained on **frozen** 5B embeddings beat the strongest published models on bothtranslation efficiency (>140 human and mouse cell types drawn from 3,819 ribosome profilingdatasets) and protein expression (1,459 synonymous CDS variants with an *E. coli* readout), withno fine-tuning.<img src="https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1/resolve/main/assets/fig5-te-expression.png" width="1060" alt="Two bar charts of Spearman correlation. On mRNA translation efficiency, EnCodon 5B CDWT and 5B lead at about 0.72, ahead of SOTA-Best-1 at roughly 0.69 and SOTA-Best-3 at 0.52. On mRFP expression, EnCodon 5B and 5B CDWT lead at about 0.73, ahead of SOTA-Best-3 at 0.68 and SOTA-Best-1 at 0.55.">*Figure 5. Random forest performance on frozen zero-shot embeddings, for translation efficiency(RiboNN Spearman ρ) and mRFP protein expression (Spearman ρ on a held-out test set). The 5B modelslead on both.*### Where it gets used<picture><source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1/resolve/main/assets/codonfm-applications-dark.svg"><img src="https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1/resolve/main/assets/codonfm-applications.svg" width="1060" alt="Optimized coding sequences from CodonFM feed CAR-T immunotherapy, tumour profiling, vaccine efficacy and peptide manufacturing."></picture>### In the labBenchmarks are one thing; wet-lab validation is another. Working with the **Arc Institute** and**Ansa Bio**, CodonFM-designed sequences raised GFP expression nearly **4×** over wild type in theA549 human epithelial line, and luciferase roughly **2×** in the same cells, from changingcodon usage alone, leaving both proteins untouched. Two targets rather than one is the point: itis the difference between a method that transfers and a single lucky sequence.<img src="https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1/resolve/main/assets/fig6-arc-gfp.png" width="1060" alt="Two bar charts of protein expression in A549 cells relative to wild type. For luciferase, wild type sits at 1.0, SOTA-A at about 0.4, SOTA-B at about 1.3 and the CodonFM design at about 1.95, marked significant with p equal to 6.3e-05. For GFP, wild type sits at 1.0, SOTA-A at about 0.4, SOTA-B at about 1.15 and the CodonFM design at about 3.95, with p equal to 7.8e-05.">*Figure 6. Protein expression in A549 human epithelial cells, relative to wild type.CodonFM-designed sequences reach roughly 2× for luciferase (p = 6.3 × 10⁻⁵) and 4× for GFP(p = 7.8 × 10⁻⁵), outperforming two current state-of-the-art RNA language models on both.*Collaborations with further partners, including **Therna Biosciences**, have achieved orexceeded these gains in therapeutic design work.## Hardware and software| | ||---|---|| **GPU memory** | ~24 GB for inference || **Tested on** | [TODO: confirm with Ankit. A100 is listed for 1B; add the 5B list and Blackwell status] || **Base image** | `nvcr.io/nvidia/pytorch:26.09-py3`, which requires CUDA 13.4 and an R580+ / R615+ driver || **OS** | Linux |## Limitations- CodonFM models protein-coding sequences only. It does not model UTRs, introns or non-coding RNA,so regulatory effects outside the CDS are out of scope.- Context is capped at 2,046 codons; longer transcripts are truncated.- Predictions are computational hypotheses. Designed sequences and variant calls needexperimental validation before use in research or clinical decisions.- Training data excludes viral sequences and coding sequences from human-pathogenic bacteria.The formal model card, with the full Model Card++ bias, explainability, safety and privacysubcards, is on [NGC](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/clara/models/nv_codonfm_encodon).## Where to go next| If you want to | Go here ||---|---|| Walk through an end-to-end analysis without writing code | [Genomic Analysis Blueprint](https://build.nvidia.com/nvidia/genomics-analysis): step-by-step variant effect prediction with CodonFM and Parabricks || Reproduce the benchmarks above | The [evaluation notebooks](https://github.com/NVIDIA-BioNeMo/CodonFM/tree/main/notebooks): zero-shot variant scoring, translation efficiency, expression and stability || Understand the method | The [preprint](https://research.nvidia.com/labs/dbr/assets/data/manuscripts/nv-codonfm-preprint.pdf) || Use a smaller or earlier model | The [CodonFM collection](https://huggingface.co/collections/nvidia/codonfm) || Read the background | The [original CodonFM blog](https://developer.nvidia.com/blog/introducing-the-codonfm-open-model-for-rna-design-and-analysis/) |## LicenseCode is released under Apache-2.0. Model weights are governed by the[NVIDIA Open Model License Agreement](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/).Ready for commercial and non-commercial use.## Citation```bibtex@article{codonfm_2025,author = {Darabi+, Sajad and Cao+, Fan and Naghipourfar+, Mohsen and Rabi, Sara andSethia, Ankit and Gion, Kyle and Grewal, Jasleen and Cohen, Jonathan andGreenleaf, William and Goodarzi*, Hani and Sundaram*, Laksshman},title = {{Learning the language of codon translation with CodonFM}},url = {https://research.nvidia.com/labs/dbr/assets/data/manuscripts/nv-codonfm-preprint.pdf},year = {2025}}```Sajad Darabi, Fan Cao and Mohsen Naghipourfar are equal contributing first authors.Corresponding authors: Hani Goodarzi and Laksshman Sundaram.## ContactQuestions and correspondence: nv-codonfm@nvidia.com21 unmodified lines222324252627282930313 unmodified lines353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410521 unmodified lines- masked-language-modeling---<p align="center"><picture><source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/nvidia/CodonFM-Encodon-5B-CDWT-v1/resolve/main/assets/codonfm-wordmark-dark.svg"><img src="https://huggingface.co/nvidia/CodonFM-Encodon-5B-CDWT-v1/resolve/main/assets/codonfm-wordmark.svg" width="300" alt="CodonFM"></picture></p>3 unmodified lines<a href="https://github.com/NVIDIA-BioNeMo/CodonFM">Code</a> ·<a href="https://research.nvidia.com/labs/dbr/assets/data/manuscripts/nv-codonfm-preprint.pdf">Preprint</a> ·<a href="https://huggingface.co/collections/nvidia/codonfm">All CodonFM models</a> ·<a href="https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1">CodonFM-5B</a></p># CodonFM-5B-CDWT**CodonFM** is a family of open RNA foundation models that read protein-coding sequences atcodon resolution, so synonymous codons, which most protein models treat as interchangeable,stay distinct. **CodonFM-5B-CDWT** is the 5B model trained with codon-frequency-weighted masking, which weights rare codons more heavily and makes it more sensitive to species-specific codon preference. It is the best model in the family at separating pathogenic from benign synonymous variants in ClinVar. For somatic variants and expression prediction, plain CodonFM-5B is at least as strong.<picture><source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/nvidia/CodonFM-Encodon-5B-CDWT-v1/resolve/main/assets/codonfm-overview-dark.svg"><img src="https://huggingface.co/nvidia/CodonFM-Encodon-5B-CDWT-v1/resolve/main/assets/codonfm-overview.svg" width="1060" alt="A coding sequence tokenised two ways. Amino-acid models collapse the synonymous codons GAA and GAG into a single token E, losing the distinction. CodonFM keeps each codon as its own token, which feeds codon optimization, variant effect prediction and sequence embeddings."></picture>> **Why codon resolution matters.** `GAA` and `GAG` both encode glutamate. A protein model sees> one amino acid and stops there. CodonFM sees two different words, and the choice between them> changes how fast the ribosome reads the transcript, how stable it is, and whether a "silent"> clinical variant is harmless.## At a glance| | Details ||---|---|| **Parameters** | 5B || **Training objective** | Masked language modelling over codons · codon-frequency-weighted masking || **Input** | A protein-coding sequence (CDS) as codons, up to 2,046; longer is truncated || **Output** | Per-position codon probabilities, sequence likelihoods, encoder embeddings || **License** | Code: Apache-2.0 · Weights: [NVIDIA Open Model License](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/) |## Where this sits in the family<picture><source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/nvidia/CodonFM-Encodon-5B-CDWT-v1/resolve/main/assets/codonfm-scale-Cdwt-5B-dark.svg"><img src="https://huggingface.co/nvidia/CodonFM-Encodon-5B-CDWT-v1/resolve/main/assets/codonfm-scale-Cdwt-5B.svg" width="1060" alt="Bar chart of CodonFM model sizes from 80M to 5B parameters, with CodonFM-5B-CDWT highlighted."></picture>| Model | Params | Masking | Use this one if… ||---|---|---|---|| [CodonFM-5B](https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1) ★ | 5B | Random | You want the strongest all-round model for mRNA design, expression prediction and somatic variant analysis || **CodonFM-5B-CDWT** ← you are here | 5B | Codon-frequency-weighted | You are scoring **germline** variants. Best in the family on ClinVar synonymous variants; for somatic variants and expression, plain 5B is at least as strong || [Encodon-1B](https://huggingface.co/nvidia/NV-CodonFM-Encodon-1B-v1) | 911M | Random | You need the previous flagship, or 5B does not fit your GPU || [Encodon-Cdwt-1B](https://huggingface.co/nvidia/NV-CodonFM-Encodon-Cdwt-1B-v1) | 911M | Codon-frequency-weighted | You need germline variant scoring at 1B. Weakest in the family on protein expression, so use Encodon-1B for that || [Encodon-600M](https://huggingface.co/nvidia/NV-CodonFM-Encodon-600M-v1) | 609M | Random | You are trading accuracy for throughput || [Encodon-80M](https://huggingface.co/nvidia/NV-CodonFM-Encodon-80M-v1) | 77M | Random | You are testing a pipeline, not making calls, since it is close to chance on variant interpretation |All of them are in the [CodonFM collection](https://huggingface.co/collections/nvidia/codonfm).## Quick start```bashgit clone https://github.com/NVIDIA-BioNeMo/CodonFM && cd CodonFMhf download nvidia/CodonFM-Encodon-5B-CDWT-v1 --local-dir ./CodonFM-Encodon-5B-CDWT-v1``````pythonfrom src.inference.encodon import EncodonInferencemodel = EncodonInference(model_path="./CodonFM-Encodon-5B-CDWT-v1/", task_type="fitness_prediction")model.configure_model()model = model.to("cuda").eval()```> **The full guide is on the [CodonFM-5B page](https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1).**> Worked examples for codon optimization and variant scoring, benchmarks, hardware notes and> limitations. All of it applies here, at this size. New to the model family? Start with the> [Genomic Analysis Blueprint](https://build.nvidia.com/nvidia/genomics-analysis) for an end-to-end walkthrough with no code.---
README.md+33-445