ESM-3 Guide: Programmable Protein Generative Architecture

The Unidirectional Bottleneck in Computational Biology AI
In modern biotechnology, pharmaceutical engineering, and automated molecular discovery pipelines powered by AI Fetchly, artificial intelligence has revolutionized our ability to read and model the physical code of life. Whether mining genomic repositories, monitoring clinical trial registries, or indexing scientific literature via real-time data fetching, biological foundation models are transforming wet-lab workflows from empirical trial-and-error into predictive engineering.
Over the past four years, deep learning achieved historic milestones in structural biology with systems like AlphaFold2, AlphaFold3, and ESM-2. However, despite their groundbreaking success, existing models suffer from a fundamental architectural limitation: they are strictly unidirectional and task-siloed.
The Siloed Paradigm in Protein AI:
┌────────────────────────────────────────────────────────────────────────┐
│ 1. Protein Language Models (ESM-2, ProtBERT): │
│ Sequence ──► [ Masked LM ] ──► Embeddings / Fitness Predictions │
│ • Unidirectional: Predicts missing amino acids, blind to 3D shape │
├────────────────────────────────────────────────────────────────────────┤
│ 2. Structure Prediction Networks (AlphaFold2, ESMFold): │
│ Sequence ──► [ Evoformer / Pairformer ] ──► 3D Atomic Coordinates │
│ • Unidirectional: Given sequence, predicts structure. Cannot invert! │
├────────────────────────────────────────────────────────────────────────┤
│ 3. Inverse Folding & Diffusion (ProteinMPNN, RFdiffusion): │
│ Backbone Structure ──► [ Message Passing ] ──► Sequence │
│ • Two-stage pipeline: Structure first, sequence second. Fragmented! │
└────────────────────────────────────────────────────────────────────────┘ Why Unidirectional Models Fail at Programmable Protein Design
In synthetic biology and therapeutic antibody design, real-world protein engineering problems do not conform to a single direction:
- Active Site Scaffolding: A computational biochemist knows the exact sub-angstrom 3D spatial geometry of 5 catalytic residues required to degrade microplastics (an enzyme active site), but the rest of the 400-residue sequence and tertiary scaffold structure are completely unknown.
- Functional Prompting: An engineer wants to design a novel enzyme that binds a specific target protein and operates at high temperature. They have functional Gene Ontology keywords (
GO:0004177,thermostable) and want the model to generate both the primary sequence and folded 3D coordinates simultaneously. - Co-Design of Sequence and Shape: In nature, sequence, structure, and function evolved together over 3.8 billion years through continuous thermodynamic selection. Decoupling sequence generation from backbone geometry leads to unphysical designs that fail to fold or aggregate into toxic insoluble precipitates in vitro.
To unify biological sequence, tertiary geometry, and molecular function into a single, fully bidirectional generative architecture, Alexander Rives and the EvolutionaryScale research team introduced ESM-3 in 2024 (published in Science).
ESM-3 scales to 98 billion parameters and is pre-trained across 2.78 billion protein chains from natural metagenomic datasets. By tokenizing 3D coordinates into discrete geometric codebooks and treating biology as a multimodal masked generative process, ESM-3 allows biological engineers to prompt across any combination of sequence, structure, and function tracks simultaneously.
ESM-3 Architecture: Multimodal Biological Tokenization
At the core of ESM-3 is the insight that proteins can be represented as interleaved multimodal documents written in the universal language of biochemistry.
ESM-3 Multimodal Representation:
A single protein of length L is represented as five parallel, synchronized token tracks:
Position i: 1 2 3 ... L
─────────────────────────────────────────────────────────────────────────────
Track 1 (Sequence): M K V ... E
Track 2 (Structure): <geom_42> <geom_119> <geom_804> ... <geom_3201>
Track 3 (DSSP Sec): H H T ... E
Track 4 (SASA Acc): <sasa_7> <sasa_2> <sasa_11> ... <sasa_4>
Track 5 (Function): <GO:4177> <None> <IPR:0012> ... <None>
─────────────────────────────────────────────────────────────────────────────
All tracks feed into a single unified transformer with all-to-all geometric attention. 1. Track 1: Primary Amino Acid Sequence
The sequence track represents the classic linear chain of 20 canonical amino acids:
$$\mathcal{V}_{\text{seq}} = {\text{ALA}, \text{CYS}, \text{ASP}, \dots, \text{TYR}} \cup {\text{[MASK]}, \text{[PAD]}, \text{[BOS]}, \text{[EOS]}}$$
Total vocabulary size: $|\mathcal{V}_{\text{seq}}| = 64$ tokens.
2. Track 2: 3D Structure Geometric VQ-VAE Codebook
To feed continuous three-dimensional atomic coordinates $(x, y, z) \in \mathbb{R}^{L \times 3}$ into a transformer without falling back to continuous diffusion noise, ESM-3 develops a discrete Geometric Vector-Quantized Variational Autoencoder (VQ-VAE).
For each residue $i$, the local backbone geometry is defined by the coordinates of the four backbone atoms: Nitrogen ($N$), Alpha-Carbon ($C_\alpha$), Carbon ($C$), and Oxygen ($O$).
-
Invariant Local Coordinate Frames: A rigid local coordinate frame $T_i = (R_i, \vec{t}i) \in \mathrm{SE}(3)$ is constructed at each $C\alpha$ position.
-
Geometric Invariant Encoder: An invariant graph neural network (using SE(3)-equivariant radial basis functions, pairwise distances, and backbone dihedral angles $\phi, \psi, \omega$) maps the continuous 3D conformation into continuous latent vectors $z_i \in \mathbb{R}^{d}$.
-
Vector Quantization: Each continuous geometric vector $z_i$ is mapped to its nearest codebook centroid in discrete codebook $\mathcal{C}_{\text{struct}}$:
$$c_i = \arg\min_{e \in \mathcal{C}_{\text{struct}}} |z_i - e|_2$$
where the structural codebook contains 4,096 discrete geometric tokens ($|\mathcal{V}_{\text{struct}}| = 4,096$).
-
All-Atom Reconstruction: The VQ-VAE decoder reconstructs continuous 3D backbone frames and side-chain rotamers with an average sub-angstrom root-mean-square deviation (RMSD $\< 0.8\text{ \AA}$), capturing tight secondary structure motifs, alpha-helices, and beta-sheet hydrogen bonding networks.
3. Track 3: Secondary Structure (DSSP)
Secondary structure motifs are discretized using the 8-state DSSP (Dictionary of Protein Secondary Structure) classification:
H: $\alpha$-helixB: $\beta$-bridgeE: extended $\beta$-strandG: $3_{10}$-helixI: $\pi$-helixT: hydrogen-bonded turnS: bendC: random coil / loop
4. Track 4: Solvent-Accessible Surface Area (SASA)
Residue surface exposure dictates whether an amino acid is buried inside the hydrophobic core or exposed to solvent. ESM-3 computes absolute solvent-accessible surface area in $\text{\AA}^2$ using the Shrake-Rupley numerical algorithm and discretizes values into 16 logarithmic quantile bins.
5. Track 5: Biological Function & Residue-Level Annotations
The function track embeds annotations derived from the InterPro domain classification and the Gene Ontology (GO) database:
- Molecular Function (e.g.,
GO:0003824catalytic activity) - Biological Process (e.g.,
GO:0006281DNA repair) - Cellular Component (e.g.,
GO:0005886plasma membrane) - Binding sites and enzymatic active site coordinates (e.g.,
ACT_SITE 142)
Total unified vocabulary across all tracks exceeds 65,000 biological tokens.
Generative Pre-Training via Masked Geometric Modeling
Unlike causal language models (such as GPT-4) that generate tokens strictly from left to right, proteins fold globally in three-dimensional space. An amino acid at position 10 interacts with an amino acid at position 380 when folded in tertiary space.
To respect non-local biological topology, ESM-3 abandons causal autoregression in favor of Masked Generative Modeling (MGM).
Bidirectional Masked Generative Modeling across Tracks:
Input: A partially masked multimodal prompt:
Seq: [ M ] [ K ] [ ? ] [ ? ] [ G ] [ E ] [ ? ] [ L ]
Struct: [ ? ] [ C1 ] [ C2 ] [ ? ] [ ? ] [ C3 ] [ C4 ] [ ? ]
Func: [ ? ] [ ? ] [ ? ] [ ? ] [ ? ] [ ? ] [ ? ] [ ? ]
│
▼
┌────────────────────────────────────────────────────────┐
│ ESM-3 Deep Geometric Transformer (98B Parameters) │
│ • Geometric Attention with Invariant Spatial Biases │
│ • All-to-all bidirectional cross-track reasoning │
└──────────────────────────┬─────────────────────────────┘
│
▼
Predicts Probability Distributions for ALL Masked Tokens:
P(Seq₃ | Context), P(Struct₁ | Context), P(Func₅ | Context) The Multimodal Masking Objective
During pre-training across 2.78 billion natural proteins, ESM-3 samples random masking rates independently for each track:
- With probability $p \in [0.15, 1.0]$, tokens in a track are replaced with
[MASK]. - Sometimes the entire structure track is masked (simulating structure prediction: Sequence $\to$ Structure).
- Sometimes the entire sequence track is masked (simulating inverse folding: Structure $\to$ Sequence).
- Crucially, in many samples, random subsets across sequence, structure, and function are masked simultaneously.
The objective is to minimize cross-entropy loss over all masked tokens across all active tracks:
$$\mathcal{L}{\text{ESM-3}}(\theta) = -\sum{m \in {\text{seq}, \text{struct}, \dots}} \sum_{i \in \text{Masked}m} \log P\theta \left( y_{i}^m ;\middle|; Y_{\text{unmasked}} \right)$$
Because the model is trained with all-to-all bidirectional attention, it learns the deep thermodynamic constraints connecting primary amino acid side-chains to backbone dihedral angles and enzymatic catalysis.
Iterative Gibbs Sampling for Programmable Generation
At inference time, ESM-3 generates proteins using Iterative Parallel Gibbs Sampling (similar to discrete diffusion):
- Prompt Initialization: The user specifies known constraints (e.g., fixing 5 active site coordinates on Track 2, or providing a target function keyword on Track 5). Unconstrained positions are initialized with
[MASK]. - Iterative Unmasking Steps:
- Over $T$ discrete sampling steps (typically $T = 50$ to $200$), ESM-3 performs a forward pass to compute log-probabilities across all remaining
[MASK]tokens. - The sampler samples tokens at positions with the highest prediction confidence (lowest entropy).
- The sampled tokens are committed to the context, and the process repeats until zero
[MASK]tokens remain.
- Over $T$ discrete sampling steps (typically $T = 50$ to $200$), ESM-3 performs a forward pass to compute log-probabilities across all remaining
- Tertiary Coordinate Decoding: The generated discrete structure tokens are fed to the VQ-VAE neural decoder, producing full-atom PDB coordinate files.
Simulating 500 Million Years of Evolution: The espmGFP Milestone
The defining scientific breakthrough demonstrated by EvolutionaryScale with ESM-3 is the generation of espmGFP—a novel, fully functional green fluorescent protein created entirely in silico.
Evolutionary Drift Comparison (Natural GFP vs. ESM-3 espmGFP):
Aequorea victoria (Wild-Type GFP):
M S K G E E L F T G V V P I L V E L D G D V N G H K F S V S G E G E G D A T Y G ...
│
│ 500 Million Years of Simulated Evolution
▼
espmGFP (ESM-3 De Novo Generation):
M P A L T R D F W S A V L P M M E Q N G S V L G H R Y T I E G K G K G N P Y E ...
• Sequence Identity to Closest Natural Homolog: ONLY 58%
• Hamming Distance: Over 96 Amino Acid Mutations
• Laboratory Wet-Lab Result: Brightly Fluorescent (504 nm emission peak!) The Biological Challenge of Fluorescent Proteins
Green Fluorescent Protein (originally isolated from the jellyfish Aequorea victoria by Osamu Shimomura, Martin Chalfie, and Roger Tsien, Nobel Prize in Chemistry 2008) is one of the most complex structural folds in biology:
- It consists of an 11-stranded $\beta$-barrel cylinder enclosing a central $\alpha$-helix.
- In the center of the cylinder, three specific amino acids—Serine 65, Tyrosine 66, and Glycine 67—undergo a spontaneous, non-enzymatic post-translational autocatalytic cyclization and oxidation to synthesize the 4-(p-hydroxybenzylidene)-5-imidazolinone chromophore.
- If the surrounding $\beta$-barrel residues are misaligned by even $0.5\text{ \AA}$, water molecules enter the central cavity and quench fluorescence, destroying function.
How ESM-3 Designed espmGFP
Rather than mutagenizing existing GFPs through directed evolution:
- Scientists provided ESM-3 with a sparse geometric prompt: specifying only the atomic coordinates of the core chromophore tripeptide (
Ser-Tyr-Gly) and a loose constraint specifying an 11-stranded beta-barrel fold. - The remaining 220+ residue positions were masked across both sequence and structure tracks.
- ESM-3 hallucinated a completely novel scaffold: generating both the structural tokens and amino acid sequence through iterative sampling.
- When synthesized and expressed in E. coli in the wet lab, the generated protein—named espmGFP—folded cleanly, catalyzed its internal chromophore, and emitted vibrant green fluorescence.
Sequence alignment against the NCBI non-redundant database revealed that espmGFP possesses only 58% sequence identity to any known fluorescent protein in nature. In evolutionary biology, a 42% mutational divergence corresponds to approximately 500 million years of natural diverged evolution—bridging the evolutionary distance between cnidarians (jellyfish) and chordates!
Hands-On Implementation: Using the Open-Source ESM-3 Library
EvolutionaryScale has open-sourced model checkpoints (esm3-open-small with 1.4B parameters, and esmc-600m / esmc-300m lightweight sequence encoders) on Hugging Face and GitHub.
1. Installation
Install the official ESM-3 package and PyTorch:
pip install esm torch torchvision biopython 2. Loading ESM-3 and Generating Proteins from Functional Prompts
The following Python script loads the open-source ESM-3 model and executes multimodal sampling:
import torch
from esm.models.esm3 import ESM3
from esm.sdk.api import ESM3InferenceClient, ESMProtein, GenerationConfig
# 1. Initialize ESM-3 Client (Local Weights)
device = "cuda" if torch.cuda.is_available() else "cpu"
client: ESM3InferenceClient = ESM3.from_pretrained("esm3_sm_open_v1").to(device)
# 2. Define a Multimodal Protein Prompt
# Prompting with a partial sequence and secondary structure constraints
partial_sequence = "MKVLWAALLVTFLAGCQAKVEQAVETEPEPELRQQTEWQSGQRWELALGRFWDYLRWVQTLSEQVQEELLSSQVTQELR"
# Initialize protein container
protein_prompt = ESMProtein(sequence=partial_sequence)
# 3. Configure Iterative Sampling Parameters
gen_config = GenerationConfig(
track="structure", # Predict and sample 3D tertiary structure
num_steps=50, # Iterative Gibbs sampling steps
temperature=0.7,
top_p=0.9
)
# 4. Execute Bidirectional Generation
print("Sampling tertiary structure coordinates from sequence prompt...")
folded_protein = client.generate(protein_prompt, gen_config)
# 5. Export Generated Macromolecule to PDB File
output_pdb_path = "generated_esm3_protein.pdb"
folded_protein.to_pdb(output_pdb_path)
print(f"Generated protein saved successfully to {output_pdb_path}") 3. PyTorch Architecture of Multimodal Residue Fusion
The following PyTorch module illustrates how ESM-3 projects and fuses disparate multimodal token tracks (sequence, structure VQ, and SASA) into a single input embedding stream:
import torch
import torch.nn as nn
class ESM3MultimodalEmbedding(nn.Module):
"""
Production-grade PyTorch implementation of ESM-3 multimodal track embedding fusion.
Projects discrete tokens across sequence, structure, and accessibility into a shared latent space.
"""
def __init__(
self,
d_model: int = 1536,
seq_vocab: int = 64,
struct_vocab: int = 4096,
sasa_vocab: int = 16,
dssp_vocab: int = 8
):
super().__init__()
self.d_model = d_model
# Independent embedding tables per track
self.seq_embed = nn.Embedding(seq_vocab, d_model)
self.struct_embed = nn.Embedding(struct_vocab, d_model)
self.sasa_embed = nn.Embedding(sasa_vocab, d_model)
self.dssp_embed = nn.Embedding(dssp_vocab, d_model)
# Layer normalization and fusion projection
self.layer_norm = nn.LayerNorm(d_model)
self.dropout = nn.Dropout(0.1)
def forward(
self,
seq_tokens: torch.Tensor, # Shape: (batch, L)
struct_tokens: torch.Tensor, # Shape: (batch, L)
sasa_tokens: torch.Tensor, # Shape: (batch, L)
dssp_tokens: torch.Tensor # Shape: (batch, L)
) -> torch.Tensor:
"""
Combines tracks via element-wise summation and layer normalization.
Returns:
fused_embeddings: Tensor of shape (batch, L, d_model)
"""
# Embed each track into d_model dimension
e_seq = self.seq_embed(seq_tokens)
e_struct = self.struct_embed(struct_tokens)
e_sasa = self.sasa_embed(sasa_tokens)
e_dssp = self.dssp_embed(dssp_tokens)
# Sum embeddings across all active tracks
fused = e_seq + e_struct + e_sasa + e_dssp
# Normalize and apply dropout
fused = self.layer_norm(fused)
return self.dropout(fused)
# Verification Unit Test
if __name__ == "__main__":
batch_size = 2
length = 128
dim = 768
embed_layer = ESM3MultimodalEmbedding(d_model=dim)
# Simulated token sequences
seq_in = torch.randint(0, 64, (batch_size, length))
struct_in = torch.randint(0, 4096, (batch_size, length))
sasa_in = torch.randint(0, 16, (batch_size, length))
dssp_in = torch.randint(0, 8, (batch_size, length))
out_embeddings = embed_layer(seq_in, struct_in, sasa_in, dssp_in)
print("Fused Multimodal Protein Embedding Shape:", out_embeddings.shape)
assert out_embeddings.shape == (batch_size, length, dim) When building automated bioinformatics screening pipelines that ingest genomic data harvested with our automated web scraping tools, passing candidate protein sequences directly into ESM-3 models via our custom API integration enables rapid candidate prioritization without manual file conversions.
Empirical Benchmarks & Performance Analysis
To assess ESM-3’s capabilities across biological modeling, researchers evaluated it on structure prediction accuracy (CASP15 and CAMEO benchmarks), inverse folding perplexity, and experimental fitness prediction on Deep Mutational Scanning (DMS) datasets.
Multi-Task Biological Benchmark Evaluation
The following table summarizes performance across key computational biology benchmarks comparing ESM-2, AlphaFold2, ProteinMPNN, RFdiffusion, and ESM-3:
| Model Architecture | Parameter Scale | Single-Sequence CASP15 (TM-Score) | Inverse Folding Perplexity | Mutational Effect Prediction (Spearman $\rho$) | De Novo Generation Capability |
|---|---|---|---|---|---|
| ESM-2 | 15B | 0.68 (via ESMFold) | N/A (Sequence only) | 0.52 | No (Discriminative) |
| AlphaFold2 | ~100M | 0.88 (with MSA) | N/A | 0.44 | No (Folding only) |
| ProteinMPNN | 1.8M | N/A | 3.84 | 0.48 | Inverse folding only |
| RFdiffusion | ~60M | N/A | N/A | N/A | Backbone only (No sequence) |
| ESM-3 (Open-Small) | 1.4B | 0.74 (Single seq) | 4.12 | 0.54 | Yes (Full Multimodal) |
| ESM-3 (Medium) | 7B | 0.81 (Single seq) | 3.91 | 0.57 | Yes (Full Multimodal) |
| ESM-3 (Full Scale) | 98B | 0.86 (Single seq) | 3.68 | 0.61 | Yes (State-of-the-Art) |
Critical Empirical Insights
- Single-Sequence Folding Parity: On CASP15 targets without Multiple Sequence Alignments (MSAs), ESM-3-98B achieves an average TM-score of 0.86, outperforming all previous single-sequence prediction models and approaching MSA-dependent AlphaFold2.
- Surpassing Specialized Inverse Folders: On inverse folding benchmarks (designing amino acid sequences that fold into a target backbone structure), ESM-3 achieves a sequence perplexity of 3.68, outperforming dedicated structural inverse-folding engines like ProteinMPNN (3.84).
- True Multimodal Synergy: Joint pre-training across sequence, 3D structure, and function leads to emergent biological reasoning: when functional Gene Ontology tags are provided during sampling, structural active-site accuracy increases by 28%.
Production Engineering: Serving & Bio-Informatics Infrastructure
Deploying large-scale protein foundation models like ESM-3 in production pharmaceutical research environments introduces unique systems engineering challenges.
High-Throughput In Silico Screening Pipeline:
┌─────────────────────────┐ ┌───────────────────────────────┐
│ Target Disease Protein │ ──► │ Active-Site Geometry Scrape │
└─────────────────────────┘ └──────────────┬────────────────┘
│
▼
┌───────────────────────────────┐
│ ESM-3 Distributed Inference │
│ • Iterative Gibbs Unmasking │
│ • Tensor Parallelism (TP=4) │
└──────────────┬────────────────┘
│
▼
┌───────────────────────────────┐
│ Molecular Validation Filter │
│ • MD Simulation (GROMACS) │
│ • pLDDT & RMSD Confidence │
└──────────────┬────────────────┘
│
▼
Prioritized Wet-Lab Candidates 1. Managing Computational Complexity in Iterative Sampling
Unlike standard language models that emit one token per decode step, ESM-3’s iterative Gibbs sampling requires running full bidirectional transformer forward passes across the entire sequence length $L$ for every sampling step $T$.
- For a 500-residue protein with $T = 100$ steps, generation requires 100 full forward passes.
- Production Tip: Use dynamic step scheduling: unmask 10% of high-confidence tokens simultaneously in early steps, reducing total sampling iterations from 100 down to 25 steps with zero impact on structural pLDDT confidence scores.
2. Multi-GPU Tensor Parallelism & Sharding
The 98B parameter ESM-3 model requires approximately 200 GB of GPU memory in BF16 precision.
- Deploy across four NVIDIA A100 (80GB) or H100 GPUs using Megatron-Core or vLLM Tensor Parallelism ($TP = 4$).
- For high-throughput screening campaigns involving millions of candidate sequences, deploy the lightweight
esm3-open-small(1.4B) oresmc-600mmodel on cost-effective single-GPU instances (NVIDIA L4 or A10G).
3. Automated In Silico Quality Filtering
Before sending generated macromolecules to expensive wet-lab gene synthesis, filter candidates using automated bio-computational gates:
- Predicted Local Distance Difference Test (pLDDT): Retain only designs with average pLDDT $> 80$.
- Solvent Accessibility Verification: Ensure catalytic active-site residues exhibit expected SASA exposure.
- Self-Consistency RMSD (scRMSD): Re-fold the generated sequence using AlphaFold or ESMFold; verify that the re-predicted backbone aligns with the generated structure within $\text{scRMSD} \< 2.0\text{ \AA}$.
Explore our flexible pricing tiers for infrastructure options optimized for large-scale scientific and multimodal machine learning workloads.
For complete developer tutorials, API documentation, and configuration templates, consult our comprehensive developer documentation.
Frequently Asked Questions (FAQ)
How does ESM-3 differ from AlphaFold2 and AlphaFold3?
AlphaFold2 and AlphaFold3 are primarily predictive folding models: given an input amino acid sequence and multiple sequence alignments (MSAs), they predict the static 3D atomic coordinates. They cannot generate novel sequences from scratch, nor can they be prompted with desired enzymatic functions. ESM-3 is a generative foundation model that treats sequence, structure, and function as equal, interchangeable token tracks within a single transformer, enabling bidirectional generation and de novo design across any combination of inputs.
What is the geometric VQ-VAE in ESM-3?
The geometric VQ-VAE is a discrete visual/spatial tokenizer for 3D protein structures. It converts continuous atomic coordinates into a sequence of discrete tokens chosen from a learned codebook of 4,096 geometric representations. This allows a standard discrete transformer to read and emit 3D protein structures using standard cross-entropy loss, without requiring complex continuous diffusion sampling during the main transformer inference.
Can ESM-3 design binders or antibody-antigen complexes?
Yes. By providing the 3D coordinates of a target pathogen antigen as structural context and leaving the complementary CDR loop residues masked, ESM-3 can sample complementary antibody sequences that fold into shapes geometrically and electrostatically compatible with the target epitope.
What hardware is required to run ESM-3 locally?
The open-source esm3-open-small (1.4B parameters) runs comfortably on a single consumer GPU with 16 GB to 24 GB of VRAM (such as an NVIDIA RTX 4090 or A5000). The full-scale 98B parameter model requires enterprise multi-GPU nodes with at least 4x 80GB GPUs (such as NVIDIA A100 or H100).