Basis fashions are reshaping computational biology. Pretrained on huge corpora of protein or genomic sequences, fashions comparable to ESM2 (a protein language mannequin) and Evo 2 (a DNA language mannequin) seize statistical regularities of organic sequences. These switch nicely to a variety of downstream duties, together with construction prediction, variant impact, and useful annotation.
But adapting these fashions to a selected process is nontrivial: at billions of parameters, full fine-tuning shortly turns into impractical, each in compute and storage of optimizer state and checkpoints.
Low-Rank Adaptation (LoRA) immediately addresses this problem. By conserving the pretrained spine frozen and coaching solely a small set of low-rank adapter matrices, LoRA can match full fine-tuning high quality on many duties whereas coaching ~1% of the parameters, becoming a single billion-scale mannequin and its adapter state on a single workstation GPU.
To scale back the problem of constructing these workflows, NVIDIA BioNeMo Recipes present step-by-step coaching recipes constructed on acquainted PyTorch, Hugging Face, Megatron-Bridge patterns. Efficiency-oriented elements comparable to NVIDIA Transformer Engine (TE) and scale-out methods are built-in the place they repay, however the recipes themselves keep readable.
This put up walks via two case research that present how the identical parameter-efficient recipe applies throughout organic modalities on a single NVIDIA RTX 6000 Blackwell Workstation Version GPU:
All of the supply code to customise or reproduce these outcomes can be found in NVIDIA BioNeMo Recipes.
How LoRA permits fine-tuning at scale
Earlier than diving into the case research, a fast refresher on the strategy. Full fine-tuning is resource-heavy as a result of it requires storing and updating all mannequin parameters and their optimizer states, which shortly turns into impractical as fashions scale.
LoRA is a sensible technique to fine-tune massive pretrained transformers with out updating or storing optimizer state for all mannequin parameters. The core concept behind LoRA is that as a substitute of updating a dense mannequin’s weight matrix (W), LoRA provides a brand new trainable low-rank matrix (W=BA) in parallel and retains (W) frozen. This dramatically reduces the variety of trainable parameters and the optimizer/reminiscence footprint.


LoRA is parameterized by a small set of hyperparameters that commerce off capability, stability, and value. The rank (r) controls the dimensions of the added low-rank matrices and due to this fact the variety of trainable parameters. The goal modules specify which layers obtain adapters, with frequent decisions comparable to consideration and MLP projections. For small datasets, LoRA dropout might be enabled as a further type of regularization.
Whereas the next two case research differ in modality (protein versus DNA), process kind (token classification versus sequence classification), and underlying structure (transformer versus striped Hyena), each use the identical LoRA recipe sample.
ESM2-3B for protein secondary construction prediction
PSSP is the duty of assigning a structural label to every amino acid in a protein sequence. Secondary construction labels describe native spine conformations—helices and strands—with out requiring a full 3D construction prediction. For a lot of proteins, these native patterns correlate with useful motifs and international fold group.
PSSP is a core constructing block for a lot of downstream purposes in biology. As a result of native construction is strongly correlated with protein perform, PSSP can present helpful useful context. As well as, these predictions can inform tertiary construction prediction, solvent accessibility prediction, protein-protein interplay prediction, and structural class- or domain-related prediction.
At a modeling degree, PSSP is a token classification downside: the enter is an amino-acid sequence, and the output is a structural label for every residue.
There are two frequent analysis variants, differing solely within the label house:
Q3 (3-state): H (Helix), E (Strand/Sheet), C (Coil/Loop)
Q8 (8-state): H (α-helix), B (β-bridge), E (β-strand), G (310 helix), I (π-helix), T (flip), S (bend), C (coil/different)
ESM2-3B is a 3-billion-parameter protein language mannequin, so full fine-tuning usually requires substantial compute and reminiscence. LoRA makes adaptation sensible by coaching solely a small variety of further parameters, whereas nonetheless attaining robust efficiency on PSSP.
ESM2 plus PEFT in BioNeMo Recipes (TE-accelerated)
The workforce fine-tuned ESM2-3B for PSSP by including a light-weight per-residue classification head (for Q3/Q8 labels) and coaching LoRA adapters via the PEFT library, whereas conserving the pretrained spine weights frozen. For information, we used the curated splits launched by the authors of the Porter 6 mannequin and reported outcomes on their offered take a look at set. To maximise throughput, we enabled TE and sequence packing and ran the total coaching workflow on one NVIDIA RTX 6000 Blackwell Workstation Version GPU in beneath one hour.
The next snippet tailored from the BioNeMo Recipes ESM2 plus PEFT instance exhibits load the TE-compatible ESM2 mannequin and connect LoRA adapters to the fused question/key/worth (QKV) projections:
import torch
from transformers import AutoConfig, AutoModelForTokenClassification
# Load config and token-classification mannequin (use a neighborhood checkpoint path or HF mannequin ID, e.g. nvidia/esm2_t36_3B_UR50D).
config = AutoConfig.from_pretrained(“nvidia/esm2_t36_3B_UR50D”, trust_remote_code=True)
mannequin = AutoModelForTokenClassification.from_pretrained(
“nvidia/esm2_t36_3B_UR50D”, config=config, trust_remote_code=True, dtype=”bfloat16″
)
peft_config = peft.LoraConfig(
task_type=peft.TaskType.TOKEN_CLS,
inference_mode=False,
r=8,
lora_alpha=16,
target_modules=[“layernorm_qkv”],
bias=”none”,
)
peft_model = peft.get_peft_model(mannequin, peft_config)
peft_model.to(“cuda”, dtype=torch.bfloat16)
You may then plug this PEFT mannequin into your coaching loop. The total recipe consists of the dataloader, loss, and optimizer setup.
Desk 1 summarizes Q3/Q8 take a look at accuracy for the ESM2-3B plus LoRA mannequin alongside robust printed baselines reported within the Porter 6 paper. Desk 1 stories the imply rating excessive 5 validation checkpoints for ESM2-3B.
Total, LoRA fine-tuning reaches accuracy that’s aggressive with different state-of-the-art PSSP approaches. Determine 2 exhibits validation loss and accuracy versus fine-tuning steps.


