Anyscale、Ray Data LLM が vLLM の同期エンジンより 2 倍のスループットを実現
本文の状態
日本語全文を表示中
詳細モードで約12分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
Anyscale Engineering
Anyscale Engineering は、大規模バッチ推論向けライブラリ「Ray Data LLM」を発表し、vLLM の同期エンジンと比較してスループットが2倍向上する成果を示した。
AI深層分析を開く2026年8月15日 15:32
AI深層分析
キーポイント
Ray Data LLM の機能と目的
合成データ生成や大規模評価など、スループットを重視するバッチ処理ワークロード向けに設計されたライブラリであり、スケーラビリティと耐障害性を提供している。
vLLM との性能比較
Anyscale Engineering の発表によると、Ray Data LLM を使用することで、vLLM の同期エンジンと比較して生産規模でのスループットが2倍に向上する結果が得られた。
アーキテクチャの最適化
本ライブラリは、非同期・ストリーミング・分散実行を組み合わせることで、ハードウェア効率を最大化し、オーバーヘッドを最小化するアーキテクチャを採用している。
単純なバッチ推論の非効率性
データセット全体をCPUメモリに読み込み、vLLMのLLMクラスで直接順次計算を行うアプローチは、本番環境スケールではボトルネックとなる。
Ray Data LLMによる解決
各工程で発生する制限を特定し、Ray Data LLMがそれらを克服することで2倍のスループット向上を実現する。
重要な引用
Ray Data LLM enables 2x throughput over vLLM's synchronous LLM engine at production-scale
these workloads prioritize throughput over per-request latency
users can achieve 2x throughput over vLLM's synchronous LLM engine while benefiting from production-scale resiliency
A naive approach to batch LLM inference is to load the entire dataset into CPU memory and run forward passes directly using vLLM's LLM class.
編集コメントを表示
編集コメント
Anyscale Engineering は、LLM のバッチ処理におけるボトルネック解消に向けた具体的な数値成果を提示した。vLLM との比較においてスループットが2倍となる点は、大規模データ処理パイプラインの設計において重要な判断材料となる。
Source Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。

現代の AI ワークフローでは、合成データ生成やデータキュレーション、大規模な評価などにおいて、LLM がますます重要な役割を果たしています。これらは大量のモデル出力を生成したり、膨大なコーパスを分類・フィルタリング・強化したり、広範なデータセット全体でモデルの品質を測定するために活用されています。
多くの場合、コーディングや対話型アプリケーションとは異なり、こうしたワークロードでは「1 件あたりの応答速度」よりも「スループット(処理能力)」が重視されます。しかし現在、多くの LLM システムやデプロイメントは前者の遅延低減に最適化されています。これらのバッチ処理ワークロードはオフラインで実行可能であり、それを支えるシステムはハードウェアを効率的に活用し、オーバーヘッドを最小限に抑えながら、大規模なジョブを確実に完了させる必要があります。
本稿では、LLM の大規模バッチ推論のために設計されたライブラリ「Ray Data LLM」について解説します。このライブラリは、スケーラブルな実行環境、高いスループット、そして耐障害性を提供します。パフォーマンス、スケーラビリティ、耐障害性の観点から、なぜ Ray Data LLM が LLM バッチ推論に最適なアーキテクチャを提供するのかを詳しく見ていきましょう。
最後に、Ray Data LLM を活用することで、生産環境における堅牢性を保ちつつ、vLLM の同期型 LLM エンジンと比較してスループットを 2 倍に向上させる事例をご紹介します。
なぜ Ray Data LLM なのか?
本稿では、大規模な生産パイプラインに対する単純なバッチ推論アプローチを紹介し、各段階で生じる課題と、それらをどう解決できるかを解説します。
単純なアプローチ – vLLM のオフライン推論 API
バッチ LLM 推論における最も基本的な方法は、データセット全体を CPU メモリに読み込み、vLLM の LLM クラス を直接使用して順方向計算を実行することです。
1from vllm import LLM
2llm = LLM(model="facebook/opt-125m")
3
4prompts = [
5 "What is machine learning?",
6 "Explain neural networks.",
7 "How does backpropagation work?",
8]
9
10sampling_params = SamplingParams(
11 temperature=0.7,
12 max_tokens=100,
13)
14
15outputs = llm.generate(prompts, sampling_params)実際には、生産環境のデータセットは非常に巨大なため、このアプローチではスケーラビリティが確保できません。大規模なデータセットは利用可能な CPU メモリを容易に超過し、CPU RAM の容量を超えるデータの処理を不可能にしてしまいます。
この単純なアプローチでは、大規模データを処理するためのストリーミング実行機能や、障害耐性(フォールトトレランス)の両方が欠けています。
そこで自然な代替案として、Ray Data などの分散実行エンジンと vLLM を組み合わせてデータ処理をスケールアウトさせる方法があります。
代替アプローチ – Ray Data と同期型 LLM の組み合わせ

