NVIDIA BioNeMoレシピを用いたLoRAによる生物学的基盤モデルのファインチューニング
NVIDIA は BioNeMo レシピを通じて、LoRA 技術を活用した生物学的基盤モデルの効率的なファインチューニング手法を発表し、創薬研究のアクセシビリティ向上を促進している。
キーポイント
BioNeMo と LoRA の統合
NVIDIA は BioNeMo プラットフォームに LoRA(Low-Rank Adaptation)技術を組み込み、大規模な生物学的モデルを低コスト・高速で特定タスクに適応させる手法を提供している。
計算リソースの削減
従来のフルパラメータファインチューニングと比較して、必要な計算資源とストレージを大幅に削減しながら、モデル性能を維持・向上させることが可能になる。
研究コミュニティへの貢献
このレシピにより、リソースが限られた研究者や中小企業でも最先端の生物学的 AI モデルを容易にカスタマイズし、創薬やタンパク質構造解析に応用できる。
影響分析・編集コメントを表示
影響分析
この発表は、生物情報学と AI の融合領域において、大規模モデルの実用化における最大の障壁である計算コストと専門知識のハードルを下げた画期的な進展です。特に創薬やゲノム解析といったリソース集約的な分野において、より多くの研究機関が最先端の生成 AI を活用できる環境を整えることで、新薬発見のスピードアップに寄与すると期待されます。
編集コメント
生物医療分野における AI の実用化において、計算リソースの壁を打破する LoRA 技術の採用は極めて重要なステップです。特に大規模モデルを特定ドメインに最適化する際の効率化は、今後の創薬研究のスピードを決定づける要素となるでしょう。
ファウンデーションモデル は計算生物学を再構築しています。タンパク質やゲノム配列の膨大なコーパスで事前学習された ESM2(タンパク質言語モデル)や Evo 2(DNA 言語モデル)などのモデルは、生物学的配列の統計的規則性を捉えています。これらは構造予測、変異効果、機能注釈など、幅広い下流タスクへよく転移します。
しかし、これらのモデルを特定のタスクに適応させることは容易ではありません:パラメータ数が数十億に達する中で、オプティマイザの状態やチェックポイントの計算リソースおよびストレージの観点から、フルファインチューニングはすぐに現実的ではなくなります。
低ランク適応 (LoRA) はこの課題に直接対応します。事前学習済みバックボーンを凍結し、少数の低ランクアダプター行列のみを訓練することで、LoRA は多くのタスクにおいてフルファインチューニングと同等の品質を実現しつつ、パラメータの約 1% のみを訓練します。これにより、単一のワークステーション GPU に数十億規模のモデルとそのアダプター状態を収容することが可能になります。
これらのワークフロー構築の難易度を低減するため、NVIDIA BioNeMo Recipes では、親しみのある PyTorch や Hugging Face、Megatron-Bridge のパターンに基づいた、段階的なトレーニングレシピを提供しています。NVIDIA Transformer Engine (TE) などのパフォーマンス指向コンポーネントやスケールアウト戦略は、効果が見込める箇所に統合されていますが、レシピ自体は可読性を保つように設計されています。
本記事では、単一の NVIDIA RTX 6000 Blackwell Workstation Edition GPU 上で、同じパラメータ効率的なレシピが生物学的モダリティ全体にどのように適用されるかを示す 2 つのケーススタディを紹介します。
- タンパク質二次構造予測 (PSSP) における ESM2-3B と LoRA の組み合わせ
- DNA スプライスサイト分類における Evo2-1B と LoRA の組み合わせ
これらの結果をカスタマイズまたは再現するための全ソースコードは、NVIDIA BioNeMo Recipes で利用可能です。
スケーラブルなファインチューニングを実現する LoRA の仕組み
ケーススタディに入る前に、手法の簡単な復習を行いましょう。フルファインチューニングは、すべてのモデルパラメータとそのオプティマイザ状態を保存・更新する必要があり、リソース消費が非常に大きいため、モデルがスケールするにつれてすぐに実用的ではなくなります。
LoRA は、すべてのモデルパラメータに対してオプティマイザの状態を更新または保存することなく、大規模な事前学習済みトランスフォーマーをファインチューニングするための実用的な手法です。LoRA の核心となる考え方は、密なモデルの重み行列を更新するのではなく、並列に新しい訓練可能な低ランク行列を追加し、元の行列を凍結(frozen)させることです。これにより、訓練可能なパラメータの数とオプティマイザ・メモリのフットプリントが劇的に削減されます。
image*図 1. LoRA の再パラメータ化。ここで* *(緑色) は元のモデルパラメータを示し、** と *行列(黒色)のみが訓練されます*
LoRA は、容量・安定性・コストのトレードオフを制御する少数のハイパーパラメータによってパラメータ化されています。ランクは追加される低ランク行列のサイズ、したがって訓練可能なパラメータの数を制御します。ターゲットモジュールは、アダプターが適用される層を指定し、一般的な選択としてはアテンション(attention)や MLP 投影があります。小規模なデータセットの場合、LoRA ドロップアウトを有効にして追加の正則化形式とすることができます。
以下の 2 つのケーススタディは、モダリティ(タンパク質対 DNA)、タスクタイプ(トークン分類対シーケンス分類)、および基盤となるアーキテクチャ(トランスフォーマー対ストライプド・ヒエナ)において異なりますが、どちらも同じ LoRA レシピパターンを使用しています。
タンパク質二次構造予測のための ESM2-3B
PSSP は、タンパク質配列内の各アミノ酸に構造ラベルを割り当てるタスクです。二次構造ラベルは、完全な 3 次元構造予測を必要とせず、ヘリックスやストランドといった局所的な主鎖のコンフォメーション(conformation)を記述します。多くのタンパク質において、これらの局所パターンは機能的モチーフや全体の折りたたみ組織と相関しています。
PSSP は生物学における多くの下流アプリケーションの中核的な構成要素です。局所構造がタンパク質機能と強く相関しているため、PSSP は有用な機能的文脈を提供できます。さらに、これらの予測は三次元構造予測、溶媒和アクセシビリティ予測、タンパク質-タンパク質相互作用予測、および構造クラスまたはドメイン関連の予測を導く情報となります。
モデル化のレベルでは、PSSP はトークン分類問題です:入力はアミノ酸配列であり、出力は各残基に対する構造ラベルです。
評価には主に 2 つの変種があり、ラベル空間のみが異なります:
- Q3(3 状態): H(ヘリックス)、E(ストランド/シート)、C(コイル/ループ)
- Q8(8 状態): H(α-ヘリックス)、B(β-ブリッジ)、E(β-ストランド)、G(310 ヘリックス)、I(π-ヘリックス)、T(ターン)、S(ベンド)、C(コイル/その他)
ESM2-3B は 30 億パラメータを持つタンパク質言語モデルであるため、フルファインチューニングには通常、相当な計算資源とメモリが必要です。LoRA は、追加するパラメータ数をごく少数に抑えつつも PSSP で強力な性能を達成することで、適応を現実的なものに変えます。
BioNeMo Recipes における ESM2 と PEFT の併用 (TE アクセラレーション対応)
チームは、軽量な残基ごとの分類ヘッド(Q3/Q8 ラベル用)を追加し、PEFT ライブラリを通じて LoRA アダプターをトレーニングしながら、事前学習済みバックボーンの重みを凍結することで、PSSP に対して ESM2-3B をファインチューニングしました。データについては、Porter 6 モデルの著者によって公開されたキュレーション済みスプリットを使用し、提供されたテストセット上で結果を報告しました。スループットの最大化のため、TE(Tensor Engine)とシーケンスパッキングを有効化し、NVIDIA RTX 6000 Blackwell Workstation Edition GPU 1 枚上でフルトレーニングワークフローを 1 時間未満で実行しました。
以下のスニペットは BioNeMo Recipes ESM2 plus PEFT の例 から適応されたもので、TE 互換の ESM2 モデルを読み込み、融合されたクエリ/キー/バリュー(QKV)投影に LoRA アダプターを接続する方法を示しています:
import peft
import torch
from transformers import AutoConfig, AutoModelForTokenClassification
config = AutoConfig.from_pretrained("nvidia/esm2_t36_3B_UR50D", trust_remote_code=True)
model = 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",
)
import peft
import torch
from transformers import AutoConfig, AutoModelForTokenClassification
config = AutoConfig.from_pretrained("nvidia/esm2_t36_3B_UR50D", trust_remote_code=True)
model = 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(model, peft_config)
peft_model.to("cuda", dtype=torch.bfloat16)
その後、この PEFT モデル(Parameter-Efficient Fine-Tuning)をトレーニングループに組み込むことができます。完全なレシピには、データローダー、損失関数、オプティマイザーの設定も含まれています。
表 1 は、Porter 6 論文で報告された強力な公開ベースラインと比較した ESM2-3B に LoRA(Low-Rank Adaptation)を適用したモデルの Q3/Q8 テスト精度を要約しています。表 1 のスコアは、ESM2-3B のトップ 5 つの検証チェックポイントにおける平均値です。
モデルQ3 精度 (%)Q8 精度 (%)
ESM-2 3B plus LoRA (top five validation mean)84.8074.30
Porter 684.5674.18
NetSurfP-3.082.9271.84
SPOT-1D-LM84.3074.09
*表 1. Porter 6 ベンチマークにおける ESM2-3B に LoRA を適用したモデルと、公開されたベースラインモデルとの Q3 および Q8 タスクでのタンパク質二次構造予測精度の比較*
全体的に、LoRA による微調整は、他の最先端の PSSP(Protein Secondary Structure Prediction)アプローチと競合しうる精度を達成しています。図 2 は、微調整ステップに対する検証損失および精度の変化を示しています。
image*図 2. Q3 および Q8 タスクにおけるタンパク質二次構造予測の微調整中、ESM2-3B に LoRA を適用したモデルの検証精度および損失曲線*
シーケンスパッキングはどのようにしてより高い利用率とスループットをもたらすのか?
タンパク質データセットには通常、異なる長さの配列が含まれています。これらを単純にバッチ処理すると(パディングされた BSHD 形式)、バッチ内の最大長までパディングが施され、トークンの大部分がパディングになります。これにより、アテンション層と MLP 層内部で計算リソースとメモリ帯域幅が無駄になります。
シーケンスパッキング(パッキングされた平坦化 THD 形式)は、非パディングトークンのみを連結し、累積長メタデータで各シーケンスの境界を追跡することで、この無駄を削減します。その結果、アテンション/MLP カーネルは実際のトークンに対して動作し、パディングされたトークンに対しては動作しません。パッキングが実際にどのように機能するか(および TE パック形式とどう相互作用するか)についてより深い説明については、PyTorch と NVIDIA BioNeMo Recipes を用いた生物学トランスフォーマーモデルのスケールアップをご覧ください。図 3 は、THD と BSHD でファインチューニングを行った場合のスループット(トークン/秒)を示しています。
image*図 3. THD でファインチューニングした場合、BSHD と比較してスループットは 5.5 倍高速です*
この設定では、BSHD から THD に切り替えることでトークン/秒が約 5.5 倍向上し、これは主にパディングのオーバーヘッドを除去した結果によるものです。達成される速度向上は、シーケンス長の分布、マイクロバッチサイズ、および GPU に大きく依存します。
スループット以外にも、THD パッキングはメモリエフィシエンシーを向上させます。パディングトークンに費やされる活性化またはアテンション作業の量を減らすため、GPU メモリトラフィックと計算資源のうち、より大きな割合が有用な(パディングではない)トークンに向かうようになります。
同一の入力シーケンスとバッチサイズにおいて、THD は通常、BSHD よりも少ないメモリを使用します。これはパディングトークンをマテリアライズする必要がないためです。実際には、この節約されたリソースは、1 ステップあたりに処理される実在するトークンの数を増やすために使用されます。
DNA スプライスサイト分類のための Evo2-1B
Evo 2 は、生命のすべてのドメインにわたるゲノム配列を学習対象として訓練された生成型 DNA ファウンデーションモデルです。アーキテクチャ的には、ストライプ化された Hyena ブロックに基づいて構築されており、これは状態空間型の長距離畳み込み演算子と、より少数のアテンション層の組み合わせで構成されています。これにより、長い DNA コンテキストを効率的に処理することが可能になります。ESM2 がアミノ酸配列からタンパク質の「文法」を学習するのと同様に、Evo2 はヌクレオチド配列から直接ゲノムの規則性を学習し、これは多様な下流タスクへ転移可能です:変異効果予測、調節要素分類、そして(ここでは特に興味深い)スプライスサイト同定です。
スプライスサイト分類とは何か?
スプライシングは、pre-mRNA からイントロンを除去しエクソンをつなぎ合わせる細胞プロセスです。境界は 2 つの短い配列モチーフによって定義されます:ドナーサイト(イントロンの開始部、通常は GT)はイントロンの 5′末端にあり、アクセプターサイト(イントロンの終了部、通常は AG)は 3′末端にあります。
生データからこれらの部位を同定することは、単にジヌクレオチドモチーフをマッチングするよりも困難です。同じ GT/AG パターンはゲノム全体に出現しますが、機能的なスプライスサイトとなるのはごく一部だけです。有用な予測モデルは、候補位置周辺のより長距離の文脈を学習する必要があります。
私たちは Nucleotide Transformer downstream-tasks データセットから splice_sites_all タスクを使用しました。各例は固定長の 600 bp の DNA ウィンドウであり、ラベルは中央位置を記述する 3 つのクラス(スプライスなし、アクセプター、ドナー)のいずれかです。ベンチマークには約 3 万件のトレーニングデータと約 3 千件のテストデータが含まれており、ほぼクラスバランスが取れています。
モデルレベルでは、これはシーケンス分類問題です:入力シーケンスごとに単一のラベルを付与するものであり、PSSP のようなトークンごとのラベルとは対照的です。
BioNeMo Recipes における Evo2 と LoRA の併用
チームは、平均プーリングされた隠れ状態の上に小さなシーケンス分類ヘッドを追加するために Megatron Hyena モデルをサブクラス化し、Evo2-1B をスプライスサイト分類のためにファインチューニングしました。その後、バックボーンのアテンション、MLP(多層パーセプトロン)、および Hyena-mixer 投影に対して LoRA アダプターが訓練されました。事前学習済みバックボーンの重みは凍結されたまま保たれ、LoRA アダプターと分類ヘッドのみが訓練されました。
LoRA の貢献を文脈の中で理解するために、同じデータで 2 つの構成を訓練し比較しました:
- ヘッドのみベースライン:バックボーンは凍結、アダプターなし、分類ヘッドのみが学習可能。学習可能なパラメータ総数:約 370 万(モデル全体の 0.33%)
- LoRA 追加ヘッド:バックボーンは凍結、指定されたターゲットモジュールに LoRA アダプターを適用し、分類ヘッドは学習可能。学習可能なパラメータ総数:約 1600 万(モデル全体の 1.42%)
表 2 は、保留された 3,000 の例に対するテスト精度を示しています。
モード学習可能なパラメータ学習可能割合テスト精度
ヘッドのみ3,697,9230.33 %52.3 %
LoRA 追加ヘッド15,985,9231.42 %96.6 %
*表 2. ヘッドのみの場合と LoRA アダプター適用後の Evo2-1B モデルにおける学習可能パラメータ数とスプライスサイト分類精度の比較*
差は大きいです。学習可能なパラメータが約 1% のみであっても、LoRA は事前学習済み Evo2 バックボーンが保持するスプライシングに関するシグナルのほぼすべてを回復します。一方、プーリングのみでは全く不十分です。LoRA モデルにおける残差誤差の大部分はドナー↔アクセプター方向に集中しています。これは予想される結果で、両方のモチーフが GT/AG 二塩基配列構造を共有しており、曖昧さを解消するために長距離コンテキストが必要となるためです。
全体のワークフローは、単一の RTX 6000 Workstation Edition で約 1 時間でエンドツーエンドに実行されます。
以下のスニペットは ESM2 の例と同様のスタイルで記述されています:Evo2 バックボーンを読み込み、Hyena Model サブクラスを通じて分類ヘッドを接続し、アテンション、MLP(多層パーセプトロン)、および Hyena-mixer 投影に LoRA アダプターを設定します。
from bionemo.evo2.models.evo2_lora import Evo2LoRA
from evo2_classifier import (
Hyena1bClassifierProvider,
HyenaForSequenceClassification,
)
model_provider = Hyena1bClassifierProvider(
num_classes=3,
classifier_dropout=0.1,
pool="mean",
)
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 point handles the distributed training, optimizer, scheduler, checkpointing, dataloading, and logging.
To launch a fine-tuning run end-to-end, the recipe exposes a CLI:
torchrun --nproc_per_node=1 evo2_classifier.py \
--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 increase the batch size to reproduce the head-only baseline. Data, optimizer, scheduler, and evaluation stay the same.
完全なトレーニングループ、データセットコード、パラメータの計算、および評価ユーティリティについては、Evo2 LoRA 微調整ノートブック を参照してください。
生物学的基盤モデルの微調整を始める
ESM2 を用いたタンパク質と Evo2 を用いた DNA という、非常に異なる 2 つの生物学的モダリティにわたって、同じパラメータ効率的なレシピを使用できます。事前学習済みバックボーンを凍結し、小さな LoRA アダプタ(Low-Rank Adaptation)とタスク固有のヘッドのみをトレーニングすることで、単一のワークステーション GPU 上で、フル微調整や専用モデルに匹敵する精度を回復することが可能です。
ESM2-3B の場合、LoRA を用いることで PSSP パフォーマンスが強力な公開ベースラインである Porter 6 や SPOT-1D-LM と同程度の範囲に達し、TE および THD シーケンスパッキング(シーケンスの結合)により、単一の NVIDIA RTX 6000 Blackwell Workstation Edition GPU 上でのトレーニングが現実的なものとなります。Evo2-1B の場合、同じアプローチにより、凍結バックボーンベースラインの約 52% からテスト精度を約 97% に引き上げながら、パラメータのわずか約 1.4% だけをトレーニングします。
数十億パラメータの生物基盤モデルも、周囲のトレーニングスタック(TE、Megatron-Bridge、パケット化されたシーケンス、PEFT)が適切に統合されていれば、限られたハードウェア上で適応可能となっています。NVIDIA の BioNeMo Recipes は、この統合を例外ではなくデフォルトとして実現するために設計されています。
LoRA、TE、スケーラブルな PyTorch ワークフローを用いて生物基盤モデルのファインチューニングを開始するには、NVIDIA BioNeMo Recipes をご覧ください。
原文を表示
Foundation models are reshaping computational biology. Pretrained on massive corpora of protein or genomic sequences, models such as ESM2 (a protein language model) and Evo 2 (a DNA language model) capture statistical regularities of biological sequences. These transfer well to a wide range of downstream tasks, including structure prediction, variant effect, and functional annotation.
Yet adapting these models to a specific task is nontrivial: at billions of parameters, full fine-tuning quickly becomes impractical, both in compute and storage of optimizer state and checkpoints.
Low-Rank Adaptation (LoRA) directly addresses this challenge. By keeping the pretrained backbone frozen and training only a small set of low-rank adapter matrices, LoRA can match full fine-tuning quality on many tasks while training ~1% of the parameters, fitting a single billion-scale model and its adapter state on a single workstation GPU.
To reduce the difficulty of building these workflows, NVIDIA BioNeMo Recipes provide step-by-step training recipes built on familiar PyTorch, Hugging Face, Megatron-Bridge patterns. Performance-oriented components such as NVIDIA Transformer Engine (TE) and scale-out strategies are integrated where they pay off, but the recipes themselves stay readable.
This post walks through two case studies that show how the same parameter-efficient recipe applies across biological modalities on a single NVIDIA RTX 6000 Blackwell Workstation Edition GPU:
- ESM2-3B plus LoRA for protein secondary structure prediction (PSSP)
- Evo2-1B plus LoRA for DNA splice-site classification
All the source code to customize or reproduce these results are available in NVIDIA BioNeMo Recipes.
How LoRA enables fine-tuning at scale
Before diving into the case studies, a quick refresher on the method. Full fine-tuning is resource-heavy because it requires storing and updating all model parameters and their optimizer states, which quickly becomes impractical as models scale.
LoRA is a practical method to fine-tune large pretrained transformers without updating or storing optimizer state for all model parameters. The core idea behind LoRA is that instead of updating a dense model’s weight matrix , LoRA adds a new trainable low-rank matrix in parallel and keeps frozen. This dramatically reduces the number of trainable parameters and the optimizer/memory footprint.