How can sequence packing yield increased utilization and throughput?
Protein datasets usually comprise sequences of various lengths. If they’re batched naively (the padded BSHD format), they’re padded to the utmost size within the batch and a big fraction of tokens turn out to be padding. This wastes compute and reminiscence bandwidth inside consideration and MLP layers.
Sequence packing (the packed/flattened THD format) reduces that waste by concatenating solely the nonpadding tokens and monitoring per-sequence boundaries with cumulative-length metadata. In consequence, consideration/MLP kernels function on actual tokens reasonably than padded tokens. For a deeper clarification of how packing works in follow (and the way it interacts with TE packed codecs), see Scale Biology Transformer Fashions with PyTorch and NVIDIA BioNeMo Recipes. Determine 3 exhibits throughput (tokens/sec) when fine-tuning with THD versus BSHD.


On this setup, switching from BSHD to THD improved tokens/sec by ~5.5x, largely by eradicating padding overhead. The achieved speedup largely is determined by the sequence size distribution, microbatch measurement, and GPU.
Past throughput, THD packing improves reminiscence effectivity. It reduces the quantity of activation or consideration work spent on padding tokens, so a bigger fraction of the GPU reminiscence site visitors and compute goes towards helpful (non-padding) tokens.
For similar enter sequences and batch measurement, THD usually makes use of much less reminiscence than BSHD as a result of it avoids materializing padded tokens. In follow, that saved headroom is used to extend the variety of actual tokens processed per step.
Evo2-1B for DNA splice-site classification
Evo 2 is a generative DNA basis mannequin educated on genomic sequences spanning all domains of life. Architecturally it’s constructed on striped Hyena blocks—a mixture of state-space-style long-convolution operators and a smaller variety of consideration layers. This permits it to course of lengthy DNA contexts effectively. Simply as ESM2 learns protein “grammar” from amino-acid sequences, Evo2 learns genomic regularities immediately from nucleotide sequences, which switch to quite a lot of downstream duties: variant impact prediction, regulatory component classification, and (of curiosity right here) splice-site identification.
What’s splice-site classification?
Splicing is the mobile course of that removes introns from pre-mRNA and joins exons collectively. The boundaries are outlined by two quick sequence motifs: donor websites (intron begins, usually GT) on the 5′ finish of the intron and acceptor websites (intron ends, usually AG) on the 3′ finish.
Figuring out these websites from uncooked DNA is tougher than simply matching the dinucleotide motif. The identical GT/AG patterns seem all through the genome and solely a small fraction are useful splice websites. Helpful predictors should be taught longer-range context across the candidate place.
We used the splice_sites_all process from the Nucleotide Transformer downstream-tasks dataset. Every instance is a fixed-length 600 bp DNA window, and the label is considered one of three courses describing the central place—no-splice, acceptor, or donor. The benchmark ships ~30K coaching / ~3K take a look at examples and is roughly class-balanced.
At a modeling degree, this can be a sequence classification downside: a single label per enter sequence, in distinction to the per-token labels in PSSP.
Evo2 plus LoRA in BioNeMo Recipes
The workforce fine-tuned Evo2-1B for splice-site classification by subclassing the Megatron Hyena mannequin so as to add a small sequence-classification head on high of mean-pooled hidden states. LoRA adapters have been then educated on the spine consideration, MLP, and Hyena-mixer projections. The pretrained spine weights have been stored frozen; solely the LoRA adapters and the classification head have been educated.
To place the LoRA contribution in context, we educated two configurations on the identical information and in contrast them:
Head-only baseline: Spine frozen; no adapters, solely the classification head is trainable. Complete trainable parameters: ~3.7 million (0.33 % of the mannequin)
LoRA plus head: Spine frozen; LoRA adapters on the listed goal modules, classification head trainable. Complete trainable parameters: ~16.0 million (1.42 % of the mannequin)
Desk 2 exhibits the take a look at accuracy on the held-out 3K examples.
The hole is massive: with solely ~1% of the parameters trainable, LoRA recovers almost all the sign that the pretrained Evo2 spine holds about splicing, whereas pooling alone is way from enough. A lot of the residual error from the LoRA mannequin is within the donor↔acceptor path. That is anticipated as a result of each motifs share the GT/AG dinucleotide construction and require longer-range context to disambiguate.
The total workflow runs end-to-end on a single RTX 6000 Workstation Version in about one hour.
The next snippet mirrors the ESM2 instance stylistically: it masses the Evo2 spine, attaches a classification head via a Hyena Mannequin subclass, and configures LoRA adapters on the eye, MLP, and Hyena-mixer projections.
from evo2_classifier import (
Hyena1bClassifierProvider,
HyenaForSequenceClassification,
)
# Spine supplier: a HyenaModel subclass with a small classification head
# (LayerNorm → Linear → GELU → Dropout → Linear) on high of mean-pooled hidden states.
model_provider = Hyena1bClassifierProvider(
num_classes=3, # no-splice / acceptor / donor
classifier_dropout=0.1,
pool=”imply”,
)
# LoRA adapters on consideration (linear_qkv, linear_proj), MLP (linear_fc1, linear_fc2),
# and the Hyena mixer (dense_projection, dense). The classification head is stored
# trainable through the skip_freeze_modules sample; every little thing else is frozen.
peft = Evo2LoRA(
target_modules=[
“linear_qkv”, “linear_proj”,
“linear_fc1”, “linear_fc2”,
“dense_projection”, “dense”,
],
dim=16,
alpha=32,
dropout=0.1,
skip_freeze_modules=[“*classification_head*”],
)
The Megatron-Bridge pretrain entry level handles the distributed coaching, optimizer, scheduler, checkpointing, dataloading, and logging.
To launch a fine-tuning run end-to-end, the recipe exposes a CLI:
–train-jsonl splice_train.jsonl
–val-jsonl splice_val.jsonl
–test-jsonl splice_test.jsonl
–base-ckpt-dir evo2_1b_bf16_mbridge
–result-dir splice_run
–experiment-name lora_finetune
–num-classes 3
–seq-length-tokens 600
–train-iters 1000
–global-batch-size 32 –micro-batch-size 32
–lr 5e-4 –min-lr 5e-5 –warmup-iters 30
–lora-finetune –lora-dim 16 –lora-alpha 32 –lora-dropout 0.1
Swap –lora-finetune and enhance the batch measurement to breed the head-only baseline. Knowledge, optimizer, scheduler, and analysis keep the identical.
For the whole coaching loop, dataset code, parameter accounting, and analysis utilities, see the Evo2 LoRA fine-tuning pocket book.
Get began fine-tuning organic basis fashions
Throughout two very totally different organic modalities—proteins with ESM2 and DNA with Evo2—the identical parameter-efficient recipe can be utilized. You may freeze the pretrained spine, practice a small LoRA adapter plus a task-specific head, and recuperate accuracy that’s aggressive with full fine-tuning or specialised fashions, on a single workstation GPU.
For ESM2-3B, LoRA brings PSSP efficiency into the identical vary as robust printed baselines like Porter 6 and SPOT-1D-LM, whereas TE and THD sequence packing make coaching on a single NVIDIA RTX 6000 Blackwell Workstation Version GPU sensible. For Evo2-1B, the identical strategy lifts splice-site classification from a frozen-backbone baseline of ~52% to ~97% take a look at accuracy whereas coaching solely ~1.4% of the parameters.
Billion-parameter organic basis fashions are actually adaptable on modest {hardware}, offered that the encircling coaching stack (TE, Megatron-Bridge, packed sequences, PEFT) is nicely built-in. NVIDIA BioNeMo Recipes are designed to make that integration the default, not the exception.
To get began fine-tuning organic basis fashions with LoRA, TE, and scalable PyTorch workflows, try the NVIDIA BioNeMo Recipes.