ストリーミング実行モデルを採用した Ray Data は、利用可能な CPU メモリを超える規模のデータセット処理を可能にします。このアプローチは同期 LLM エンジンを構築し、Ray Data の map_batches API を活用して、同期 LLM エンジンを持つ分散アクター上でデータセットを処理します。さらに重要なのは、Ray Data に組み込まれたフォールトトレランス機能です。クラッシュしたエンジンのアクターを自動的に置き換え、失敗したバッチの再実行を行うことで、本番環境でのワークロードに対する耐性を提供します。
1class vLLMCallable:
2 def __init__(self, *args, **kwargs):
3 self.llm = LLM(*args, **kwargs)
4
5 def __call__(self, batch: pd.DataFrame) -> dict:
6 prompts = batch['prompt'].tolist()
7 sampling_params = SamplingParams(temperature=0.7, max_tokens=100)
8
9 outputs = self.llm.generate(prompts, sampling_params)
10 generated_texts = [out.outputs[0].text for out in outputs]
11 return {"generated_text": generated_texts}
12
13ray.init()
14ds = ray.data.from_items([
15 {"prompt": "What is machine learning?"},
16 {"prompt": "Explain neural networks."},
17 {"prompt": "How does backpropagation work?"},
18])
19
20ds = ds.map_batches(
21 vLLMCallable,
22 batch_size=32,
23 num_gpus=1,
24 fn_constructor_kwargs={
25 "model": "facebook/opt-125m",
26 "max_model_len": 512,
27 },
28)Ray Data の恩恵は大きいものの、このアプローチには依然として限界があります。LLM はデコードプロセスにおいて非決定性(non-determinism)を示すため、デコードシーケンスの長さが可変となり、結果として各リクエストの実行時間が異なります。同期エンジンと同期の map_batches 呼び出しを併用すると、デコードシーケンスが短いリクエストは、長いリクエストが完了するまで待たされることになります。これによりパイプラインにバブルが発生し、リソース効率が低下します。
さらに、このアプローチではプロンプトのバッチ処理が「リクエスト単位」に限られています。同期 LLM クラスは、リクエスト単位ではなくトークン単位でプロンプトをバッチ化する continuous batching をサポートしていません。この制約もまた、パイプラインの非効率さを悪化させています。
このアプローチでは、本番環境レベルでの耐障害性とパフォーマンスを実現するために不可欠な機能、すなわちリクエストとバッチの並行処理、および graceful failover(優雅なフェイルオーバー)がまだ欠けています。
生産環境向けアプローチ:Ray Data LLM
Ray Data LLM は、上記の課題すべてを解決します。その内部では vLLM の非同期 LLM エンジンを活用し、継続的なバッチ処理によってリソース利用率を最大化。さらに map_batches() を非同期で呼び出すことで、出力デコード長が異なるリクエストを並列処理できます。
また、トークナイゼーションとデトクナイゼーションを vLLM エンジンから分離し、パイプライン内の各工程(トークナイゼーション、エンジン処理、デトクナイゼーション)に対して CPU、GPU、メモリといったリソースを細かく制御可能にしています。
耐障害性と観測性が重要な生産環境において、Ray Data LLM は両方を強力にサポートします。具体的には、エンジンからのリクエストレベルのエラー(プロンプトが長すぎるなど)で単一の行が失敗しても、データパイプライン全体は稼働し続け、エラーはジョブの停止ではなく結果となるデータセットに記録されます。また、個別のリクエストごとのレイテンシを含む行レベルでの観測性を提供するため、遅延や問題のあるリクエストのデバッグが容易になります。
1import ray
2from ray.data.llm import vLLMEngineProcessorConfig, build_processor
3
4ray.init()
5
6ds = ray.data.from_items([
7 {"prompt": "What is machine learning?"},
8 {"prompt": "Explain neural networks."},
9 {"prompt": "How does backpropagation work?"},
10])
11
12config = vLLMEngineProcessorConfig(
13 model_source="facebook/opt-125m",
14 concurrency=16,
15 batch_size=32,
16 engine_kwargs={
17 "max_model_len": 512,
18 },
19 tokenize_stage=True,
20 detokenize_stage=True,
21)
22
23processor = build_processor(
24 config,
25 preprocess=lambda row: {
26 "messages": [{"role": "user", "content": row["prompt"]}],
27 "sampling_params": {
28 "temperature": 0.7,
29 "max_tokens": 100,
30 },
31 },
32 postprocess=lambda row: {
33 "prompt": row["prompt"],
34 "response": row["generated_text"],
35 },
36)
37
38ds = processor(ds)
39result = ds.take_all()さらに Ray Data LLM はモジュール設計となっており、Ray Data を基盤とした既存のデータ処理パイプラインとの統合も容易です。例えば、異なるプロンプトと LLM を持つ複数の工程を連鎖させることで、LLM を活用したより複雑で大規模なデータ処理ワークフローを実現できます。
差別化要因:非同期 LLM 実行