LoRA is parameterized by a small set of hyperparameters that trade off capacity, stability, and cost. The rank controls the size of the added low-rank matrices and therefore the number of trainable parameters. The target modules specify which layers receive adapters, with common choices such as attention and MLP projections. For small datasets, LoRA dropout can be enabled as an additional form of regularization.
While the following two case studies differ in modality (protein versus DNA), task type (token classification versus sequence classification), and underlying architecture (transformer versus striped Hyena), both use the same LoRA recipe pattern.
ESM2-3B for protein secondary structure prediction
PSSP is the task of assigning a structural label to each amino acid in a protein sequence. Secondary structure labels describe local backbone conformations—helices and strands—without requiring a full 3D structure prediction. For many proteins, these local patterns correlate with functional motifs and global fold organization.
PSSP is a core building block for many downstream applications in biology. Because local structure is strongly correlated with protein function, PSSP can provide useful functional context. In addition, these predictions can inform tertiary structure prediction, solvent accessibility prediction, protein-protein interaction prediction, and structural class- or domain-related prediction.
At a modeling level, PSSP is a token classification problem: the input is an amino-acid sequence, and the output is a structural label for each residue.
There are two common evaluation variants, differing only in the label space:
- 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 (turn), S (bend), C (coil/other)
ESM2-3B is a 3-billion-parameter protein language model, so full fine-tuning typically requires substantial compute and memory. LoRA makes adaptation practical by training only a small number of additional parameters, while still achieving strong performance on PSSP.
ESM2 plus PEFT in BioNeMo Recipes (TE-accelerated)
The team fine-tuned ESM2-3B for PSSP by adding a lightweight per-residue classification head (for Q3/Q8 labels) and training LoRA adapters through the PEFT library, while keeping the pretrained backbone weights frozen. For data, we used the curated splits released by the authors of the Porter 6 model and reported results on their provided test set. To maximize throughput, we enabled TE and sequence packing and ran the full training workflow on one NVIDIA RTX 6000 Blackwell Workstation Edition GPU in under one hour.
The following snippet adapted from the BioNeMo Recipes ESM2 plus PEFT example shows how to load the TE-compatible ESM2 model and attach LoRA adapters to the fused query/key/value (QKV) projections:
import peft
import torch
from transformers import AutoConfig, AutoModelForTokenClassification
config = AutoConfig.from_pretrained("nvidia/esm2_t36_3B_UR50D", trust_remote_code=True)
model = 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(model, peft_config)
peft_model.to("cuda", dtype=torch.bfloat16)
You can then plug this PEFT model into your training loop. The full recipe includes the dataloader, loss, and optimizer setup.
Table 1 summarizes Q3/Q8 test accuracy for the ESM2-3B plus LoRA model alongside strong published baselines reported in the Porter 6 paper. Table 1 reports the mean score over the top five validation checkpoints for ESM2-3B.
Overall, LoRA fine-tuning reaches accuracy that is competitive with other state-of-the-art PSSP approaches. Figure 2 shows validation loss and accuracy versus fine-tuning steps.

