Miles:大規模 LLM の強化学習後学習のための PyTorch ネイティブスタック
本文の状態
日本語全文を表示中
詳細モードで約18分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
TLDR AI
TLDR AI は、大規模言語モデルの強化学習後学習を容易に構築・再現・運用するためのフレームワーク「Miles」を紹介した。このツールは、分散システム化が進む大規模 LLM 向けに、トレーニングの構成可能性と拡張性を高めつつ、研究者やインフラチームがコアトレーナーをカスタマイズできる設計となっている。
Source Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。
**
Featured projects
-
-
TL;DR
Miles は、RadixArk が提供する大規模 LLM の強化学習(RL)ポストトレーニング用のオープンソースフレームワークです。ロールアウトには SGLang を、トレーニングには NVIDIA Megatron-LM を使用し、Ray によるオーケストレーションと PyTorch ネイティブの拡張性を、小型でプラグイン可能なトレーナーの背後に統合しています。統一された低精度レシピ、MoE(Mixture-of-Experts)対応のロールアウト/トレーニング整合性、高速な NVIDIA NCCL/RDMA を介した重み同期、組み込みの観測機能およびフォールトトレランスを備えており、フロンティア規模の LLM RL の構築・再現・運用を容易にします。
Why Miles?
強化学習は、大規模言語モデルのポストトレーニングにおいて中心的な役割を果たすようになりました。しかし、モデルが大型化し、密結合型から MoE(Mixture-of-Experts)へ移行し、NVIDIA Blackwell や Hopper シリーズなどのより分散化・専門化されたハードウェア上で実行されるようになると、RL ポストトレーニングは単なる学習ループではもはやありません。これは分散システムの問題です。
現代の LLM RL フレームワークは、以下の複数の要素を調整する必要があります:
- ロールアウトワーカーは、高スループットでサンプルを生成する必要があります。
- トレーナーは、これらのサンプルを効率的に消費し、安定したポリシー更新を計算する必要があります。
- ロールアウト用ポリシーとトレーニング用ポリシーは同期され続ける必要があります。
- 大規模な MoE モデルでは、ロールアウトとトレーニング全体でルーティング動作が整合している必要があります。
- 低精度レシピは、パイプライン全体で一貫して機能する必要があります。
- 長時間実行されるジョブについては、最初から観測機能、チェックポイント機能、フォールトトレランスが必要です。
Miles はこの設定のために構築されました。
Miles は、RadixArk が提供する大規模言語モデル(LLM)のポストトレーニング用のオープンソース強化学習フレームワークです。高スループットなロールアウトのために SGLang をネイティブに構築し、Megatron-LM と深く統合してスケーラブルなトレーニングを実現し、Ray を用いて分散システムをオーケストレーションします。また、スタック全体を通じて PyTorch を共通のプログラミングおよび数値層として維持しています。
目標はシンプルです。大規模 LLM の強化学習トレーニングをよりコンポーザブルで再現性が高く、スケーリングしやすいものにしつつ、コアとなるトレーナーは研究者やインフラチームがカスタマイズできるほど小さく保つことです。
Miles のアーキテクチャ
Miles は「小さなコア、多数のエッジ」という哲学に基づいています。
コアとなるトレーニングループは意図的にコンパクトに設計されています。ユーザーが最も変更したいと考える要素——ロールアウトロジック、報酬計算、損失関数、サンプルフィルタリング、メトリクス、およびトレーニングループのフック——は、起動時にユーザーが提供する Python モジュールを通じて接続されます。これにより、チームはフレームワークをフォークすることなく、新しいアルゴリズムや生産環境の制約に合わせてシステムを適応させることができます。
この小さなコアの下には、4 つの主要なシステムが構成されています:
- 高スループットなロールアウト生成のための SGLang。
- スケーラブルな分散トレーニングのための Megatron-LM。
- クラスターオーケストレーション、アクターのライフサイクル管理、スケジューリング、監視のための Ray。
- モデル、自動微分(autograd)、分散プリミティブ、データ型(dtype)サポート、拡張性、およびプロファイリングのための PyTorch。
この構成は重要です。強化学習(RL)のポストトレーニングでは、生成と学習を連携させる必要がありますが、両フェーズには非常に異なるパフォーマンス特性があります:ロールアウトはメモリー帯域幅に制約され(デコーディング中は KV キャッシュとパラメータ読み込みが支配的)、一方、学習は計算集約型かつ通信負荷が高いものです。重みの同期、サンプル転送、チェックポイント変換、ルーティングの一貫性、低精度動作のすべてを、境界をまたいで慎重に処理する必要があります。
この投稿の後半では、Miles がその境界の各部分をどのように扱うか——Ray によるオーケストレーション、Megatron-LM によるスケーリング、PyTorch による拡張性、そして標準で提供される機能——について順を追って説明します。
Ray: 長時間実行される RL ジョブのオーケストレーション
Miles は分散ランタイムである Ray に直接構築されています。Miles の実行では、すべての長寿命プロセスは Ray アクターとして表現されます:トレーナーランク、SGLang ロールアウトサーバー、ルーティングプロキシ、非同期ロールアウトワーカーはすべて Ray のアクターモデル内に存在します。
これにより、Miles はクラスター規模の RL ワークロードに対する自然な基盤を得ています。
GPU 上でのワーカー配置
Miles は、Ray の GPU 対応スケジューラと配置グループを活用してアクターの配置を行い、起動時の Ray 配置仕様を通じて、ロールアウトとトレーニングを別ノードで行う非集約型 (disaggregated) と、同じノード上で行う同置型 (colocated) の両方のレイアウトをサポートします。プロセス配置は、慎重な同置を実現し、予備ノードを確保するとともに、エラーの分離のためのキーとして機能させるためにラック単位での認識が必要となります。なぜなら、ラック内の問題(例えば、不良 GPU とラック全体の故障の違い)を区別することは、必ずしも容易ではないからです。
RL パイプライン間でのデータ転送
プロンプト、サンプル、更新された重みは、ロールアウトアクターとトレーナーランクの間で継続的に循環しており、Miles は Ray のアクターとタスクを用いてこのフローを調整します。バッチ処理による重みの転送においては、Ray が制御パスを担当し、テンソルバイトは専用の NCCL/RDMA チャネルを通じて移動するため、Miles は Ray レベルのプログラム性と、大規模データのための高速パスの両方を備えています。
##
長時間実行ジョブの監視
Miles の実行はエンドツーエンドで Ray ジョブであるため、追加インフラなしに、ジョブの提出、ワーカーの監視、ログ集約、ダッシュボードでの可視化といった Ray のオペレーター機能をそのまま継承します。フォールトトレランスを有効にすることで、Miles は失敗したランクを回復し、同じ Ray 基盤の上で数週間続くワークロードを継続して実行できます。
非同期 RL の完全サポート
Ray アクターは永続的であり、独自の状態を保持し、独立してスケジューリングされるため、Miles はロールアウトとトレーニングが互いにブロックしない完全な非同期モードを実行できます。ロールアウトアクターはサンプルをキューに連続的にストリーミングし、トレーナーはそのペースでキューから取り出します。
Megatron-LM: トレーニングバックエンドのスケーリング
Miles は、Megatron-LM を本番環境のトレーニングバックエンドとして使用しており、それをブラックボックスライブラリとしてラップするのではなく、Megatron の引数パーサー、モデル構築パイプライン、トレーニングループ、並列化プリミティブ、分散チェックポイント形式に直接接続しています。これにより、Miles は最先端規模の密なモデルおよび MoE(混合専門家)モデルのトレーニングに必要なインフラストラクチャを提供しつつ、クリーンでユーザーフレンドリーなワークフローを維持します。
単一の引数インターフェース
Megatron-LM はすでに、シーケンス長、回転埋め込み(rotary embeddings)、グループ化 GEMM、あらゆる種類の並列化、オプティマイザ設定、活性化チェックポイントなど、大規模な分散トレーニング構成のインターフェースを公開しています。Miles はこれをラップしたり再宣言したりするのではなく、直接再利用します。ユーザーは Miles 固有のオプションと標準的な Megatron オプションを組み合わせた単一の起動スクリプトを通じて Miles の実行を設定するため、重複した設定レイヤーを避け、トレーニングセットアップを上位版である Megatron の動作に近づけています。
長期フォークではなくモデル仕様
フロンティアアーキテクチャは急速に変化しており、新しいアテンションブロック、ルーティングメカニズム、エキスパートレイアウトがモデルファミリー全体で次々と登場しています。Miles はこれらに対応するため、プラグイン形式のモデル仕様(model specs)を採用しています。これは、ゲート付きアテンション出力モジュールやゲート付きデルタネットブロック、あるいはモデル固有の MoE ルーターといったカスタム PyTorch コンポーネントを Megatron のモデルパイプラインに直接挿入するための小型の仕様ファイルです。これにより、Miles は、アップストリームから常に乖離する長期維持型の Megatron フォークを維持することなく、DeepSeek-V3/V4、GLM-4.7、Qwen3 MoE バリアントといった新しいアーキテクチャをサポートできます。
パラレルism 対応チェックポインティング
Miles は Megatron のパラレルism 対応分散チェックポイント形式を使用しているため、モデルは Hugging Face から一度変換するだけで、重みの再変換を必要とせずに、異なるテンソル/パイプライン/コンテキスト/エキスパート並列構成間でロード可能です。大規模なトレーニングジョブを運用するチームにとって、これはモデルやクラスター形状が変更されるたびにチェックポイントの変換や並列設定の変更が別のエンジニアリングプロジェクトとなってしまうことを意味します。
バックエンドのパッチ適用なしでのトレーニング拡張
Miles は、モデル初期化後、対数尤度計算前、および各トレーニングステップ前に明確に定義されたフックをトレーニングループ内に公開しており、ユーザーは Megatron の内部コードを変更することなく、補助的な損失関数、カスタムメトリクス、サンプルレベルの診断、クリッピングルール、またはアルゴリズム固有の動作を追加できます。設計上の目的はシンプルです:バックエンドのパワーを維持しつつ、ユーザーによるカスタマイズはその外部で行えるようにすることです。
PyTorch: モデル、数値計算、拡張性を支える共通レイヤー
Miles 内部における共通プログラミングモデルは PyTorch です。モデルコンポーネントは通常の torch.nn.Modules であり、損失関数は標準的な autograd グラフとして実装されます。また、混合精度計算 (mixed precision)、勾配チェックポイント (gradient checkpointing)、分散処理用プリミティブ、およびプロファイリング機能もすべて、慣れ親しんだ PyTorch のワークフロー内に留まります。これは重要です。なぜなら、LLM RL 事後トレーニングの分野は急速に変化しており、チームは毎回新しい抽象化を学ぶことなく、新たな報酬関数、損失関数、ルーティング機構、モデルコンポーネント、およびデバッグツールを追加できる必要があるからです。
PyTorch ネイティブなモデル拡張性
Miles のプラグインモデル仕様メカニズムは torch.nn.Modules を中心に構築されているため、新しいアーキテクチャをサポートするには、その新コンポーネントを通常の PyTorch コードとして記述し、Megatron のモデルパイプラインに接続するだけで十分です。autograd、混合精度計算、勾配チェックポイント、およびモジュールのライフサイクルはすべて、PyTorch ユーザーが期待する通りに動作し続けます。チームは、Miles 上で実行可能にするためにモデルを別の中間抽象化に変換する必要はありません。
PyTorch ネイティブな RL カスタマイズ
同じ原則は RL アルゴリズムにも適用されます:ロールアウト関数、報酬、損失関数、サンプルフィルタ、メトリクス、トレーニングループフックはすべて、起動時に提供される Python モジュールを通じてカスタマイズされ、標準的な PyTorch 演算を用いて残りのトレーニンググラフと統合されます。チームは既存のレシピを出発点とし、報酬を置き換えたり、補助損失を追加したり、サンプルフィルタを変更したり、新しい診断機能を追加したりして、トレーナー自体を書き換えることなく対応できます。
パイプライン全体にわたる低精度レシピ
Miles は、BF16、FP8、MXFP8、INT4-QAT(Quantization-Aware Training)の各レシピをトレーニングとロールアウトの両方にまたがって実装し、孤立したバックエンド機能としてではなく、PyTorch の dtype システムを基盤とした低精度パイプラインを構築しています。この一貫性は RL において重要です。なぜなら、サンプル生成に使用されるポリシーと、トレーニング対数尤度の計算に使用されるポリシーは整合性を保つ必要があるからです。Miles は、これらの数値的な選択を明示的かつ再現可能になるように設計されています。
慣れ親しんだツールでのプロファイリングとデバッグ
大規模 RL のパフォーマンス問題は、ロールアウトのレイテンシ、トレーニング計算、集合通信、データ転送、重みの同期、サンプルフィルタリング、スケジューリングなど、あらゆる場所で発生する可能性があります。そのため Miles は PyTorch プロファイラを統合し、標準的なツールで検査できるようトレーニングフェーズの Chrome トレースを取得します。Megatron の PyTorch ベースバックエンドや、サポートされる場合はグラフコンパイルパスと組み合わせることで、デバッグとパフォーマンス最適化作業を慣れ親しんだ PyTorch エコシステム内に維持しています。
Miles が提供する標準機能
Miles は、大規模 LLM の RL 後期トレーニングに必要なコアシステム機能を備えるように設計されています:
- Rollout とトレーニングの統合 — SGLang による rollout を Megatron-LM によるトレーニングに接続し、GPU バジェットや利用率の目標に応じて、非集約型と共置型の両方の実行モードに対応します。
- 非同期実行 — 完全な非同期モードにより、rollout とトレーニングが分離されます。rollout アクターはサンプルを連続的にキューへストリーミングし、トレーナーはそのペースでキューから取り出すため、2 つのフェーズ間の反復ごとのブロックが解消されます。
- 高速な重み同期 — トレーニング更新のたびに、新鮮な重みが専用 NCCL/RDMA チャンネルを通じて rollout ワーカーへ転送され、Ray は制御パスのみを処理するため、大量のテンソルデータは Python データパスから外れます。
- MoE 対応の rollout/トレーニング整合 — Rollout Routing Replay により、rollout とトレーニングの境界を超えてルーティング決定が保持され、MoE RL を不安定化させる可能性のあるトレーナー側と rollout 側のルーティング不一致を軽減します。
- 低精度サポート — BF16 / FP8 / MXFP8 / INT4-QAT のパイプラインを統一し、個別のトレーニング専用レシピではなく、エンドツーエンドの RL スタックの一部として設計されています。
- Rollout とトレーニング全体での LoRA 対応 — rollout パスとトレーニングパスの両方で LoRA をサポートしており、大規模ベースモデルのコスト削減と反復速度向上を実現するパラメータ効率的な後期トレーニングを可能にします。
- 耐障害性と観測性 — Ray のジョブおよびアクターモデルは、監視、ログ集約、ダッシュボードによる可視化を提供し、ランクレベルの耐障害性が数週間にわたるトレーニング実行を継続させます。一方、PyTorch プロファイラーとの統合により、トレーニングレベルのビューがカバーされます。
- 広範なモデルおよびハードウェアサポート — Miles は、DeepSeek-V4、Kimi K2.5 / K2.6、GLM-5 / 5.1、Qwen3.5 / 3.6 を含む最先端およびオープンソースモデル向けに、すぐに実行可能なレシピを同梱しており、NVIDIA のフラッグシップである Hopper および Blackwell GPU もサポートしています。
多くの拡張ポイントを持つ小さなコア
Miles の最も重要な設計選択の一つは、コアトレーナーが小さく保たれていることです。
新しいアルゴリズムやモデルファミリーごとにフレームワークをフォークすることをユーザーに強制するのではなく、Miles は明示的な拡張ポイントを公開しています:
- カスタム生成動作のためのロールアウト関数 (Rollout functions)
- タスク固有の監視のための報酬関数 (Reward functions)
- 新しい RL 目的のための損失関数 (Loss functions)
- データ選択および拒否のためのサンプルフィルタ (Sample filters)
- メトリクス、診断、補助損失、カスタム更新ロジックのためのトレーニングフック (Training hooks)
- アーキテクチャ固有モジュールのためのモデル仕様 (Model specs)
これらの拡張ポイントにより、Miles は以下の幅広いポストトレーニングワークフローで有用となります: 古典的な RLHF スタイルのトレーニング、ルールベース報酬トレーニング、コードおよびエージェントタスク、MoE ポストトレーニング、低精度実験、カスタム観測性や安全性チェックが必要なプロダクションパイプライン。
要するに、Miles は配置、重み同期、フォールトトレランス、低精度レシピといったシステムレベルの判断を担当し、ユーザーコードはアルゴリズムとプロダクトロジックに集中できるようにしています。

