ntv3 / tabs /home.html
ybornachot's picture
Link and cite version 2 of the NTv3 preprint (#7)
fafa19c
Raw History Blame Contribute Delete
15.8 kB
<div class="legacy-banner">
πŸ—„οΈ Looking for the 2025 NTv3 models? They are listed under the
<a href="#" data-tab-link="initial">Initial release (2025)</a> tab, with their notebooks.
</div>
<div class="summary">
<h2>πŸ“– About NTv3</h2>
<p>
NTv3 is a genomic foundation model that reads DNA at single-base resolution across up to <strong>1 Mb</strong> of
context in one pass. One architecture supports three capabilities: <strong>functional-track prediction</strong>,
<strong>gene annotation</strong> and <strong>regulatory sequence design</strong>. The backbone is U-Net-style: a
convolutional tower that reads the sequence, a Transformer tower that carries long-range context, and a
deconvolutional tower that returns predictions at base resolution.
</p>
<p>
The three capabilities are acquired in stages, each building on the one before. NTv3 is first
<strong>pretrained</strong> by masked-token prediction on unlabeled genomes from the OpenGenome2 corpus. It is then
<strong>post-trained on functional tracks</strong>, a supervised multi-task stage over 16,262 tracks from 15 species,
which gives the first capability. The other two are built from those same functional representations:
<strong>annotation fine-tuning</strong> on reference gene annotations, and <strong>generative post-training</strong>
by masked diffusion on MPRA activity datasets. The checkpoints below are the pretrained backbone, tracks and
annotation, plus the plant promoter model of the paper as an example of the generative ones.
</p>
<p>
Because it is one backbone and one set of learned representations throughout, what NTv3 learns about sequence
function carries across tasks and across species rather than being relearned for each.
</p>
</div>
<div class="paper-summary">
<img src="assets/ntv3_overview.png" alt="NTv3 overview: pre-training, tracks post-training, annotation fine-tuning and generative post-training, with the four resulting capabilities" />
</div>
<div class="why-ntv3">
<h2>✨ What NTv3 does</h2>
<ul>
<li>πŸ“ <strong>Reads any genome.</strong> 1 Mb of context at nucleotide resolution, with a U-Net design that keeps very long sequences tractable on GPU.</li>
<li>πŸ“Š <strong>Predicts functional tracks.</strong> 16,262 tracks across 15 species: 9,603 gene expression, 3,115 histone marks, 2,193 TF binding, 1,351 accessibility.</li>
<li>🏷️ <strong>Annotates genes from DNA alone.</strong> Per-base posteriors over intergenic, intron, CDS and splice states, decoded into gene models on both strands. One model per clade: mammals, plants and insects.</li>
<li>✏️ <strong>Designs regulatory DNA.</strong> Conditional generation of plant promoters, plant enhancers and fly enhancers at requested activity levels, with activity measured experimentally.</li>
<li>🌍 <strong>Generalizes across species</strong>, including to genomes held out of post-training entirely.</li>
</ul>
</div>
<div class="grid">
<div class="card" style="grid-column: span 12;">
<h2>πŸ€– The NTv3 models</h2>
<p>
NTv3 is a family rather than a single model. One <strong>700M-parameter</strong> backbone is trained once on
unlabeled genomes, then specialised into a checkpoint per capability, so each one inherits what the others
learned about sequence rather than starting over.
</p>
<p>
Start from <strong>NTv3-pretrained</strong> for embeddings, masked-token prediction, or your own fine-tuning on
a task we have not covered. Reach for <strong>NTv3-tracks</strong> to predict functional signal, chromatin
accessibility, histone marks, transcription factor binding and expression, anywhere in a supported genome. Use
<strong>NTv3-annotate</strong> to call genes from sequence alone, choosing the model for your clade.
</p>
<table class="capability-grid">
<thead>
<tr>
<th>Model</th>
<th>Stage</th>
<th>What it is for</th>
<th>Repository</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>NTv3-pretrained</strong></td>
<td>Pretrained</td>
<td>Embeddings, masked-token prediction, starting point for your own fine-tuning</td>
<td><a href="https://huggingface.co/InstaDeepAI/NTv3_pretrained" target="_blank" rel="noopener noreferrer"><code>InstaDeepAI/NTv3_pretrained</code></a></td>
</tr>
<tr>
<td><strong>NTv3-tracks</strong></td>
<td>Tracks post-training</td>
<td>Functional-track prediction, and the backbone for downstream fine-tuning. <code>NTv3_tracks_1mb</code> is the 1 Mb specialist; 1 Mb inputs only</td>
<td>
<a href="https://huggingface.co/InstaDeepAI/NTv3_tracks" target="_blank" rel="noopener noreferrer"><code>InstaDeepAI/NTv3_tracks</code></a><br />
<a href="https://huggingface.co/InstaDeepAI/NTv3_tracks_1mb" target="_blank" rel="noopener noreferrer"><code>InstaDeepAI/NTv3_tracks_1mb</code></a>
</td>
</tr>
<tr>
<td><strong>NTv3-annotate</strong></td>
<td>Annotation fine-tuning</td>
<td><em>Ab initio</em> gene prediction, one model per clade</td>
<td>
<a href="https://huggingface.co/InstaDeepAI/NTv3_annot_mammals" target="_blank" rel="noopener noreferrer"><code>InstaDeepAI/NTv3_annot_mammals</code></a><br />
<a href="https://huggingface.co/InstaDeepAI/NTv3_annot_plants" target="_blank" rel="noopener noreferrer"><code>InstaDeepAI/NTv3_annot_plants</code></a><br />
<a href="https://huggingface.co/InstaDeepAI/NTv3_annot_insects" target="_blank" rel="noopener noreferrer"><code>InstaDeepAI/NTv3_annot_insects</code></a>
</td>
</tr>
<tr>
<td><strong>NTv3-generative-plant-promoter</strong></td>
<td>Generative post-training</td>
<td>Example generative model used in the paper: designs plant core promoters at a requested strength, and is what notebook 06 runs</td>
<td><a href="https://huggingface.co/InstaDeepAI/NTv3_generative_plant_promoter" target="_blank" rel="noopener noreferrer"><code>InstaDeepAI/NTv3_generative_plant_promoter</code></a></td>
</tr>
</tbody>
</table>
</div>
<div class="card-stack">
<div class="card">
<h2>πŸ““ Notebooks</h2>
<p>
The notebooks cover the workflows end to end. All run against the published checkpoints and are linked.
</p>
<ul>
<li>πŸš€ <strong>00 Β· Quickstart inference</strong><br /><a href="https://huggingface.co/spaces/InstaDeepAI/ntv3/blob/main/notebooks_tutorials/00_quickstart_inference.ipynb" target="_blank" rel="noopener noreferrer"><code>00_quickstart_inference.ipynb</code></a></li>
<li>πŸ“Š <strong>01 Β· Tracks prediction</strong><br /><a href="https://huggingface.co/spaces/InstaDeepAI/ntv3/blob/main/notebooks_tutorials/01_tracks_prediction.ipynb" target="_blank" rel="noopener noreferrer"><code>01_tracks_prediction.ipynb</code></a></li>
<li>🎯 <strong>02 · Fine-tune NTv3 on bigwig tracks</strong><br /><a href="https://huggingface.co/spaces/InstaDeepAI/ntv3/blob/main/notebooks_tutorials/02_fine_tuning_bigwig_tracks.ipynb" target="_blank" rel="noopener noreferrer"><code>02_fine_tuning_bigwig_tracks.ipynb</code></a></li>
<li>🏷️ <strong>03 · Genome annotation with NTv3</strong>
<ul>
<li><strong>03a Β· Train a gene-annotation model</strong><br /><a href="https://huggingface.co/spaces/InstaDeepAI/ntv3/blob/main/notebooks_tutorials/03a_genome_annotation_training.ipynb" target="_blank" rel="noopener noreferrer"><code>03a_genome_annotation_training.ipynb</code></a></li>
<li><strong>03b Β· From per-base predictions to gene models</strong><br /><a href="https://huggingface.co/spaces/InstaDeepAI/ntv3/blob/main/notebooks_tutorials/03b_genome_annotation_decoding.ipynb" target="_blank" rel="noopener noreferrer"><code>03b_genome_annotation_decoding.ipynb</code></a></li>
<li><strong>03c Β· Evaluate a gene annotation against a reference</strong><br /><a href="https://huggingface.co/spaces/InstaDeepAI/ntv3/blob/main/notebooks_tutorials/03c_genome_annotation_evaluation.ipynb" target="_blank" rel="noopener noreferrer"><code>03c_genome_annotation_evaluation.ipynb</code></a></li>
</ul>
</li>
<li>πŸ” <strong>04 Β· Model interpretation</strong><br /><a href="https://huggingface.co/spaces/InstaDeepAI/ntv3/blob/main/notebooks_tutorials/04_model_interpretation.ipynb" target="_blank" rel="noopener noreferrer"><code>04_model_interpretation.ipynb</code></a></li>
<li>πŸ§ͺ <strong>05 Β· Fine-tuning NTv3 into a diffusion model</strong><br /><a href="https://huggingface.co/spaces/InstaDeepAI/ntv3/blob/main/notebooks_tutorials/05_diffusion_fine_tuning.ipynb" target="_blank" rel="noopener noreferrer"><code>05_diffusion_fine_tuning.ipynb</code></a></li>
<li>🌱 <strong>06 · Generating plant promoter sequences</strong><br /><a href="https://huggingface.co/spaces/InstaDeepAI/ntv3/blob/main/notebooks_tutorials/06_plant_promoter_generation.ipynb" target="_blank" rel="noopener noreferrer"><code>06_plant_promoter_generation.ipynb</code></a></li>
</ul>
</div>
<div class="card">
<h2>πŸ”— Links</h2>
<ul>
<li><a href="https://www.biorxiv.org/content/10.64898/2025.12.22.695963" target="_blank" rel="noopener noreferrer">πŸ“„ Paper (bioRxiv preprint)</a></li>
<li><a href="https://github.com/instadeepai/nucleotide-transformer" target="_blank" rel="noopener noreferrer">πŸ’» JAX model code (GitHub)</a></li>
<li><a href="https://huggingface.co/collections/InstaDeepAI/ntv3" target="_blank" rel="noopener noreferrer">🎯 HF model collection</a></li>
<li><a href="https://huggingface.co/datasets/InstaDeepAI/NTv3_benchmark_dataset_revised" target="_blank" rel="noopener noreferrer">πŸ“š NTv3 benchmark dataset</a></li>
<li><a href="https://huggingface.co/datasets/InstaDeepAI/NTv3_annot_dataset" target="_blank" rel="noopener noreferrer">🏷️ NTv3 annotation dataset</a></li>
<li><a href="https://huggingface.co/spaces/InstaDeepAI/ntv3_benchmark" target="_blank" rel="noopener noreferrer">πŸ† NTv3 benchmark leaderboard</a></li>
</ul>
</div>
</div>
<div class="card-stack">
<div class="card">
<h2>πŸ€– NTv3-pretrained</h2>
<p>Embeddings and masked-token prediction, the starting point for your own fine-tuning.</p>
<div class="code"><pre><code class="language-python">import torch
from transformers import AutoModel, AutoTokenizer
model_name = "InstaDeepAI/NTv3_pretrained"
model = AutoModel.from_pretrained(model_name, trust_remote_code=True).eval()
tok = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
# Input length must be a multiple of 128. Batch only equal-length sequences:
# padding is NOT masked out, so a padded sequence gets different values than
# the same sequence run on its own.
batch = tok(["ACGT" * 32, "TTGA" * 32], add_special_tokens=False, return_tensors="pt")
# The forward takes the token tensor positionally, not the tokenizer dict
with torch.no_grad():
out = model(batch["input_ids"])
print(out["logits"].shape) # (B, L, V = 11)
print(out["embedding"].shape) # (B, L, 1024)
</code></pre></div>
</div>
<div class="card">
<h2>πŸ” NTv3-tracks: model interpretation</h2>
<p>Multi-scale analysis of a genomic region: predicted tracks, attention and saliency.</p>
<img src="assets/saliency_example.png" alt="Saliency example" style="max-width: 100%; margin-top: 20px;" />
</div>
</div>
<div class="card" style="grid-column: span 12;">
<h2>πŸ“Š NTv3-tracks: predict functional tracks</h2>
<p>
Give the pipeline a genomic region and the tracks you want, and it fetches the sequence, conditions on the
species, predicts and plots.
</p>
<div class="code"><pre><code class="language-python">from transformers import pipeline
ntv3_tracks = pipeline("ntv3-tracks", model="InstaDeepAI/NTv3_tracks", trust_remote_code=True)
out = ntv3_tracks(
{"chrom": "chr19", "start": 6_700_000, "end": 6_732_768, "species": "human"},
plot=True,
tracks_to_plot={
"K562 RNA-seq": "ENCSR056HPM",
"K562 DNAse": "ENCSR921NMD",
"K562 H3k4me3": "ENCSR000DWD",
"K562 CTCF": "ENCSR000AKO",
},
)
print(out.tracks.shape) # (12288, 4): the central 37.5 % of the window
print(out.coordinates) # (6710240, 6722528), the span actually predicted
print(out.track("ENCSR000AKO").shape) # (12288,): one track</code></pre></div>
<img src="assets/output_tracks.png" alt="Predicted tracks over a human genomic window" style="max-width: 100%; margin-top: 20px;" />
</div>
<div class="card" style="grid-column: span 12;">
<h2>🏷️ NTv3-annotate: end-to-end FASTA annotation pipeline</h2>
<p>
Turns a genome FASTA into its predicted gene annotation (GFF3): the production pipeline tiles every chromosome
into 1 Mb windows, runs the clade model and decodes the gene models. Here is a single-chromosome example on a
test species.
</p>
<div class="code"><pre><code class="language-bash"># 1. Get the code
git clone git@github.com:instadeepai/nucleotide-transformer-private.git
cd nucleotide-transformer-private
# 2. Install with GPU support, then check that JAX sees the GPU
python3 -m venv .venv && source .venv/bin/activate
pip install '.[gpu]'
python -c "import jax; print(jax.devices())" # should list a CudaDevice
# 3. Get chromosome 31 of the monarch butterfly (2.8 Mb, soft-masked)
NCBI=https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/018/135/715/GCF_018135715.1_MEX_DaPlex
curl -sSfLO $NCBI/GCF_018135715.1_MEX_DaPlex_genomic.fna.gz
gunzip GCF_018135715.1_MEX_DaPlex_genomic.fna.gz
faidx GCF_018135715.1_MEX_DaPlex_genomic.fna NC_083558.1 > danaus_chr31.fa
# 4. Annotate it with the insect model (weights download on the first run)
export HF_TOKEN=hf_... # needed while the model repos are private
ntv3-annotate --genome danaus_chr31.fa --model_cfg insects --out danaus_chr31.gff3
# 5. Look at one predicted gene: a gene line, then its exons (CDS) and introns
awk '$4 >= 2334916 && $5 <= 2337940' danaus_chr31.gff3 | cut -f 1,3-5,7
# NC_083558.1 gene 2334916 2337940 -
# NC_083558.1 CDS 2334916 2334969 -
# NC_083558.1 intron 2334970 2335582 -
# NC_083558.1 CDS 2335583 2335753 -
# NC_083558.1 intron 2335754 2336418 -
# NC_083558.1 CDS 2336419 2336565 -
# NC_083558.1 intron 2336566 2336820 -
# NC_083558.1 CDS 2336821 2336932 -
# NC_083558.1 intron 2336933 2337785 -
# NC_083558.1 CDS 2337786 2337940 -</code></pre></div>
<img src="assets/output_annotation.png" alt="Predicted gene models on monarch butterfly chromosome 31 against the RefSeq reference" style="max-width: 100%; margin-top: 20px;" />
<p>
The predicted genes (blue) over 34 kb of chromosome 31, against the RefSeq reference (grey). Four genes match the
reference exon for exon, including the one printed above; the rightmost reference gene is missed.
</p>
<div class="notice">
Needs an <strong>A100-40GB or larger</strong> GPU. For the other clades, use
<code style="white-space: nowrap;">--model_cfg mammals</code> or
<code style="white-space: nowrap;">--model_cfg plants</code> with a genome of that clade. Notebook
<strong>03b</strong> explains how the gene models are decoded, and notebook <strong>03c</strong> scores a GFF3
against the benchmark reference.
</div>
</div>
</div>