Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/.vuepress/sidebars/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const enSidebar: ThemeSidebarMulti = {
icon: 'carbon:machine-learning-model',
collapsed: false,
items: [
{ text: 'MinerU Scale — Real workload', link: 'mineru-scale' },
{ text: 'MinerU PDF', link: 'mineru' },
{ text: 'YOLO → SAM', link: 'yolo-sam' },
{ text: 'Dual vLLM', link: 'dual-vllm' },
Expand Down
1 change: 1 addition & 0 deletions docs/.vuepress/sidebars/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const zhSidebar: ThemeSidebarMulti = {
icon: 'carbon:machine-learning-model',
collapsed: false,
items: [
{ text: 'MinerU Scale(真实负载)', link: 'mineru-scale' },
{ text: 'MinerU PDF', link: 'mineru' },
{ text: 'YOLO → SAM', link: 'yolo-sam' },
{ text: '双 vLLM', link: 'dual-vllm' },
Expand Down
1 change: 1 addition & 0 deletions docs/en/benchmarks/built-ins.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Built-in Benchmarks now have dedicated pages. Every page includes a workload exp

## Real-model workloads

- [MinerU Scale — real workload](mineru-scale.md): production-hardened local/HDFS PDF processing, configurable large actor pools, atomic output, and resume.
- [MinerU PDF](mineru.md): dynamic page fan-out, cross-PDF GPU batching, and ordered document reconstruction.
- [YOLO → SAM](yolo-sam.md): a multi-stage image pipeline with two persistent vision-model pools.
- [Dual vLLM](dual-vllm.md): generation and refinement through two persistent LLM engines.
Expand Down
1 change: 1 addition & 0 deletions docs/en/benchmarks/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ flowchart LR

| Benchmark | Type | Core topology | What to observe |
| --- | --- | --- | --- |
| [`MinerUScaleBench`](mineru-scale.md) | **Real workload / scale** | local or HDFS PDF → Page → MinerU → atomic Document | real end-to-end execution, large actor pools, fractional GPUs, batching, resume, shared-output behavior |
| [`MinerUBench`](mineru.md) | Real model | PDF → Page → MinerU → Document | page throughput, multi-GPU scaling, cross-PDF batching, ordered reconstruction |
| [`YoloSamBench`](yolo-sam.md) | Real model | Image → YOLO → SAM → Save | balance between persistent model pools, stage bottlenecks, end-to-end image throughput |
| [`DualVllmBench`](dual-vllm.md) | Real model | Prompt → vLLM A → vLLM B | two-engine composition, model-stage time, batching efficiency |
Expand Down
220 changes: 220 additions & 0 deletions docs/en/benchmarks/mineru-scale.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
# MinerU Scale Benchmark — Real Workload

> **Real workload:** `MinerUScaleBench` renders real PDF files, loads the real
> MinerU 2.5 model in persistent vLLM GPU actors, performs page inference, and
> writes real Markdown, layout JSON, extracted images, and document commit
> markers. It is not a synthetic topology or scheduler-only benchmark.

`MinerUScaleBench` is the large-scale version of
[`MinerUBench`](mineru.md): both express the PDF → Page → OCR → Document
relation, while the Scale version strengthens input handling, actor
initialization, output commit, and resource configuration for long-running
local multi-GPU and multi-node GPU jobs.

## What the scale version adds

| Capability | Behavior |
| --- | --- |
| local and HDFS inputs | accepts one or more PDF files/directories or `hdfs://` roots, with deterministic discovery and duplicate-stem rejection |
| resilient rendering | retries PDF reads and refreshes cached HDFS filesystem clients |
| node-safe vLLM actors | serializes vLLM initialization on each node and assigns non-overlapping port blocks |
| fractional GPU layouts | exposes both OCR replica count and GPU reservation per actor |
| atomic output | publishes `_SUCCESS` only after Markdown, layout JSON, and images are complete |
| resume | validates committed documents and reuses them on rerun |
| reproducible reports | records configuration, actor/RPC/batch metrics, document/page counts, failures, and throughput |
| direct CLI | runs without editing RayOrch or workload source constants |

## Topology

```mermaid
flowchart LR
PDF["Local/HDFS PDF URI"] --> Render["MinerUScalePdfToPages<br/>CPU actor pool"]
PDF --> Meta["MinerUScalePdfMetadata"]
Render --> Expand["F.expand"]
Expand --> Page["Page records<br/>cross-document READY queue"]
Page --> OCR["MinerUScaleVlmOcrPage<br/>persistent GPU actor pool"]
OCR --> Reduce["F.reduce_aligned<br/>ordered by document and page"]
Page --> Reduce
Meta --> Assemble["MinerUScaleAssembleDoc<br/>shared POSIX or HDFS"]
Reduce --> Assemble
Assemble --> Output["Markdown + layout.json + images + _SUCCESS"]
```

Pages from different PDFs may share an OCR RPC. This cross-document packing is
the main reason to keep multiple input batches active: model actors can consume
READY pages without waiting for every page of one PDF.

## Prerequisites

- a Ray cluster with GPU nodes and enough CPUs for all persistent actor pools;
- the MinerU model visible at the same path on every eligible GPU node;
- Flash-MinerU importable as `flash_mineru` in every actor;
- vLLM, `mineru-vl-utils`, Pillow, and the dependencies in the workload's
`env.json`;
- PyArrow and working HDFS client configuration for `hdfs://` inputs or output;
- a shared POSIX/Ceph path or HDFS URI for business output and a path visible to
the driver for Benchmark reports.

The Benchmark does not download the model or dataset and does not create a Ray
cluster. Prepare those resources before running the command.

## Run directly

The same entry point works for a local Ray instance or an existing cluster:

```bash
python -m rayorch.benchmarks.mineru_scale \
--input /shared/pdfs \
--model /shared/models/MinerU2.5-2509-1.2B \
--output /shared/results/mineru-scale \
--artifact-dir /shared/results/mineru-scale-reports \
--ray-address auto
```

Repeat `--input` to combine multiple roots. Use `--input-limit` for a smoke or
screening run. A fresh output directory is recommended for every performance
candidate so resume does not change the amount of output work.

### 4×H20 experiment

This conservative layout uses one OCR actor per 96-GB H20:

```bash
python -m rayorch.benchmarks.mineru_scale \
--input /shared/pdfs \
--input-limit 48 \
--model /shared/models/MinerU2.5-2509-1.2B \
--output /shared/results/mineru-scale-4h20 \
--artifact-dir /shared/results/mineru-scale-4h20-reports \
--render-replicas 16 \
--ocr-replicas 4 \
--assemble-replicas 4 \
--batch-size 64 \
--input-batch-size 24 \
--max-active-input-batches 3 \
--gpu-memory-utilization 0.8 \
--gpus-per-ocr-actor 1 \
--ray-address auto
```

One real local validation processed 48 PDFs / 867 pages on 4×H20 with no
failed documents:

| Metric | Observed value |
| --- | ---: |
| completed documents | 48 / 48 |
| pages | 867 |
| measured pipeline wall | 136.860 s |
| page throughput | 6.335 pages/s |
| OCR RPCs | 18 |
| average OCR pages/RPC | 48.17 / 64 |
| OCR batch fill | 75.26% |
| actor/model startup | 551.215 s |

The run used Ray 2.58.0, vLLM 0.10.0, Torch 2.7.1, and
`mineru-vl-utils` 1.2.1.

## Reference 64-GPU defaults

The default constructor records the completed 8-node × 8-H20 experiment shape:

| Parameter | Default |
| --- | ---: |
| `render_replicas` | 256 |
| `ocr_replicas` | 128 |
| `gpus_per_ocr_actor` | 0.5 |
| total OCR GPU reservation | 64 |
| `assemble_replicas` | 64 |
| `batch_size` | 64 pages |
| `input_batch_size` | 24 PDFs |
| `max_active_input_batches` | 24 |
| `gpu_memory_utilization` | 0.32 |
| `render_dpi` | 200 |

The reference run processed 3,690 PDFs / 174,744 pages at 48.1738 pages/s and
reported one failed document. It used Ray 2.51.1, vLLM 0.11.0, Torch
2.8.0+cu128, PyArrow 19.0.1, and 64 H20 GPUs. The exact provenance is stored in
`success_contract.json` next to the Benchmark implementation.

The default actor plan requests 449 actor CPUs
(`256 + 128 + 64 + 1`). If the cluster cannot admit that plan, reduce render
and assemble replicas before launching; Ray will otherwise leave actors pending
rather than silently shrinking the pools.

## Python API

```python
from rayorch.benchmark import MinerUScaleBench


bench = MinerUScaleBench(
input_paths=(
"hdfs://namenode/path/to/pdfs-a",
"hdfs://namenode/path/to/pdfs-b",
),
model="/shared/models/MinerU2.5-2509-1.2B",
output_dir="/shared/results/mineru-scale",
artifact_dir="/shared/results/mineru-scale-reports",
render_replicas=256,
ocr_replicas=128,
gpus_per_ocr_actor=0.5,
assemble_replicas=64,
batch_size=64,
input_batch_size=24,
max_active_input_batches=24,
gpu_memory_utilization=0.32,
)

report = bench.run(ray_address="auto")
report.print_summary()
```

`submit()` is also available through the standard Benchmark API. Input, model,
output, and artifact paths must be visible in the execution environment; source
upload does not upload those large assets.

## Output and resume protocol

Each document is written below:

```text
<output>/<pdf-stem>/
_SUCCESS
vlm/
<pdf-stem>.md
layout.json
images/
```

A document is complete only when `_SUCCESS` is valid. Local/shared-filesystem
writes use `.rayorch-incomplete` during assembly. HDFS writes use a staging
directory followed by a move into the final location. A rerun validates the
commit and reuses complete documents.

Standard reports are written to:

```text
<artifact-dir>/<run-id>/
config.json
summary.json
gpu_samples.jsonl
```

`summary.json` adds `documents`, `failed_documents`, `pages`, and
`pages_per_s` to the common Benchmark metrics.

## Parameter-setting recommendations

Tune in this order:

1. validate one or two PDFs;
2. fit OCR actors to GPU count and memory;
3. sweep `batch_size`—normally 32, 64, 96, then 128;
4. increase `max_active_input_batches` until OCR packing stops improving;
5. increase render replicas only when OCR waits for pages;
6. tune assemble replicas against the real shared filesystem.

The Benchmark directory includes a `mineru-scale-tuning` Codex Skill and a
deterministic parameter recommender. Note that its recommended parameters are
not necessarily optimal; they are estimates based on historical testing
experience.
4 changes: 4 additions & 0 deletions docs/en/benchmarks/mineru.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

`MinerUBench` is the most complete real-model workload included with RayOrch. A PDF dynamically expands into a variable number of pages, CPU actors render them, persistent GPU actors run MinerU 2.5 with vLLM, and page results are reconstructed by PDF and page index before writing Markdown, layout JSON, and images—even when physical completion is out of order.

For local/HDFS multi-root input, fractional GPU actor layouts, atomic document
commits, resume, and the validated large-scale configuration, use
[`MinerUScaleBench`](mineru-scale.md).

## Topology

```mermaid
Expand Down
1 change: 1 addition & 0 deletions docs/zh/benchmarks/built-ins.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

## 真实模型负载

- [MinerU Scale(真实负载)](mineru-scale.md):生产化加固的本地/HDFS PDF 处理、可配置大规模 Actor 池、原子输出和断点复用。
- [MinerU PDF](mineru.md):动态页面展开、跨 PDF GPU 组批和保序文档重建。
- [YOLO → SAM](yolo-sam.md):两个常驻视觉模型池组成的多阶段图片流水线。
- [双 vLLM](dual-vllm.md):两个常驻 LLM 引擎串联的生成与改写流程。
Expand Down
1 change: 1 addition & 0 deletions docs/zh/benchmarks/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ flowchart LR

| Benchmark | 类型 | 核心拓扑 | 主要观察点 |
| --- | --- | --- | --- |
| [`MinerUScaleBench`](mineru-scale.md) | **真实负载 / 规模化** | 本地或 HDFS PDF → Page → MinerU → 原子文档提交 | 真实端到端运行、大 Actor 池、分数 GPU、组批、断点复用和共享输出行为 |
| [`MinerUBench`](mineru.md) | 真实模型 | PDF → Page → MinerU → Document | 页面吞吐、多 GPU 扩展、跨 PDF 组批、保序重建 |
| [`YoloSamBench`](yolo-sam.md) | 真实模型 | Image → YOLO → SAM → Save | 串联模型池的吞吐平衡、阶段瓶颈、端到端图像吞吐 |
| [`DualVllmBench`](dual-vllm.md) | 真实模型 | Prompt → vLLM A → vLLM B | 双引擎串联、模型阶段耗时与批处理效率 |
Expand Down
Loading
Loading