If you follow bioinformatics news, you've seen the headlines: "A language model for proteins." "An AI that reads DNA." "A foundation model for the genome."
The names are everywhere: ESM, DNABERT, Nucleotide Transformer, Enformer, AlphaGenome, AlphaFold. But very few explain, in simple words, what these models actually do, what they're good at, and where they fall short.
In the last posts, we looked at structure: docking and molecular dynamics. Those methods start from a 3D structure. This post goes one level earlier, to the sequence itself. Can a model learn useful biology just by reading millions of DNA or protein sequences?
By the end, you'll know:
- what a "language model" is, without the jargon
- why DNA and proteins are called "languages"
- what ESM, DNABERT, Enformer and AlphaGenome actually do (and how they differ)
- how these models connect to AlphaFold and protein structure
- what they're good at, and where they fail
- how to try a protein language model yourself with a few lines of Python
- how to judge any new model critically
No machine learning background is needed.
Part 1: The Basics
What is a language model?
A language model is a program trained to predict missing or next pieces of a sequence.
You already use one. When your phone suggests the next word while typing, it's guessing which word is most likely to come next, based on patterns it learned from lots of text.
There are two common training styles:
| Style | The task | Simple example |
|---|---|---|
| Masked language model | Fill in the hidden piece | "The cat sat on the ___" |
| Autoregressive model | Predict the next piece | "The cat sat on the" → "mat" |
To get good at this, the model has to learn the patterns and rules of the data. It is never told these rules. It discovers them from the examples. This is called self-supervised learning: the data itself provides the "answers" (the hidden pieces), so no human labeling is needed.
Why call DNA and proteins "languages"?
It's an analogy, but a useful one:
| Language | DNA | Protein |
|---|---|---|
| Alphabet | 4 letters (A, C, G, T) | 20 amino acids |
| Words | Motifs, regulatory elements | Motifs, domains |
| Grammar | Rules for gene regulation, splicing | Rules for folding and function |
| Meaning | What the sequence does | What the protein does |
Sequences are not random. Evolution has kept patterns that work and removed ones that don't. A protein that folds and functions has a "grammar" that real sequences follow. A model that reads millions of real protein sequences can learn this grammar.
A word of caution: the analogy has limits. DNA and proteins aren't human languages, and a model that predicts the next letter well hasn't necessarily "understood" biology. We'll come back to this.
What does "training" and "using" a model mean?
| Term | Simple meaning |
|---|---|
| Token | One piece of input (a nucleotide, a k-mer, an amino acid) |
| Embedding | A list of numbers that represents a sequence (or a position) |
| Pre-training | Learning general patterns from a huge amount of unlabeled data |
| Fine-tuning | Further training on a small, labeled dataset for a specific task |
| Zero-shot | Using the model as-is, with no extra training |
| Probing | Training a small, simple model on top of the frozen model's embeddings |
| Parameters | The numbers a model learns (more parameters = bigger model) |
If you read the last newsletter on foundation models, these ideas will feel familiar: a foundation model is pre-trained on lots of data, then reused for many tasks.
Part 2: Protein Language Models (the ESM Family)
What is ESM?
ESM (Evolutionary Scale Modeling) is a family of protein language models. They read protein sequences, hide some amino acids, and learn to predict the hidden ones.
The family has grown over time:
- ESM-1b: a 650-million-parameter model trained on 250 million protein sequences from across all organisms. nih
- ESM-1v: focused on predicting the effect of mutations without extra training.
- ESM-2: a larger and improved family that also powers ESMFold, a model that predicts structure directly from a single sequence.
- ESM-3: a multimodal generative model that can reason over protein sequences, structures and functions. arxiv
(Model versions and releases change quickly, so check the official repositories for the latest.)
What does it actually learn?
To predict a hidden amino acid well, the model has to know which amino acids tend to appear in which contexts: which residues sit together, which positions are conserved, which substitutions are tolerated. This reflects evolutionary constraints.
The model turns each protein into embeddings, numbers that capture patterns useful for many tasks.
What can you do with it?
1. Get embeddings for any protein
Use them as input for your own classifier (for example, predicting function, localization or stability).
2. Predict the effect of mutations (zero-shot)
Mask a position and compare how likely the model finds the original amino acid versus the mutant. If the mutant is much less likely, the change may be damaging. This "masked marginals" approach lets models predict variant effects without task-specific training.
At scale, researchers used ESM-1b to predict the effects of about 450 million possible missense variants in the human genome.
3. Predict structure (ESMFold)
ESMFold predicts 3D structure from a single sequence, without the multiple sequence alignment (MSA) step that AlphaFold-style methods rely on, making it much faster.
4. Design proteins
Newer, generative models can propose new sequences with desired properties.
How it connects to AlphaFold
This is where the series connects:
| AlphaFold (family) | ESMFold | |
|---|---|---|
| Main input | Sequence plus evolutionary information (MSAs) | A single sequence |
| Approach | Dedicated structure prediction architecture | Language model embeddings feed a folding head |
| Speed | Slower (needs alignments) | Much faster |
| Accuracy | Generally higher | Generally lower, especially for proteins with few relatives |
| Best for | High-accuracy structure | Fast, large-scale screening, orphan proteins |
Both start from sequence, and both end with a structure you can then use for docking and molecular dynamics, the topics of the last two posts.
What are the limits of protein language models?
- They may not have learned physics. Analysis of ESM-2 found that its structure prediction performance correlates strongly with the number of similar sequences in the training data. In other words, proteins with many relatives are predicted better, and rare or novel proteins are harder.
- Input length limits. For example, ESM-1b is limited to 1,022 amino acids, which excludes around 12% of human protein isoforms. Workarounds exist, but you must know the limit of the model you use.
- A score is not a diagnosis. A mutation score says the change is unusual for the model, not that it causes disease.
- Bias from training data. Well-studied protein families dominate training sets.
- Poor at some questions. Effects that depend on interactions, conditions or cellular context aren't captured by sequence alone.
Part 3: DNA Language Models (DNABERT and Friends)
Why is DNA harder?
DNA has a few big differences from proteins:
- The human genome has 3 billion letters, and most of it doesn't code for protein.
- Regulatory signals can be far from the gene they control (tens or hundreds of thousands of bases away).
- There's a lot of repetitive sequence.
- The "meaning" of a regulatory sequence depends on the cell type.
So DNA language models have to handle long sequences, and learning what matters is harder.
The main DNA language models
| Model | Key idea |
|---|---|
| DNABERT | The first pre-trained foundation model for genome sequences, trained on the human genome using overlapping k-mer tokens. |
| DNABERT-2 | Uses a smarter tokenization method and is trained on multiple species. It has about 117 million parameters. |
| Nucleotide Transformer | A family of larger models trained on many genomes. Its biggest variants are many times larger than DNABERT. |
| HyenaDNA | Handles very long inputs. The large version supports up to 1 million base pairs of context, using single-nucleotide tokens. |
| Caduceus | Designed to handle both DNA strands (reverse complement). |
| Evo / Evo 2 | Very large, newer genomic models trained across many organisms, able to both score and generate sequences. |
What does "tokenization" mean for DNA?
A model can't read raw text, so it splits the sequence into tokens. Different models choose differently:
- Single nucleotides (A, C, G, T): simple, precise, but long
- k-mers (for example, 6-letter chunks): shorter inputs, but chunks can overlap or hide small changes
- Byte-pair encoding (BPE): the model learns its own "words" from frequent patterns
The choice affects what the model can do, especially for single-letter variants.
What can you do with DNA language models?
- Classify sequences: promoters, enhancers, splice sites, transcription factor binding
- Generate embeddings for downstream models
- Score variants (some models)
- Study conservation and regulatory patterns
The honest picture: they're not always better than simple models
This is the most important message of this section. Independent benchmarks have compared DNA language models against simpler, task-specific models. For example, DART-Eval is a benchmark that evaluates DNA language models on regulatory DNA across zero-shot, probed and fine-tuned settings, against contemporary ab initio (trained-from-scratch) baselines.
The results depend heavily on the task and the setup. Other benchmarks show that how you use the model matters too. In one study, averaging token embeddings gave better classification performance than using a summary token in 41 of 52 datasets for DNABERT-2.
What this means in practice:
- Pre-trained models can help, especially when you have little labeled data
- A simple model trained directly on your task is often a strong competitor
- Always include a simple baseline when you test a DNA language model
Part 4: Enformer and AlphaGenome (Not Exactly Language Models)
People often group Enformer with DNABERT, but they are different in an important way.
Language model vs sequence-to-function model
| DNA language model | Sequence-to-function model | |
|---|---|---|
| Trained on | Sequence only (self-supervised) | Sequence plus experimental measurements (supervised) |
| Learns to | Predict missing/next letters | Predict real molecular readouts |
| Output | Embeddings, likelihoods | Predicted tracks (expression, chromatin accessibility, histone marks, etc.) |
| Examples | DNABERT-2, Nucleotide Transformer | Enformer, AlphaGenome |
Enformer
Enformer takes a DNA sequence of roughly 200,000 letters and predicts thousands of experimental tracks, such as gene expression and chromatin signals, across many cell types. It combines convolutional layers with transformer layers so it can use information from far away. It's trained on real experimental data, which is why it's called a sequence-to-function model.
AlphaGenome
AlphaGenome is a newer model from the same research line. According to its Nature paper, it takes 1 Mb of DNA sequence as input and predicts thousands of functional genomic tracks at up to single-base-pair resolution, and matches or exceeds the strongest available external models in 25 of 26 variant effect prediction evaluations. It builds on Enformer. The model is available through an API for non-commercial research.
Why it matters: you can give it a sequence with and without a variant, and compare the predicted tracks to estimate how the variant might change gene regulation, splicing or expression. That's powerful for studying non-coding variants, which make up most of the genome.
Remember the caveat: these are predictions. Predicting the direction of an effect is generally easier than predicting its exact size, and any prediction still needs experimental follow-up.
Part 5: Putting It All Together
Three families of models, three questions
| Model type | Examples | The question it answers |
|---|---|---|
| Language models (sequence only) | ESM-2, DNABERT-2, Nucleotide Transformer | "What patterns does this sequence follow?" |
| Sequence-to-function models | Enformer, AlphaGenome | "What molecular activity does this DNA produce?" |
| Structure predictors | AlphaFold, ESMFold | "What 3D shape does this protein take?" |
Quick comparison
| Model | Reads | Trained how | Typical use |
|---|---|---|---|
| ESM-2 | Protein sequence | Self-supervised | Embeddings, variant scoring, structure (ESMFold) |
| DNABERT-2 | DNA sequence | Self-supervised | Sequence classification, embeddings |
| Nucleotide Transformer | DNA sequence | Self-supervised | Embeddings, classification |
| HyenaDNA | Long DNA sequence | Self-supervised | Very long context tasks |
| Enformer | ~200 kb DNA | Supervised on experimental data | Predicting expression and chromatin tracks |
| AlphaGenome | Up to 1 Mb DNA | Supervised on experimental data | Regulatory variant effect prediction |
| AlphaFold / ESMFold | Protein sequence | Trained on structures (ESMFold: language model plus folding head) | Predicting 3D structure |
A modern workflow that connects the whole series
- Take a gene or protein of interest
- Use a protein language model to score possible mutations
- Use AlphaFold or ESMFold to get a 3D structure
- Dock a candidate ligand to the structure
- Run molecular dynamics to check stability
- Test the best candidates in the lab
Each step gives a hypothesis that the next step refines.
Part 6: Try It Yourself (Hands-On)
The best way to understand these models is to use one. This example uses a small ESM-2 model (8 million parameters) that runs on a normal laptop.
Step 1: Install
mamba create -n plm python=3.11 -c conda-forge
conda activate plm
pip install torch transformersStep 2: Get an embedding for a protein
import torch
from transformers import AutoTokenizer, EsmForMaskedLM
model_name = "facebook/esm2_t6_8M_UR50D"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = EsmForMaskedLM.from_pretrained(model_name)
model.eval()
# A short toy sequence. Replace with a real protein sequence.
seq = "MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQ"
inputs = tokenizer(seq, return_tensors="pt")
with torch.no_grad():
out = model(**inputs, output_hidden_states=True)
# Last layer, one vector per residue (skip the start and end tokens)
residue_embeddings = out.hidden_states[-1][0, 1:-1]
# One vector for the whole protein: average over residues
protein_embedding = residue_embeddings.mean(dim=0)
print(protein_embedding.shape) # a list of numbers describing this proteinThis protein_embedding can be used as input features for your own classifier.
Step 3: Score a mutation (zero-shot)
def mutation_score(seq, pos, wt, mt):
"""pos is 1-based. Returns log P(mutant) - log P(wild type)."""
assert seq[pos - 1] == wt, "Wild-type residue doesn't match the sequence"
masked_seq = seq[:pos - 1] + tokenizer.mask_token + seq[pos:]
inputs = tokenizer(masked_seq, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
# Index pos works because index 0 is the start token
log_probs = torch.log_softmax(logits[0, pos], dim=-1)
wt_id = tokenizer.convert_tokens_to_ids(wt)
mt_id = tokenizer.convert_tokens_to_ids(mt)
return (log_probs[mt_id] - log_probs[wt_id]).item()
# Example: change residue 5 (Y) to A
print(mutation_score(seq, 5, "Y", "A"))How to read the score:
- Negative: the model finds the mutant less likely than the original. The change may be less tolerated.
- Close to zero or positive: the model finds the mutant about as likely, or more likely.
Remember: this is a hint, not a diagnosis. A tiny 8M model is for learning. Larger ESM-2 models (650M and above) give better results, but need more memory.
A great first project: test it critically
- Pick a well-studied protein with known disease-causing (pathogenic) and harmless (benign) variants, for example from ClinVar.
- Compute zero-shot scores for each variant using an ESM-2 model.
- Compare the scores with the known labels (for example, compute ROC AUC).
- Compare with a simple baseline, such as a BLOSUM62 substitution score.
- Report honestly: does the language model beat the baseline? By how much? Where does it fail?
- Put the code and results on GitHub with a clear README.
This project teaches model use, evaluation and critical thinking, which is exactly the skill employers look for.
Part 7: What These Models Can and Can't Do
What they're good at
- Capturing patterns learned from huge datasets that would be hard to code by hand
- Giving quick first-pass predictions at scale (for example, scoring millions of variants)
- Providing useful features when you have little labeled data
- Speeding up structure prediction and screening
- Generating hypotheses to test
What they are NOT good at (yet)
- Understanding causation. They find patterns, not mechanisms.
- Novel or rare cases. Performance often drops when training data has few similar examples.
- Cell-specific context. Sequence alone doesn't capture everything about a cell's state.
- Replacing experiments. Predictions need validation.
- Always beating simple baselines. Sometimes a simple model does just as well.
A healthy way to think about it
A language model learns what is typical in the sequences it has seen. Whether that matches what is true for your question is something you still have to check.
Part 8: Common Beginner Mistakes
- Treating a model score as a diagnosis. A score is a prediction, not a clinical result.
- Skipping the baseline. Without comparing to a simple method, you can't tell if the big model helps.
- Ignoring the model's input limits. Long sequences may need to be split or may not be supported.
- Using the wrong model for the task. A language model is not an expression predictor, and vice versa.
- Not checking what the model was trained on. Species, genome version and data type all matter.
- Data leakage. Testing on sequences similar to the training data makes results look better than they are.
- Not recording versions. Models and weights change, so note the exact model name and version.
- Believing the hype. Read the evaluation, not just the headline.
- Using huge models when a small one is enough. Start small and scale only if needed.
- Forgetting biology. Always ask whether the result makes biological sense.
Part 9: A Checklist for Any New Sequence Model
Before trusting a model's output, ask:
- What data was it trained on (species, data type, version)?
- Is it a language model or a sequence-to-function model?
- What is its input length limit?
- Was it compared against simple baselines on tasks like mine?
- Was it tested on data truly separate from training?
- Has it been independently evaluated?
- What are its known failure cases?
- Can I check the output against known biology or experiments?
Part 10: Your Learning Roadmap
Week 1: Basics. Learn what tokens, embeddings, masked prediction and fine-tuning mean. Revisit protein and DNA basics if needed.
Week 2: Hands-on with a protein model. Run the code above, get embeddings, and score a few mutations.
Week 3: Try structure prediction. Explore AlphaFold-predicted structures from the AlphaFold Database, and try ESMFold on a sequence you know.
Week 4: Evaluate critically. Do the ClinVar baseline project described above.
Week 5 and beyond:
- Explore a DNA language model (for example, DNABERT-2) on a small classification task
- Read the original papers for the models you use
- Try a sequence-to-function model through its public tools
- Learn the basics of fine-tuning
- Combine tools into a pipeline (and make it reproducible, which is the topic of our next post)
Quick Recap
- Language models learn patterns by predicting missing parts of sequences. DNA and proteins are sequences with "grammar" shaped by evolution.
- ESM models read proteins and can give embeddings, score mutations and predict structure (ESMFold).
- DNA language models (DNABERT, Nucleotide Transformer, HyenaDNA) learn from genomes, but face harder challenges and do not always beat simple models.
- Enformer and AlphaGenome are sequence-to-function models. They're trained on experimental data to predict molecular activity, which is different from language models.
- AlphaFold and ESMFold predict structure, linking sequence models to docking and molecular dynamics.
- Always compare against a simple baseline, check input limits and treat outputs as predictions.
Final Thoughts
It's easy to feel overwhelmed by the pace of new models. But you don't need to know every architecture. You need to understand the core ideas: what the model reads, how it was trained, what it predicts, and how to check whether it's right.
Try one model, test it on a small problem, compare it with a simple method and write down what you find. That habit will serve you far longer than any single model name.
If you get stuck on the code, drop your error message in the comments and I'll help. And tell me: would you like a full hands-on post on running ESMFold or AlphaFold predictions and using them for docking?
In the next post, we'll look at Docker and Singularity for Bioinformatics: Why Containers Make Your Analysis Reproducible, which is how you package everything from this series so it runs the same on any computer.