NVIDIA NeMo AutoModelによるTransformersの微調整加速
NVIDIA は Hugging Face 上で NeMo AutoModel を公開し、Transformer モデルのファインチューニングを自動化・高速化する新しいツールを提供した。
キーポイント
NeMo AutoModel の公開と機能
NVIDIA が Hugging Face Blog にて NeMo AutoModel を発表し、Transformer モデルのファインチューニングプロセスを自動化する機能を強化した。
開発効率の劇的向上
複雑な設定やコード記述を削減し、ユーザーがデータセットとモデルを選択するだけで高速なファインチューニングが可能になる。
NVIDIA GPU 最適化の実装
NeMo フレームワークの基盤を活かし、NVIDIA GPU の性能を最大限に引き出すように設計された自動最適化機能を提供する。
大規模モデルのフルファインチューニング実現
550B パラメータを持つ Nemotron 3 Ultra モデルを 16 ノード(128 GPU)環境でフルファインチューニングし、Expert Parallelism (EP=64) の重要性を実証しました。
高度な最適化技術の統合
Mamba2、LatentMoE、Multi-Token Prediction などの最新アーキテクチャに加え、DeepEP ディスパッチや TransformerEngine カーネルを自動的に活用して性能を最大化します。
単一ノードでの高速化
30B モデルの MoE 2 つのトレーニングにおいて、NeMo AutoModel が Transformers v5 よりも GPU あたりの速度向上を示し、スケーラビリティとメモリ最適化を達成しました。
メモリ不足の回避と実行可能性
Transformers v5 はこの規模ではメモリ不足になるが、NeMo AutoModel の Expert Parallelism (EP) がエキスパートをシャードすることでフルファインチューニングを可能にする。
影響分析・編集コメントを表示
影響分析
この発表は、NVIDIA が AI モデル開発の標準化と効率化を主導する姿勢を示すものであり、特に Hugging Face ユーザー層に対して GPU パフォーマンスを活かした迅速なモデルカスタマイズを可能にする。業界全体として、大規模モデルの実装コスト低下とデプロイ速度向上に寄与し、AI アプリケーション開発の民主化を加速させる可能性がある。
編集コメント
NVIDIA と Hugging Face の連携強化により、開発者が GPU の性能を最大限に活用してモデルを調整するプロセスが大幅に簡素化されました。これは、実務レベルでの LLM カスタマイズ需要に応える重要な一歩と言えます。
HuggingFace Transformers はオープンソース AI エコシステムの基盤となっており、最新の Transformers v5 リリースでは、現在 フロンティアモデル の主流である Expert モデル(Mixture-of-Experts: MoE)に対するファーストクラスのサポートが強化されました。v5 では、MoE を拡張可能で構築しやすいものとするための基盤として、エキスパートバックエンド、動的ウェイトローディング、分散実行機能が搭載されています。
NVIDIA NeMo AutoModel は、大規模なカスタム生成 AI モデルを構築するための NVIDIA NeMo フレームワーク の一部であるオープンソースライブラリです。NeMo AutoModel は v5 をクリーンに拡張し、Expert Parallelism(エキスパート並列処理)、DeepEP 統合型 all-to-all ディスパッチ、TransformerEngine カーネルを追加します。また、v5 の動的ウェイトローディングを活用することで、これらの最適化を広範かつ増加するモデルファミリーに提供します。その結果、同じ from_pretrained() API を使用しながら、ネイティブな Transformers v5 と比較して MoE モデルのファインチューニングにおいてトレーニングスループットが 3.4〜3.7 倍向上し、GPU メモリ使用量が 29〜32% 削減されます。これは単なるインポート行の追加であり、他のコード変更は一切不要です。
本ブログでは、この組み合わせがどのように機能するか、そしてユーザーが API を変更せずに MoE モデルをより高速にファインチューニングする方法について詳しく解説します。
バックグラウンド
MoE モデルの台頭は、効率的なトレーニングに新たな課題をもたらしました:数百のエキスパート間でルーティングされたトークン、エキスパート行列積算の単一カーネルへの融合、GPU 間での重みのシャード化、および通信と計算のオーバーラップは、汎用ライブラリが標準で提供するものを超えたインフラストラクチャを必要とします。
Transformers v5(「v5」)は、expert backends、dynamic weight loading、および分散実行用のテンソル並列計画など、ファーストクラスの MoE サポートを導入しました。さらに、v5 では PyTorch の DeviceMesh を from_pretrained() に直接統合することで、分散トレーニングをファーストクラスとして扱っています。
NeMo AutoModel は v5 をベースに、AutoModelForCausalLM をサブクラス化し、Expert Parallelism (EP)、DeepEP による融合された all-to-all ディスパッチ、および TransformerEngine カーネルを追加しています。DeepEP は v5 がまだ持っていない機能で、通信とエキスパート計算のオーバーラップを実現します。さらに、NeMo AutoModel は v5 の可逆的な重み変換を利用して各モデルを読み込むため、再利用可能なコア演算にエンジニアリングリソースを集中でき、モデルごとのチェックポイント処理に費やす必要がなくなります。また、save_pretrained() により標準的な HF チェックポイントが出力されるため、vLLM や SGLang などのツールでロード可能です。
次のセクションでは、これら 2 つがどのように連携し、16 ノードにわたるフルファインチューニング NVIDIA Nemotron 3 Ultra 550B A55B から、Qwen3-30B-A3B や Nemotron 3 Nano 30B A3B のような単一ノードモデルに至るまで、私たちが測定したパフォーマンスの向上について詳しく解説します。
NeMo AutoModel: 同じ API でより高いパフォーマンス
NeMo AutoModel の目標の一つは、オープンソースコミュニティを支援するために HuggingFace Transformers との API 互換性を維持することです。NeMoAutoModelForCausalLM は AutoModelForCausalLM をサブクラス化しているため、HF モデルで動作するコードはそのまま AutoModel でも動作します。
モデルを読み込む際の両者の違いは以下の通りです。変更されるのはインポート文のみです:
この単一のインポートが多くの処理を行います。Qwen3 や NVIDIA Nemotron、GPT-OSS、DeepSeek V3 などの人気のある MoE アーキテクチャの場合、NeMo AutoModel は TransformerEngine のアテンション、融合された線形層、カスタムエキスパートカーネルを備えた 手動調整された実装 を提供します。それ以外のアーキテクチャについては、Liger kernel パッチなどの最適化を適用しつつも、バニラの HF にフォールバックします。どちらのパスを選んでも、結果として得られるモデルはスケーリングが可能で、device_mesh を渡すだけで追加のリファクタリングなしにマルチ GPU 学習が実行できます。
NeMo AutoModel が特に輝くのは、MoE モデルをマルチ GPU 学習にスケールさせる点です。Nemotron 3 Nano 30B A3B を 8 枚の GPU にわたる Expert Parallelism(エキスパート並列処理)で学習させるには、分散メッシュ設定を追加します。
import os
import torch
import torch.distributed as dist
from nemo_automodel import NeMoAutoModelForCausalLM
from nemo_automodel.recipes._dist_utils import create_distributed_setup_from_config
dist.init_process_group(backend="nccl")
torch.manual_seed(0)
torch.cuda.set_device(int(os.environ.get("LOCAL_RANK", 0)))
dist_setup = create_distributed_setup_from_config(
{
"strategy": "fsdp2",
"ep_size": 8,
},
)
model = NeMoAutoModelForCausalLM.from_pretrained(
"nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16",
dtype=torch.bfloat16,
distributed_setup=dist_setup,
)
dist.destroy_process_group()
これにより、from_pretrained() 呼び出し一つで、FSDP2(Fully Sharded Data Parallel 2)、Expert Parallelism、TransformerEngine カーネル、DeepEP ディスパッチによる高速化、スケーラビリティ向上、メモリ最適化が実現します。
パフォーマンス比較
NeMo AutoModel の評価は二つのシナリオで行いました。一つは、16 ノードにわたって最先端の 550B モデルをフルファインチューニングするケース、もう一つは単一ノードで 30B の MoE モデル 2 つを学習させるケースです。550B の結果は、スケールにおいて Expert Parallelism が不可欠である理由を示しており、30B の結果は Transformers v5 に対する GPU 単体の速度向上を定量化したものです。
Nemotron 3 Ultra 550B A55B(フルファインチューニング、マルチノード)
Nemotron 3 Ultra 550B A55B は、Mamba2、LatentMoE、および Multi-Token Prediction (MTP) を搭載した 550B パラメータのハイブリッドモデルです。私たちはフルファインチューニングをベンチマークしました:これはすべてのパラメータが更新され、Adam オプティマイザの状態もマテリアライズされるものであり、この規模では16 H100 ノード(128 GPU)にまたがります。
方法論:
Parameter
Value
Hardware
16x H100 80GB (128 GPUs)
Expert Parallelism
EP=64
Local batch size
2
Sequence length
4,096
Features
MTP、activation checkpointing、fused linear cross-entropy
Kernels
DeepEP dispatch + torch_mm experts + TransformerEngine
Metric
NeMo AutoModel (EP=64)
TPS/GPU (avg)
815
TFLOP/s/GPU
~293
Peak Memory
58.2 GiB
なぜ Transformers v5 の列がないのか。 この規模では Transformers v5 はメモリ不足になるため、報告できる v5 の数値はありません。AutoModel の Expert Parallelism(専門化並列処理)は、専門化ユニットを GPU 間でシャードしてフットプリントを予算内に収め、これによりフルファインチューニングが実行可能になります。以下の 30B の比較でも、v5 が対応できる範囲で同様の優位性が示されています。
Single-node 30B MoE ベンチマーク
8x H100 80GB GPU を備えたシングルノード上で、3 つのアプローチをベンチマークしました:HF Transformers v4(ハブコード)、HF Transformers v5(利用可能な最良の最適化あり)、および NeMo AutoModel (EP=8 + カスタムカーネル)。
方法論:
Parameter
Value
Hardware
8x H100 80GB (single node)
Sequence length
4,096
Local batch size
1
ルーティングゲートに関する注記。 以下の NeMo AutoModel の数値は、バランス型ルーティングゲートを使用しており、トークンをエキスパート間で均一に分散させるよう強制します。これは MoE が学習する際に目指す*理想的な*動作点を模倣しています:適切に訓練されたモデルでは負荷分散損失がエキスパート利用率をほぼ均一にするため、バランス型ルーティングは実際のワークロードが収束する定常状態を反映し(ランダムなダミートークンがエキスパート並列処理に注入するノイズである「遅延者」のノイズも除去します)。v4/v5 はネイティブルーターを同じダミートークン上で実行しています。したがって、バランス型ゲートは NeMo AutoModel をその目標とする MoE 動作点で測定しており、v4/v5 の列はそれらの出荷時(out-of-the-box)の動作を反映しています。
Qwen3-30B-A3B
Metric
v4
v5 (FA2 + grouped_mm)
NeMo AutoModel (EP=8)
v5 → NeMo AutoModel
TPS/GPU (avg)
deadlock
3,075
11,340
3.69x
Peak Memory
—
68.2 GiB
48.1 GiB
-29%
Avg Forward+Loss
—
582 ms
194 ms
3.00x
Avg Backward
—
758 ms
178 ms
4.26x
v4 がデッドロックする理由: Transformers v4 では、Qwen3 MoE のエキスパートを 128 個の個別 MLP モジュールからなる ModuleList として格納しており、それぞれが個別に FSDP(Fully Sharded Data Parallel)でラップされています。順方向パスは、トークンを受け取ったエキスパートのみを反復するデータ依存ループを使用します。各ランクで異なるデータがあるため、異なるランクが異なるエキスパートをスキップし、FSDP の AllGather/ReduceScatter 集合演算に不一致が生じて、無限の待機状態(hang)を引き起こします。Transformers v5 では、エキスパートを融合された 3D パラメータテンソルとして格納することでこれを修正しています(個別のエキスパートモジュールや個別のエキスパート向け FSDP 集合演算はありません)。
Nemotron 3 Nano 30B A3B
Metric
v4 (hub code)
v5 (FA2 + grouped_mm + Mamba CUDA)
NeMo AutoModel (EP=8)
v5 → NeMo AutoModel
TPS/GPU (avg)
1,807
4,583
15,421
3.36x
Peak Memory
61.9 GiB
62.1 GiB
42.5 GiB
-32%
Avg Forward+Loss
1,024 ms
283 ms
109 ms
2.60x
Avg Backward
1,246 ms
611 ms
157 ms
3.89x
v4 config: trust_remote_code=True (NVIDIA's hub modeling code). The hub code's expert loop is FSDP-safe (iterates all experts regardless of token assignment), so it doesn't deadlock like Qwen3 v4.
Where the speedup comes from
The 3.4-3.7x speedup from NeMo AutoModel over Transformers v5 comes from three sources:
- Expert Parallelism reduces memory pressure. EP=8 distributes expert weights across GPUs, cutting the per-GPU MoE footprint by 8x. For Qwen3, this drops peak memory from 68.2 GiB to 48.1 GiB (-29%). For Nemotron Nano, it drops from 62.1 GiB to 42.5 GiB (-32%), freeing headroom for larger batch sizes or longer sequences.
- DeepEP fuses communication with computation. Instead of separate AllGather/ReduceScatter collectives for expert routing, DeepEP fuses token dispatch and combines into optimized GPU kernels, overlapping communication with expert computation.
- TransformerEngine kernels accelerate core operations. TE's fused attention, linear layers, and RMSNorm implementations provide consistent speedups over their PyTorch/Flash Attention equivalents across all layer types, not just MoE layers.
HuggingFace AutoModel が活用する Transformers v5 の機能
エキスパートバックエンド
Transformers v5 における最も影響力のある機能の一つに、experts_implementation パラメータがあり、これには 3 つのエキスパートバックエンドが含まれています。
バックエンド
説明
最適用途
eager
選択されたエキスパートに対する for ループ
デバッグ、互換性、および正しさ。v4 でも利用可能。
batched_mm
エキスパートパラメータを複製し、torch.bmm を介した単一のバッチ化 GEMM 実行
小規模入力、torch.compile で高速。v5 で追加
grouped_mm
トークンをエキスパート順に並べ替え、torch.nn.functional.grouped_mm を介した単一のグループ化 GEMM 実行
トレーニング(メモリ効率的、パラメータ複製なし)。v5 で追加。
grouped_mm バックエンドがトレーニング最適化の鍵となります。これはエキスパートを一つずつループするのではなく、割り当てられたエキスパートに応じてトークンをソートし、単一の融合されたグループ行列乗算を実行します。
NeMo AutoModel はこれをさらに発展させます。カスタム実装を持つモデルに対しては、DeepEP による融合されたオールツーオールディスパッチに、grouped GEMM カーネルと TransformerEngine の線形層を組み合わせて使用します。その進化の道筋は以下の通りです。
v4 (eager for-loop) → v5 (grouped_mm) → NeMo AutoModel (DeepEP + GMM + TE)
NeMo AutoModel では、エキスパートバックエンドは BackendConfig を通じて設定されます。
from nemo_automodel.components.models.common.utils import BackendConfig
backend = BackendConfig(
attn="te", # TransformerEngine attention
linear="te", # TransformerEngine linear layers
experts="torch_mm", # Grouped expert matmul
dispatcher="deepep", # DeepEP fused all-to-all
)
Expert Parallelism and DeepEP
Transformers v5 also ships an Expert Parallelism path. It shards expert weights across GPUs. The GroupedGemmParallel style loads only each device's local experts, and RouterParallel routes tokens and combines results with an all_reduce. It's neatly built on v5's existing tensor-parallel machinery. Enabling it makes the model's tp_plan return its expert plan, so expert parallelism shares the device budget with data parallelism (ep × dp = world_size). For the single-node 30B benchmarks here, we found plain data-parallel v5 (dp=8, ep=1) to be the fastest v5 configuration, so that's the v5 setup we report.
NeMo AutoModel は、マルチ GPU MoE 学習に最適化された補完的なアプローチを採用しています。これは EP を独自の並列次元として扱い、データ並列メッシュから切り出すのではなく、それに並行して専用の moe_mesh を構築します。これには PyTorch の DTensor と Shard(0) が使用されます。エキスパートメッシュがデータ並列と直交しているため、両者は同じデバイス上で合成されます。8 枚の GPU を用いた場合、NeMo AutoModel は ep=8 と dp=8 を同時に実行し、各 GPU が独自にデータの断片を処理しながら、保持するエキスパートは全体の 1/8 に抑えられます。エキスパート重みは、エキスパート次元に沿って物理的に GPU 間でシャードされます。
From nemo_automodel/components/moe/parallelizer.py
from torch.distributed.tensor import Shard, distribute_tensor
Each GPU holds only 1/ep_size of the expert weights
distribute_tensor(param, device_mesh, [Shard(0)])
ep_size=8 の状態で 8 枚の GPU を使用すると、各 GPU はエキスパートパラメータの 1/8 しか保持しません。Nemotron-3-Nano-30B-A3B のようなモデルでは、約 55 GiB のエキスパート重みを持ちますが、EP により GPU あたりのエキスパート負荷は約 55 GiB から約 6.8 GiB に削減され、FSDP(Fully Sharded Data Parallel)のみを用いたアプローチではメモリ不足で実行不可能な環境でも学習が可能になります。
EP に加え、NeMo AutoModel は DeepEP を統合しており、トークンルーティングを最適化された GPU カーネルに融合させることで、グループ化された GEMM(行列乗算)と組み合わせることで、グループ化された専門家計算において大幅な速度向上を実現します。私たちの 大規模 MoE ベンチマーク において、DeepEP とグループ化された GEMM を併用することで、全 DeepSeek V3 671B モデルにおける 1 イテレーションあたりのコストを、all-gather(全結合)とループ型専門家ベースラインと比較して 47% 削減しました。
Dynamic Weight Loading
Transformers v5 ではまた、WeightConverter と WeightRenaming を通じて 動的ウェイト読み込み システムも導入されました。これにより、MoE チェックポイント(重み保存ファイル)を融合された 3D テンソルとして保存し、より効率的な実行を可能にしています。WeightConverter は、from_pretrained() の実行中にチェックポイントテンソルを変換するための合成可能な操作を適用します。
NeMo AutoModel はこの v5 API を直接利用するコンシューマーです。20 以上のモデルタイプ が、MODELS_REQUIRING_TENSOR_MERGING を通じてこのメカニズムを利用しており、Mixtral、Qwen2 MoE、Qwen3 MoE、DeepSeek V2/V3、OLMoE などを含みます。これらの変換は完全に可逆であり、save_pretrained() によって生成されるのは標準的な HF フォーマットのチェックポイントで、あらゆる下流のツールが読み込むことができます。
Getting Started
NeMo AutoModel をお試しください。そのためには、公式ドキュメントページ こちら からインストールを開始してください。
詳細については、以下の資料をご覧ください:
- NeMo AutoModel HuggingFace API 互換性ガイド
- NeMo AutoModel モデル対応状況
- NeMo AutoModel パフォーマンスサマリー
- HuggingFace 上の NeMo AutoModel
結論
NVIDIA NeMo AutoModel は、モデルトレーニングのスケールアップを図る HuggingFace ユーザーにとって、自然な次のステップです。Transformers v5 に直接基づいて構築されているため、AutoModel は摩擦のないアップグレードパスを提供します:インポート文を1行変更するだけで、3 倍以上高速なモデルインスタンスが得られます。
Qwen3-30B-A3B および Nemotron 3 Nano 30B-A3B において、これは最適な Transformers v5 設定と比較して、GPU メモリ使用量を 29〜32% 削減しながら、トレーニングスループットを 3.4〜3.7 倍向上させます。そして、真のエキスパート並列化(Expert Parallelism)がエキスパートを GPU にまたいでシャードするため、この同じパスは 16 ノードにわたって 550B モデルである Nemotron 3 Ultra のフルファインチューニングまでスケールアップ可能です。これは、モデルをメモリに収めるためにエキスパート並列化が不可欠となる領域です。NeMo AutoModel チェックポイントは標準的な HF フォーマットの safetensors であるため、vLLM や SGLang などの推論フレームワーク上でデプロイすることができます。
コード、設定ファイル、ベンチマークスクリプトはすべて、NeMo AutoModel リポジトリ で利用可能です。
謝辞
この研究の主要貢献者(姓順にアルファベット順):Adil Asif, Hemil Desai, Alexandros Koumparoulis, Huiying Li.
原文を表示
HuggingFace Transformers has become the foundation of the open-source AI ecosystem, and the recent Transformers v5 release strengthened it with first-class support for Mixture-of-Experts (MoE) models, now the dominant architecture for frontier models. v5 ships the MoE foundations: expert backends, dynamic weight loading, and distributed execution that make MoE extensible and easy to build on.
NVIDIA NeMo AutoModel is an open library part of the NVIDIA NeMo framework for building custom generative AI models at scale. NeMo AutoModel builds cleanly on top of v5, adding Expert Parallelism, DeepEP fused all-to-all dispatch, and TransformerEngine kernels, and it leans on v5's dynamic weight loading to bring those optimizations to a broad and growing set of model families. The payoff is 3.4-3.7x higher training throughput and 29-32% less GPU memory on fine-tuning MoE models than native Transformers v5, using the same from_pretrained() API: a single import line, with no other code changes.
This blog details how this combination works and how users can fine-tune MoE models faster without changing their APIs.
Background
The rise of MoE models has introduced new challenges to efficient training: Routing tokens across hundreds of experts, fusing expert matmuls into a single kernel, sharding weights across GPUs, and overlapping communication with computation all require infrastructure beyond what a general-purpose library provides out of the box.
Transformers v5 (“v5”) introduced first-class MoE support such as expert backends, dynamic weight loading, and tensor parallel plans for distributed execution. In addition, v5 made distributed training first-class by integrating PyTorch's DeviceMesh directly into from_pretrained().
NeMo AutoModel builds on top of v5 by subclassing AutoModelForCausalLM, and adding Expert Parallelism (EP), DeepEP fused all-to-all dispatch, and TransformerEngine kernels. DeepEP is the piece v5 doesn't have yet: it overlaps communication with expert compute. And because NeMo AutoModel rides v5's reversible weight conversion to load each model, it can focus its engineering on these reusable core ops instead of per-model checkpoint plumbing, while save_pretrained() still emits standard HF checkpoints that tools like vLLM and SGLang can load.
The next section walks through how the two work together and the performance gains we measured, from full fine-tuning NVIDIA Nemotron 3 Ultra 550B A55B across 16 nodes down to single-node models such as Qwen3-30B-A3B and Nemotron 3 Nano 30B A3B.
NeMo AutoModel: Same API, More Performance
One of NeMo AutoModel's goals is API compatibility with HuggingFace Transformers to enable open-source community. NeMoAutoModelForCausalLM subclasses AutoModelForCausalLM, so any code that works with HF models works with AutoModel too.
Here's what loading a model looks like in both. Only the import changes:
That single import does a lot of work. For popular MoE architectures like Qwen3, NVIDIA Nemotron, GPT-OSS, and DeepSeek V3, NeMo AutoModel ships hand-tuned implementations with TransformerEngine attention, fused linear layers, and custom expert kernels. For everything else, it falls back to vanilla HF while still applying optimizations like Liger kernel patching, among others. And whichever path it takes, the resulting model is ready to scale: pass a device_mesh and you have multi-GPU training without further rewrites.
Where NeMo AutoModel really shines is scaling MoE models to multi-GPU training. To train Nemotron 3 Nano 30B A3B with Expert Parallelism across 8 GPUs, one adds the distributed mesh configuration:
import os
import torch
import torch.distributed as dist
from nemo_automodel import NeMoAutoModelForCausalLM
from nemo_automodel.recipes._dist_utils import create_distributed_setup_from_config
dist.init_process_group(backend="nccl")
torch.manual_seed(0)
torch.cuda.set_device(int(os.environ.get("LOCAL_RANK", 0)))
dist_setup = create_distributed_setup_from_config(
{
"strategy": "fsdp2",
"ep_size": 8,
},
)
model = NeMoAutoModelForCausalLM.from_pretrained(
"nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16",
dtype=torch.bfloat16,
distributed_setup=dist_setup,
)
dist.destroy_process_group()
This gives speed, scalability and memory-optimizations with FSDP2, Expert Parallelism, TransformerEngine kernels and DeepEP dispatch, all from a from_pretrained() call.
Performance Comparison
We evaluated NeMo AutoModel in two regimes: full fine-tuning a frontier-scale 550B model across 16 nodes, and training two 30B MoE models on a single node. The 550B result shows why Expert Parallelism is essential at scale; the 30B results quantify the per-GPU speedup over Transformers v5.
Nemotron 3 Ultra 550B A55B (full fine-tune, multi-node)
Nemotron 3 Ultra 550B A55B is a 550B-parameter hybrid model shipping with Mamba2, LatentMoE, and Multi-Token Prediction (MTP). We benchmark a full fine-tune: every parameter is updated and the Adam optimizer state is materialized, which at this scale spans 16 H100 nodes (128 GPUs).
Methodology:
Parameter
Value
Hardware
16x H100 80GB (128 GPUs)
Expert Parallelism
EP=64
Local batch size
2
Sequence length
4,096
Features
MTP, activation checkpointing, fused linear cross-entropy
Kernels
DeepEP dispatch + torch_mm experts + TransformerEngine
Metric
NeMo AutoModel (EP=64)
TPS/GPU (avg)
815
TFLOP/s/GPU
~293
Peak Memory
58.2 GiB
Why there is no Transformers v5 column. Transformers v5 runs out of memory at this scale, so there is no v5 number to report here. AutoModel's Expert Parallelism shards the experts across GPUs to bring the footprint within budget, which is what lets the full fine-tune run. The 30B comparisons below show the same advantage where v5 fits.
Single-node 30B MoE benchmarks
We benchmarked three approaches on a single node with 8x H100 80GB GPUs: HF Transformers v4 (hub code), HF Transformers v5 (with best available optimizations), and NeMo AutoModel (EP=8 + custom kernels).
Methodology:
Parameter
Value
Hardware
8x H100 80GB (single node)
Sequence length
4,096
Local batch size
1
A note on the routing gate. The NeMo AutoModel numbers below use a balanced routing gate, which forces tokens to be distributed uniformly across experts. This emulates the *ideal* operating point an MoE is trained toward: a well-trained model's load-balancing loss drives expert utilization to near-uniform, so balanced routing reflects the steady-state a real workload converges to (and removes the straggler noise that random dummy tokens otherwise inject into expert parallelism). v4/v5 run their native router on the same dummy tokens. The balanced gate therefore measures NeMo AutoModel at its target MoE operating point, and the v4/v5 columns reflect their out-of-the-box behavior.
Qwen3-30B-A3B
Metric
v4
v5 (FA2 + grouped_mm)
NeMo AutoModel (EP=8)
v5 → NeMo AutoModel
TPS/GPU (avg)
deadlock
3,075
11,340
3.69x
Peak Memory
—
68.2 GiB
48.1 GiB
-29%
Avg Forward+Loss
—
582 ms
194 ms
3.00x
Avg Backward
—
758 ms
178 ms
4.26x
Why v4 deadlocks: Transformers v4 stores Qwen3 MoE experts as a ModuleList of 128 individual MLP modules, each separately FSDP-wrapped. The forward pass uses a data-dependent loop that only iterates experts that received tokens. With different data per rank, different ranks skip different experts, causing mismatched FSDP AllGather/ReduceScatter collectives and an indefinite hang. Transformers v5 fixes this by storing experts as fused 3D parameter tensors (no per-expert modules, no per-expert FSDP collectives).
Nemotron 3 Nano 30B A3B
Metric
v4 (hub code)
v5 (FA2 + grouped_mm + Mamba CUDA)
NeMo AutoModel (EP=8)
v5 → NeMo AutoModel
TPS/GPU (avg)
1,807
4,583
15,421
3.36x
Peak Memory
61.9 GiB
62.1 GiB
42.5 GiB
-32%
Avg Forward+Loss
1,024 ms
283 ms
109 ms
2.60x
Avg Backward
1,246 ms
611 ms
157 ms
3.89x
v4 config: trust_remote_code=True (NVIDIA's hub modeling code). The hub code's expert loop is FSDP-safe (iterates all experts regardless of token assignment), so it doesn't deadlock like Qwen3 v4.
Where the speedup comes from
The 3.4-3.7x speedup from NeMo AutoModel over Transformers v5 comes from three sources:
- Expert Parallelism reduces memory pressure. EP=8 distributes expert weights across GPUs, cutting the per-GPU MoE footprint by 8x. For Qwen3, this drops peak memory from 68.2 GiB to 48.1 GiB (-29%). For Nemotron Nano, it drops from 62.1 GiB to 42.5 GiB (-32%), freeing headroom for larger batch sizes or longer sequences.
- DeepEP fuses communication with computation. Instead of separate AllGather/ReduceScatter collectives for expert routing, DeepEP fuses token dispatch and combines into optimized GPU kernels, overlapping communication with expert computation.
- TransformerEngine kernels accelerate core operations. TE's fused attention, linear layers, and RMSNorm implementations provide consistent speedups over their PyTorch/Flash Attention equivalents across all layer types, not just MoE layers.
Transformers v5 Features Leveraged by HuggingFace AutoModel
Expert Backends
One of the most impactful features in Transformers v5 is the experts_implementation parameter, which includes three expert backends:
Backend
Description
Best for
eager
For-loop over selected experts
Debugging, compatibility, and correctness. Also available for v4.
batched_mm
Duplicates expert params, single batched GEMM via torch.bmm
Small inputs, fast with torch.compile. Added for v5
grouped_mm
Orders tokens by expert, single grouped GEMM via torch.nn.functional.grouped_mm
Training (memory efficient, no param duplication). Added for v5.
The grouped_mm backend is the key training optimization: instead of looping over experts one by one, it sorts tokens by their assigned expert and executes a single fused grouped matrix multiplication.
NeMo AutoModel takes this further. For models with custom implementations, it uses DeepEP fused all-to-all dispatch combined with grouped GEMM kernels and TransformerEngine linear layers. The progression looks like:
v4 (eager for-loop) → v5 (grouped_mm) → NeMo AutoModel (DeepEP + GMM + TE)
In NeMo AutoModel, the expert backend is configured through BackendConfig:
from nemo_automodel.components.models.common.utils import BackendConfig
backend = BackendConfig(
attn="te", # TransformerEngine attention
linear="te", # TransformerEngine linear layers
experts="torch_mm", # Grouped expert matmul
dispatcher="deepep", # DeepEP fused all-to-all
)
Expert Parallelism and DeepEP
Transformers v5 also ships an Expert Parallelism path. It shards expert weights across GPUs. The GroupedGemmParallel style loads only each device's local experts, and RouterParallel routes tokens and combines results with an all_reduce. It's neatly built on v5's existing tensor-parallel machinery. Enabling it makes the model's tp_plan return its expert plan, so expert parallelism shares the device budget with data parallelism (ep × dp = world_size). For the single-node 30B benchmarks here, we found plain data-parallel v5 (dp=8, ep=1) to be the fastest v5 configuration, so that's the v5 setup we report.
NeMo AutoModel takes a complementary approach tuned for multi-GPU MoE training. It makes EP its own parallelism dimension, a dedicated moe_mesh alongside (rather than carved from) the data-parallel mesh, using PyTorch's DTensor with Shard(0). Because the expert mesh is orthogonal to data parallelism, the two compose on the same devices. On 8 GPUs NeMo AutoModel runs ep=8 and dp=8 together, so every GPU trains on its own data shard while holding only 1/8 of the experts. Expert weights are physically sharded across GPUs along the expert dimension.
# From nemo_automodel/components/moe/parallelizer.py
from torch.distributed.tensor import Shard, distribute_tensor
# Each GPU holds only 1/ep_size of the expert weights
distribute_tensor(param, device_mesh, [Shard(0)])
With ep_size=8 on 8 GPUs, each GPU holds only 1/8 of the expert parameters. For a model like Nemotron-3-Nano-30B-A3B with ~55 GiB of expert weights, EP reduces the per-GPU expert footprint from ~55 GiB to ~6.8 GiB, making training possible where FSDP-only approaches run out of memory.
On top of EP, NeMo AutoModel integrates DeepEP that fuses the token routing into optimized GPU kernels, and delivers significant speedups when combined with grouped GEMM for grouped expert computation. In our large-scale MoE benchmarks, DeepEP + grouped GEMM reduced cost per iteration by 47% on the full DeepSeek V3 671B model compared to all-gather + looped expert baselines.
Dynamic Weight Loading
Transformers v5 also introduced a dynamic weight loading system through WeightConverter and WeightRenaming. This enables MoE checkpoint to be stored in fused 3D tensors for more efficient execution. The WeightConverter applies composable operations to transform checkpoint tensors on-the-fly during from_pretrained().
NeMo AutoModel is a direct consumer of this v5 API. Over 20 model types use this mechanism through MODELS_REQUIRING_TENSOR_MERGING, including Mixtral, Qwen2 MoE, Qwen3 MoE, DeepSeek V2/V3, OLMoE, and more. The conversions are fully reversible: save_pretrained() produces standard HF-format checkpoints that any downstream tool can load.
Getting Started
To try NeMo AutoModel, please visit our official documentation page to get started.
For more details, see:
- NeMo AutoModel HuggingFace API Compatibility Guide
- NeMo AutoModel Model Coverage
- NeMo AutoModel Performance Summary
- NeMo AutoModel on HuggingFace
Conclusion
NVIDIA NeMo AutoModel is the natural next step for HuggingFace users scaling up model training. By building directly on Transformers v5, AutoModel provides a zero-friction upgrade path: change one import line and get a model instance that is more than three times as fast.
On Qwen3-30B-A3B and Nemotron 3 Nano 30B-A3B, this delivers 3.4-3.7x higher training throughput with 29-32% less GPU memory compared to the best Transformers v5 configuration. And because true Expert Parallelism shards experts across GPUs, the same path scales up to full fine-tuning a 550B model like Nemotron 3 Ultra across 16 nodes, the regime where Expert Parallelism becomes essential to fit the model in memory. Because NeMo AutoModel checkpoints are standard HF-format safetensors, you can deploy them on inference frameworks like vLLM and SGLang.
The code, configs, and benchmark scripts are all available in the NeMo AutoModel repository.
Acknowledgements
Core contributors to this work, listed alphabetically by last name: Adil Asif, Hemil Desai, Alexandros Koumparoulis, and Huiying Li.
関連記事
ハイブリッドモデルはどのトークンをより正確に予測するか?
Hugging Face Blog は、ハイブリッド型言語モデルが従来のモデルと比較して、特定のトークン予測においてどのような精度の向上を示すかを分析した研究結果を公開しました。
Anthropic の Claude が有料消費者層で ChatGPT を凌駕し市場を席巻
Anthropic が提供する AI チャットボット「Claude」が、従来 ChatGPT が独占していた有料顧客市場において支持を集め、シェア拡大に成功していることが示された。
NVIDIA TensorRT を用いた複数 GPU での AI 推論のスケーリングとマルチデバイス推論サポートの紹介
NVIDIA は、TensorRT の新機能であるマルチデバイス推論サポートを活用し、複数の GPU にわたって AI 推論を効率的にスケーリングする手法を発表した。これにより大規模モデルの実行性能が向上する。
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み