今後の展望
LLM のポストトレーニングは急速に進化しており、より大規模なモデル、長いコンテキスト、MoE(Mixture of Experts)の増加、そして非同期でエージェント指向かつシステム集約型の RL パイプラインが主流となっています。Miles はこのトレンドに対応するために設計されており、SGLang、Ray、Megatron-LM、PyTorch を小さなプラグイン可能なトレーナーの背後に統合することで、研究者やインフラチームに対して、アルゴリズムの実験から大規模な RL 実行までをカバーする PyTorch ネイティブなパスを提供します。そのため、最先端規模の LLM RL ポストトレーニングをより再現しやすく、拡張可能で運用しやすいものにするために、Miles をオープンソース化しました。
原文を表示
**
Featured projects
-
-
TL;DR
Miles is RadixArk’s open source framework for large-scale LLM RL post-training. It composes SGLang for rollout, NVIDIA Megatron-LM for training, Ray orchestration, and PyTorch-native extensibility behind a small, pluggable trainer, with unified low-precision recipes, MoE-aware rollout/training alignment, fast NVIDIA NCCL/RDMA weight synchronization, observability, and fault tolerance built in — making frontier-scale LLM RL easier to build, reproduce, and operate.
Why Miles?
Reinforcement learning has become a central part of post-training large language models. But as models become larger, transition from dense to mixture-of-experts (MoE), and run across more distributed and specialized hardware (e.g. NVIDIA Blackwell and Hopper series), RL post-training is no longer just a training loop. It is a distributed systems problem.
A modern LLM RL framework needs to coordinate several moving pieces:
- Rollout workers must generate samples at high throughput.
- Trainers must consume those samples efficiently and compute stable policy updates.
- The rollout policy and training policy must stay synchronized.
- Large MoE models introduce routing behavior that must remain aligned across rollout and training.
- Low-precision recipes need to work consistently across the full pipeline.
- Long-running jobs need observability, checkpointing, and fault tolerance from the start.
Miles was built for this setting.
Miles is RadixArk’s open source reinforcement learning framework for LLM post-training. It is built natively on SGLang for high-throughput rollout and integrates deeply with Megatron-LM for scalable training, uses Ray to orchestrate the distributed system, and keeps PyTorch as the common programming and numerical layer throughout the stack.
The goal is simple: make large-scale LLM RL training more composable, reproducible, and easier to scale, while keeping the core trainer small enough for researchers and infrastructure teams to customize.
The Miles Architecture
Miles follows a small-core, many-edges philosophy.
The core training loop is intentionally compact. The pieces that users most often want to change — rollout logic, reward computation, loss functions, sample filtering, metrics, and training-loop hooks — are attached at launch time through user-supplied Python modules. This lets teams adapt the system to new algorithms and production constraints without forking the framework.
Underneath that small core, Miles composes four major systems:
- SGLang for high-throughput rollout generation.
- Megatron-LM for scalable distributed training.
- Ray for cluster orchestration, actor lifecycle, scheduling, and supervision.
- PyTorch for models, autograd, distributed primitives, dtype support, extensibility, and profiling.