Ray Data LLM の性能優位性を支える最大の要因は、非同期実行です。これは Ray Data 内のバッチレベルと vLLM 内のエンジンレベルという、2 つの補完的なレイヤーで動作します。
バッチレベルでは、Ray Data がバッチを非同期で実行し、複数のバッチを並列処理します。これにより、長時間かかるバッチが後続のバッチをブロックすることがなくなり、vLLM エンジンアクターが常にタスクで飽和状態を保つことができます。
エンジンレベルでは、vLLM がトークンレベルでリクエストを動的にバッチ化することで非同期実行を実現します。この仕組みにより、デコードシーケンスが長いリクエストが短いリクエストを停止させることがなく、生成処理をリクエスト間で効率的にインターリーブできます。
これら2 つの非同期実行レイヤーが、バッチレベルとトークンレベルの両方でブロックを排除し、同期実行と比較して劇的に高いスループットを実現します。
LinkBenchmark の手法
同期実行と非同期実行のトレードオフをより深く理解するため、Ray Data を用いて Qwen-4B に対してさまざまなデコードパターンでアブレーションスタディを実施しました。ここでは、推論トレースと非推論トレースを組み合わせたミックスドワークロードに焦点を当てています。このワークロードは、双峰型のデコード長分布を用いてモデル化されています。
第一のモードは平均 50 トークン、標準偏差 10 の正規分布で、これは典型的な非推論生成を表します。第二のモードは 100 から 2,000 トークンの範囲で変動し、標準偏差も増加させます。これにより、推論トレースを表現しています。
デコード長を精密に制御するために、vLLM エンジンでは ignore_eos を有効化しています。
結果は、推論トレースが長く、かつ多様化するほど、非同期実行が同期実行を上回る傾向が顕著になることを示しています。その相対的な改善幅は対数スケールで拡大していきます。この傾向から、非同期実行による性能向上には本質的な上限がないことがわかります。推論トレースが任意に長くなるにつれて、非同期実行は長時間稼働するリクエストを継続的にオーバーラップさせることができますが、同期実行はバッチレベルおよびリクエストレベルでの同期バリアによって制約を受けやすくなります。

Qwen4B の混合推論・非推論トレースにおけるスループット比較グラフ。平均デコード長(トークン)を横軸に、秒間処理行数を縦軸にとり、デコード長が伸びるにつれて非同期実行が同期実行を一貫して上回る様子を示しています。

非同期実行の処理スループット向上率を示す折れ線グラフ。平均デコード長が伸びるにつれて、その改善率は高まっています。
結論
Ray Data LLM は、大規模データセットをストリーミングしてバッチ推論をスケールさせ、連続バッチ処理を活用し、耐障害性も提供します。本記事で取り上げた機能に加え、Ray Data LLM は多様な入力を扱うビジョン・ランゲージモデルのバッチ推論にも対応しています。これらの高度な機能について詳しく掘り下げる続報をお楽しみに!
コミュニティに参加しよう!
- Ray Slack の #llm チャンネルに参加する:https://www.ray.io/join-slack
- Ray LLM オフィスアワーの参加登録はこちら(カレンダー招待状):https://forms.gle/QsjHNGvEhhpRcW3r5
- 過去の Ray LLM オフィスアワーの録画はこちら:https://youtube.com/playlist?list=PLzTswPQNepXl2IYF8DcV35FdCoVbeL4_6&si=huzJ7Oqn-LD4DgFL
原文を表示

