生成型レコメンダーがスケールする推薦システムを再定義
本文の状態
日本語全文を表示中
詳細モードで約18分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
NVIDIA Developer Blog
NVIDIA は大規模推薦システムにおける従来の埋め込み類似度ベースの手法から、LLM を活用した生成型アプローチへの移行を提案し、データ量やスパース性などの課題に対する具体的なアーキテクチャ解決策を発表する。
AI深層分析を開く2026年8月21日 10:37
AI深層分析
キーポイント
生成型推薦システム(GR)へのパラダイムシフト
従来の埋め込み類似度に基づく目的関数から、ユーザーの履歴シーケンスに基づいてカタログ内の次のアクションやアイテムを予測する生成型アプローチへ移行する動向が示される。
大規模データ処理におけるボトルネック
テラバイトからペタバイト規模に達するユーザー履歴データは、GPU の高帯域メモリ(HBM)に収まりきらず、学習と推論の過程で多くのボトルネックを引き起こすことが指摘される。
スパース性とロングテール問題
アイテム数がユーザー数を遥かに超える環境では相互作用データが極めて希薄になり、人気アイテムへの偏りが激しく、ニッチなアイテムの学習信号が不足する課題がある。
コールドスタートと遅延要件
新規ユーザーやアイテムには履歴が存在せず埋め込みを推定する必要があり、初期推薦の質低下リスクに加え、厳格なレイテンシ要件を満たす必要性が強調される。
生成型推薦の基本概念
従来の埋め込みベースのアプローチとは異なり、ユーザー履歴を条件とした次回の行動やアイテムの確率分布をモデル化する。
重要な引用
The advent of LLMs has inspired a shift from the traditional embedding-similarity-based objective to a generative one
At industry scale, this data can get to the order of terra or petabytes every day. Even on the most high-end hardware accelerators, data of this size will be unable to fit GPU high-bandwidth memory (HBM)
The long-tail problem in recommender systems describes the phenomenon where a small number of popular items in a catalog get the majority of the interaction
Unlike traditional embedding-based recommenders that model user-item preference with geometric similarity, GRs reframe recommendation as a sequence modelling problem similar to LLMs.
編集コメントを表示
編集コメント
推薦システム分野における生成 AI の応用は、単なるトレンドではなく大規模データ処理の根本的な課題解決を迫る重要な転換点である。NVIDIA が提示するアーキテクチャ上の課題と解決策は、実務レベルでのシステム設計に直結する示唆に富む内容となっている。
Source Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。
レコメンデーションシステム(RecSys)は、消費者向けインターネット業界において最も普及した機械学習課題の一つですが、大規模な環境でのトレーニングと提供においては非常に困難であることが知られています。LLM の登場により、従来の埋め込み類似度に基づく目的関数から、ユーザーの履歴シーケンスを元に、大規模カタログ内の次のアクションやアイテムを予測する生成型アプローチへとシフトが起きています。
本稿では、生成型レコメンデーション(GRs)へのアーキテクチャ転換と、それがもたらす実運用上の課題、そして NVIDIA の recsys-examples と nv-embedding-cache がそれらの課題をどのように解決しているかについて解説します。
大規模環境で従来の RecSys が機能しなくなる理由
データの種類と量
ユーザーの履歴は、レコメンデーションシステムの主要なデータタイプであり、カタログ内のアイテムに対するユーザーのインタラクション記録を表しています。テキストや画像といった他のモダリティとは異なり、ユーザーの履歴にはカテゴリカル特徴と連続値が混在しており、時間とともに頻繁に変化します。業界規模で考えると、このデータ量は毎日テラバイトからペタバイトのオーダーに達することもあります。最も高性能なハードウェアアクセラレータを用いた場合でも、このような大量のデータを GPU の高帯域メモリ(HBM)に収めることはできず、トレーニングや推論の過程で多くのボトルネックが発生します。
稀疏性とロングテール問題
推薦システムの「ロングテール問題」とは、カタログ内の少数の人気アイテムが相互作用の大半を占めてしまう現象を指します。この課題が生じる背景には、アイテム数がユーザー数を大きく上回っているという事実があります。その結果、ユーザーとアイテムの間の相互作用データは極めて希薄なものとなります。また、特定のアイテムとの相互作用確率は、そのアイテムの人気度に強く依存するため、学習データからは、ユーザーの嗜好を表す真実値となるニッチなアイテム群に対する十分なシグナルが得られにくいのです。
初期化問題(コールドスタート)
新しいユーザーやアイテムが推薦プラットフォームに参加した際、即座に高品質な埋め込みベクトルを生成できる相互作用履歴は存在しません。代わりに、限られた特徴量から推測するしかありませんが、これにより推薦の方向性が損なわれるリスクがあります。類似アイテムとの相関やセマンティックな記述情報を活用することで部分的には解決できますが、初期段階での推薦精度が低く、ユーザー体験を低下させる恐れは残ります。
厳格なレイテンシ要件
本番環境では、推薦システムモデルは厳格なサービスレベル合意(SLA)の下で数百万人のユーザーにオンライン提供されます。この場合、わずかなレイテンシの増加でもユーザー体験に影響を及ぼします。自己回帰的なデコーディングの遅延をある程度許容できる大規模言語モデル(LLM)のワークロードとは異なり、推薦システムモデルは数ミリ秒のうちに数千件の候補アイテムを検索・ランク付けする必要があります。
生成型推薦システム
従来の埋め込みベースの推薦システムがユーザーとアイテムの嗜好を幾何学的な類似性でモデル化するのに対し、生成型推薦器(GRs)はこれを LLM と同様の「シーケンスモデリング問題」として再定義します。
目的は、過去のユーザー行動という条件付きで、次のアクションやアイテムが発生する確率分布をモデル化することです:
P(next_item | user_history)
より均質でトランスフォーマーに近いアーキテクチャへの移行により、スケーリング則の恩恵を最大限に得られるようになります。これによって検索とランク付けが単一のモデル内で統合され、急速に進化する LLM エコシステムとも自然に連携できるようになります。
この目的を実現する推薦システムの主要なアプローチとして、階層型逐次トランスダクションユニット(HSTU)とセマンティック ID の 2 つが挙げられます:
HSTU
Meta が 2024 年に発表した HSTU は、生成型の目標に基づいて RecSys を再定義する基盤となる GR モデルアーキテクチャです。実用規模での効率的な学習と推論を可能にするための重要な革新が盛り込まれています。
HSTU では、入力データをタイムスタンプ順に並べた、ユーザーごとの「アイテム」と「アクション(いいねやクリックなど)」が交互に現れるシーケンスとして表現します。従来の RecSys モデルで一般的だった手動による特徴量エンジニアリングへの依存を排除し、代わりにユーザーとアイテムの相互作用に対するアテンションを通じて学習された逐次的な表現を採用しています。この形式により、ユーザーの履歴は LLM における次のトークン予測と同様のものとなり、トレーニング時にはシーケンス内およびバッチ間から有意義な学習シグナルを得ることが可能になります。
標準的な Transformer のアテンションとは異なり、HSTU はソフトマックス正規化を SiLU ベースの重み付けに置き換え、相対アテンションバイアスを組み込み、出力投影前に要素ごとのゲート処理を適用することで、アテンション集約メカニズムを変更しています。これらの改良により、長序列全体でより強いマグニチュード情報を保持しつつ、カーネル融合の効率化と低遅延推論が可能になります。
セマンティック ID
アイテム数が膨大でユーザー・アイテム間の相互作用が疎なデータセット上で次期アイテム予測を行う場合、いくつかの課題が生じます。具体的には、全ソフトマックス計算によるボトルネック、ロングテールアイテムからの学習シグナルの弱さ、そして意味的に類似するアイテムへの一般化性能の低下です。
Google が導入したセマンティック ID(Semantic IDs)は、アイテム埋め込みの階層クラスタリングに基づいて新しい語彙トークンのセットを縮小することで、これらの課題を緩和します。TIGER、PLUM、OneRec v1/v2、そして多くの現代的な生成推薦(GR)アーキテクチャでは、スケーラブルな自己回帰型推薦の基盤としてセマンティック ID が採用されています。