This composition is important. RL post-training requires generation and training to work together, but the two phases have very different performance profiles: rollout is memory-bandwidth-bound (KV-cache and parameter reads dominate during decoding), while training is compute-bound and communication-heavy. Weight synchronization, sample transfer, checkpoint conversion, routing consistency, and low-precision behavior all need to be handled carefully across the boundary.
The rest of this post walks through how Miles handles each piece of that boundary — orchestration with Ray, scaling with Megatron-LM, extensibility with PyTorch, and what comes out of the box.
Ray: Orchestrating Long-Running RL Jobs
Miles is built directly on the Ray distributed runtime. In a Miles run, every long-lived process is represented as a Ray actor: trainer ranks, SGLang rollout servers, routing proxies, and asynchronous rollout workers all live inside Ray’s actor model.
This gives Miles a natural foundation for cluster-scale RL workloads.
Placing workers on GPUs
Miles uses Ray’s GPU-aware scheduler and placement groups for actor placement, supporting disaggregated (rollout and training on separate nodes) and colocated** (rollout and training on the same nodes) layouts via launch-time Ray placement specs. Process placement must be rack-aware to facilitate careful colocation, reserving spare nodes, and key for error isolation, since isolating problems within a rack (e.g., distinguishing a bad GPU from a full rack issue) is not always straightforward.
Moving data across the RL pipeline
Prompts, samples, and updated weights cycle continuously between rollout actors and trainer ranks, and Miles uses Ray actors and tasks to coordinate that flow. For bulk weight transfer, Ray handles the control path while the tensor bytes move over dedicated NCCL/RDMA channels, giving Miles both Ray-level programmability and a fast path for large data.
###
Supervising long-running jobs
Because a Miles run is a Ray job end-to-end, it inherits Ray’s operator surface — job submission, worker supervision, log aggregation, and dashboard visibility — without bolt-on infrastructure. With fault tolerance enabled, Miles can recover failed ranks and keep week-long workloads moving on top of the same Ray substrate.
Supporting fully asynchronous RL
Because Ray actors are persistent, hold their own state, and are scheduled independently, Miles can run a fully asynchronous mode in which rollout and training no longer block on each other — rollout actors continuously stream samples into a queue that the trainer drains at its own pace.
Megatron-LM: Scaling the Training Backend
Miles uses Megatron-LM as its production training backend, plugging directly into Megatron’s argument parser, model-construction pipeline, training loop, parallelism primitives, and distributed checkpoint format rather than wrapping it as a black-box library. That gives Miles the infrastructure needed for frontier-scale dense and MoE training while preserving a clean user-facing workflow.
One argument surface
Megatron-LM already exposes a large distributed-training configuration surface — sequence length, rotary embeddings, grouped GEMM, all flavors of parallelism, optimizer settings, activation checkpointing, and more — and Miles reuses it directly rather than wrapping or re-declaring it. Users configure a Miles run through one launch script that combines Miles-specific options with standard Megatron options, avoiding duplicated configuration layers and keeping the training setup close to upstream Megatron behavior.
Model specs instead of long-lived forks
Frontier architectures change quickly, with new attention blocks, routing mechanisms, and expert layouts arriving across model families, so Miles handles them through plug-in model specs — small spec files that insert custom PyTorch components (for example, a gated attention-output module, a Gated-Delta-Net block, or a model-specific MoE router) directly into Megatron’s model pipeline. This lets Miles support new architectures — for example DeepSeek-V3/V4, GLM-4.7, and Qwen3 MoE variants — without maintaining a long-lived Megatron fork that constantly diverges from upstream.
Parallelism-aware checkpointing
Miles uses Megatron’s parallelism-aware distributed checkpoint format, so a model can be converted from Hugging Face once and then loaded across different tensor / pipeline / context / expert parallel configurations without re-converting weights from scratch. For teams operating large training jobs, this means checkpoint conversion and parallelism changes don’t become a separate engineering project every time the model or cluster shape changes.
Extending training without patching the backend
Miles exposes hooks at well-defined points in the training loop — after model initialization, before log-probability computation, and before each training step — so users can add auxiliary losses, custom metrics, sample-level diagnostics, clipping rules, or algorithm-specific behavior without editing Megatron internals. The design goal is simple: keep the backend powerful, but keep user customization outside it.
PyTorch: The Common Layer for Models, Numerics, and Extensibility
PyTorch is the common programming model inside Miles: model components are regular torch.nn.Modules, losses are standard autograd graphs, and mixed precision, gradient checkpointing, distributed primitives, and profiling all stay inside familiar PyTorch workflows. This matters because LLM RL post-training changes fast — teams need to add new rewards, losses, routers, model modules, and debugging tools without learning a new abstraction each time.
PyTorch-native model extensibility
Miles’ plug-in model-spec mechanism is built around torch.nn.Modules, so supporting a new architecture means writing the new component as ordinary PyTorch code and connecting it into Megatron’s model pipeline — autograd, mixed precision, gradient checkpointing, and module lifecycle all keep working the way PyTorch users expect. Teams don’t have to translate the model into a separate intermediate abstraction to get it running on Miles.
PyTorch-native RL customization
The same principle applies to RL algorithms: rollout functions, rewards, loss functions, sample filters, metrics, and training-loop hooks are all customized through Python modules provided at launch time, using standard PyTorch operations that compose with the rest of the training graph. A team can start from an existing recipe and replace the reward, add an auxiliary loss, change sample filtering, or instrument new diagnostics without rewriting the trainer.
Low-precision recipes across the pipeline
Miles builds its low-precision pipeline on PyTorch’s dtype system, with BF16, FP8, MXFP8, and INT4-QAT recipes that span training and rollout rather than living as isolated backend-only features. This consistency matters for RL because the policy used to generate samples and the policy used to compute training log probabilities must stay aligned, and Miles is designed to make those numerical choices explicit and reproducible.
Profiling and debugging in familiar tools
Large-scale RL performance issues can surface anywhere — rollout latency, training compute, collective communication, data movement, weight synchronization, sample filtering, or scheduling — so Miles wires in the PyTorch profiler to capture Chrome traces of training phases for inspection in standard tooling. Combined with Megatron’s PyTorch-based backend and graph-compile paths where supported, this keeps debugging and performance work inside the familiar PyTorch ecosystem.
What Miles Provides Out of the Box
Miles is designed to provide the core systems features needed for large-scale LLM RL post-training:
- Rollout and training integration — Connects SGLang rollout with Megatron-LM training, with both disaggregated and colocated execution to fit different GPU budgets and utilization targets.
- Asynchronous execution — Fully async mode decouples rollout from training: rollout actors stream samples continuously into a queue that the trainer drains at its own pace, eliminating the per-iteration blocking between the two phases.
- Fast weight synchronization — After each training update, fresh weights flow to rollout workers over dedicated NCCL/RDMA channels, with Ray handling only the control path so bulk tensor bytes stay off the Python data path.
- MoE-aware rollout/training alignment — Rollout Routing Replay preserves routing decisions across the rollout/training boundary, reducing the trainer-vs-rollout routing mismatch that would otherwise destabilize MoE RL.
- Low-precision support — A unified BF16 / FP8 / MXFP8 / INT4-QAT pipeline designed as part of the end-to-end RL stack rather than as isolated training-only recipes.
- LoRA across rollout and training — LoRA is supported in both rollout and training paths, enabling parameter-efficient post-training that reduces cost and speeds up iteration on large base models.
- Fault tolerance and observability — Ray’s job and actor model provide supervision, log aggregation, and dashboard visibility, while rank-level fault tolerance keeps week-long training runs moving; PyTorch profiler integration covers the training-level view.
- Broad model and hardware support — Miles ships ready-to-run recipes for frontier and open-source models including DeepSeek-V4, Kimi K2.5 / K2.6, GLM-5 / 5.1, and Qwen3.5 / 3.6, with support for NVIDIA flagship Hopper / Blackwell GPUs.
A Small Core with Many Extension Points
One of Miles’ most important design choices is that the core trainer stays small.
Instead of forcing users to fork the framework for every new algorithm or model family, Miles exposes explicit extension points:
- Rollout functions for custom generation behavior.
- Reward functions for task-specific supervision.
- Loss functions for new RL objectives.
- Sample filters for data selection and rejection.
- Training hooks for metrics, diagnostics, auxiliary losses, and custom update logic.
- Model specs for architecture-specific modules.
These extension points make Miles useful across a range of post-training workflows: classic RLHF-style training, rule-based reward training, code and agentic tasks, MoE post-training, low-precision experiments, and production pipelines that need custom observability or safety checks.
In short, Miles makes the systems-level decisions — placement, weight sync, fault tolerance, low-precision recipes — so that user code can focus on algorithm and product logic.

Looking Ahead
LLM post-training is moving quickly — larger models, longer contexts, more MoE, and more asynchronous, agentic, system-intensive RL pipelines — and Miles is built for that trajectory: by composing SGLang, Ray, Megatron-LM, and PyTorch behind a small pluggable trainer, it gives researchers and infrastructure teams a PyTorch-native path from algorithm experimentation to large-scale RL runs, which is why we are open-sourcing Miles to make frontier-scale LLM RL post-training easier to reproduce, extend, and operate.
関連記事
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み