How can sequence packing yield higher utilization and throughput?
Protein datasets typically contain sequences of varying lengths. If they are batched naively (the padded BSHD format), they are padded to the maximum length in the batch and a large fraction of tokens become padding. This wastes compute and memory bandwidth inside attention and MLP layers.
Sequence packing (the packed/flattened THD format) reduces that waste by concatenating only the nonpadding tokens and tracking per-sequence boundaries with cumulative-length metadata. As a result, attention/MLP kernels operate on real tokens rather than padded tokens. For a deeper explanation of how packing works in practice (and how it interacts with TE packed formats), see Scale Biology Transformer Models with PyTorch and NVIDIA BioNeMo Recipes. Figure 3 shows throughput (tokens/sec) when fine-tuning with THD versus BSHD.

In this setup, switching from BSHD to THD improved tokens/sec by ~5.5x, largely by removing padding overhead. The achieved speedup largely depends on the sequence length distribution, microbatch size, and GPU.
Beyond throughput, THD packing improves memory efficiency. It reduces the amount of activation or attention work spent on padding tokens, so a larger fraction of the GPU memory traffic and compute goes toward useful (non-padding) tokens.
For identical input sequences and batch size, THD typically uses less memory than BSHD because it avoids materializing padded tokens. In practice, that saved headroom is used to increase the number of real tokens processed per step.
Evo2-1B for DNA splice-site classification
Evo 2 is a generative DNA foundation model trained on genomic sequences spanning all domains of life. Architecturally it is built on striped Hyena blocks—a mix of state-space-style long-convolution operators and a smaller number of attention layers. This allows it to process long DNA contexts efficiently. Just as ESM2 learns protein “grammar” from amino-acid sequences, Evo2 learns genomic regularities directly from nucleotide sequences, which transfer to a variety of downstream tasks: variant effect prediction, regulatory element classification, and (of interest here) splice-site identification.
What is splice-site classification?
Splicing is the cellular process that removes introns from pre-mRNA and joins exons together. The boundaries are defined by two short sequence motifs: donor sites (intron starts, typically GT) at the 5′ end of the intron and acceptor sites (intron ends, typically AG) at the 3′ end.
Identifying these sites from raw DNA is more difficult than just matching the dinucleotide motif. The same GT/AG patterns appear throughout the genome and only a small fraction are functional splice sites. Useful predictors have to learn longer-range context around the candidate position.
We used the splice_sites_all task from the Nucleotide Transformer downstream-tasksdataset. Each example is a fixed-length 600 bp DNA window, and the label is one of three classes describing the central position—no-splice, acceptor, or donor. The benchmark ships ~30K training / ~3K test examples and is roughly class-balanced.
At a modeling level, this is a sequence classification problem: a single label per input sequence, in contrast to the per-token labels in PSSP.
Evo2 plus LoRA in BioNeMo Recipes
The team fine-tuned Evo2-1B for splice-site classification by subclassing the Megatron Hyena model to add a small sequence-classification head on top of mean-pooled hidden states. LoRA adapters were then trained on the backbone attention, MLP, and Hyena-mixer projections. The pretrained backbone weights were kept frozen; only the LoRA adapters and the classification head were trained.
To put the LoRA contribution in context, we trained two configurations on the same data and compared them:
- Head-only baseline: Backbone frozen; no adapters, only the classification head is trainable. Total trainable parameters: ~3.7 million (0.33 % of the model)
- LoRA plus head: Backbone frozen; LoRA adapters on the listed target modules, classification head trainable. Total trainable parameters: ~16.0 million (1.42 % of the model)
Table 2 shows the test accuracy on the held-out 3K examples.
The gap is large: with only ~1% of the parameters trainable, LoRA recovers nearly all of the signal that the pretrained Evo2 backbone holds about splicing, whereas pooling alone is far from sufficient. Most of the residual error from the LoRA model is in the donor↔acceptor direction. This is expected because both motifs share the GT/AG dinucleotide structure and require longer-range context to disambiguate.
The full workflow runs end-to-end on a single RTX 6000 Workstation Edition in about one hour.
The following snippet mirrors the ESM2 example stylistically: it loads the Evo2 backbone, attaches a classification head through a Hyena Model subclass, and configures LoRA adapters on the attention, MLP, and Hyena-mixer projections.
from bionemo.evo2.models.evo2_lora import Evo2LoRA
from evo2_classifier import (
Hyena1bClassifierProvider,
HyenaForSequenceClassification,
)
model_provider = Hyena1bClassifierProvider(
num_classes=3,
classifier_dropout=0.1,
pool="mean",
)
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 point handles the distributed training, optimizer, scheduler, checkpointing, dataloading, and logging.
To launch a fine-tuning run end-to-end, the recipe exposes a CLI:
torchrun --nproc_per_node=1 evo2_classifier.py \
--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 increase the batch size to reproduce the head-only baseline. Data, optimizer, scheduler, and evaluation stay the same.
For the complete training loop, dataset code, parameter accounting, and evaluation utilities, see the Evo2 LoRA fine-tuning notebook.
Get started fine-tuning biological foundation models
Across two very different biological modalities—proteins with ESM2 and DNA with Evo2—the same parameter-efficient recipe can be used. You can freeze the pretrained backbone, train a small LoRA adapter plus a task-specific head, and recover accuracy that is competitive with full fine-tuning or specialized models, on a single workstation GPU.
For ESM2-3B, LoRA brings PSSP performance into the same range as strong published baselines like Porter 6 and SPOT-1D-LM, while TE and THD sequence packing make training on a single NVIDIA RTX 6000 Blackwell Workstation Edition GPU practical. For Evo2-1B, the same approach lifts splice-site classification from a frozen-backbone baseline of ~52% to ~97% test accuracy while training only ~1.4% of the parameters.
Billion-parameter biological foundation models are now adaptable on modest hardware, provided that the surrounding training stack (TE, Megatron-Bridge, packed sequences, PEFT) is well integrated. NVIDIA BioNeMo Recipes are designed to make that integration the default, not the exception.
To get started fine-tuning biological foundation models with LoRA, TE, and scalable PyTorch workflows, check out theNVIDIA BioNeMo Recipes.
関連記事
生成モデルProteina-Complexaを用いたタンパク質結合剤の設計
NVIDIAの研究チームが、生成モデルProteina-Complexaを使用して、標的タンパク質に結合するタンパク質結合剤を設計する新手法を開発した。この技術は、タンパク質ベースの治療薬や触媒の開発を加速させる可能性がある。
LoRA を超えるか?最も人気のあるファインチューニング手法に勝てるか
Hugging Face は、現在最も普及しているファインチューニング技術である LoRA の限界を検証し、それを上回る新たな手法の可能性について議論している。
あなたの言語・ドメイン、またはアクセント向けに Nemotron 3.5 ASR をファインチューニングする方法
Hugging Face は、Nemotron 3.5 ASR モデルを特定の言語や業界ドメイン、話者のアクセントに合わせてカスタマイズするファインチューニングの手順を解説した。
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み