従来の推薦システム(RecSys)とは異なり、セマンティック ID の自己回帰的デコードは埋め込み空間内での検索ではなく、直接推薦を生成します。これにより、出力ロジットを通じて自然なランク付けが可能となり、ビームサーチなどの探索手法を用いれば、単一の順方向パスで複数のセマンティック ID を生成できます。その結果、スループットが向上し、クラスター内のニッチなアイテムも選択できるようになります。
recsys-examples リポジトリ
recsys-examples リポジトリは、PyTorch を用いて NVIDIA GPU 上で生成型推薦システムのトレーニングと展開におけるベストプラクティスを示す例のコレクションです。HSTU やセマンティック ID モデルの最適化実装が含まれており、トレーニングから推論までのワークフローを網羅しています。また、このリポジトリでは 3 つのモジュールコンポーネントを統合しています。1 つ目は埋め込み層用の DynamicEmb、2 つ目は推薦システム向けに設計された KV キャッシュとストレージマネージャー、そして 3 つ目は HSTU やセマンティック ID のビームサーチデコードのための効率的な CUDA オペレーションです。
ダイナミックエンベディング
従来の RecSys で使われる埋め込みテーブルは、固定かつ静的な語彙を前提としています。しかし実運用では、新しいユーザーやアイテムが絶えず出現し、アイテムカタログのロングテール部分は、単一の GPU の HBM(高帯域メモリ)が追いつく速度よりもはるかに速く成長します。静的なテーブルを用意しすぎれば、一度も参照されない行のためにメモリを浪費することになります。逆に用意が不足すれば、高価なコピー処理が発生し、モデルのパフォーマンスや品質の低下を招きます。
DynamicEmb は、従来の静的なテーブルに代わり、任意のフィーチャー ID を必要に応じて埋め込み行にマッピングする GPU 最適化型のスコア付きハッシュテーブルを採用しています。このテーブルは、モデルが実際に参照する ID のみが割り当てられるため、HBM(高帯域幅メモリ)とピン留めされたホストメモリの両方にまたがって配置され、単一の GPU の容量を超えて拡張可能です。
実装には、HierarchicalKV のハッシュテーブル設計で示されたアルゴリズムを基盤としています。採用制御とスコアベースの淘汰(eviction)を組み合わせた手法により、モデル学習に重要な ID にリソースを集中配分でき、大規模環境におけるロングテール問題も現実的な範囲で処理できるようになります。
これは TorchRec のバックエンドとして提供されており、EmbeddingBagCollection および EmbeddingCollection API を用いてテーブルをランク間で行方向にシャードしています。
Fused CUDA kernels は、SUM、MEAN、およびシーケンスプーリングモードにおけるルックアップと勾配の集約を処理します。プリフェッチ技術により、頻繁にアクセスされる埋め込みベクトルが HBM 内に常駐し、効率的なアクセスを実現しています。
HSTU サポート
Recsys-examples は、HSTU 向けの生産環境並みのトレーニングおよび推論スタックを提供します。アイテム、ユーザー、アクション、コンテキストの埋め込みテーブルは TorchRec を通じて管理され、高次元なテーブルに対して DynamicEmb が動的な容量確保とキャッシングを実現しています。一方、密結合層では HSTU のバックボーンに Megatron-Core を採用しており、単一のトレーニング実行でデータ並列化、テンソル並列化、シーケンス並列化、パイプライン並列化を同時に活用できます。このライブラリはスタック全体を通じてモジュール設計されており、コンポーネントはカスタムアーキテクチャとプラグアンドプレイで接続可能です。
トレーニング時には、TorchRec/DynamicEmb と Megatron-Core がシームレスに統合され、埋め込み層と密結合モジュール全体でシャード処理と並列化を調整します。トレーニングパイプラインには、ラANK 間で負荷をバランスさせる動的シャッフル機能や、埋め込み通信・プリフェッチと密結合計算のオーバーラップ処理が含まれています。また、NVIDIA の Ampere、Hopper、Blackwell GPU に最適化された融合演算と FBGEMM アテンションカーネルを搭載した HSTU レイヤーも採用されています。
これらの最適化により、2 台の DGX H100 ノード上で、エンドツーエンドのモデル FLOP 利用率(MFU)が 7.65% から 31.40% に向上し、トレーニング効率に大幅な 改善 が実現されました。
推論においては、recsys-examples は PyTorch AOTInductor をサポートし、モデルを Torch C++ ランタイムで実行しながらも NVIDIA Triton Inference Server との互換性を維持することで、厳しい低遅延要件に対応しています。
頻繁にアクセスされる埋め込みベクトルは nv-embedding-cache によって GPU の近くに保持され、さらにカスタマイズされた FlexKV 対応の KV キャッシュにより計算負荷を削減します。このキャッシュ方式では、エントリが複数のメモリ階層に分散されます。
Triton Inference Server でデプロイした場合、PyTorch AOTI バックエンドを使用し KV キャッシュなしで推論すると、Python バックエンドと比較して 1.14 倍〜1.28 倍の高速化が実現します。また、理想的な全 GPU キャッシュヒット環境において PyTorch AOTI バックエンドに KV キャッシュを併用すれば、2.20 倍〜2.38 倍の速度向上が可能です。