LLM are increasingly utilized in modern AI workflows such as synthetic data generation, data curation, and large-scale evaluation to produce diverse model outputs at scale, classify, filter, or enrich massive corpora, or measure model quality across extensive datasets.
In many of these workloads, unlike coding or interactive applications, these workloads prioritize throughput over per-request latency, which many LLM systems and deployments optimize for today. These workloads can be run in an offline batch fashion, and the systems designed to support these workloads must efficiently utilize hardware, minimize overhead, and reliably complete large jobs.
In this blog post, we’ll talk about Ray Data LLM, a library built for large-scale batch inference for LLMs, providing scalable execution, high throughput, and fault tolerance. We’ll highlight why Ray Data LLM provides a highly optimized architecture for running LLM batch inference from performance, scalability, and fault tolerance perspectives.
We finish by showing an example where by using Ray Data LLM, users can achieve 2x throughput over vLLM’s synchronous LLM engine while benefiting from production-scale resiliency.
LinkWhy Ray Data LLM?
Let’s walk through a naive batch inference approach to a production-scale pipeline, highlighting the limitations that emerge at each stage and how Ray Data LLM addresses them.
LinkNaive approach – vLLM’s Offline Inference API
A naive approach to batch LLM inference is to load the entire dataset into CPU memory and run forward passes directly using vLLM’s LLM class.
1from vllm import LLM
2llm = LLM(model="facebook/opt-125m")
3
4prompts = [
5 "What is machine learning?",
6 "Explain neural networks.",
7 "How does backpropagation work?",
8]
9
10sampling_params = SamplingParams(
11 temperature=0.7,
12 max_tokens=100,
13)
14
15outputs = llm.generate(prompts, sampling_params)In practice, production datasets are often far too large for this approach to scale as large datasets can easily exceed available CPU memory which prohibits from processing datasets larger than available CPU RAM.
With this naive approach, we are missing streaming execution capability to process large datasets and fault tolerance.
A natural alternative method is to use a distributed execution engine like Ray Data with vLLM to scale out the data processing.
LinkAlternative approach – Synchronous LLM with Ray Data

With its streaming execution model, Ray Data enables processing datasets that exceed available CPU memory. This approach creates synchronous LLM engines and leverages Ray Data’s map_batches API to process the dataset on distributed actors with synchronous LLM engines. More importantly, Ray Data built-in fault tolerance automatically replaces actors with crashed engines and retries failed batches, offering resiliency for production workloads.
1class vLLMCallable:
2 def __init__(self, *args, **kwargs):
3 self.llm = LLM(*args, **kwargs)
4
5 def __call__(self, batch: pd.DataFrame) -> dict:
6 prompts = batch['prompt'].tolist()
7 sampling_params = SamplingParams(temperature=0.7, max_tokens=100)
8
9 outputs = self.llm.generate(prompts, sampling_params)
10 generated_texts = [out.outputs[0].text for out in outputs]
11 return {"generated_text": generated_texts}
12
13ray.init()
14ds = ray.data.from_items([
15 {"prompt": "What is machine learning?"},
16 {"prompt": "Explain neural networks."},
17 {"prompt": "How does backpropagation work?"},
18])
19
20ds = ds.map_batches(
21 vLLMCallable,
22 batch_size=32,
23 num_gpus=1,
24 fn_constructor_kwargs={
25 "model": "facebook/opt-125m",
26 "max_model_len": 512,
27 },
28)Despite the benefits from Ray Data, there are still limitations with this approach. LLMs present non-determinism in the decode process, resulting in variable decode sequence lengths and, consequently, requests with different execution times. When using a synchronous engine together with synchronous map_batches invocation, requests with shorter decode sequences must wait for those with longer ones to complete, creating pipeline bubbles and leading to inefficient resource utilization. Furthermore, this approach only batches prompts at the request level. The synchronous LLM class does not support continuous batching where prompts are batched at the token level rather than the request level, which further exacerbates pipeline inefficiencies.
With this approach, we are still missing some key features to achieve production-scale resiliency and performance, namely overlapping requests and batches and graceful failover.
LinkProduction-scale approach: Ray Data LLM
Ray Data LLM addresses all of the challenges above. Under the hood, Ray Data LLM leverages vLLM’s asynchronous LLM engine, enabling continuous batching to maximize resource utilization, and invokes map_batches() asynchronously to concurrently process requests with varying output decode lengths. Moreover, Ray Data LLM disaggregates tokenization and detokenization from the vLLM engine, providing fine-grained control over the resources (CPU, GPU, and memory) for different stages (tokenization, engine, detokenization) in the pipeline.
In production scenarios where fault tolerance and observability are critical, Ray Data LLM provides strong support for both. In particular, when a single row fails due to a request level error from the engine (e.g. prompt too long, etc.), the overall data pipeline continues running, and the error is recorded in the resulting dataset rather than causing the job to crash. It also exposes row-level observability, including per-request latency, making it easier to debug slow or problematic requests.
1import ray
2from ray.data.llm import vLLMEngineProcessorConfig, build_processor
3
4ray.init()
5
6ds = ray.data.from_items([
7 {"prompt": "What is machine learning?"},
8 {"prompt": "Explain neural networks."},
9 {"prompt": "How does backpropagation work?"},
10])
11
12config = vLLMEngineProcessorConfig(
13 model_source="facebook/opt-125m",
14 concurrency=16,
15 batch_size=32,
16 engine_kwargs={
17 "max_model_len": 512,
18 },
19 tokenize_stage=True,
20 detokenize_stage=True,
21)
22
23processor = build_processor(
24 config,
25 preprocess=lambda row: {
26 "messages": [{"role": "user", "content": row["prompt"]}],
27 "sampling_params": {
28 "temperature": 0.7,
29 "max_tokens": 100,
30 },
31 },
32 postprocess=lambda row: {
33 "prompt": row["prompt"],
34 "response": row["generated_text"],
35 },
36)
37
38ds = processor(ds)
39result = ds.take_all()Moreover, Ray Data LLM is designed to be modular, making it easy to integrate with existing data processing pipelines built on Ray Data. For example, users can chain multiple stages with different prompts and LLMs to perform more complex, large-scale data processing workflows using LLMs.
LinkThe Differentiator – Asynchronous LLM execution

