Upload README.md
Browse files37 unmodified lines3839404142434414 unmodified lines596061626364656637 unmodified lines104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215121 unmodified lines33733833934034134234334460 unmodified lines4054064074084094104114124134144154164174184194204214224234244254264274288 unmodified lines4374384394404414424434449 unmodified lines45445545645745845937 unmodified lines<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">14 unmodified linesCodonFM-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">37 unmodified lines| Run something now | [Quick start](#quick-start) || Choose between the two 5B models | [Which model should I use?](#which-model-should-i-use) || Score variants starting from sequencing data | [From a sequencer to scored variants](#from-a-sequencer-to-scored-variants) || Know exactly what the model takes and returns | [What goes in, what comes out](#what-goes-in-what-comes-out) || See the evidence that scale helps | [What scaling to 5B buys you](#what-scaling-to-5b-buys-you) |## 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** | ~130M coding sequences from >22,000 species across the tree of life, from NCBI RefSeq. Human-affecting pathogen sequences are excluded for biosafety || **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. Its embeddings lean less on simple features like GC content, which makes it weakest in the family on protein expression; use Encodon-1B there || [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 you121 unmodified linesStage three is what this page documents. Stages one and two are what make it usable on data youactually have, rather than on a coding sequence you were already holding.It needs a GPU and the Parabricks container, so it is not a browser-only demo. The dataset itships with is small on purpose: the pipeline is the point, and it scales to real cohorts.## What scaling to 5B buys you60 unmodified lines<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.## Where to go next| If you want to | Go here |8 unmodified lines| | ||---|---|| **GPU memory** | [TODO: confirm with Ankit] || **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`, pinned by digest in the repository's Dockerfile. Python 3.12 || **OS** | Linux |9 unmodified linesThe 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).## LicenseCode is released under Apache-2.0. Model weights are governed by the37 unmodified lines3839404142434414 unmodified lines596061626364656637 unmodified lines104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170121 unmodified lines29229329429529629729829960 unmodified lines3603613623633643658 unmodified lines3743753763773783793803819 unmodified lines39139239339439539639739839940040140240340440540640740840941037 unmodified lines<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/boost-protein-expression-and-predict-variant-effects-with-codonfm-5b">Blog</a></p><p align="center">14 unmodified linesCodonFM-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. To learn more see[What are the two training objectives?](#what-are-the-two-training-objectives)<picture><source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1/resolve/main/assets/codonfm-overview-dark.svg">37 unmodified lines| Run something now | [Quick start](#quick-start) || Choose between the two 5B models | [Which model should I use?](#which-model-should-i-use) || Score variants starting from sequencing data | [From a sequencer to scored variants](#from-a-sequencer-to-scored-variants) || Know exactly what the model takes and returns | [What are the inputs and outputs for the model?](#what-are-the-inputs-and-outputs-for-the-model) || See the evidence that scale helps | [What scaling to 5B buys you](#what-scaling-to-5b-buys-you) |## Model Architecture| Model Name | Parameters ||---|---|| Encodon-80M | 7.68 × 10⁷ || Encodon-600M | 6.09 × 10⁸ || Encodon-1B | 9.11 × 10⁸ || Encodon-Cdwt-1B | 9.11 × 10⁸ || Encodon-5B | 4.85 × 10⁹ || Encodon-5B-CDWT | 4.85 × 10⁹ |## Which model should I use?| Model | Params | Masking | Benefits ||---|---|---|---|| [CodonFM-5B](https://huggingface.co/nvidia/CodonFM-Encodon-5B-v1) ★ | 5B | Random | Best for zero-shot prediction valuable for codon optimization and mRNA design, expression prediction and somatic variant analysis || [CodonFM-5B-CDWT](https://huggingface.co/nvidia/CodonFM-Encodon-5B-CDWT-v1) | 5B | Codon-frequency-weighted | Valuable for species-specific differences and **germline** variants. || [Encodon-1B](https://huggingface.co/nvidia/NV-CodonFM-Encodon-1B-v1) | 911M | Random | Smaller model needed for fine-tuning or post-training || [Encodon-Cdwt-1B](https://huggingface.co/nvidia/NV-CodonFM-Encodon-Cdwt-1B-v1) | 911M | Codon-frequency-weighted | Smaller model needed for fine-tuning or post-training and more valuable for species-specific differences || [Encodon-600M](https://huggingface.co/nvidia/NV-CodonFM-Encodon-600M-v1) | 609M | Random | Smaller model for fine-tuning or post-training || [Encodon-80M](https://huggingface.co/nvidia/NV-CodonFM-Encodon-80M-v1) | 77M | Random | Smallest model for fine-tuning or post-training |All CodonFM models are listed in the [CodonFM collection](https://huggingface.co/collections/nvidia/codonfm).## What are the two training objectives?Each pretraining method for the 5B models offers unique advantages for the resulting models.**CodonFM-5B** uses uniform random masking of codons, where all codons are weighted equally, regardless of how often they appear in the pretraining corpus.**CodonFM-5B-CDWT** weights the loss according to usage bias, pushing the model to learn therare-codon usage in certain sub-contexts of sequences. This allowed the model to better capture species-specific functional codon selection and improved scoring for germline pathogenicity scoring.## What are the inputs and outputs for the model?Because CodonFM can be used for a variety of capabilities, the model can be used in a number of tasks illustrated in the notebooks.### InputA protein-coding sequence (CDS): uppercase `A`/`C`/`G`/`T`.The model tokenises by codon (sequences must be divisible by 3), with a default context window of 2048 tokens including the start and separator tokens.### Files in- **Input Type(s):** Text (mRNA Sequence)- **Input Format:** fasta files converted to memmaps- **Input Parameters:** 1D- **Other Properties Related to Input:** mRNA sequence represented as a string of codons, of maximum length 2046. Longer sequences are automatically truncated to this length### Files out- **Output Type(s):** Other: mRNA Sequence- **Output Format:** Text- **Output Parameters:** 2D- **Other Properties Related to Output:** Numeric 2D tensor with floating-point values representing probabilities of a given codon at each masked position within the sequence### What a variant score does not tell you121 unmodified linesStage three is what this page documents. Stages one and two are what make it usable on data youactually have, rather than on a coding sequence you were already holding.It runs on GPU and needs the Parabricks container. The dataset that ships with it is small, aworked example rather than a realistic cohort.## What scaling to 5B buys you60 unmodified lines<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>## Where to go next| If you want to | Go here |8 unmodified lines| | ||---|---|| **GPU memory** | The checkpoint is FP32, so the weights alone occupy 19.4 GB before activations. Plan for a 40 GB card or larger || **Tested on** | NVIDIA A100. Supported microarchitecture compatibility: NVIDIA Ampere and NVIDIA Hopper || **Base image** | `nvcr.io/nvidia/pytorch:26.09-py3`, pinned by digest in the repository's Dockerfile. Python 3.12 || **OS** | Linux |9 unmodified linesThe 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).## Ethical ConsiderationsNVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. When downloaded or used in accordance with our terms of service, developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse.For more detailed information on ethical considerations for this model, please see the Model Card++ Bias, Explainability, Safety & Security, and Privacy Subcards.Users are responsible for ensuring the physical properties of model-generated molecules are appropriately evaluated and comply with applicable safety regulations and ethical standards.CodonFM optimizes or scores a coding sequence that the user supplies. It does not propose biological payloads, and it provides no guidance on synthesizability or immunogenicity. Determining whether a designed sequence can be manufactured, and how it will behave in a biological system, remains the responsibility of the user.Users designing sequences for synthesis are encouraged to screen them with [SecureDNA](https://securedna.org/). Two limitations are worth understanding: SecureDNA screens DNA, so RNA sequences must have U converted to T before submission; and it identifies hazards by similarity to known sequences of concern, which makes it least sensitive to novel constructs. This is guidance for users rather than a control that NVIDIA applies to model outputs.Please report model quality, risk, security vulnerabilities or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/).## LicenseCode is released under Apache-2.0. Model weights are governed by the
README.md+54-103