Semantic ID-GR
Semantic ID ベースの GR(Generative Recommender)は、チャットベースの LLM 推論とは全く異なるサービングパターンを採用しています。具体的には、長いユーザーコンテキストに対して短い自己回帰的デコーディングを行い、制約されたアイテムトークン空間でビーム幅を大きく設定します。
実際の Semantic ID ワークロードでは、1 つのリクエストに数千の履歴トークンが含まれ、生成されるのは 2〜3 トークンの Semantic ID のみですが、推薦の多様性を高めるためにビーム幅は 128 や 256 といった大きな値が用いられます。
vLLM、SGLang、TensorRT LLM などの既存の LLM サービングシステムは、主にページ化された KV キャッシュや動的バッチ処理、長いデコーディングを特徴とするマルチユーザー向けチャットスタイルのサービングに最適化されています。これらは強力な汎用フレームワークですが、Semantic ID-GR が本質的に必要とするコアな抽象化——リクエストレベルで共有されるコンテキスト KV、ビームごとの短いデコード KV、ビームパスの追跡機能、動的ビーム幅、そしてアイテム制約付き生成——を自然に提供しているわけではありません。
これに対応するため、recsys-examples は Qwen ベースのセマンティック ID モデル向けに GR 特化型の推論フレームワークを提供しています example。
このフレームワークは KV キャッシュを分割し、ビーム依存・非依存のコンポーネントを分離します。具体的には、長い共有コンテキストを ContextKV に、短いデコード履歴を BeamKV に、論理的なビームの祖先関係を BeamPath として管理します。これにより、各ビームを個別の長序列として扱う非効率性を回避しています。
ランタイムには、GR ネイティブの連続バッチ処理、直接プールビュー CUDA グラフの再生、アイテム制約付き topK、そして GR の KV レイアウト上で直接動作する専用バックエンド gr-decode_atten が含まれています。
NVIDIA H100 80GB GPU 1 基上で Qwen3-1.7B を使用し、コンテキスト長を 1,000 トークンと 5,000 トークン、ビーム幅を 256、出力トークンを 3 と設定した場合でも、GR に特化したパスは、測定されたオフラインおよびオンラインのベンチマークにおいて SGLang のビーム検索を一貫して上回ります。
| 指標 | ワークロード | GR 結果 | ベースライン | 改善率 |
|---|---|---|---|---|
| オフラインレイテンシ | ctx=1000, batch=4, beam=256, output=3 | 47.736 ms | 102.318 ms | 2.14 倍高速 |
| オフラインレイテンシ | ctx=5000, batch=4, beam=256, output=3 | 154.224 ms | 349.857 ms | 2.27 倍高速 |
| オフラインレイテンシ | ctx=5000, batch=8, beam=256, output=3 | 307.917 ms | 685.354 ms | 2.23 倍高速 |
| オンラインサービングスループット | ctx=5000, concurrency=4, beam=256, output=3 | ~19.7 req/s | ~10.7 req/s | ~1.85 倍高い |
| オンライン中央値レイテンシ | ctx=5000, concurrency=4, beam=256, output=3 | ~198 ms | ~370 ms | ~46% 低い |
| オフライン正答率 | ctx=1000/5000, batch=1/2/4/8, beam=256 | Top1 完全一致 1.000 | SGLang 比較 | TopK 重なり平均 0.960 |
表 2. recsys-examples の Semantic ID-GR 推論フレームワークにおけるサービング結果
これにより、Semantic ID-GR サービングは recsys-examples 内の HSTU や埋め込みコンポーネントにとって自然な補完関係となります。HSTU と DynamicEmb は大規模なトレーニングと埋め込み中心の推論を担当し、一方 Semantic ID-GR の推論パスは、長いコンテキスト、広範なビームサーチ、そして厳格なレコメンダーシステムのレイテンシ要件を満たすための自己回帰的な Semantic ID 生成を目的としています。
nv-embedding-cache
[nv-embedding-cache](https://github.com/NVIDIA/nv-embedding-cache) (NVE) は、大規模な埋め込みテーブルの参照や演算を高速化するための SDK です。最適化されたカーネル、ソフトウェアキャッシュのプリミティブ、PyTorch 互換バインディングといったモジュール型コンポーネントを提供し、単一の GPU の HBM(高帯域メモリ)では収容できないような巨大な埋め込みテーブルへの低レイテンシアクセスを可能にします。
実運用環境におけるレコメンダーの埋め込みテーブルは、通常単一 GPU の HBM 容量を超えます。そのため、推論システムでは複数のメモリアーキテクチャ間で埋め込みをステージングする必要があります。さらに、レコメンダーシステムはキャッシュの恩恵を受けやすいアクセスパターンを示すことが多々あります。
NVE は、HBM に格納された GPU キャッシュをホット層、DRAM の CPU キャッシュをウォーム層、そしてリモートパラメータストア(通常は Redis や RocksDB ベース)をコールド層とする階層的なルックアップフローによってこれを管理しています。ホットキーの GPU キャッシュへのプロモーションはカスタマイズ可能であり、ロックレスな無効化・コミットプロトコルにより、GPU 上でルックアップとキャッシュ操作を並行して実行でき、ストリームが停止することはありません。また、CUDA の仮想メモリを活用してデバイス間でシャード処理を行うため、単一の論理テーブルを複数の GPU やノードに跨って配置することが可能です。

図 3:NVE でサポートされる埋め込みテーブルに対する階層的メモリ検索
NVE は、PyTorch エコシステムとの統合を容易にするため、NVEmbedding と NVEmbeddingBag を提供しています。これらはそれぞれ torch.nn.Embedding および torch.nn.EmbeddingBag のドロップイン代替品として機能します。
各モジュールでは、従来の引数に加え、キャッシュに特化した設定フラグも用意されています。
各レイヤーが標準的な nn.Module コンポーネントとして動作するため、既存の推薦モデルへの統合はグラフの変更を最小限に抑えて実現できます。デプロイにおいては、NVE が LibTorch の安定 ABI に対してルックアップ演算子を登録することで、C++ ランタイム上で AOTInductor のサポートを提供します。
RecSys Examples の DynamicEmb テーブルは NVE でサポートされており、トレーニングから推論への移行が容易になります。DLRM v3 において、HSTU ベースの MLPerf 生成型レコメンダーベンチマークでは、recsys-examples と NVE を組み合わせることで、オンラインサーバーシナリオで 99,997 クエリ/秒 の推論スループットを達成しました。これらのライブラリを使用した推論の実行方法については、こちら をご覧ください。
始め方
クイックスタートガイドや詳細情報は、以下のリポジトリをご覧ください:
原文を表示
Recommender systems (RecSys) are one of the most ubiquitous machine learning problems in the consumer internet industry yet notoriously difficult to train and serve at scale. The advent of LLMs has inspired a shift from the traditional embedding-similarity-based objective to a generative one, where the goal is to predict the next action or item in a large catalog given a sequence of user histories.
This post covers the architectural shift toward generative recommenders (GRs), the production challenges it introduces, and how the NVIDIA recsys-examples and nv-embedding-cache address them.
Why traditional RecSys breaks at scale
Data type and volume
User histories, the primary RecSys data type, represent a record of how users interact with items in a catalog. Unlike modalities such as text or images, user histories involve a mix of categorical and continuous features that change frequently over time. At industry scale, this data can get to the order of terra or petabytes every day. Even on the most high-end hardware accelerators, data of this size will be unable to fit GPU high-bandwidth memory (HBM), introducing many bottlenecks during training and inference.
Sparsity and the long-tail problem
The long-tail problem in recommender systems describes the phenomenon where a small number of popular items in a catalog get the majority of the interaction. This issue arises because the catalog of items can far exceed the number of users, leading to very sparse user-item interaction data. Because the probability distribution of interacting with an item is heavily skewed towards how popular that item is, training data provides little signal to a vast majority of niche items that represent ground truth for user preferences.
Cold start problem
As new users or items join a RecSys platform, there is no interaction history to immediately produce a quality embedding. Rather, it has to be deduced from a smaller set of features, which can negatively impact the trajectory of recommendations. This can be partially resolved by correlating with similar items and semantic descriptions, but there is a risk that initial recommendations are poor and degrade user experience.
Strict latency requirements
In production, RecSys models are often served online to millions of users under strict service-level agreements (SLAs), where small increases in latency can impact user experience. Unlike LLM workloads that may tolerate autoregressive decoding latency, RecSys models must frequently retrieve and rank thousands of candidate items in a few milliseconds.
Generative recommenders
Unlike traditional embedding-based recommenders that model user-item preference with geometric similarity, GRs reframe recommendation as a sequence modelling problem similar to LLMs.
The objective is to model the probability distribution of next action or item conditioned on a sequence of user history:
P(next_item | user_history)
The shift toward more homogeneous, transformer-like architectures can better leverage scaling laws, potentially unify retrieval and ranking within a single model, and more naturally integrate with the rapidly evolving LLM ecosystem.
The two prevalent approaches that implement this objective in recommenders are Hierarchical Sequential Transduction Units (HSTU) and Semantic IDs:
HSTU
HSTU, introduced by Meta in 2024, is a foundational GR model architecture that reframes RecSys under the generative objective and introduces key innovations to enable efficient training and serving at production scale.
HSTU represents input data as a per-user sequence of interleaved items and actions (like, click, etc.) ordered by timestamp. It also removes the dependence on explicit feature engineering, a common practice in traditional RecSys models, in favor of learned sequential representations from attention over user-item interactions. This formulation makes user histories analogous to next token prediction in LLMs, where in training you can get a meaningful learning signal both within a sequence and across batches.
Unlike standard Transformer attention, HSTU modifies the attention aggregation mechanism by replacing softmax normalization with SiLU-based weighting, incorporating relative attention bias, and applying elementwise gating before output projection. These modifications preserve stronger magnitude information across long sequences while enabling more efficient kernel fusion and lower-latency inference.
Semantic IDs
Modeling next item prediction over a large corpus of items with a sparse set of user-item interactions can introduce many challenges: bottlenecks from full softmax calculation, weak training signal from long tail items, and poor generalization to semantically similar items.
Semantic IDs (SIDs), introduced by Google, alleviate these issues by producing a smaller set of new vocabulary tokens based on hierarchical clustering of item embeddings. Architectures such as TIGER, PLUM, OneRec v1/v2, and many modern GR architectures use Semantic IDs as the foundation for scalable autoregressive recommendation.

Unlike traditional RecSys, autoregressive decoding of Semantic IDs directly generates recommendations instead of searching within an embedding space, and naturally provides a ranking via output logits. This allows search methodologies like beam search to produce multiple Semantic IDs in a single forward pass, improving throughput and allowing niche items in a cluster to be chosen.
recsys-examples repository
The recsys-examples repository is a collection of examples to demonstrate the best practice for training and deploying generative recommenders on NVIDIA GPUs using PyTorch. It includes optimized implementations of HSTU and semantic ID models, covering both training and inference workflows. The repository also consolidates three modular components: DynamicEmb for embedding layers, a KV cache and storage manager tailored for recommender systems, and efficient CUDA ops for HSTU and semantic ID beam search decoding.
Dynamic embedding
Traditional embedding tables in RecSys assume a fixed, static vocabulary. However, in production, new users and items appear continuously, and the long-tail of the item catalog grows much faster than any single GPU’s HBM can keep up with. Over-provisioning a static table wastes memory on rows that will never be touched, while under-provisioning causes expensive copies that can degrade model performance and quality.
DynamicEmb replaces static tables with a GPU-optimized scored hash table that maps arbitrary feature IDs to embedding rows on demand. Rows are allocated only for IDs the model actually sees, and the table lives across HBM and pinned host memory so it can grow well beyond a single GPU’s capacity. The implementation builds on the algorithms from the HierarchicalKV hash-table design. The combination of admission control and score-based eviction allows capacity to be spent on IDs that matter to model training, and makes the long-tail problem tractable at scale.
It is provided as a TorchRec backend, with tables sharded row-wise across ranks using the EmbeddingBagCollection and EmbeddingCollection APIs. Fused CUDA kernels handle lookup and gradient reduction for SUM, MEAN, and sequence pooling modes. Prefetching techniques keep frequently accessed embeddings resident in HBM for efficient access.
HSTU support
Recsys-examples provides a production-style training and inference stack for HSTU. Item, user, action, and contextual embedding tables are managed through TorchRec, with DynamicEmb providing dynamic capacity and caching for the high-cardinality tables. For dense layers, the HSTU backbone uses Megatron-Core so a single training run can leverage data, tensor, sequence, and pipeline parallelism. The library is designed to be modular across the entire stack so that components can be plug and play with custom architectures.
During training, TorchRec/DynamicEmb and Megatron-Core are seamlessly integrated to coordinate sharding and parallelism across both embedding and dense modules. The training pipeline incorporates dynamic shuffling to balance workloads across ranks, overlaps embedding communication and prefetching with dense computation, and includes a HSTU layer with fused ops and FBGEMM attention kernels optimized for NVIDIA Ampere, Hopper, and Blackwell GPUs. Together, these optimizations improve end-to-end Model FLOP Utilization (MFU) to 31.40% from 7.65% on two DGX H100 nodes, demonstrating substantial gains in training efficiency.
For inference, recsys-examples is designed to meet strict low-latency requirements by supporting PyTorch AOTInductor to execute the model in the Torch C++ runtime while remaining compatible with NVIDIA Triton Inference Server.
Frequently accessed embeddings are kept close to the GPU using nv-embedding-cache, and computation is further reduced through a customized FlexKV-enabled KV cache that distributes cache entries across multiple memory tiers.
When deployed with Triton Inference Server, inference with the Pytorch AOTI backend & no KV cache delivers a 1.14x ~ 1.28x speedup over the Python backend, and inference with the Pytorch AOTI backend with KV cache delivers a 2.20x ~ 2.38x speedup in an ideal all GPU cache-hit scenario.

Semantic ID-GR
Semantic ID-based GR introduces a serving pattern that is very different from chat-based LLM inference: long user context, short autoregressive decoding, and large beam widths over constrained item-token spaces. In practical Semantic ID workloads, a request may contain thousands of historical tokens, decode only 2–3 Semantic ID tokens, and use beam widths such as 128 or 256 to improve recommendation diversity.
Existing LLM serving systems such as vLLM, SGLang, and TensorRT LLM are primarily optimized for multi-user chat-style serving with paged KV cache, dynamic batching, and long decoding. They are powerful general frameworks, but do not naturally expose the core abstractions needed by Semantic ID-GR: shared request-level context KV, short per-beam decode KV, beam-path tracking, dynamic beam width, and item-constrained generation.
To address this, recsys-examples provides a GR-specialized inference framework example for Qwen based Semantic ID models. The framework separates KV cache to isolate beam dependent and independent components: long shared context into ContextKV, short decode history into BeamKV, and logical beam ancestry into BeamPath. This avoids treating every beam as a separate long sequence. The runtime also includes GR-native continuous batching, direct pool-view CUDA graph replay, item-constrained topK, and a dedicated gr-decode_atten backend that operates directly on the GR KV layout.
On a single NVIDIA H100 80GB GPU with Qwen3-1.7B, context lengths of 1,000 and 5,000 tokens, beam width of 256, and 3 output tokens, the GR-specialized path consistently outperforms the SGLang beam-search in the measured offline and online benchmarks.
| Metric | Workload | GR Result | Baseline | Improvement |
|---|---|---|---|---|
| Offline latency | ctx=1000, batch=4, beam=256, output=3 | 47.736 ms | 102.318 ms | 2.14x faster |
| Offline latency | ctx=5000, batch=4, beam=256, output=3 | 154.224 ms | 349.857 ms | 2.27x faster |
| Offline latency | ctx=5000, batch=8, beam=256, output=3 | 307.917 ms | 685.354 ms | 2.23x faster |
| Online serving throughput | ctx=5000, concurrency=4, beam=256, output=3 | ~19.7 req/s | ~10.7 req/s | ~1.85x higher |
| Online median latency | ctx=5000, concurrency=4, beam=256, output=3 | ~198 ms | ~370 ms | ~46% lower |
| Offline correctness | ctx=1000/5000, batch=1/2/4/8, beam=256 | Top1 exact 1.000 | SGLang comparison | TopK overlap mean 0.960 |
*Table 2. Serving results for recsys-examples Semantic ID-GR inference framework*
This makes Semantic ID-GR serving a natural complement to the HSTU and embedding components in recsys-examples: HSTU and DynamicEmb address production-scale training and embedding-heavy inference, while the Semantic ID-GR inference path targets autoregressive Semantic ID generation with long context, large beam search, and strict recommender-system latency requirements.
nv-embedding-cache
[nv-embedding-cache](https://github.com/NVIDIA/nv-embedding-cache) (NVE) is an SDK for accelerating large-scale embedding table lookups and operations in recommender inference. It provides modular components including optimized kernels, software cache primitives, and PyTorch-compatible bindings, enabling low-latency access to embedding tables that exceed the capacity of a single GPU’s HBM.
Production recommender embedding tables routinely exceed the capacity of a single GPU’s HBM, forcing inference systems to stage embeddings across multiple memory tiers. Furthermore, recommenders often exhibit access patterns that are very favorable to caching.
NVE manages this through a hierarchical lookup flow, composed of GPU cache in HBM as the hot tier, CPU cache in DRAM as the warm tier, and a remote parameter store (typically Redis or RocksDB-backed). Hot keys promotion into the GPU cache is customizable, and a lockless invalidate-and-commit protocol lets lookups and cache modifications run concurrently on the GPU without stalling the lookup stream. Sharding across devices is handled via CUDA virtual memory, so a single logical table can span multiple GPUs or nodes.

NVE provides NVEmbedding and NVEmbeddingBag as drop-in replacements for torch.nn.Embedding and torch.nn.EmbeddingBag for easy integration with the PyTorch ecosystem. The modules expose familiar arguments while adding cache specific configuration flags. Because the layers behave like standard nn.Module components, they can be integrated into existing recommender models with minimal graph changes. For deployment, NVE registers its lookup operators against the LibTorch Stable ABI, providing AOTInductor support in the C++ runtime.
Recsys-examples DynamicEmb tables are supported in NVE, allowing an easy transition between training and inference. On DLRM v3, the MLPerf generative recommender benchmark based on HSTU, recsys-examples and NVE were able to achieve 99,997 queries/sec inference throughput in an online server scenario. An example of how to perform inference with these two libraries can be found here.
Get started
Check out the following repositories for quick-start guides and more details:
- recsys-examples quick-start guide
- nv-embedding-cache overview
関連記事
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み