Asynchronous execution is the primary driver of Ray Data LLM’s performance advantages. It operates at two complementary layers: the batch level within Ray Data and the engine level within vLLM.
At the batch level, Ray Data executes batches asynchronously, allowing multiple batches to be processed concurrently. This prevents long-running batches from blocking subsequent ones and ensures that the vLLM engine actors remain continuously saturated with tasks.
At the engine level, vLLM performs asynchronous execution by dynamically batching requests at the token level. Under this mechanism, requests with longer decode sequences do not stall shorter ones, enabling efficient interleaving of generation across requests.
Together, these two layers of asynchronous execution eliminate blocking at both the batch and token levels, leading to significantly higher throughput compared to synchronous execution.
LinkBenchmark methodology
To better understand the trade-offs between synchronous and asynchronous execution, we conducted an ablation study using Ray Data with Qwen-4B across a range of decode patterns. We focus on mixed workloads that combine reasoning and non-reasoning traces, modeled using a bimodal decode-length distribution. The first mode is a normal distribution with a mean of 50 tokens and a standard deviation of 10, representing typical non-reasoning generation. The second mode varies from 100 to 2,000 tokens with increasing standard deviation to represent reasoning traces. To precisely control decode lengths, ignore_eos is enabled in the vLLM engine.
The results show that as reasoning traces become longer and more variable, asynchronous execution increasingly outperforms synchronous execution, with the relative improvement growing on a logarithmic scale. This trend suggests that the performance gains from asynchronous execution are not intrinsically bounded: as reasoning traces become arbitrarily long, asynchronous execution continues to overlap long-running requests, while synchronous execution is increasingly constrained by synchronization barriers at the batch and request level.


LinkConclusion
Ray Data LLM scales batch inference by streaming large datasets, leveraging continuous batching, and offering fault tolerance. Beyond the features covered in this post, Ray Data LLM also supports batch inference for vision-language models with multimodal inputs. Stay tuned for a follow-up post that explores these advanced capabilities in more detail!
Join the Community!
- Join the Ray Slack #llm channel: https://www.ray.io/join-slack
- Ray LLM office hours; sign up here for the Calendar invite: https://forms.gle/QsjHNGvEhhpRcW3r5
- Ray LLM office hours past recordings: https://youtube.com/playlist?list=PLzTswPQNepXl2IYF8DcV35FdCoVbeL4_6&si=huzJ7Oqn-LD4DgFL
関連記事
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み