License: ESM3 uses Custom (Cambrian Open License Agreement) for code and Custom (Cambrian Non-Commercial License Agreement) for model weights and has restrictions around commercial use and may require explicit attribution when utilized. Model weights are gated and require accepting the provider’s terms and authenticating with a HuggingFace token. Please refer to the code license and model weights license for full terms.
Proto is not affiliated with Biohub. This toolkit is open source and builds on the implementation produced by this organization. Product names, logos, and trademarks are the property of their respective owners.
evolutionaryscale/esm
Simulating 500 million years of evolution with a language model
Open Notebook
Open notebook
| Function | Description | |
|---|---|---|
run_esm3_embeddings() | Extract protein sequence embeddings and logits using ESM3 (GPU) | Docs Source |
run_esm3_sample() | Sample masked positions in protein sequences using ESM3 language model (GPU) | Docs Source |
run_esm3_score() | Score protein sequences using ESM3 language model (GPU) | Docs Source |
Background
In 2025, Hayes et al. introduced ESM3, a generative model from EvolutionaryScale that departs from the encoder-only design of the ESM-1/ESM-2 line. ESM3 is a masked generative transformer that represents a protein across three simultaneous tracks (amino-acid sequence, discrete structure tokens, and function annotation). Training masks spans across all three tracks, so a single model can be prompted with any combination of partial sequence, structure, and function and asked to complete the rest. The flagship 98B-parameter model (esm3-large-2024-03) is available through the EvolutionaryScale Forge API under closed-beta access (also offered via AWS SageMaker); the publicly released open checkpoint, esm3_sm_open_v1, is the small 1.4B-parameter variant.
ESM3 is the multimodal successor to ESM-2 (Lin et al., 2023). Where ESM-2 is a sequence-only masked language model, ESM3 adds structure and function tracks and a generative objective. For pure sequence-embedding workloads ESM-2 remains lighter and faster; ESM3 is the choice when masked generative editing matters. This toolkit exposes only the sequence-track operations (embeddings, masked sampling, scoring) over supplied sequences.
Tools
ESM3 Sampling (esm3-sample)
Selects positions via a configurable masking strategy, masks them, and resamples from ESM3’s predicted distribution. single_pass fills every masked position in one forward pass; iterative_refinement dispatches to ESM3’s native batch_generate for multi-round commitment. Positions can also be pre-masked directly with _ in the input string, or a masking strategy can be used.API Reference
Source
Input: MaskedModelInput
Input: MaskedModelInput
Protein sequence(s) to process. Can be provided as:
Source
Config: ESM3SampleConfig
Config: ESM3SampleConfig
Positions to mask before sampling.
ESM3 weights variant.
“single_pass” fills every mask in one forward; “iterative_refinement” dispatches to
model.batch_generate and uses the five GenerationConfig settings below.Available options: single_pass, iterative_refinementSoftmax temperature.
Nucleus threshold (iterative only).
Refinement steps (iterative only).
Unmask schedule (iterative only).Available options:
cosine, linearPer-round commit selection (iterative only).Available options:
random, entropyAnneal toward 0 across rounds (iterative only).
Include per-position logits.
Verbosity level (0=quiet, 1=info, 2=debug, 3=raw subprocess stderr).
True is coerced to 1 and False to 0.Device to run on.
Maximum execution time in seconds.
None waits indefinitely.Random seed. When set, tools run reproducibly up to small GPU float noise (see
BaseToolOutput.approx_equal), and the seed participates in cache keys. When None, cacheable seed-sensitive tools skip cache until seeded.Sequences per GPU forward pass.
Source
Output: ESM3SampleOutput
Output: ESM3SampleOutput
Per-position logits for each sequence. Shape is (num_sequences, seq_len, vocab_size=20). Only present if return_logits=True in config.
Sampled or mutated protein sequences. Each sequence is a string of amino acid characters and is a modified version of the input sequence with masked positions changed to model-predicted alternatives.
Applications
This tool drives guided point mutation, variant generation, and infilling at designable sites. Resampling masked positions from a protein language model is the core operation behind directed-evolution proposals and antibody affinity maturation. Which positions are resampled is set by the masking strategy; see its README for the available selection methods and tuning parameters.Usage Tips
iterative_refinementproduces more coherent joint samples thansingle_pass. It runs ESM3’sbatch_generateovernum_stepsrounds (cosine or linear unmask schedule) instead of filling every mask independently in one pass; it is roughlynum_steps×slower. Default to it when masking more than a handful of sites.masking_strategycontrols which positions get masked before sampling. See the masking strategy README for the available selection methods and tuning parameters. As an alternative to passing a strategy, pre-mask exact positions with_directly in the input string and the masking strategy is skipped entirely.temperaturescales the per-position logits before sampling. Values of 0.5 to 0.7 yield conservative mutations close to the input; values above 1.0 broaden exploration of the model’s distribution.
ESM3 Scoring (esm3-score)
Computes masked-language-model pseudo-perplexity for each input sequence. Each position is masked individually and the model’s log-probability of the true amino acid under bidirectional context is recorded, then aggregated into per-sequence log-likelihood, average log-likelihood, and perplexity.API Reference
Source
Input: MaskedModelInput
Input: MaskedModelInput
Protein sequence(s) to process. Can be provided as:
Source
Config: ESM3ScoringConfig
Config: ESM3ScoringConfig
ESM3 weights variant.
Print status messages during scoring.
Device to run the model on.
Maximum execution time in seconds.
None waits indefinitely.Random seed. When set, tools run reproducibly up to small GPU float noise (see
BaseToolOutput.approx_equal), and the seed participates in cache keys. When None, cacheable seed-sensitive tools skip cache until seeded.Masked variants per forward pass, pooled across all input sequences. Larger batches improve throughput but use more memory.
Include per-position logits in the output (large; disable to save memory).
Source
Metrics (one set per
Output: MaskedModelScoringOutput
Output: MaskedModelScoringOutput
List of scoring outputs, one per input sequence. Each entry is a
Metrics subclass with scalar metrics (accessed via score.perplexity or score["perplexity"]) plus declared logits / vocab fields that carry raw model outputs when requested.scores item)| Metric | Type | Range | Availability |
|---|---|---|---|
log_likelihood | float | ≤ 0.0 | always |
avg_log_likelihood | float | ≤ 0.0 | always |
perplexity | float | ≥ 1.0 | always |
Applications
ESM3 pseudo-perplexity is a fitness proxy for ranking variants, filtering generated sequences for naturalness, or comparing engineered constructs against wild type. The masked log-likelihood difference between wild-type and mutant residues is a zero-shot baseline for variant-effect prediction.Usage Tips
- Pseudo-perplexity is a relative score, not an absolute fitness. It is measured against the model’s training distribution and is sensitive to length, so it is most useful for comparing closely related sequences of similar length.
- Ambiguous residues are excluded. Perplexity is computed only over the 20 canonical amino acids;
X,B,Z, and similar are dropped from both the log-likelihood sum and the position count.
Toolkit Notes
These apply to every ESM3 tool in this toolkit (esm3-embedding, esm3-sample, esm3-score).
- ESM3 is a gated model and requires a HuggingFace token. The open checkpoint lives behind a gated HuggingFace repo (EvolutionaryScale/esm3-sm-open-v1). Set the
HF_TOKENenvironment variable with an account that has accepted the model license, or every tool raises before loading. - One open checkpoint is available.
esm3_sm_open_v1is the only public open-weights checkpoint; larger ESM3 models are EvolutionaryScale API-only and not wrapped here. - ESM3 is larger than many ESM-2 variants. For sequence-embedding-only workloads, smaller ESM-2 variants are faster; consider reaching for ESM3 when you want masked generative editing. This toolkit takes only amino-acid sequences as input and does not expose the structure or function tracks.
batch_sizecontrols memory usage across the toolkit. Lower it if you OOM; raise it for short-sequence throughput. Foresm3-score,batch_sizecounts masked variants pooled across all input sequences rather than sequences themselves (each input contributes one masked variant per position).
Infrastructure Guides
The following guides cover how to run tools efficiently and at scale.Tool Persistence
Keep a tool’s model warm across calls instead of reloading it every invocation.
Device Management
How GPUs are allocated to tools and how to target specific devices.
Parallel Execution
Fan a batch of inputs out across multiple GPUs.

Biohub