> ## Documentation Index
> Fetch the complete documentation index at: https://proto.evodesign.org/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# CodonFM Codon Language Model

> CodonFM/Encodon masked codon language model for local coding-sequence mutation/refinement

![CodonFM Codon Language Model](https://proto-bio.github.io/proto-assets/images/generator/codonfm/hero.png)

> [!NOTE]
>
> **License:** CodonFM (Encodon) uses Apache-2.0 for code and Custom (NVIDIA Open Model License) for model weights. Please refer to the [code license](https://github.com/NVIDIA-BioNeMo/CodonFM/blob/main/LICENSE) and [model weights license](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/) for full terms.

This generator is open source. Any third-party models, product names, or trademarks referenced are the property of their respective owners, and Proto is not affiliated with them.

***

&#x20;Tools Used Tools Used  Source Source  Cite Cite

![](https://proto-bio.github.io/proto-assets/images/tool/codonfm/social.png)

&#x20;Go to Tool Page

[Open](https://proto.evodesign.org/docs/tools/masked-models/codonfm.md)

![Proto](https://mintcdn.com/bio-pro/cMLt8hAqaP9M3LKy/assets/logo/logo-light.svg?fit=max\&auto=format\&n=cMLt8hAqaP9M3LKy\&q=85\&s=f5e5dfd1b8f9b9db3a0be0e2eb01f678)

evo-design/proto-language

&#x20;View source

[Open](https://github.com/evo-design/proto-language/blob/0824a53b9c4ed4c3ed45d82d06d250a40b1c9e7a/proto_language/generator/codonfm_generator.py#L84)

@articlecodonfm2025

```bibtex theme={null}
@article{codonfm2025,
  title={Learning the language of codon translation with CodonFM},
  author={Darabi, Sajad and Cao, Fan and Naghipourfar, Mohsen and Rabi, Sara and Sethia, Ankit and Gion, Kyle and Grewal, Jasleen and Cohen, Jonathan and Greenleaf, William and Goodarzi, Hani and Sundaram, Laksshman},
  year={2025},
  publisher={NVIDIA},
  url={https://research.nvidia.com/labs/dbr/assets/data/manuscripts/nv-codonfm-preprint.pdf}
}
```

&#x20;Copy citation

Generator contributors[![](https://avatars.githubusercontent.com/u/21143637?v=4\&s=64)bviggiano](https://github.com/bviggiano)
Coding-sequence mutation generator using the CodonFM (Encodon) codon language model.

Refines existing coding sequences by masking a subset of codon positions and resampling
them from Encodon's per-codon distribution. Sequence length is preserved. The generator
category is `"mutation"`.

## API Reference

ConfigCodonFMGeneratorConfig[ Source](https://github.com/evo-design/proto-language/blob/0824a53b9c4ed4c3ed45d82d06d250a40b1c9e7a/proto_language/generator/codonfm_generator.py#L19)

Configuration object for CodonFMGenerator.

CodonFM (Encodon) is a codon-level masked language model. As a Proto Language generator it
refines an existing coding sequence by masking a subset of codons and resampling them from
the model — a mutation-category generator, so the segment must already carry a sequence
(directly or from a prior optimizer stage).

**model\_checkpoint** `enum` (default: encodon\_80m)

Encodon checkpoint: encodon\_80m | encodon\_600m | encodon\_1b | encodon\_1b\_cdwt.

Options: `encodon_80m`, `encodon_600m`, `encodon_1b`, `encodon_1b_cdwt`

**masking\_strategy** `RandomMaskingStrategy`

Which codons to resample (counted in codons); fixed\_positions pins codons that must survive.

**temperature** `number` (default: 1.0)

Sampling temperature. Below 1 sharpens toward the likely codon; above 1 adds diversity.

**device** `string` (default: cuda)

GPU device to run CodonFM on (e.g. 'cuda' or 'cuda:0').

**batch\_size** `integer` (default: 1)

Number of same-length sequences to process simultaneously on GPU.

**excluded\_amino\_acids** `array`

Single-letter codes no resampled codon may encode (e.g. \['C'] to forbid cysteine).

## Usage

```python python icon="python" theme={null}
>>> from proto_language.generator import CodonFMGenerator, CodonFMGeneratorConfig
>>> from proto_language.core import Segment
>>> from proto_tools.transforms.masking import RandomMaskingStrategy
>>> gen = CodonFMGenerator(CodonFMGeneratorConfig(masking_strategy=RandomMaskingStrategy(num_mutations=3)))
>>> segment = Segment(sequence="ATGGTGAGCAAGGGC", sequence_type="dna")  # 5 codons
>>> gen.assign(segment)
>>> gen.sample()  # resamples 3 randomly masked codons
```

## Metadata

| Property | Value |
| - | - |
| Key | `codonfm` |
| Class | `CodonFMGenerator` |
| Category | `mutation` |
| Input Type | `starting_sequence` |
| Uses GPU | `True` |
| Supported Sequence Types | `dna`, `rna` |
| Allows Empty Start | `False` |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.