emelryan commited on
Commit
73acd66
·
verified ·
1 Parent(s): 9f6ac6e

Refresh Parse model card, examples and DFlash2 performance guides

Browse files

Improve quick starts, prompt controls and postprocessing documentation; add full-page extraction examples and confirmed DFlash2 throughput curves and serving profiles. Preserve required model disclosures, legal terms and accuracy results.

.gitattributes CHANGED
@@ -34,3 +34,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  dflash2/performance/concurrency.png filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  dflash2/performance/concurrency.png filter=lfs diff=lfs merge=lfs -text
37
+ assets/hero-0.png filter=lfs diff=lfs merge=lfs -text
38
+ assets/hero-1.png filter=lfs diff=lfs merge=lfs -text
39
+ assets/hero-2.png filter=lfs diff=lfs merge=lfs -text
40
+ assets/parse-demo.gif filter=lfs diff=lfs merge=lfs -text
41
+ assets/parse-demo.png filter=lfs diff=lfs merge=lfs -text
42
+ assets/prompt-boxes.png filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -9,428 +9,404 @@ library_name: transformers
9
  ---
10
  # Nemotron 3.5 Parse
11
 
12
- ## New: DFlash2 speculative decoding
 
 
 
13
 
14
- **November 4, 2026:** This repository now includes an optional DFlash2 drafter in
15
- [`dflash2/`](dflash2/README.md) for faster vLLM inference. Download the model and
16
- drafter together, then point vLLM at the local draft folder:
17
-
18
- ```bash
19
- hf download nvidia/Nemotron-3.5-Parse --local-dir ./parse35
20
-
21
- vllm serve ./parse35 \
22
- --trust-remote-code \
23
- --speculative-config '{"method":"dflash","model":"./parse35/dflash2","num_speculative_tokens":32}'
24
- ```
25
-
26
- Use a vLLM build with native Nemotron Parse and `DFlash2DraftModel` support;
27
- tested with `0.32.1rc1.dev505+g00b6c4c56` on H200/BF16. No additional model
28
- package or worker plugin is required for this path. The tested build selects
29
- Model Runner V2 automatically; older vLLM builds have not been qualified.
30
- See [draft-length tuning and throughput](dflash2/README.md#performance) below.
31
-
32
- ![DFlash2, MTP and base inference across concurrency](dflash2/performance/concurrency.png)
33
-
34
- The curve uses the best tested native draft length at each concurrency;
35
- the command above uses a fixed 32-token draft. Measurements use one H200,
36
- 2,078 ParseBench pages and three trials per point. See the [benchmark protocol
37
- and results](dflash2/performance/README.md) for settings and limitations.
38
 
 
39
 
40
- ### Description:
41
- Nemotron 3.5 Parse is a document image parser that produces structured, machine-readable text with semantic layout classes, bounding boxes, and reading order. It combines a C-RADIOv4-SO400M vision encoder with a 10-layer mBART decoder that consumes the visual sequence as a causal prefix. The release uses dynamic rectangular NaViT preprocessing, content-normalized coordinates, grouped-query self-attention (16 query heads and 8 key/value heads), a 72,505-token multilingual tokenizer, and chart-aware output through the `<class_Chart>` token. It is intended for document understanding, information retrieval, data extraction, and multimodal data-curation workflows.<br>
42
 
43
- Nemotron 3.5 Parse was developed by NVIDIA as a part of Nemotron.
 
 
 
 
 
 
44
 
45
- This model is ready for commercial or non-commercial use. <br>
46
 
47
- ## Hosted inference
 
48
 
49
- - [Try the API on NVIDIA Build](https://build.nvidia.com/nvidia/nemotron-3.5-parse)
50
- - [Deploy on Baseten](https://www.baseten.co/library/nemotron-35-parse/)
51
 
52
- ## Benchmark highlights
 
 
53
 
54
- Detailed benchmarks: [ParseBench](#parsebench) · [IndicVisionBench](#indicvisionbench-ocr) · [MOSCAR](#moscar-multilingual-ocr).
55
 
56
- | Model | Mean ↑ | Tables ↑ | Charts ↑ | Content Faithfulness ↑ | Semantic Formatting ↑ | Visual Grounding ↑ |
57
- | :--- | ---: | ---: | ---: | ---: | ---: | ---: |
58
- | **Nemotron 3.5 Parse** | **75.20** | **84.67** | **64.40** | **87.96** | **68.28** | **70.67** |
59
 
60
- ParseBench results use triple pass with region union on 2,078 unique pages. See [pipeline details](#parsebench), [reproduction instructions](reference/parsebench/pipeline/README.md), and [evaluation results](reference/parsebench/pipeline/validation_metrics.json).
 
 
61
 
62
- Additional OCR highlights (scores on a 0–100 scale):
63
 
64
- * **IndicVisionBench OCR: 83.73 ANLS-char**, evaluated on 876 test pages across 10 languages. [Per-language results](#indicvisionbench-ocr).
65
- * **MOSCAR: 99.51 character bag F1**, evaluated on 8,111 simply rendered synthetic pages covering 163 language/script entries. [Per-script results](#moscar-multilingual-ocr) and [full per-language results](reference/multilingual/moscar_by_language.md).
66
 
67
- MOSCAR uses simple synthetic renderings of text in each language to test basic OCR capability. These results do not guarantee accuracy on complex scanned documents, handwriting, degraded images, or other real-world variations. Character bag F1 measures character overlap without considering character order.
68
 
69
- ### License/Terms of Use:
70
- Governing Terms: Your use of this model is governed by the [OpenMDW License Agreement, version 1.1](https://openmdw.ai/license/1-1/). Use of the tokenizer included in this model is governed by the [MIT license and tokenizer attribution](https://huggingface.co/nvidia/Nemotron-3.5-Parse/blob/main/TOKENIZER_ATTRIBUTION.md). See [third-party notices](https://huggingface.co/nvidia/Nemotron-3.5-Parse/blob/main/THIRD_PARTY_NOTICES.md) for separately installed dependencies.<br>
71
 
72
- Tokenizer source and modifications are documented in [TOKENIZER_ATTRIBUTION.md](TOKENIZER_ATTRIBUTION.md).
73
 
74
- The portable ParseBench pipeline has its own [license](reference/parsebench/pipeline/LICENSE)
75
- and [third-party notices](reference/parsebench/pipeline/THIRD_PARTY_NOTICES.md),
76
- including the separately installed benchmark environment. See the
77
- [component inventory](reference/package/benchmark_environment_components.json)
78
- and [package build evidence](reference/package/README.md) for exact versions and digests.
79
-
80
- ### Deployment Geography:
81
- Global<br>
82
-
83
- ### Use Case: <br>
84
- Nemotron 3.5 Parse is designed for developers and teams building document intelligence, retrieval-augmented generation (RAG), curator, extractor, and agentic AI applications. It can convert scanned or rendered PDFs, presentation slides, forms, reports, tables, and mixed-content document pages into structured outputs for downstream indexing, retrieval, analytics, model training-data creation, and human-in-the-loop review.<br>
85
-
86
- ### Release Date: <br>
87
- Hugging Face 10/17/2026 via https://huggingface.co/nvidia/Nemotron-3.5-Parse <br>
88
-
89
- ## References:
90
- * [Hugging Face Transformers mBART documentation](https://huggingface.co/docs/transformers/en/model_doc/mbart) <br>
91
- * [NVIDIA C-RADIOv4-SO400M](https://huggingface.co/nvidia/C-RADIOv4-SO400M) <br>
92
 
93
- ## Model Architecture:
94
- **Architecture Type:** Transformer<br>
95
 
96
- **Network Architecture:** <br>
97
- * Vision Encoder: NVIDIA C-RADIOv4-SO400M (`vit_so400m_patch16_224`) with dynamic rectangular NaViT preprocessing<br>
98
- * Adapter Layer: 1D convolutions and normalization layers that compress the vision latent sequence before decoding<br>
99
- * Decoder: 10-layer mBART causal visual-prefix decoder with 16 query heads and 8 key/value heads<br>
100
- * Auxiliary Prediction Head: One trained one-step multi-token-prediction (MTP) head is included in `model.safetensors`. Transformers uses the normal decoder for generation; the vLLM plugin enables the bundled head for one-token speculative decoding.<br>
101
- * Tokenizer: 72,505 entries with multilingual and task/control tokens including `<predict_bbox>`, `<predict_classes>`, `<predict_text_in_pic>`, and `<class_Chart>`; the decoder embedding is padded to 72,512 rows. Use of the tokenizer included in this model is governed by the [MIT license and tokenizer attribution](https://huggingface.co/nvidia/Nemotron-3.5-Parse/blob/main/TOKENIZER_ATTRIBUTION.md).<br>
102
- * Number of Parameters: 630,800,496 unique trainable parameters (approximately 0.631B), including the MTP head; shared decoder embedding/output weights are counted once<br>
103
 
104
- ## Input(s): <br>
105
- **Input Type(s):** Image, Text<br>
106
 
107
- **Input Format(s):** <br>
108
- * Image: Red, Green, Blue (RGB)<br>
109
- * Text: Prompt string<br>
 
 
 
 
 
 
 
 
110
 
111
- **Input Parameters:** <br>
112
- * Image: Two-Dimensional (2D)<br>
113
- * Text: One-Dimensional (1D)<br>
 
 
114
 
115
- **Other Properties Related to Input:** <br>
116
- * Recommended maximum input resolution (Width, Height): 1664, 2048<br>
117
- * Channel Count: 3<br>
118
- * Prompt format: one task prompt composed from the supported control tokens. The default prompt extracts bounding boxes, semantic classes, and text in markdown format: `</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>`.<br>
119
 
120
- ## Output(s): <br>
121
- **Output Type(s):** Text<br>
122
 
123
- **Output Format(s):** String<br>
124
 
125
- **Output Parameters:** One-Dimensional (1D)<br>
126
 
127
- **Other Properties Related to Output:** Nemotron 3.5 Parse returns a string encoding document text, semantic element classes, and content-normalized bounding boxes. Scale x coordinates by the evaluated image width and y coordinates by its height. Postprocessing utilities can convert table or chart-associated text into LaTeX, HTML, markdown, JSON, or CSV where supported.<br>
128
 
129
- Our AI models are designed and/or optimized to run on NVIDIA GPU-accelerated systems. By leveraging NVIDIA hardware and software frameworks, the model achieves faster training and inference times compared to CPU-only solutions. <br>
 
130
 
131
- ## Quick Start
 
 
 
 
132
 
133
- ### Transformers installation
134
 
135
- Use Python 3.12 and a fresh environment:
 
 
136
 
137
- ```bash
138
- python3.12 -m venv .venv
139
- source .venv/bin/activate
140
- python -m pip install "transformers==5.14.1" "torchvision==0.26.0" "timm==1.0.22"
 
 
 
 
 
 
 
 
 
 
 
141
  ```
142
 
143
- Run `hf auth login` if repository access requires authentication. Transformers downloads the model weights, processor, and custom model code automatically. No Nemotron package installation is needed for Transformers inference.
 
144
 
145
- ### Usage example
 
146
 
147
- ```python
148
- import torch
149
- from PIL import Image
150
- from transformers import AutoModel, AutoProcessor, GenerationConfig
151
 
152
- model_path = "nvidia/Nemotron-3.5-Parse"
153
- device = "cuda:0"
 
 
 
 
 
 
 
 
154
 
155
- model = AutoModel.from_pretrained(
156
- model_path,
157
- trust_remote_code=True,
158
- dtype=torch.bfloat16
159
- ).to(device).eval()
160
- processor = AutoProcessor.from_pretrained(model_path, trust_remote_code=True)
161
 
162
- image = Image.open("path/to/your/image.jpg").convert("RGB")
163
- task_prompt = "</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>"
164
 
165
- inputs = processor(images=[image], text=task_prompt, return_tensors="pt", add_special_tokens=False).to(device)
166
 
167
- generation_config = GenerationConfig.from_pretrained(model_path)
168
- generation_config.max_new_tokens = 8744
169
 
170
- with torch.inference_mode():
171
- outputs = model.generate(**inputs, generation_config=generation_config)
 
172
 
173
- generated_text = processor.batch_decode(outputs, skip_special_tokens=False)[0]
174
- print(generated_text)
 
 
 
 
 
 
 
175
  ```
176
 
177
- ### Postprocessing
 
 
178
 
179
- The shared helpers render a complete document as Markdown with HTML tables, and
180
- return structured blocks with normalized boxes and optional pixel boxes. They
181
- preserve model reading order, table spans, blank cells, and in-cell line breaks.
182
- They also decode rich table formatting, remove literal duplicate elements, repair
183
- empty serialization prefixes, and normalize existing list bullets and discretionary
184
- soft hyphens in text. Code and math are protected from typography cleanup.
185
 
186
- Download the helpers and their shared implementation into your working directory
187
- (no Nemotron package installation is needed for this path):
188
 
189
- ```bash
190
- python -m pip install "beautifulsoup4==4.13.3"
191
- hf download nvidia/Nemotron-3.5-Parse \
192
- --include 'postprocessing.py' 'latex2html.py' 'nemotron_parse/**' --local-dir .
193
- ```
194
 
195
- Continue from the Transformers example above:
 
 
 
 
196
 
197
- ```python
198
- from pathlib import Path
199
- from PIL import ImageDraw
200
- from postprocessing import postprocess_document
201
-
202
- document = postprocess_document(generated_text, image_size=image.size)
203
- Path("prediction.md").write_text(document["markdown"], encoding="utf-8")
204
- draw = ImageDraw.Draw(image)
205
- for block in document["blocks"]:
206
- draw.rectangle(block["bbox_pixels"], outline="red", width=2)
207
- image.save("prediction.png")
208
- ```
209
 
210
- The existing `extract_classes_bboxes`, `transform_bbox_to_original`, and
211
- `postprocess_text` functions remain available. Supported `table_format` values:
212
- `latex` | `HTML` | `markdown` | `json` | `json_hierarchical` | `csv`.
213
- HTML and hierarchical JSON retain merged-cell structure; flat Markdown, CSV, and
214
- record JSON flatten spans. Headerless tables use neutral column names in flat
215
- exports, retaining every data row.
216
 
217
- Explicit chart titles, subtitles, and panel labels are preserved with their tables.
218
- Header inference uses predicted spans and existing bold markup; it can be disabled.
219
- Numeric value/percentage column splitting and geometric chart-caption association
220
- are enabled by default. Both preserve existing predicted values/text and can be disabled. See
221
- [postprocessing examples](docs/postprocessing.md) for controls and examples.
222
 
223
- ## Inference with vLLM
 
 
 
 
224
 
225
- vLLM requires the Nemotron plugin for this architecture and its MTP head. The plugin accepts stable vLLM releases `>=0.25.0,<0.33` (0.25.x through 0.32.x). In a fresh Python 3.12 environment, download the repository and install the serving extras:
 
226
 
227
  ```bash
228
- python -m pip install "huggingface-hub>=1.24.0,<2"
229
- hf download nvidia/Nemotron-3.5-Parse --local-dir nemotron-parse
230
- cd nemotron-parse
231
- python -m pip install ".[vllm,client]" "vllm>=0.25.0,<0.33"
232
  ```
233
 
234
- To select a specific vLLM release within this range, replace the final argument with your desired version (for example, `"vllm==0.32.0"`). Let pip resolve the compatible Torch, torchvision, and Transformers dependencies declared by the package.
235
-
236
- One-token MTP and the compatible FA3 scheduler are enabled automatically.
237
-
238
- ### vLLM Inference example
239
-
240
- #### Option 1: Python inference with MTP
241
 
242
  ```python
243
- from PIL import Image
244
- from vllm import LLM, SamplingParams
 
245
 
246
  def main():
247
- llm = LLM(
248
- model=".",
249
- dtype="bfloat16",
250
- trust_remote_code=True,
251
- distributed_executor_backend="uni",
252
- max_model_len=16384,
253
- max_num_seqs=64,
254
- max_num_batched_tokens=16384,
255
- limit_mm_per_prompt={"image": 1},
256
- enable_prefix_caching=False,
257
- attention_config={"flash_attn_version": 3},
258
- )
259
- sampling_params = SamplingParams(
260
- temperature=0,
261
- top_k=1,
262
- repetition_penalty=1.1,
263
- max_tokens=8744,
264
- skip_special_tokens=False,
265
- )
266
- image = Image.open("<YOUR-IMAGE-PATH>").convert("RGB")
267
- outputs = llm.generate([{
268
- "prompt": "<pad>\n</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>",
269
- "multi_modal_data": {"image": image},
270
- }], sampling_params, tokenization_kwargs={"add_special_tokens": False})
271
- print(outputs[0].outputs[0].text)
272
 
273
  if __name__ == "__main__":
274
  main()
275
  ```
276
 
277
- The offline prompt includes the image placeholder `<pad>`. Automatic special
278
- tokens are disabled because the task prompt already contains its control tokens.
279
 
280
- #### Option 2: vLLM serve with MTP
 
 
 
 
281
 
282
- ```bash
283
- vllm serve . \
284
- --served-model-name nemotron-parse \
285
- --dtype bfloat16 \
286
- --distributed-executor-backend uni \
287
- --tensor-parallel-size 1 \
288
- --max-model-len 16384 \
289
- --max-num-seqs 192 \
290
- --max-num-batched-tokens 16384 \
291
- --no-enable-prefix-caching \
292
- --limit-mm-per-prompt '{"image":1}' \
293
- --attention-config '{"flash_attn_version":3}' \
294
- --trust-remote-code \
295
- --port 8000 \
296
- --chat-template chat_template.jinja
297
- ```
298
 
299
- Then run inference through the OpenAI-compatible API:
 
300
 
301
  ```python
302
- import base64
303
- from openai import OpenAI
304
 
305
- client = OpenAI(
306
- base_url="http://localhost:8000/v1",
307
- api_key="EMPTY",
308
- )
309
 
310
- with open("<YOUR-IMAGE-PATH>", "rb") as f:
311
- img_b64 = base64.b64encode(f.read()).decode("utf-8")
 
 
 
312
 
313
- prompt_text = "</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>"
 
 
314
 
315
- resp = client.chat.completions.create(
316
- model="nemotron-parse",
317
- messages=[
318
- {
319
- "role": "user",
320
- "content": [
321
- {
322
- "type": "text",
323
- "text": prompt_text,
324
- },
325
- {
326
- "type": "image_url",
327
- "image_url": {
328
- "url": f"data:image/png;base64,{img_b64}",
329
- },
330
- },
331
- ],
332
- }
333
- ],
334
- max_tokens=8744,
335
- temperature=0.0,
336
- extra_body={
337
- "repetition_penalty": 1.1,
338
- "top_k": 1,
339
- "skip_special_tokens": False,
340
- },
341
- )
342
- print(resp.choices[0].message.content)
343
- ```
344
 
345
- For Docker deployment and optional generation controls, see [the serving guide](docs/serving.md).
346
 
347
- ## Software Integration:
348
- **Runtime Engine(s):**
349
- * Transformers <br>
350
- * vLLM <br>
351
 
352
- **Reference Hardware:** NVIDIA Hopper H100, BF16. The FA3/MTP speed profile above is measured on H100.<br>
353
 
354
- **Supported Operating System(s):**
355
- * Linux <br>
356
 
357
- The integration of foundation and fine-tuned models into AI systems requires additional testing using use-case-specific data to ensure safe and effective deployment. Following the V-model methodology, iterative testing and validation at both unit and system levels is essential to mitigate risks, meet technical and functional requirements, and ensure compliance with safety and ethical standards before deployment. <br>
358
 
359
- ## Model Version(s):
360
- Nemotron 3.5 Parse · October 17, 2026 release <br>
361
 
362
- This AI model can be embedded as an Application Programming Interface (API) call through the documented Transformers or vLLM serving interfaces.
 
 
 
 
363
 
364
- ## Training, Testing, and Evaluation Datasets:
 
365
 
366
- ### Training Dataset
367
 
368
- **Data Modality:** <br>
369
- * Image <br>
370
- * Text <br>
371
 
372
- **Image Training Data Size:** <br>
373
- * 1 Million to 1 Billion Images <br>
374
 
375
- **Text Training Data Size:** <br>
376
- * 1 Billion to 10 Trillion Tokens <br>
377
 
378
- **Data Collection Method by dataset:** <br>
379
- * Automated, Manually-Collected, Synthetic <br>
 
 
 
 
380
 
381
- **Labeling Method by dataset:** Automated, Manually-Labeled, Synthetic <br>
382
- **Labeling Details:** Labels are produced through a combination of automated OCR and layout annotation, manual annotation, and synthetic generation. The combination varies by constituent dataset. <br>
 
 
 
 
383
 
384
- **Properties:** The training set contains millions of image-text items aggregated across large document, table, and layout datasets. The data consists of document-page and table images paired with OCR text, bounding boxes, and layout labels. Sources include rendered digital documents, scientific papers, PDFs, Wikipedia-style pages, and synthetic document, table, word, and character renderings. Annotations come from OCR and layout models, third-party OCR services, synthetic-generation pipelines, and human labeling. <br>
 
 
 
 
385
 
386
- ### Testing Dataset
 
 
 
387
 
388
- **Data Collection Method by dataset:** Automated, Manually-Collected, Synthetic
389
- **Collection Details:** Sources combine automated collection, manually collected material, and synthetic generation; methods vary by constituent dataset.
390
 
391
- **Labeling Method by dataset:** Automated, Manually-Labeled, Synthetic
392
- **Labeling Details:** Labels are produced through a combination of automated OCR and layout annotation, manual annotation, and synthetic generation. The combination varies by constituent dataset.
393
 
394
- **Properties:** Tested on internal and public document-understanding benchmarks using document-page images and reference text, layout classes, bounding boxes, and structure annotations. Coverage includes OCR quality, layout structure, table parsing, reading order, and visual grounding across document types and languages.
 
 
 
395
 
396
- ### Evaluation Dataset
 
 
 
 
 
397
 
398
- **Data Collection Method by dataset:** Automated, Manually-Collected, Synthetic
399
- **Collection Details:** Sources combine automated collection, manually collected material, and synthetic generation; methods vary by constituent dataset.
 
400
 
401
- **Labeling Method by dataset:** Automated, Manually-Labeled, Synthetic
402
- **Labeling Details:** Labels are produced through a combination of automated OCR and layout annotation, manual annotation, and synthetic generation. The combination varies by constituent dataset.
 
 
 
 
 
 
403
 
404
- **Properties:** Evaluated on internal and public document-understanding benchmarks covering OCR quality, layout structure, table parsing, reading order, and visual grounding. The ParseBench reference evaluation covers 2,078 unique document pages. Additional benchmarks cover Indic-language OCR and multilingual synthetic OCR across the scripts listed below. <br>
 
 
405
 
406
- Benchmark coverage: <br>
407
- * ParseBench evaluates document parsing across text fidelity, semantic formatting, tables, charts, and visual grounding with layout boxes/classes. <br>
408
- * IndicVisionBench evaluates OCR quality for Indic-language pages, including Bengali, Gujarati, Hindi, Kannada, Malayalam, Marathi, Odia, Punjabi, Tamil, and Telugu. <br>
409
- * MOSCAR evaluates multilingual synthetic OCR across broad script coverage, including Latin, Arabic, Cyrillic, Han, Hangul, Japanese, Indic scripts, Hebrew, Thai, Greek, and others. <br>
410
 
411
- ### Evaluation Results
412
 
413
- #### ParseBench
414
 
415
- - **Single pass:** parse the full page once.
416
- - **Double pass:** parse the page, then refine Table/Chart crops selected from its predictions.
417
- - **Triple pass:** add a separate detection request and refine the union of detector and parser regions. Full-page parsing and detection can overlap.
 
 
 
 
 
 
418
 
419
- On ParseBench, double pass gains **2.18 overall points** over single pass. Triple
420
- pass adds **0.28 points** over double pass at about **9% lower throughput**. Double
421
- pass captures most of the measured accuracy gain; the table shows the speed tradeoff.
422
 
423
- Published overall scores with locally measured throughput:
 
 
 
 
 
 
 
424
 
425
  | Model | Published ParseBench ↑ | Measured pages/s ↑ |
426
  | :--- | ---: | ---: |
427
- | **Nemotron 3.5 Parse (triple-pass)** | **75.20** | **10.62** |
428
  | LightOnOCR-3-4B | 75.10 | 2.76 |
429
- | **Nemotron 3.5 Parse (double-pass)** | **74.92** | **11.65** |
430
  | LightOnOCR-3-0.8B | 74.60 | 5.69 |
431
  | Infinity-Parser2-Flash | 73.25 | 3.06 |
432
  | MinerU2.5-Pro-2605-1.2B | 72.78 | 4.13 |
433
- | **Nemotron 3.5 Parse (single-pass)** | **72.74** | **15.42** |
434
  | KDL-Frontier-Parser-nano | 72.38 | 2.98 |
435
  | LightOnOCR-3-1B | 71.40 | 2.44 |
436
  | Chandra-ocr-2 | 70.10 | 2.01 |
@@ -438,13 +414,40 @@ Published overall scores with locally measured throughput:
438
  | PaddleOCR-VL-1.5 | 65.95 | 3.40 |
439
  | Nemotron Parse 2.0 | 63.91 | 3.95 |
440
 
441
- Speeds use the same 2,078 prepared page images on one H100 per model. Timing includes all model passes and dependent crop work, excluding initial page preparation, startup, warmup, final document rendering and writes.
 
 
 
 
 
 
 
 
 
 
 
442
 
443
  The refinement merge retains differing full-page/crop alternatives; the reported scores include these alternatives.
444
 
445
- See [score sources and timing details](reference/parsebench/comparisons/README.md), [full results](reference/parsebench/comparisons/results.json), and the [pipeline reproduction instructions](reference/parsebench/pipeline/README.md).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
446
 
447
- #### IndicVisionBench OCR
 
448
 
449
  OCR results on 876 test pages across 10 languages. ANLS-char and character error rate (CER) are shown as percentages. CER includes insertion errors and can exceed 100%.
450
 
@@ -462,7 +465,12 @@ OCR results on 876 test pages across 10 languages. ANLS-char and character error
462
  | Tamil | 88 | 81.77 | 91.24 | 42.05 | 7.41 |
463
  | Telugu | 89 | 79.86 | 87.75 | 43.57 | 10.53 |
464
 
465
- #### MOSCAR multilingual OCR
 
 
 
 
 
466
 
467
  MOSCAR uses simple synthetic renderings of text in each language to test basic OCR capability. These results do not guarantee accuracy on complex scanned documents, handwriting, degraded images, or other real-world variations. Character bag F1 measures character overlap without considering character order.
468
 
@@ -500,35 +508,166 @@ OCR results on 8,111 held-out synthetic pages covering all 163 configured langua
500
 
501
  Both comparisons use the [released Parse 2.0 weights](https://huggingface.co/nvidia/NVIDIA-Nemotron-Parse-2.0) and current Parse 3.5 weights, identical page sets, greedy decoding, and the same scorer for each benchmark. Each model uses its documented default task prompt. All outputs, including those reaching the token limit, are included. See the [full MOSCAR results for all 163 language/script entries](reference/multilingual/moscar_by_language.md), [downloadable results](reference/multilingual/README.md), and [evaluation settings](reference/multilingual/README.md#evaluation-settings).
502
 
503
- Inference reference outputs and verification instructions are available in [reference/](https://huggingface.co/nvidia/Nemotron-3.5-Parse/blob/main/reference/README.md).
504
 
505
- The [quick20/full500 regression references](reference/parse_3_5/README.md) were refreshed for the released checkpoint on October 18, 2026. Full500 completed 500/500 pages without request failures and scored **74.49% overall** and **83.38% table quality** with the released table parser. These are lightweight regression metrics, separate from official ParseBench or OmniDocBench TEDS. Raw outputs, legacy scores and the updated scorer are included.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
506
 
507
  ## Inference:
508
  **Acceleration Engine:** Transformers, vLLM <br>
509
  **Test Hardware:** <br>
510
  * NVIDIA Hopper H100 <br>
 
511
 
512
- ## Ethical Considerations:
513
- NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. Developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse. <br>
514
 
515
- Please make sure you have proper rights and permissions for all input image and video content. If an input image contains people, personal health information, confidential business data, or intellectual property, the model may extract or reproduce visible text from that content. <br>
 
516
 
517
- For more detailed information on ethical considerations for this model, please see the Model Card++ [Bias](bias.md), [Explainability](explainability.md), [Safety & Security](safety.md), and [Privacy](privacy.md) subcards. <br>
518
- Please report model quality, risk, security vulnerabilities, or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/). <br>
519
 
520
- ## Parsing helpers
521
 
522
- The Python helpers return Markdown, structured blocks, and raw model output.
523
- After installing the package and starting the vLLM server above:
 
524
 
525
- ```python
526
- from nemotron_parse.inference import DocumentParser
527
 
528
- with DocumentParser() as parser:
529
- document = parser.parse("page.png")
530
- print(document["markdown"])
531
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
532
 
533
- See the [postprocessing guide](docs/postprocessing.md) for pipeline options,
534
- prepared batches, high concurrency, CLI examples, and output controls.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  ---
10
  # Nemotron 3.5 Parse
11
 
12
+ **Turn document pages into structured information.** Nemotron 3.5 Parse extracts
13
+ text, tables, chart data, reading order, semantic classes, and bounding boxes from
14
+ page images. Use it on scans, rendered PDFs, slides, forms, reports, and mixed
15
+ document layouts; export the results as Markdown, HTML, or structured JSON.
16
 
17
+ ![Synthetic documents and charts become structured predictions](assets/parse-demo.gif)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
+ *Full-page predictions on synthetic documents. [Static preview](assets/parse-demo.png) · [All examples](assets/hero-examples.md).*
20
 
21
+ <a id="benchmark-highlights"></a>
 
22
 
23
+ - **Leading ParseBench accuracy:** **75.20** with triple-pass parsing, the highest
24
+ overall score among the systems in our [reported comparison](#parsebench).
25
+ - **Broad multilingual OCR:** evaluated across **163 language/script entries in
26
+ 26 script groups**, plus 10 Indic languages. See [language results](#multilingual-ocr).
27
+ - **Small and fast:** **0.631B parameters**, with an optional **89.3M-parameter
28
+ DFlash2 drafter**. See [throughput measurements](#new-dflash2-speculative-decoding)
29
+ for the hardware, concurrency, and parsing mode behind each result.
30
 
31
+ <a id="new-dflash2-speculative-decoding"></a>
32
 
33
+ **New — November 4, 2026:** Native DFlash2 speculative decoding is available in
34
+ [`dflash2/`](dflash2/README.md), in the same repository as the target model.
35
 
36
+ ![DFlash2, MTP, and base inference across concurrency](dflash2/performance/concurrency.png)
 
37
 
38
+ One H200, BF16, 2,078 pages, median of three runs, using the best tested native
39
+ draft length at each concurrency. See the [benchmark protocol and data](dflash2/performance/README.md).
40
+ This direct-engine, greedy benchmark is separate from the HTTP pass-mode timings.
41
 
42
+ <a id="hosted-inference"></a>
43
 
44
+ [Try the NVIDIA Build API](https://build.nvidia.com/nvidia/nemotron-3.5-parse) ·
45
+ [Deploy on Baseten](https://www.baseten.co/library/nemotron-35-parse/)
 
46
 
47
+ [Run it](#run-parse) · [Choose a parsing mode](#single-double-or-triple-pass) ·
48
+ [Prompts](#task-prompts) · [Tables and postprocessing](#tables-and-postprocessing) ·
49
+ [Benchmarks](#evaluation-results) · [Model details and terms](#model-details-and-terms)
50
 
51
+ <a id="quick-start"></a>
52
 
53
+ ## Run Parse
 
54
 
55
+ <a id="transformers-installation"></a>
56
 
57
+ ### Transformers
 
58
 
59
+ Use a fresh Python environment:
60
 
61
+ ```bash
62
+ python -m venv .venv
63
+ source .venv/bin/activate
64
+ python -m pip install transformers torchvision timm
65
+ ```
 
 
 
 
 
 
 
 
 
 
 
 
 
66
 
67
+ <a id="usage-example"></a>
 
68
 
69
+ ```python
70
+ import torch
71
+ from PIL import Image
72
+ from transformers import AutoModel, AutoProcessor, GenerationConfig
 
 
 
73
 
74
+ MODEL = "nvidia/Nemotron-3.5-Parse"
75
+ TASK_PROMPT = "</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>"
76
 
77
+ model = AutoModel.from_pretrained(
78
+ MODEL, trust_remote_code=True, dtype=torch.bfloat16,
79
+ ).to("cuda").eval()
80
+ processor = AutoProcessor.from_pretrained(MODEL, trust_remote_code=True)
81
+ image = Image.open("page.png").convert("RGB")
82
+ inputs = processor(
83
+ images=[image], text=TASK_PROMPT,
84
+ return_tensors="pt", add_special_tokens=False,
85
+ ).to("cuda")
86
+ generation = GenerationConfig.from_pretrained(MODEL)
87
+ generation.max_new_tokens = 8744
88
 
89
+ with torch.inference_mode():
90
+ output_ids = model.generate(**inputs, generation_config=generation)
91
+ raw_output = processor.batch_decode(output_ids, skip_special_tokens=False)[0]
92
+ print(raw_output)
93
+ ```
94
 
95
+ Keep the control tokens in `raw_output` for postprocessing. Transformers uses
96
+ the normal decoder; the speculative-decoding options below are for vLLM.
 
 
97
 
98
+ <a id="inference-with-vllm"></a>
99
+ <a id="vllm-inference-example"></a>
100
 
101
+ ### vLLM
102
 
103
+ Use vLLM with native Parse and DFlash2 support. The included speculator speeds up token generation:
104
 
105
+ Download the target and drafter together and start a server:
106
 
107
+ ```bash
108
+ hf download nvidia/Nemotron-3.5-Parse --local-dir ./parse35
109
 
110
+ vllm serve ./parse35 \
111
+ --served-model-name nemotron-parse \
112
+ --trust-remote-code \
113
+ --speculative-config '{"method":"dflash","model":"./parse35/dflash2","num_speculative_tokens":32}'
114
+ ```
115
 
116
+ Send one RGB page through the OpenAI-compatible API (`pip install openai`):
117
 
118
+ ```python
119
+ import base64
120
+ from openai import OpenAI
121
 
122
+ TASK_PROMPT = "</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>"
123
+ with open("page.png", "rb") as f:
124
+ image_b64 = base64.b64encode(f.read()).decode()
125
+ client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
126
+ response = client.chat.completions.create(
127
+ model="nemotron-parse",
128
+ messages=[{"role": "user", "content": [
129
+ {"type": "text", "text": TASK_PROMPT},
130
+ {"type": "image_url", "image_url": {"url": "data:image/png;base64," + image_b64}},
131
+ ]}],
132
+ temperature=0, max_tokens=8744,
133
+ extra_body={"top_k": 1, "repetition_penalty": 1.1, "skip_special_tokens": False},
134
+ )
135
+ raw_output = response.choices[0].message.content
136
+ print(raw_output)
137
  ```
138
 
139
+ The text content is the task prompt only. vLLM handles the image placeholder;
140
+ do not manually prepend `<pad>` or a newline to this HTTP request.
141
 
142
+ <details>
143
+ <summary>Offline vLLM: use the same task tokens without an extra newline</summary>
144
 
145
+ For offline `LLM.generate`, put one image placeholder directly before the task
146
+ prompt, without an intervening newline:
 
 
147
 
148
+ ```python
149
+ request = {
150
+ "prompt": "<pad>" + TASK_PROMPT,
151
+ "multi_modal_data": {"image": image},
152
+ }
153
+ outputs = llm.generate(
154
+ [request], sampling_params,
155
+ tokenization_kwargs={"add_special_tokens": False},
156
+ )
157
+ ```
158
 
159
+ Here `llm` is an initialized `vllm.LLM`, `image` is a PIL RGB image, and
160
+ `sampling_params` is your `SamplingParams`. Transformers and HTTP requests use
161
+ the task prompt without a manually inserted image placeholder.
 
 
 
162
 
163
+ </details>
 
164
 
165
+ ### PDF input
166
 
167
+ The model consumes page images. Render each PDF page first; for example, with
168
+ `pip install pymupdf`:
169
 
170
+ ```python
171
+ import pymupdf
172
+ from pathlib import Path
173
 
174
+ pages = Path("pages")
175
+ pages.mkdir(exist_ok=True)
176
+ page_paths = []
177
+ with pymupdf.open("document.pdf") as pdf:
178
+ for number, page in enumerate(pdf):
179
+ pix = page.get_pixmap(dpi=150, colorspace=pymupdf.csRGB, alpha=False)
180
+ path = pages / f"page-{number:04d}.png"
181
+ pix.save(str(path))
182
+ page_paths.append(str(path))
183
  ```
184
 
185
+ Pass `page_paths` to `parse_many` below. Each result corresponds to one
186
+ page; combine their Markdown if desired. The helper does not infer cross-page
187
+ table continuations or a document-wide reading order.
188
 
189
+ <a id="parsing-helpers"></a>
 
 
 
 
 
190
 
191
+ ## Single, double, or triple pass
 
192
 
193
+ Pass count controls how much image analysis is performed. A speculator accelerates
194
+ token generation within those requests; it does not select the pass count.
 
 
 
195
 
196
+ | Mode | What it does | Reported ParseBench overall | DFlash2 pages/s |
197
+ | --- | --- | ---: | ---: |
198
+ | Single | Parse the full page once | 72.74 | 18.01 |
199
+ | Double | Parse the page, then refine predicted Table/Chart crops | 74.92 | 14.26 |
200
+ | Triple | Also detect regions separately; refine the detector/parser union | 75.20 | 12.99 |
201
 
202
+ **Single pass** sends the whole page once and extracts its text, layout, tables
203
+ and chart data. Start here when throughput is the priority.
 
 
 
 
 
 
 
 
 
 
204
 
205
+ **Double pass** uses the full-page prediction to locate tables and charts, parses
206
+ those cropped regions at higher detail, and merges the refinements back into the
207
+ page. Crops start as each page's first result becomes available.
 
 
 
208
 
209
+ **Triple pass** starts full-page parsing and independent layout detection
210
+ together. It refines the union of their table/chart regions, including regions
211
+ that either request missed. Ready crops run while other pages and stages are
212
+ still in flight. Each retained crop is a separate request; a pass is a stage,
213
+ rather than a fixed count of three requests.
214
 
215
+ Timing uses one H200 and all 2,078 ParseBench pages; median of three fresh runs
216
+ per mode at its best tested serving configuration. See [profiles, completion
217
+ coverage and timing details](reference/dflash2-passes/README.md). Scores are the
218
+ existing reference-protocol results, separate from these DFlash2 timing runs.
219
+ See the [accuracy reproduction instructions](reference/parsebench/pipeline/README.md).
220
 
221
+ The downloaded repository includes the parser helpers. Install their dependencies
222
+ and make the downloaded source importable, without installing the serving plugin:
223
 
224
  ```bash
225
+ python -m pip install beautifulsoup4 Pillow numpy httpx
 
 
 
226
  ```
227
 
228
+ With the server above running:
 
 
 
 
 
 
229
 
230
  ```python
231
+ import sys
232
+ sys.path.insert(0, "./parse35")
233
+ from nemotron_parse.inference import DocumentParser
234
 
235
  def main():
236
+ with DocumentParser(
237
+ base_url="http://localhost:8000/v1", model="nemotron-parse",
238
+ ) as parser:
239
+ documents = parser.parse_many(
240
+ ["page.png"], mode="single", concurrency=128,
241
+ triple_regions="union", # used when mode="triple"
242
+ )
243
+ print(documents[0]["markdown"])
244
+ print(documents[0]["blocks"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
 
246
  if __name__ == "__main__":
247
  main()
248
  ```
249
 
250
+ `parse_many` uses the overlapping HTTP pipeline. In triple pass, parsing and
251
+ detection run together, and crops are dispatched as their regions become ready.
252
 
253
+ By default, crop merging preserves differing full-page/crop alternatives. Returned
254
+ documents can therefore contain overlapping table/chart hypotheses. Use
255
+ `DocumentParser(merge_policy="guarded")` when you prefer conservative replacement
256
+ and a single selected hypothesis, accepting the documented accuracy tradeoff.
257
+ See [batch parsing, crop settings, completion handling, and Transformers backends](docs/postprocessing.md).
258
 
259
+ ## Task prompts
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
 
261
+ Parse uses control-token task prompts rather than a general-purpose chat
262
+ instruction. The default is:
263
 
264
  ```python
265
+ TASK_PROMPT = "</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>"
266
+ ```
267
 
268
+ Keep token order and spelling unchanged. Disable automatic special-token
269
+ insertion when tokenizing this complete prefix.
 
 
270
 
271
+ | Control | On | Off |
272
+ | --- | --- | --- |
273
+ | Bounding boxes | `<predict_bbox>` | `<no_bbox>` |
274
+ | Semantic classes | `<predict_classes>` | `<no_classes>` |
275
+ | Text formatting | `<output_markdown>` | `<output_plain>` |
276
 
277
+ These controls request an output style and can be combined. Some combinations
278
+ can still emit extra structure. For a fixed export schema, run a full parse
279
+ and select fields from the postprocessed blocks. Each comparison below holds the other controls fixed on the same synthetic page:
280
 
281
+ ![Boxes on and off](assets/prompt-boxes.png)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
 
283
+ ### Semantic classes
284
 
285
+ With boxes disabled in both variants, toggle `<predict_classes>` / `<no_classes>`:
 
 
 
286
 
287
+ ![Classes on and off](assets/prompt-classes.png)
288
 
289
+ ### Text formatting
 
290
 
291
+ With boxes and classes disabled in both variants, toggle `<output_markdown>` / `<output_plain>`:
292
 
293
+ ![Markdown and plain text](assets/prompt-format.png)
 
294
 
295
+ For layout-only detection, use
296
+ `</s><s><predict_bbox><predict_classes><output_no_text><predict_no_text_in_pic>`.
297
+ For text only, use
298
+ `</s><s><no_bbox><no_classes><output_plain><predict_text_in_pic>`.
299
+ Full-structure benchmark scores do not apply to a changed task.
300
 
301
+ CSV, HTML, and JSON are export choices: keep the full parsing prompt and choose
302
+ the desired table format during postprocessing.
303
 
304
+ <a id="postprocessing"></a>
305
 
306
+ ## Tables and postprocessing
 
 
307
 
308
+ The model returns a serialization containing class and coordinate tokens. The
309
+ helpers turn it into a complete document and preserve the original block text:
310
 
311
+ For Transformers-only use, download the helper source into the same local layout
312
+ used by the vLLM example:
313
 
314
+ ```bash
315
+ python -m pip install beautifulsoup4 Pillow numpy httpx
316
+ hf download nvidia/Nemotron-3.5-Parse \
317
+ --include 'postprocessing.py' 'latex2html.py' 'nemotron_parse/**' \
318
+ --local-dir ./parse35
319
+ ```
320
 
321
+ ```python
322
+ import sys
323
+ from pathlib import Path
324
+ from PIL import Image
325
+ sys.path.insert(0, "./parse35")
326
+ from nemotron_parse import postprocess_document, PostprocessOptions
327
 
328
+ image = Image.open("page.png").convert("RGB")
329
+ document = postprocess_document(raw_output, image_size=image.size)
330
+ Path("page.md").write_text(document["markdown"], encoding="utf-8")
331
+ print(document["blocks"]) # class, bbox, bbox_pixels, text, rendered content
332
+ ```
333
 
334
+ `image_size` is `(width, height)`. Boxes are normalized to the evaluated image
335
+ content; `bbox_pixels` maps them back to pixels. Preserve class and coordinate
336
+ tokens when generating and decoding. Document Markdown uses HTML tables so merged
337
+ cells survive rendering. Raw per-block `text` remains available separately.
338
 
339
+ Convert a predicted table without running inference again:
 
340
 
341
+ ```python
342
+ from postprocessing import postprocess_text
343
 
344
+ table = next(block for block in document["blocks"] if block["class"] == "Table")
345
+ print(postprocess_text(table["text"], cls="Table", table_format="csv"))
346
+ print(postprocess_text(table["text"], cls="Table", table_format="json_hierarchical"))
347
+ ```
348
 
349
+ | Format | Use it for |
350
+ | --- | --- |
351
+ | `HTML` | Rendering tables while preserving merged cells |
352
+ | `json_hierarchical` | Structure with cell spans and header-role metadata |
353
+ | `markdown`, `csv`, `json` | Flat exports; merged-cell spans are expanded |
354
+ | `latex` | The predicted table's LaTeX representation |
355
 
356
+ Cleanup retains blank cells, spans, line breaks, model order, and predicted values.
357
+ Header inference can be disabled, as can chart-caption association and numeric
358
+ value/percentage splitting:
359
 
360
+ ```python
361
+ options = PostprocessOptions(
362
+ infer_headers=False,
363
+ relocate_chart_captions=False,
364
+ split_chart_value_percent=False,
365
+ )
366
+ document = postprocess_document(raw_output, image_size=image.size, options=options)
367
+ ```
368
 
369
+ See [postprocessing examples and controls](docs/postprocessing.md) for the full API,
370
+ including literal raw output, warnings, chart rendering, and prepared batches.
371
+ The guide also includes the [predicted-box overlay example](docs/postprocessing.md#draw-predicted-boxes).
372
 
373
+ <a id="option-1-python-inference-with-mtp"></a>
374
+ <a id="option-2-vllm-serve-with-mtp"></a>
 
 
375
 
376
+ ## Speed and speculative decoding
377
 
378
+ Choose one decoder in vLLM:
379
 
380
+ | Decoder | Server option |
381
+ | --- | --- |
382
+ | Base inference | Omit `--speculative-config` |
383
+ | One-token MTP | [MTP serving setup](docs/serving.md#one-token-mtp) |
384
+ | DFlash2 | `--speculative-config '{"method":"dflash","model":"./parse35/dflash2","num_speculative_tokens":32}'` |
385
+
386
+ MTP weights are bundled with the target. DFlash2 weights are in `dflash2/`.
387
+ Choose one speculator; adjust `num_speculative_tokens` to tune DFlash2 for your
388
+ request load. See the [draft-length table](dflash2/README.md#draft-length-tuning).
389
 
390
+ ## Evaluation Results
 
 
391
 
392
+ ### ParseBench
393
+
394
+ The headline score is **75.20 overall**, using triple pass with the detector/parser
395
+ region union on 2,078 unique pages. It is the highest overall score among the
396
+ models in the comparison below. Pass count, crop merging, generation settings,
397
+ and scoring protocol matter when reproducing these results.
398
+
399
+ Published overall scores and measured throughput:
400
 
401
  | Model | Published ParseBench ↑ | Measured pages/s ↑ |
402
  | :--- | ---: | ---: |
403
+ | **Nemotron 3.5 Parse (triple-pass)** | **75.20** | **12.99** |
404
  | LightOnOCR-3-4B | 75.10 | 2.76 |
405
+ | **Nemotron 3.5 Parse (double-pass)** | **74.92** | **14.26** |
406
  | LightOnOCR-3-0.8B | 74.60 | 5.69 |
407
  | Infinity-Parser2-Flash | 73.25 | 3.06 |
408
  | MinerU2.5-Pro-2605-1.2B | 72.78 | 4.13 |
409
+ | **Nemotron 3.5 Parse (single-pass)** | **72.74** | **18.01** |
410
  | KDL-Frontier-Parser-nano | 72.38 | 2.98 |
411
  | LightOnOCR-3-1B | 71.40 | 2.44 |
412
  | Chandra-ocr-2 | 70.10 | 2.01 |
 
414
  | PaddleOCR-VL-1.5 | 65.95 | 3.40 |
415
  | Nemotron Parse 2.0 | 63.91 | 3.95 |
416
 
417
+ <details>
418
+ <summary>Category scores and evaluation details</summary>
419
+
420
+ Triple-pass category results:
421
+
422
+ | Model | Mean ↑ | Tables ↑ | Charts ↑ | Content Faithfulness ↑ | Semantic Formatting ↑ | Visual Grounding ↑ |
423
+ | :--- | ---: | ---: | ---: | ---: | ---: | ---: |
424
+ | **Nemotron 3.5 Parse** | **75.20** | **84.67** | **64.40** | **87.96** | **68.28** | **70.67** |
425
+
426
+ - **Single pass:** parse the full page once.
427
+ - **Double pass:** parse the page, then refine Table/Chart crops selected from its predictions.
428
+ - **Triple pass:** add a separate detection request and refine the union of detector and parser regions. Full-page parsing and detection can overlap.
429
 
430
  The refinement merge retains differing full-page/crop alternatives; the reported scores include these alternatives.
431
 
432
+ See [score sources](reference/parsebench/comparisons/README.md), [comparison records](reference/parsebench/comparisons/results.json), [current Parse timing profiles](reference/dflash2-passes/README.md), and the [pipeline reproduction instructions](reference/parsebench/pipeline/README.md).
433
+
434
+ </details>
435
+
436
+ ### Multilingual OCR
437
+
438
+ **IndicVisionBench:** 83.73 ANLS-char on 876 pages across 10 Indic languages.
439
+ **MOSCAR:** 99.51 character-bag F1 on 8,111 synthetic pages across 163
440
+ language/script entries and 26 script groups.
441
+
442
+ MOSCAR tests basic OCR on simple synthetic text renderings. Coverage of a
443
+ language/script entry does not guarantee equivalent quality on complex scans,
444
+ handwriting, or degraded documents. Character-bag F1 measures character overlap
445
+ without considering order.
446
+
447
+ <a id="indicvisionbench-ocr"></a>
448
 
449
+ <details>
450
+ <summary>IndicVisionBench: per-language accuracy and character error rate</summary>
451
 
452
  OCR results on 876 test pages across 10 languages. ANLS-char and character error rate (CER) are shown as percentages. CER includes insertion errors and can exceed 100%.
453
 
 
465
  | Tamil | 88 | 81.77 | 91.24 | 42.05 | 7.41 |
466
  | Telugu | 89 | 79.86 | 87.75 | 43.57 | 10.53 |
467
 
468
+ </details>
469
+
470
+ <a id="moscar-multilingual-ocr"></a>
471
+
472
+ <details>
473
+ <summary>MOSCAR: results by script</summary>
474
 
475
  MOSCAR uses simple synthetic renderings of text in each language to test basic OCR capability. These results do not guarantee accuracy on complex scanned documents, handwriting, degraded images, or other real-world variations. Character bag F1 measures character overlap without considering character order.
476
 
 
508
 
509
  Both comparisons use the [released Parse 2.0 weights](https://huggingface.co/nvidia/NVIDIA-Nemotron-Parse-2.0) and current Parse 3.5 weights, identical page sets, greedy decoding, and the same scorer for each benchmark. Each model uses its documented default task prompt. All outputs, including those reaching the token limit, are included. See the [full MOSCAR results for all 163 language/script entries](reference/multilingual/moscar_by_language.md), [downloadable results](reference/multilingual/README.md), and [evaluation settings](reference/multilingual/README.md#evaluation-settings).
510
 
 
511
 
512
+ </details>
513
+
514
+ ## Model details and terms
515
+
516
+ <details>
517
+ <summary>Description, architecture, inputs, outputs, and runtime details</summary>
518
+
519
+ ### Description:
520
+ Nemotron 3.5 Parse is a document image parser that produces structured, machine-readable text with semantic layout classes, bounding boxes, and reading order. It combines a C-RADIOv4-SO400M vision encoder with a 10-layer mBART decoder that consumes the visual sequence as a causal prefix. The release uses dynamic rectangular NaViT preprocessing, content-normalized coordinates, grouped-query self-attention (16 query heads and 8 key/value heads), a 72,505-token multilingual tokenizer, and chart-aware output through the `<class_Chart>` token. It is intended for document understanding, information retrieval, data extraction, and multimodal data-curation workflows.<br>
521
+
522
+ Nemotron 3.5 Parse was developed by NVIDIA as a part of Nemotron.
523
+
524
+ This model is ready for commercial or non-commercial use. <br>
525
+
526
+ ## Model Architecture:
527
+ **Architecture Type:** Transformer<br>
528
+
529
+ **Network Architecture:** <br>
530
+ * Vision Encoder: NVIDIA C-RADIOv4-SO400M (`vit_so400m_patch16_224`) with dynamic rectangular NaViT preprocessing<br>
531
+ * Adapter Layer: 1D convolutions and normalization layers that compress the vision latent sequence before decoding<br>
532
+ * Decoder: 10-layer mBART causal visual-prefix decoder with 16 query heads and 8 key/value heads<br>
533
+ * Auxiliary Prediction Head: One trained one-step multi-token-prediction (MTP) head is included in `model.safetensors`. Transformers uses the normal decoder for generation; the vLLM plugin enables the bundled head for one-token speculative decoding.<br>
534
+ * Tokenizer: 72,505 entries with multilingual and task/control tokens including `<predict_bbox>`, `<predict_classes>`, `<predict_text_in_pic>`, and `<class_Chart>`; the decoder embedding is padded to 72,512 rows. Use of the tokenizer included in this model is governed by the [MIT license and tokenizer attribution](https://huggingface.co/nvidia/Nemotron-3.5-Parse/blob/main/TOKENIZER_ATTRIBUTION.md).<br>
535
+ * Number of Parameters: 630,800,496 unique trainable parameters (approximately 0.631B), including the MTP head; shared decoder embedding/output weights are counted once<br>
536
+
537
+ ## Input(s): <br>
538
+ **Input Type(s):** Image, Text<br>
539
+
540
+ **Input Format(s):** <br>
541
+ * Image: Red, Green, Blue (RGB)<br>
542
+ * Text: Prompt string<br>
543
+
544
+ **Input Parameters:** <br>
545
+ * Image: Two-Dimensional (2D)<br>
546
+ * Text: One-Dimensional (1D)<br>
547
+
548
+ **Other Properties Related to Input:** <br>
549
+ * Recommended maximum input resolution (Width, Height): 1664, 2048<br>
550
+ * Channel Count: 3<br>
551
+ * Prompt format: one task prompt composed from the supported control tokens. The default prompt extracts bounding boxes, semantic classes, and text in markdown format: `</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>`.<br>
552
+
553
+ ## Output(s): <br>
554
+ **Output Type(s):** Text<br>
555
+
556
+ **Output Format(s):** String<br>
557
+
558
+ **Output Parameters:** One-Dimensional (1D)<br>
559
+
560
+ **Other Properties Related to Output:** Nemotron 3.5 Parse returns a string encoding document text, semantic element classes, and content-normalized bounding boxes. Scale x coordinates by the evaluated image width and y coordinates by its height. Postprocessing utilities can convert table or chart-associated text into LaTeX, HTML, markdown, JSON, or CSV where supported.<br>
561
+
562
+ Our AI models are designed and/or optimized to run on NVIDIA GPU-accelerated systems. By leveraging NVIDIA hardware and software frameworks, the model achieves faster training and inference times compared to CPU-only solutions. <br>
563
+
564
+ ## Software Integration:
565
+ **Runtime Engine(s):**
566
+ * Transformers <br>
567
+ * vLLM <br>
568
+
569
+ **Reference Hardware:** NVIDIA H100 and H200, BF16. See each benchmark for its hardware and configuration.<br>
570
+
571
+ **Supported Operating System(s):**
572
+ * Linux <br>
573
+
574
+ ## Model Version(s):
575
+ Nemotron 3.5 Parse · October 17, 2026 release <br>
576
+
577
+ This AI model can be embedded as an Application Programming Interface (API) call through the documented Transformers or vLLM serving interfaces.
578
 
579
  ## Inference:
580
  **Acceleration Engine:** Transformers, vLLM <br>
581
  **Test Hardware:** <br>
582
  * NVIDIA Hopper H100 <br>
583
+ * NVIDIA Hopper H200 (new DFlash2 throughput measurements) <br>
584
 
585
+ </details>
 
586
 
587
+ <details>
588
+ <summary>Training, testing, and evaluation data disclosures</summary>
589
 
590
+ ## Training, Testing, and Evaluation Datasets:
 
591
 
592
+ ### Training Dataset
593
 
594
+ **Data Modality:** <br>
595
+ * Image <br>
596
+ * Text <br>
597
 
598
+ **Image Training Data Size:** <br>
599
+ * 1 Million to 1 Billion Images <br>
600
 
601
+ **Text Training Data Size:** <br>
602
+ * 1 Billion to 10 Trillion Tokens <br>
603
+
604
+ **Data Collection Method by dataset:** <br>
605
+ * Automated, Manually-Collected, Synthetic <br>
606
+
607
+ **Labeling Method by dataset:** Automated, Manually-Labeled, Synthetic <br>
608
+ **Labeling Details:** Labels are produced through a combination of automated OCR and layout annotation, manual annotation, and synthetic generation. The combination varies by constituent dataset. <br>
609
+
610
+ **Properties:** The training set contains millions of image-text items aggregated across large document, table, and layout datasets. The data consists of document-page and table images paired with OCR text, bounding boxes, and layout labels. Sources include rendered digital documents, scientific papers, PDFs, Wikipedia-style pages, and synthetic document, table, word, and character renderings. Annotations come from OCR and layout models, third-party OCR services, synthetic-generation pipelines, and human labeling. <br>
611
+
612
+ ### Testing Dataset
613
+
614
+ **Data Collection Method by dataset:** Automated, Manually-Collected, Synthetic
615
+ **Collection Details:** Sources combine automated collection, manually collected material, and synthetic generation; methods vary by constituent dataset.
616
+
617
+ **Labeling Method by dataset:** Automated, Manually-Labeled, Synthetic
618
+ **Labeling Details:** Labels are produced through a combination of automated OCR and layout annotation, manual annotation, and synthetic generation. The combination varies by constituent dataset.
619
+
620
+ **Properties:** Tested on internal and public document-understanding benchmarks using document-page images and reference text, layout classes, bounding boxes, and structure annotations. Coverage includes OCR quality, layout structure, table parsing, reading order, and visual grounding across document types and languages.
621
+
622
+ ### Evaluation Dataset
623
+
624
+ **Data Collection Method by dataset:** Automated, Manually-Collected, Synthetic
625
+ **Collection Details:** Sources combine automated collection, manually collected material, and synthetic generation; methods vary by constituent dataset.
626
+
627
+ **Labeling Method by dataset:** Automated, Manually-Labeled, Synthetic
628
+ **Labeling Details:** Labels are produced through a combination of automated OCR and layout annotation, manual annotation, and synthetic generation. The combination varies by constituent dataset.
629
 
630
+ **Properties:** Evaluated on internal and public document-understanding benchmarks covering OCR quality, layout structure, table parsing, reading order, and visual grounding. The ParseBench reference evaluation covers 2,078 unique document pages. Additional benchmarks cover Indic-language OCR and multilingual synthetic OCR across the scripts listed below. <br>
631
+
632
+ Benchmark coverage: <br>
633
+ * ParseBench evaluates document parsing across text fidelity, semantic formatting, tables, charts, and visual grounding with layout boxes/classes. <br>
634
+ * IndicVisionBench evaluates OCR quality for Indic-language pages, including Bengali, Gujarati, Hindi, Kannada, Malayalam, Marathi, Odia, Punjabi, Tamil, and Telugu. <br>
635
+ * MOSCAR evaluates multilingual synthetic OCR across broad script coverage, including Latin, Arabic, Cyrillic, Han, Hangul, Japanese, Indic scripts, Hebrew, Thai, Greek, and others. <br>
636
+
637
+ </details>
638
+
639
+ ### Deployment Geography:
640
+ Global<br>
641
+
642
+ ### Use Case: <br>
643
+ Nemotron 3.5 Parse is designed for developers and teams building document intelligence, retrieval-augmented generation (RAG), curator, extractor, and agentic AI applications. It can convert scanned or rendered PDFs, presentation slides, forms, reports, tables, and mixed-content document pages into structured outputs for downstream indexing, retrieval, analytics, model training-data creation, and human-in-the-loop review.<br>
644
+
645
+ ### Release Date: <br>
646
+ Hugging Face 10/17/2026 via https://huggingface.co/nvidia/Nemotron-3.5-Parse <br>
647
+
648
+ ## References:
649
+ * [Hugging Face Transformers mBART documentation](https://huggingface.co/docs/transformers/en/model_doc/mbart) <br>
650
+ * [NVIDIA C-RADIOv4-SO400M](https://huggingface.co/nvidia/C-RADIOv4-SO400M) <br>
651
+
652
+ ### License/Terms of Use:
653
+ Governing Terms: Your use of this model is governed by the [OpenMDW License Agreement, version 1.1](https://openmdw.ai/license/1-1/). Use of the tokenizer included in this model is governed by the [MIT license and tokenizer attribution](https://huggingface.co/nvidia/Nemotron-3.5-Parse/blob/main/TOKENIZER_ATTRIBUTION.md). See [third-party notices](https://huggingface.co/nvidia/Nemotron-3.5-Parse/blob/main/THIRD_PARTY_NOTICES.md) for separately installed dependencies.<br>
654
+
655
+ Tokenizer source and modifications are documented in [TOKENIZER_ATTRIBUTION.md](TOKENIZER_ATTRIBUTION.md).
656
+
657
+ The portable ParseBench pipeline has its own [license](reference/parsebench/pipeline/LICENSE)
658
+ and [third-party notices](reference/parsebench/pipeline/THIRD_PARTY_NOTICES.md),
659
+ including the separately installed benchmark environment. See the
660
+ [component inventory](reference/package/benchmark_environment_components.json)
661
+ and [package build evidence](reference/package/README.md) for exact versions and digests.
662
+
663
+ ### Deployment and responsible use
664
+
665
+ The integration of foundation and fine-tuned models into AI systems requires additional testing using use-case-specific data to ensure safe and effective deployment. Following the V-model methodology, iterative testing and validation at both unit and system levels is essential to mitigate risks, meet technical and functional requirements, and ensure compliance with safety and ethical standards before deployment. <br>
666
+
667
+ ## Ethical Considerations:
668
+ NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. Developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse. <br>
669
+
670
+ Please make sure you have proper rights and permissions for all input image and video content. If an input image contains people, personal health information, confidential business data, or intellectual property, the model may extract or reproduce visible text from that content. <br>
671
+
672
+ For more detailed information on ethical considerations for this model, please see the Model Card++ [Bias](bias.md), [Explainability](explainability.md), [Safety & Security](safety.md), and [Privacy](privacy.md) subcards. <br>
673
+ Please report model quality, risk, security vulnerabilities, or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/). <br>
assets/hero-0.png ADDED

Git LFS Details

  • SHA256: d971a6e48c208e5d0083c2504523ca6ace982831a3f774254eca4fca857eb50d
  • Pointer size: 131 Bytes
  • Size of remote file: 303 kB
assets/hero-1.png ADDED

Git LFS Details

  • SHA256: 0615430935de4d78d6c2d765f1f7985aae56495f848da353595162f8b265041f
  • Pointer size: 131 Bytes
  • Size of remote file: 314 kB
assets/hero-2.png ADDED

Git LFS Details

  • SHA256: 20f2369825ec251f76253f745b9cef210a4af4ef3c827410981ea2a9d9faa161
  • Pointer size: 131 Bytes
  • Size of remote file: 294 kB
assets/hero-examples.md ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Full-page extraction examples
2
+
3
+ Actual model predictions on original synthetic documents, showing the page image,
4
+ predicted boxes, and complete extracted content.
5
+
6
+ ## Operations brief
7
+
8
+ ![Operations brief: document and complete extraction](hero-0.png)
9
+
10
+ ## Delivery summary
11
+
12
+ ![Delivery summary: document and complete extraction](hero-1.png)
13
+
14
+ ## Research note
15
+
16
+ ![Research note: document and complete extraction](hero-2.png)
assets/parse-demo.gif ADDED

Git LFS Details

  • SHA256: a1517a178428ac3e444acd64777c692dcb19a0f11ebf57ea4b15b1070ca66963
  • Pointer size: 132 Bytes
  • Size of remote file: 1.2 MB
assets/parse-demo.png ADDED

Git LFS Details

  • SHA256: d971a6e48c208e5d0083c2504523ca6ace982831a3f774254eca4fca857eb50d
  • Pointer size: 131 Bytes
  • Size of remote file: 303 kB
assets/prompt-boxes.png ADDED

Git LFS Details

  • SHA256: 3e61552e9bb45c3cb38cad5f7d816a5198093a8bddf024994cff6fd24dce5428
  • Pointer size: 131 Bytes
  • Size of remote file: 130 kB
assets/prompt-classes.png ADDED
assets/prompt-format.png ADDED
dflash2/README.md CHANGED
@@ -1,78 +1,57 @@
1
- # Nemotron 3.5 Parse DFlash2
2
 
3
- A compact, three-layer, approximately 89.3M-parameter DFlash2 drafter for
4
- [Nemotron 3.5 Parse](https://huggingface.co/nvidia/Nemotron-3.5-Parse).
5
- This is the benchmarked step-63,000 checkpoint. It requires the target model;
6
- vLLM shares its embeddings and output head. These are inference weights and
7
- configuration; no training code, optimizer state or custom runtime is needed.
8
-
9
- ## Usage
10
 
11
  ```bash
12
  hf download nvidia/Nemotron-3.5-Parse --local-dir ./parse35
13
-
14
  vllm serve ./parse35 \
 
15
  --trust-remote-code \
16
  --speculative-config '{"method":"dflash","model":"./parse35/dflash2","num_speculative_tokens":32}'
17
  ```
18
 
19
- Requires a vLLM build with native Nemotron Parse and `DFlash2DraftModel` support.
20
- Validated build: `0.32.1rc1.dev505+g00b6c4c56`, BF16 on one H200. No model-specific
21
- package, worker plugin, selector hook or installed-source modification is
22
- required. Model Runner V2 is selected automatically on the validated build;
23
- the V1 runner does not support this drafter. Earlier builds are not qualified.
24
-
25
- The draft supports up to 32 speculative tokens. `block_size=33` in the
26
- configuration includes the anchor token. Keep the local folder in
27
- `speculative_config.model`: `nvidia/Nemotron-3.5-Parse/dflash2` is not a remote
28
- Hugging Face model ID. The target's normal prompt and sampling parameters still
29
- apply; see [serving guidance](../docs/serving.md).
30
 
31
  ## Performance
32
 
33
- ![Throughput and speedup across concurrency](performance/concurrency.png)
34
-
35
- | Concurrent requests | Draft tokens | Base pages/s | MTP pages/s | DFlash2 pages/s | vs. base | vs. MTP |
36
- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
37
- | 1 | 32 | 0.52 | 0.75 | 3.59 | 6.88× | 4.76× |
38
- | 2 | 32 | 0.97 | 1.45 | 5.88 | 6.06× | 4.05× |
39
- | 4 | 32 | 1.84 | 2.58 | 9.26 | 5.02× | 3.59× |
40
- | 8 | 32 | 3.26 | 4.65 | 13.56 | 4.16× | 2.91× |
41
- | 16 | 32 | 5.33 | 7.26 | 15.87 | 2.98× | 2.19× |
42
- | 32 | 16 | 8.39 | 10.91 | 18.12 | 2.16× | 1.66× |
43
- | 64 | 32 | 10.32 | 13.85 | 17.68 | 1.71× | 1.28× |
44
- | 128 | 16 | 12.61 | 14.89 | 19.63 | 1.56× | 1.32× |
45
- | 256 | 32 | 13.58 | 16.31 | 18.04 | 1.33× | 1.11× |
46
- | 512 | 8 | 13.72 | 16.54 | 19.79 | 1.44× | 1.20× |
47
-
48
- At concurrency 1, 8, 32, 128 and 512, we tested native draft lengths 8, 16 and
49
- 32 and selected the highest median throughput. At 2, 4, 16, 64 and 256, only
50
- length 32 was tested. The selected lengths are an exploratory tuning result
51
- from these measurements, not independently validated optima. Change
52
- `num_speculative_tokens` in the launch command to use the chosen length.
53
- vLLM keeps that length fixed for the server; it does not switch it automatically
54
- with request concurrency. This release uses the native candidate selector.
55
-
56
- The benchmark uses one H200, BF16, TP1, 2,078 ParseBench pages per trial, three
57
- trials per point, engine capacity 512 and a 32,768-token batching budget.
58
- It times preprocessing, prefill, decode, refill and drain; it excludes startup,
59
- image loading, warmup and serialization, and does not use HTTP. The default
60
- launch command is a usage example rather than a reproduction of all benchmark
61
- settings. Hardware, page length, concurrency and runtime settings affect speed.
62
- See [full protocol and downloadable results](performance/README.md).
63
-
64
- The measurements are single-pass throughput results, separate from the target
65
- model card's triple-pass ParseBench quality scores. Speculative target
66
- verification is active, but fast-attention execution can change greedy outputs
67
- between target-only and speculative shapes. Exact-output equality and
68
- parsing-quality equivalence are not claimed by this performance curve.
69
-
70
- ## Model details
71
-
72
- Hidden size 1,024; three decoder layers; 16 query heads and eight KV heads;
73
- intermediate size 4,096; target hidden-state layers 1/4/8; grouped convolutions;
74
- native top-16, rank-256 candidate selector; maximum context 16,384 positions.
75
- The inference package is approximately 179 MB in decimal units (170 MiB).
76
 
77
  ## License
78
 
 
1
+ # DFlash2 for Nemotron 3.5 Parse
2
 
3
+ An optional 89.3M-parameter drafter that accelerates the target model's decoding.
4
+ It requires the target model and shares its embeddings and output head.
 
 
 
 
 
5
 
6
  ```bash
7
  hf download nvidia/Nemotron-3.5-Parse --local-dir ./parse35
 
8
  vllm serve ./parse35 \
9
+ --served-model-name nemotron-parse \
10
  --trust-remote-code \
11
  --speculative-config '{"method":"dflash","model":"./parse35/dflash2","num_speculative_tokens":32}'
12
  ```
13
 
14
+ Use vLLM with native Nemotron Parse and DFlash2 support. No model-specific package,
15
+ worker plugin, selector hook or source modification is required. The usual Parse
16
+ prompts and postprocessing apply. See [serving](../docs/serving.md).
 
 
 
 
 
 
 
 
17
 
18
  ## Performance
19
 
20
+ ![Pages per second across concurrency](performance/concurrency.png)
21
+
22
+ The curve uses the fastest tested native draft length at each concurrency.
23
+ Set `num_speculative_tokens` to the chosen length for your workload; the server
24
+ keeps that length fixed.
25
+
26
+ The curve uses one H200, BF16, 2,078 ParseBench pages and three trials per point.
27
+ See [the benchmark protocol and downloadable data](performance/README.md).
28
+ The basic command above does not set every benchmark option. These single-pass
29
+ measurements are separate from the reference triple-pass quality scores. Verified
30
+ speculative execution can change greedy outputs because attention execution shapes
31
+ differ; the curve does not establish exact-output or parsing-quality equivalence.
32
+
33
+ The drafter supports up to 32 speculative tokens and a 16,384-position context.
34
+ Its inference weights occupy approximately 179 MB. Use the local `./parse35/dflash2`
35
+ folder; `nvidia/Nemotron-3.5-Parse/dflash2` is not a Hub model ID.
36
+
37
+ ## Draft-length tuning
38
+
39
+ Native single-pass pages/s on one H200, BF16, 2,078 pages; median of three runs. A dash means no three-run result under this native protocol. These are separate from HTTP multipass timings.
40
+
41
+ | Concurrency | 8 tokens | 16 tokens | 32 tokens | Best tested length |
42
+ | ---: | ---: | ---: | ---: | ---: |
43
+ | 1 | 2.21 | 3.02 | 3.74 | 32 |
44
+ | 2 | — | — | 5.88 | 32 |
45
+ | 4 | — | — | 9.26 | 32 |
46
+ | 8 | 10.55 | 12.64 | 13.53 | 32 |
47
+ | 16 | — | — | 15.87 | 32 |
48
+ | 32 | 17.19 | 18.12 | 17.05 | 16 |
49
+ | 64 | — | 19.10 | 17.68 | 16 |
50
+ | 128 | 19.00 | 19.63 | 18.15 | 16 |
51
+ | 256 | 19.05 | 19.52 | 18.04 | 16 |
52
+ | 512 | 19.79 | 19.50 | 18.45 | 8 |
53
+
54
+ The 32-token values use the original concurrency sweep; 8/16-token values use the length sweep and new full-set tests. All use the same documented native settings. These are best tested choices rather than a universal optimum.
 
 
 
 
 
 
 
 
55
 
56
  ## License
57
 
dflash2/performance/README.md CHANGED
@@ -1,52 +1,24 @@
1
- # DFlash2 concurrency benchmark
2
 
3
- ![Throughput comparison](concurrency.png)
 
 
4
 
5
- | Concurrent requests | Draft tokens | Base pages/s | MTP pages/s | DFlash2 pages/s | vs. base | vs. MTP |
6
- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
7
- | 1 | 32 | 0.52 | 0.75 | 3.59 | 6.88× | 4.76× |
8
- | 2 | 32 | 0.97 | 1.45 | 5.88 | 6.06× | 4.05× |
9
- | 4 | 32 | 1.84 | 2.58 | 9.26 | 5.02× | 3.59× |
10
- | 8 | 32 | 3.26 | 4.65 | 13.56 | 4.16× | 2.91× |
11
- | 16 | 32 | 5.33 | 7.26 | 15.87 | 2.98× | 2.19× |
12
- | 32 | 16 | 8.39 | 10.91 | 18.12 | 2.16× | 1.66× |
13
- | 64 | 32 | 10.32 | 13.85 | 17.68 | 1.71× | 1.28× |
14
- | 128 | 16 | 12.61 | 14.89 | 19.63 | 1.56× | 1.32× |
15
- | 256 | 32 | 13.58 | 16.31 | 18.04 | 1.33× | 1.11× |
16
- | 512 | 8 | 13.72 | 16.54 | 19.79 | 1.44× | 1.20× |
17
 
18
- The [JSON](results.json) records the complete protocol and aggregate values.
19
- The [CSV](results.csv), [SVG](concurrency.svg) and [PDF](concurrency.pdf) are also
20
- available. Each point is the median of three independent full 2,078-page trials;
21
- shading shows observed minimum/maximum, not a confidence interval.
 
 
 
 
22
 
23
- One NVIDIA H200 (141 GB), BF16, TP1, vLLM
24
- `0.32.1rc1.dev505+g00b6c4c56`; maximum context 16,384; engine capacity 512;
25
- batched-token budget 32,768; GPU memory utilization 0.8; prefix caching disabled;
26
- asynchronous scheduling and chunked prefill enabled; multimodal processor cache
27
- disabled; FlashAttention 3; full-decode CUDA graphs with model compilation
28
- disabled. Sampling: temperature 0, top-k 1, repetition penalty 1.1, output budget
29
- 8,744 tokens, seed 41. Every trial uses the same established parsing task prompt.
30
-
31
- Native closed-loop timing includes preprocessing, prefill, decoding, refill and
32
- drain. It excludes engine startup, image loading, capacity-sized 32-token warmup,
33
- and serialization; there is no HTTP layer. Encoder/multimodal caches are reset
34
- after warmup. MTP uses the target's bundled one-token head. Base inference
35
- disables speculation. All methods retain target verification and the same
36
- runtime, page population, prompts, decoding, engine capacity and batching budget.
37
-
38
- DFlash2 uses checkpoint 63,000 and native candidate selection. At concurrency
39
- 1/8/32/128/512 the draft-length sweep tests 8/16/32 tokens; the plotted DFlash2
40
- point is the best median from that sweep. At 2/4/16/64/256 only fixed length 32
41
- was tested, using the original concurrency sweep. The length sweep and original
42
- sweep are separate experiments under the matched settings above. Source-report
43
- SHA-256 digests are recorded in the JSON. Best lengths were selected on these
44
- measurements; there is no independent selection-validation split or live
45
- concurrency-dependent policy in the released model.
46
-
47
- Some pages reach the output-token budget; these are throughput measurements,
48
- not a parsing-quality equivalence evaluation. Fast attention may produce
49
- different greedy outputs across target-only and speculative shapes. These
50
- single-pass results do not replace the target model card's triple-pass quality
51
- benchmarks. The simple serving command uses defaults that differ from this
52
- benchmark's explicit performance settings.
 
1
+ # Concurrency throughput
2
 
3
+ The plot uses the best tested native draft length at each concurrency: 32 at
4
+ 1–16, 16 at 32–256, and 8 at 512. Each plotted choice has three full-set trials.
5
+ The server uses a fixed draft length.
6
 
7
+ Each point is the median of three full 2,078-page trials on one H200/BF16.
8
+ Shading shows observed min/max, not confidence intervals. Base/MTP and the
9
+ 32-token points use the original matched concurrency sweep. Other points use
10
+ the native draft-length sweep and new full-set tests at concurrency 64 and 256.
11
+ The plot contains throughput only, with no per-point draft-length annotations.
 
 
 
 
 
 
 
12
 
13
+ Native closed-loop single-pass decoding, greedy temperature 0/top-k 1,
14
+ repetition penalty 1.1, 8,744-token cap, TP1, engine capacity 512, maximum context
15
+ 16,384, batched-token budget 32,768, GPU-memory utilization 0.8, prefix caching
16
+ off, processor cache 0, async scheduling and chunked prefill on, FA3, compilation
17
+ off and full-decode CUDA graphs. Timing includes preprocessing, prefill, decode,
18
+ refill and drain; it excludes startup, image loading, warmup and serialization.
19
+ There is no HTTP. Token-limited pages remain visible in the downloadable data.
20
+ Do not combine these rates with the HTTP multipass pipeline measurements.
21
 
22
+ [JSON data](results.json) contains settings, ranges and source identities;
23
+ [CSV](results.csv) contains plotted values. The accompanying pass timings and
24
+ quality scores use their own explicitly documented protocols.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dflash2/performance/concurrency.pdf CHANGED
Binary files a/dflash2/performance/concurrency.pdf and b/dflash2/performance/concurrency.pdf differ
 
dflash2/performance/concurrency.png CHANGED

Git LFS Details

  • SHA256: 90daa9081994686723e81c7d1a43240f94a7feda0b615d5765890a6aede24ba7
  • Pointer size: 131 Bytes
  • Size of remote file: 233 kB

Git LFS Details

  • SHA256: 9c17616f94ed848ee8d25ca3b659098cc9b1db4359709d8d2cf1a09ce78ae7fc
  • Pointer size: 131 Bytes
  • Size of remote file: 170 kB
dflash2/performance/concurrency.svg CHANGED
dflash2/performance/draft-lengths.json ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "rows": [
3
+ {
4
+ "concurrency": 1,
5
+ "tested_rates": {
6
+ "8": 2.2108561330942393,
7
+ "16": 3.021511949376218,
8
+ "32": 3.7446092933709183
9
+ },
10
+ "best_tested_length": 32
11
+ },
12
+ {
13
+ "concurrency": 2,
14
+ "tested_rates": {
15
+ "32": 5.883906253469279
16
+ },
17
+ "best_tested_length": 32
18
+ },
19
+ {
20
+ "concurrency": 4,
21
+ "tested_rates": {
22
+ "32": 9.256247483196882
23
+ },
24
+ "best_tested_length": 32
25
+ },
26
+ {
27
+ "concurrency": 8,
28
+ "tested_rates": {
29
+ "8": 10.549156733860887,
30
+ "16": 12.641692517219202,
31
+ "32": 13.531543015454753
32
+ },
33
+ "best_tested_length": 32
34
+ },
35
+ {
36
+ "concurrency": 16,
37
+ "tested_rates": {
38
+ "32": 15.87096877311351
39
+ },
40
+ "best_tested_length": 32
41
+ },
42
+ {
43
+ "concurrency": 32,
44
+ "tested_rates": {
45
+ "8": 17.189132696632495,
46
+ "16": 18.12055641540848,
47
+ "32": 17.05121141869504
48
+ },
49
+ "best_tested_length": 16
50
+ },
51
+ {
52
+ "concurrency": 64,
53
+ "tested_rates": {
54
+ "16": 19.09674833981213,
55
+ "32": 17.683460109432588
56
+ },
57
+ "best_tested_length": 16
58
+ },
59
+ {
60
+ "concurrency": 128,
61
+ "tested_rates": {
62
+ "8": 19.00448074115009,
63
+ "16": 19.630127496093024,
64
+ "32": 18.14602028790623
65
+ },
66
+ "best_tested_length": 16
67
+ },
68
+ {
69
+ "concurrency": 256,
70
+ "tested_rates": {
71
+ "8": 19.05230304465591,
72
+ "16": 19.519740880365504,
73
+ "32": 18.035788599093195
74
+ },
75
+ "best_tested_length": 16
76
+ },
77
+ {
78
+ "concurrency": 512,
79
+ "tested_rates": {
80
+ "8": 19.786097084173154,
81
+ "16": 19.502632231125695,
82
+ "32": 18.446999616392223
83
+ },
84
+ "best_tested_length": 8
85
+ }
86
+ ],
87
+ "protocol": "native greedy;three full-set trials per populated cell"
88
+ }
dflash2/performance/results.csv CHANGED
@@ -1,31 +1,31 @@
1
  method,concurrency,draft_tokens,repeats,pages_per_second,pages_per_second_min,pages_per_second_max,output_tokens_per_second,length_capped_pages_median,speedup_vs_base,speedup_vs_mtp,source
2
  base,1,0,3,0.5220123160780666,0.5051842429114736,0.5409505654392305,653.4433611686095,12,1.0,0.692152920459014,fixed32-concurrency-sweep
3
  mtp,1,1,3,0.7541863953010334,0.739504400311975,0.7928127390277402,946.764153073649,13,1.4447674356944582,1.0,fixed32-concurrency-sweep
4
- dflash2,1,32,3,3.5921570985247993,3.376719870809708,3.71158348555005,4486.911917676116,11,6.881364649617949,4.762956638976483,native-length-sweep
5
  base,2,0,3,0.9708151972783484,0.9695792861749863,1.0115310026687216,1219.0556332211047,13,1.0,0.668997734251042,fixed32-concurrency-sweep
6
  mtp,2,1,3,1.4511487073498055,1.3685857377044754,1.5575479578935163,1820.6050228567422,13,1.494773373365042,1.0,fixed32-concurrency-sweep
7
- dflash2,2,32,3,5.883906253469279,5.8078578119272555,6.383178559911333,7433.797382420906,13,6.060789190326475,4.05465423610162,fixed32-concurrency-sweep
8
  base,4,0,3,1.8441213789282944,1.7490463452010294,1.895342741414147,2302.2293503683513,11,1.0,0.7142931404297003,fixed32-concurrency-sweep
9
  mtp,4,1,3,2.5817430891453315,2.491618737904503,2.6971964073287187,3219.9802957634697,11,1.399985444909111,1.0,fixed32-concurrency-sweep
10
- dflash2,4,32,3,9.256247483196882,9.07507934183089,9.326748194339213,11580.545569932765,12,5.019326595831844,3.5852705569790446,fixed32-concurrency-sweep
11
  base,8,0,3,3.2603292832877857,3.0994804468239012,3.327938769422553,4086.4571855122085,12,1.0,0.7004126017647565,fixed32-concurrency-sweep
12
  mtp,8,1,3,4.65486953700301,4.379883171747302,4.697798478026548,5850.819316714751,12,1.427729880188341,1.0,fixed32-concurrency-sweep
13
- dflash2,8,32,3,13.562505218579648,13.306153523750387,13.782964300862282,17041.281280434443,13,4.159857499087616,2.9136166139065907,native-length-sweep
14
  base,16,0,3,5.331603594101347,5.308570575873248,5.813006902986834,6668.453163430977,12,1.0,0.7343970038987513,fixed32-concurrency-sweep
15
  mtp,16,1,3,7.259838433159507,7.121532108319576,7.302346834695316,9109.228122180271,13,1.3616613285337782,1.0,fixed32-concurrency-sweep
16
- dflash2,16,32,3,15.87096877311351,15.765674316129054,16.067381900155073,19986.79672844285,13,2.976772089859129,2.186132504081969,fixed32-concurrency-sweep
17
  base,32,0,3,8.387748185318936,7.571553076869122,8.423169830802667,10527.051836534669,13,1.0,0.7686738097387561,fixed32-concurrency-sweep
18
  mtp,32,1,3,10.91197342624386,10.629285888687653,11.134039412453397,13638.092107870672,12,1.300941943553226,1.0,fixed32-concurrency-sweep
19
  dflash2,32,16,3,18.12055641540848,17.81386207538995,18.605220982032854,22635.897355527708,11,2.160360088912167,1.660612219951673,native-length-sweep
20
  base,64,0,3,10.318713480163451,10.278543544467862,10.856718912912338,12925.524405765244,12,1.0,0.7450122608149818,fixed32-concurrency-sweep
21
  mtp,64,1,3,13.85039417858121,13.281504906589666,13.917350060357318,17329.822485161505,11,1.342259788994724,1.0,fixed32-concurrency-sweep
22
- dflash2,64,32,3,17.683460109432588,17.55843693026921,17.932503507516834,22200.826791093412,13,1.7137272144853155,1.2767477864838663,fixed32-concurrency-sweep
23
  base,128,0,3,12.605561199266866,12.310616111672509,12.762569769969653,15714.639762141867,10,1.0,0.8463675441115379,fixed32-concurrency-sweep
24
  mtp,128,1,3,14.893719976584608,14.749430947571339,15.501219734132347,18640.902515486487,12,1.1815197864773224,1.0,fixed32-concurrency-sweep
25
  dflash2,128,16,3,19.630127496093024,19.030798382141462,19.772716071559262,24497.548917109347,12,1.5572593068870828,1.318013735114856,native-length-sweep
26
  base,256,0,3,13.580824223832028,13.146387863076619,13.622161781959232,17031.536506995526,12,1.0,0.8326236101166469,fixed32-concurrency-sweep
27
  mtp,256,1,3,16.31088052130712,15.91505581072645,16.35363731663642,20405.774309706794,12,1.2010228725797296,1.0,fixed32-concurrency-sweep
28
- dflash2,256,32,3,18.035788599093195,17.859729313771872,18.191532678479106,22649.843256053704,12,1.3280334316854985,1.105751990245579,fixed32-concurrency-sweep
29
  base,512,0,3,13.72360472005324,13.565715948204142,13.788153776091523,17221.935160986544,12,1.0,0.8297597723082074,fixed32-concurrency-sweep
30
  mtp,512,1,3,16.539250489183416,16.35363207758332,16.570745306879584,20749.914438313685,13,1.2051680900584298,1.0,fixed32-concurrency-sweep
31
  dflash2,512,8,3,19.786097084173154,19.752025552147288,19.900747822430578,24790.560912847428,12,1.44175655651618,1.1963115920587306,native-length-sweep
 
1
  method,concurrency,draft_tokens,repeats,pages_per_second,pages_per_second_min,pages_per_second_max,output_tokens_per_second,length_capped_pages_median,speedup_vs_base,speedup_vs_mtp,source
2
  base,1,0,3,0.5220123160780666,0.5051842429114736,0.5409505654392305,653.4433611686095,12,1.0,0.692152920459014,fixed32-concurrency-sweep
3
  mtp,1,1,3,0.7541863953010334,0.739504400311975,0.7928127390277402,946.764153073649,13,1.4447674356944582,1.0,fixed32-concurrency-sweep
4
+ dflash2,1,32,3,3.7446092933709183,3.512258036166125,3.74627355068174,4677.337767985349,11,7.173411772167678,4.96509790776093,original-fixed32-sweep
5
  base,2,0,3,0.9708151972783484,0.9695792861749863,1.0115310026687216,1219.0556332211047,13,1.0,0.668997734251042,fixed32-concurrency-sweep
6
  mtp,2,1,3,1.4511487073498055,1.3685857377044754,1.5575479578935163,1820.6050228567422,13,1.494773373365042,1.0,fixed32-concurrency-sweep
7
+ dflash2,2,32,3,5.883906253469279,5.8078578119272555,6.383178559911333,7433.797382420906,13,6.060789190326475,4.05465423610162,original-fixed32-sweep
8
  base,4,0,3,1.8441213789282944,1.7490463452010294,1.895342741414147,2302.2293503683513,11,1.0,0.7142931404297003,fixed32-concurrency-sweep
9
  mtp,4,1,3,2.5817430891453315,2.491618737904503,2.6971964073287187,3219.9802957634697,11,1.399985444909111,1.0,fixed32-concurrency-sweep
10
+ dflash2,4,32,3,9.256247483196882,9.07507934183089,9.326748194339213,11580.545569932765,12,5.019326595831844,3.5852705569790446,original-fixed32-sweep
11
  base,8,0,3,3.2603292832877857,3.0994804468239012,3.327938769422553,4086.4571855122085,12,1.0,0.7004126017647565,fixed32-concurrency-sweep
12
  mtp,8,1,3,4.65486953700301,4.379883171747302,4.697798478026548,5850.819316714751,12,1.427729880188341,1.0,fixed32-concurrency-sweep
13
+ dflash2,8,32,3,13.531543015454753,13.40795685381514,13.60250106058955,16968.554941380262,13,4.150360849996494,2.9069650412086303,original-fixed32-sweep
14
  base,16,0,3,5.331603594101347,5.308570575873248,5.813006902986834,6668.453163430977,12,1.0,0.7343970038987513,fixed32-concurrency-sweep
15
  mtp,16,1,3,7.259838433159507,7.121532108319576,7.302346834695316,9109.228122180271,13,1.3616613285337782,1.0,fixed32-concurrency-sweep
16
+ dflash2,16,32,3,15.87096877311351,15.765674316129054,16.067381900155073,19986.79672844285,13,2.976772089859129,2.186132504081969,original-fixed32-sweep
17
  base,32,0,3,8.387748185318936,7.571553076869122,8.423169830802667,10527.051836534669,13,1.0,0.7686738097387561,fixed32-concurrency-sweep
18
  mtp,32,1,3,10.91197342624386,10.629285888687653,11.134039412453397,13638.092107870672,12,1.300941943553226,1.0,fixed32-concurrency-sweep
19
  dflash2,32,16,3,18.12055641540848,17.81386207538995,18.605220982032854,22635.897355527708,11,2.160360088912167,1.660612219951673,native-length-sweep
20
  base,64,0,3,10.318713480163451,10.278543544467862,10.856718912912338,12925.524405765244,12,1.0,0.7450122608149818,fixed32-concurrency-sweep
21
  mtp,64,1,3,13.85039417858121,13.281504906589666,13.917350060357318,17329.822485161505,11,1.342259788994724,1.0,fixed32-concurrency-sweep
22
+ dflash2,64,16,3,19.09674833981213,18.394496395618248,19.31116508485648,23944.767607711292,11,1.8506908227002765,1.3787873538894717,new-native-full-set-tests
23
  base,128,0,3,12.605561199266866,12.310616111672509,12.762569769969653,15714.639762141867,10,1.0,0.8463675441115379,fixed32-concurrency-sweep
24
  mtp,128,1,3,14.893719976584608,14.749430947571339,15.501219734132347,18640.902515486487,12,1.1815197864773224,1.0,fixed32-concurrency-sweep
25
  dflash2,128,16,3,19.630127496093024,19.030798382141462,19.772716071559262,24497.548917109347,12,1.5572593068870828,1.318013735114856,native-length-sweep
26
  base,256,0,3,13.580824223832028,13.146387863076619,13.622161781959232,17031.536506995526,12,1.0,0.8326236101166469,fixed32-concurrency-sweep
27
  mtp,256,1,3,16.31088052130712,15.91505581072645,16.35363731663642,20405.774309706794,12,1.2010228725797296,1.0,fixed32-concurrency-sweep
28
+ dflash2,256,16,3,19.519740880365504,19.1167691009575,19.522243988617216,24444.874576041504,12,1.4373016363846085,1.1967312773131167,new-native-full-set-tests
29
  base,512,0,3,13.72360472005324,13.565715948204142,13.788153776091523,17221.935160986544,12,1.0,0.8297597723082074,fixed32-concurrency-sweep
30
  mtp,512,1,3,16.539250489183416,16.35363207758332,16.570745306879584,20749.914438313685,13,1.2051680900584298,1.0,fixed32-concurrency-sweep
31
  dflash2,512,8,3,19.786097084173154,19.752025552147288,19.900747822430578,24790.560912847428,12,1.44175655651618,1.1963115920587306,native-length-sweep
dflash2/performance/results.json CHANGED
@@ -38,7 +38,7 @@
38
  ],
39
  "warmup": "512 pages, 32 output tokens; excluded; encoder/multimodal caches reset afterward",
40
  "timing": "Closed-loop preprocessing, prefill, decode, refill and drain; excludes startup, image loading, warmup, serialization; no HTTP",
41
- "selection": "Best median among native lengths 8,16,32 at concurrency 1,8,32,128,512. Only length32 tested at 2,4,16,64,256. Length selected on the plotted measurements; not independently validated or automatically adjusted by vLLM.",
42
  "source_report_sha256": {
43
  "fixed32": "5998d284edd51bbcbba5fed56cda808116f02fc782ad0a629c0adf2ef04b2128",
44
  "native_lengths": "4f3b9201561a82f6ec36705c49ba1fb9bdb26262c8a8bd9961745b592eae2f43",
@@ -81,19 +81,19 @@
81
  "concurrency": 1,
82
  "draft_tokens": 32,
83
  "repeats": 3,
84
- "pages_per_second": 3.5921570985247993,
85
- "pages_per_second_min": 3.376719870809708,
86
- "pages_per_second_max": 3.71158348555005,
87
- "output_tokens_per_second": 4486.911917676116,
88
  "length_capped_pages_median": 11,
89
- "speedup_vs_base": 6.881364649617949,
90
- "speedup_vs_mtp": 4.762956638976483,
91
  "tested_native_draft_lengths": [
92
  8,
93
  16,
94
  32
95
  ],
96
- "source": "native-length-sweep"
97
  },
98
  {
99
  "method": "base",
@@ -140,7 +140,7 @@
140
  "tested_native_draft_lengths": [
141
  32
142
  ],
143
- "source": "fixed32-concurrency-sweep"
144
  },
145
  {
146
  "method": "base",
@@ -187,7 +187,7 @@
187
  "tested_native_draft_lengths": [
188
  32
189
  ],
190
- "source": "fixed32-concurrency-sweep"
191
  },
192
  {
193
  "method": "base",
@@ -224,19 +224,19 @@
224
  "concurrency": 8,
225
  "draft_tokens": 32,
226
  "repeats": 3,
227
- "pages_per_second": 13.562505218579648,
228
- "pages_per_second_min": 13.306153523750387,
229
- "pages_per_second_max": 13.782964300862282,
230
- "output_tokens_per_second": 17041.281280434443,
231
  "length_capped_pages_median": 13,
232
- "speedup_vs_base": 4.159857499087616,
233
- "speedup_vs_mtp": 2.9136166139065907,
234
  "tested_native_draft_lengths": [
235
  8,
236
  16,
237
  32
238
  ],
239
- "source": "native-length-sweep"
240
  },
241
  {
242
  "method": "base",
@@ -283,7 +283,7 @@
283
  "tested_native_draft_lengths": [
284
  32
285
  ],
286
- "source": "fixed32-concurrency-sweep"
287
  },
288
  {
289
  "method": "base",
@@ -367,19 +367,20 @@
367
  {
368
  "method": "dflash2",
369
  "concurrency": 64,
370
- "draft_tokens": 32,
371
  "repeats": 3,
372
- "pages_per_second": 17.683460109432588,
373
- "pages_per_second_min": 17.55843693026921,
374
- "pages_per_second_max": 17.932503507516834,
375
- "output_tokens_per_second": 22200.826791093412,
376
- "length_capped_pages_median": 13,
377
- "speedup_vs_base": 1.7137272144853155,
378
- "speedup_vs_mtp": 1.2767477864838663,
379
  "tested_native_draft_lengths": [
 
380
  32
381
  ],
382
- "source": "fixed32-concurrency-sweep"
383
  },
384
  {
385
  "method": "base",
@@ -463,19 +464,21 @@
463
  {
464
  "method": "dflash2",
465
  "concurrency": 256,
466
- "draft_tokens": 32,
467
  "repeats": 3,
468
- "pages_per_second": 18.035788599093195,
469
- "pages_per_second_min": 17.859729313771872,
470
- "pages_per_second_max": 18.191532678479106,
471
- "output_tokens_per_second": 22649.843256053704,
472
  "length_capped_pages_median": 12,
473
- "speedup_vs_base": 1.3280334316854985,
474
- "speedup_vs_mtp": 1.105751990245579,
475
  "tested_native_draft_lengths": [
 
 
476
  32
477
  ],
478
- "source": "fixed32-concurrency-sweep"
479
  },
480
  {
481
  "method": "base",
@@ -526,5 +529,11 @@
526
  ],
527
  "source": "native-length-sweep"
528
  }
529
- ]
 
 
 
 
 
 
530
  }
 
38
  ],
39
  "warmup": "512 pages, 32 output tokens; excluded; encoder/multimodal caches reset afterward",
40
  "timing": "Closed-loop preprocessing, prefill, decode, refill and drain; excludes startup, image loading, warmup, serialization; no HTTP",
41
+ "selection": "Highest median native throughput at each concurrency among draft lengths with three completed full-set trials. Each server uses a fixed draft length.",
42
  "source_report_sha256": {
43
  "fixed32": "5998d284edd51bbcbba5fed56cda808116f02fc782ad0a629c0adf2ef04b2128",
44
  "native_lengths": "4f3b9201561a82f6ec36705c49ba1fb9bdb26262c8a8bd9961745b592eae2f43",
 
81
  "concurrency": 1,
82
  "draft_tokens": 32,
83
  "repeats": 3,
84
+ "pages_per_second": 3.7446092933709183,
85
+ "pages_per_second_min": 3.512258036166125,
86
+ "pages_per_second_max": 3.74627355068174,
87
+ "output_tokens_per_second": 4677.337767985349,
88
  "length_capped_pages_median": 11,
89
+ "speedup_vs_base": 7.173411772167678,
90
+ "speedup_vs_mtp": 4.96509790776093,
91
  "tested_native_draft_lengths": [
92
  8,
93
  16,
94
  32
95
  ],
96
+ "source": "original-fixed32-sweep"
97
  },
98
  {
99
  "method": "base",
 
140
  "tested_native_draft_lengths": [
141
  32
142
  ],
143
+ "source": "original-fixed32-sweep"
144
  },
145
  {
146
  "method": "base",
 
187
  "tested_native_draft_lengths": [
188
  32
189
  ],
190
+ "source": "original-fixed32-sweep"
191
  },
192
  {
193
  "method": "base",
 
224
  "concurrency": 8,
225
  "draft_tokens": 32,
226
  "repeats": 3,
227
+ "pages_per_second": 13.531543015454753,
228
+ "pages_per_second_min": 13.40795685381514,
229
+ "pages_per_second_max": 13.60250106058955,
230
+ "output_tokens_per_second": 16968.554941380262,
231
  "length_capped_pages_median": 13,
232
+ "speedup_vs_base": 4.150360849996494,
233
+ "speedup_vs_mtp": 2.9069650412086303,
234
  "tested_native_draft_lengths": [
235
  8,
236
  16,
237
  32
238
  ],
239
+ "source": "original-fixed32-sweep"
240
  },
241
  {
242
  "method": "base",
 
283
  "tested_native_draft_lengths": [
284
  32
285
  ],
286
+ "source": "original-fixed32-sweep"
287
  },
288
  {
289
  "method": "base",
 
367
  {
368
  "method": "dflash2",
369
  "concurrency": 64,
370
+ "draft_tokens": 16,
371
  "repeats": 3,
372
+ "pages_per_second": 19.09674833981213,
373
+ "pages_per_second_min": 18.394496395618248,
374
+ "pages_per_second_max": 19.31116508485648,
375
+ "output_tokens_per_second": 23944.767607711292,
376
+ "length_capped_pages_median": 11,
377
+ "speedup_vs_base": 1.8506908227002765,
378
+ "speedup_vs_mtp": 1.3787873538894717,
379
  "tested_native_draft_lengths": [
380
+ 16,
381
  32
382
  ],
383
+ "source": "new-native-full-set-tests"
384
  },
385
  {
386
  "method": "base",
 
464
  {
465
  "method": "dflash2",
466
  "concurrency": 256,
467
+ "draft_tokens": 16,
468
  "repeats": 3,
469
+ "pages_per_second": 19.519740880365504,
470
+ "pages_per_second_min": 19.1167691009575,
471
+ "pages_per_second_max": 19.522243988617216,
472
+ "output_tokens_per_second": 24444.874576041504,
473
  "length_capped_pages_median": 12,
474
+ "speedup_vs_base": 1.4373016363846085,
475
+ "speedup_vs_mtp": 1.1967312773131167,
476
  "tested_native_draft_lengths": [
477
+ 8,
478
+ 16,
479
  32
480
  ],
481
+ "source": "new-native-full-set-tests"
482
  },
483
  {
484
  "method": "base",
 
529
  ],
530
  "source": "native-length-sweep"
531
  }
532
+ ],
533
+ "native256_comparison": {
534
+ "native8_pages_per_second": 19.05230304465591,
535
+ "native32_pages_per_second": 18.035788599093195,
536
+ "native8_faster": true
537
+ },
538
+ "plot_layout": "throughput_only"
539
  }
docs/postprocessing-reference.md ADDED
@@ -0,0 +1,446 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Document postprocessing and multipass parsing
2
+
3
+ The public helpers operate on model predictions and ordinary page images. They do
4
+ not load benchmark labels, scorer code, category IDs, reference answers, or
5
+ page-specific rules. They are adapted from the general conversion and crop-merge
6
+ components of the bundled ParseBench pipeline. The pinned reproduction bundle
7
+ remains unchanged so its recorded hashes and results stay reproducible.
8
+
9
+ ## Installation
10
+
11
+ For vLLM, use the model card's repository-source installation:
12
+
13
+ ```bash
14
+ hf download nvidia/Nemotron-3.5-Parse --local-dir nemotron-parse
15
+ cd nemotron-parse
16
+ python -m pip install '.[vllm,client]'
17
+ ```
18
+
19
+ This installs the plugin, public `nemotron_parse` Python package, compatibility
20
+ modules, and `nemotron-parse` command. No prebuilt wheel is required.
21
+ The repository source installs the vLLM plugin, parsing helpers and CLI together.
22
+ Archived release artifacts and their digests are listed in the
23
+ [build evidence](../reference/package/README.md).
24
+ Use version 3.5.0.post5 or later for the restored merge default and post7 or later
25
+ for the corrected third-party notices.
26
+
27
+ For Transformers, keep the model card's inference dependencies. To download the
28
+ helpers without installing the package:
29
+
30
+ ```bash
31
+ python -m pip install 'beautifulsoup4==4.13.3' 'Pillow==12.2.0' 'numpy==2.2.6' 'httpx==0.28.1'
32
+ hf download nvidia/Nemotron-3.5-Parse \
33
+ --include 'postprocessing.py' 'latex2html.py' 'nemotron_parse/**' --local-dir .
34
+ ```
35
+
36
+ Run Python in that directory, or put it on your Python import path. Basic text/table
37
+ postprocessing only needs Beautiful Soup; the image wrappers also need Pillow and
38
+ NumPy. The HTTP backend needs httpx. Downloaded source and installed packages
39
+ provide the same public API.
40
+
41
+ ## Render an existing prediction
42
+
43
+ ```python
44
+ from nemotron_parse import postprocess_document, PostprocessOptions
45
+
46
+ options = PostprocessOptions(
47
+ infer_headers=True,
48
+ render_charts=True,
49
+ split_chart_value_percent=True,
50
+ relocate_chart_captions=True,
51
+ )
52
+ document = postprocess_document(raw_model_output, image_size=(width, height), options=options)
53
+ print(document['markdown'])
54
+ print(document['blocks'])
55
+ ```
56
+
57
+ `raw_out` contains the cleaned model serialization. Each block has its original
58
+ class, normalized `bbox`, literal `text`, and rendered `content`. Supplying
59
+ `image_size` adds clipped, ordered `bbox_pixels`. `markdown` renders the complete
60
+ page in model order, with section headings and HTML tables for span preservation.
61
+ Raw per-block text remains available independently of presentation changes.
62
+ Malformed table markup that cannot be converted is preserved rather than passed
63
+ through a lossy row splitter; document `warnings` identify these blocks.
64
+
65
+ Default cleanup preserves empty cells, spans, line breaks, nested inline styles,
66
+ and escaped literals. It removes exact repeated blocks at identical coordinates,
67
+ repairs empty incomplete serialization prefixes, removes internal continuation
68
+ markers, and normalizes existing bullets and soft hyphens in textual roles.
69
+ Code/math roles and marked code/math text are protected from soft-hyphen cleanup.
70
+ Table conversion is applied to Table/Chart blocks; literal LaTeX in prose, code,
71
+ formulas, or Picture blocks retains its source representation.
72
+ Header inference uses predicted span topology and existing bold styling, never an
73
+ English vocabulary list. It can still make mistakes; disable `infer_headers` to
74
+ use only explicit predicted headers. Unknown classes and page numbers are retained.
75
+
76
+ Chart titles, subtitles, and explicit panel labels can be rendered with their
77
+ associated tables. Two guarded presentation choices are enabled by default and can be disabled:
78
+
79
+ - `split_chart_value_percent=True` splits consistently predicted numeric pairs
80
+ such as `32 (16.6%)` into Value and Percent subcolumns. It requires at least two
81
+ matching nonempty cells, adds those column labels, and does not calculate values.
82
+ - `relocate_chart_captions=True` associates a plain caption immediately above a
83
+ chart when geometry and text-preservation checks pass. Notes below remain
84
+ standalone. Set `relocate_chart_captions=False` to retain the standalone caption in its source order.
85
+
86
+ `normalize_text=False`, `deduplicate=False`, and `render_charts=False` disable the
87
+ corresponding cleanup/rendering choices. The existing root imports continue to
88
+ work:
89
+
90
+ ```python
91
+ from postprocessing import extract_classes_bboxes, postprocess_text
92
+ from latex2html import convert_html_table_to_json_hierarchical
93
+ ```
94
+
95
+ `postprocess_text(..., cls='Table', table_format=...)` supports LaTeX, HTML,
96
+ Markdown, record JSON, hierarchical JSON, and CSV. HTML retains merged-cell
97
+ structure. Flat exports expand spans and use neutral column names for headerless
98
+ tables without consuming the first data row as a header. Duplicate column names
99
+ are disambiguated without overwriting values. Hierarchical JSON retains the
100
+ existing `headers`, `columns`, and flat `data` fields and additionally exposes
101
+ `body_cells` with explicit text, span, and header-role metadata.
102
+
103
+ ## Parse a page with a running vLLM server
104
+
105
+ Start the server using the model card. Then:
106
+
107
+ ```python
108
+ from nemotron_parse.inference import DocumentParser
109
+
110
+ with DocumentParser(base_url='http://localhost:8000/v1', model='nemotron-parse') as parser:
111
+ single = parser.parse('page.png')
112
+ double = parser.parse_double('page.png')
113
+ triple = parser.parse_triple('page.png', triple_regions='union')
114
+ documents = parser.parse_many(['one.png', 'two.png'], mode='double', concurrency=128)
115
+ ```
116
+
117
+ | Mode | Work performed |
118
+ | --- | --- |
119
+ | Single | Full-page parse and document rendering |
120
+ | Double | Full-page parse, then Table/Chart crops from its predicted regions |
121
+ | Triple | Full-page parse, separate detection, then Table/Chart crop parsing |
122
+
123
+ A pass denotes a stage, not one request: each retained crop needs its own model
124
+ call. `triple_regions='union'` retains detector regions first and adds parser
125
+ regions after overlap filtering; `'detector'` uses only the separate detector.
126
+ The region budget defaults to 80 per page and can be changed with `max_regions`.
127
+ Crops use 4% plus 12-pixel margins and JPEG quality 95, configurable margins, and
128
+ content-normalized coordinates mapped back to the original image. Tiny crops are
129
+ skipped. Crops are made in memory and no temporary image files remain.
130
+
131
+ The default `merge_policy="alternatives"` preserves differing overlapping
132
+ Table/Chart predictions from the full-page and crop passes. Near-identical blocks
133
+ are deduplicated using geometry and text. Guarded table refinement checks native
134
+ grid validity and compatible column counts; the original block order is preserved
135
+ and crop alternatives are inserted by their predicted geometry. This policy
136
+ matches the reference approach using only model predictions, without labels,
137
+ benchmark categories or scorer feedback.
138
+
139
+ A returned document can contain overlapping or conflicting Table/Chart hypotheses.
140
+ Use `DocumentParser(merge_policy="guarded")` (CLI: `--merge-policy guarded`) when
141
+ one selected prediction per overlapping same-class region is preferable. This
142
+ option applies conservative structural replacement and rejects overlapping
143
+ same-class additions. It can discard a correct alternative, reducing recall.
144
+ Raw stage responses remain available with either policy.
145
+
146
+ Returned results include `stages` with original raw responses and usage, and
147
+ `inference` with request counts, regions, sampling, and crop/rendering settings.
148
+ Empty, failed, filtered, or token-limited generations raise `GenerationError`;
149
+ its `stage` and `response` expose the failed response. Successful stage responses
150
+ from the same page are only returned when parsing completes. No automatic retry
151
+ policy changes the request settings.
152
+
153
+ Sampling is configurable per stage:
154
+
155
+ ```python
156
+ from nemotron_parse.inference import DocumentParser, GenerationSettings
157
+
158
+ with DocumentParser(
159
+ fullpage=GenerationSettings(temperature=0, top_k=1, repetition_penalty=1.1),
160
+ detection=GenerationSettings(temperature=0, top_k=1, max_tokens=4096),
161
+ crop=GenerationSettings(temperature=0, top_k=1, repetition_penalty=1.0),
162
+ ) as parser:
163
+ document = parser.parse_double('page.png')
164
+ ```
165
+
166
+ Defaults are temperature 0.2 / repetition penalty 1.05 for full-page and detection,
167
+ and 0.1 / 1.0 for crops, top-k 50, top-p 1.0, seed 0. Token caps are 8,744 for
168
+ parsing and 4,096 for detection. These are practical starting settings rather than
169
+ a claim of optimal sampling for every document type.
170
+
171
+ ## Use an already loaded Transformers model
172
+
173
+ Continue from the model card's Transformers setup:
174
+
175
+ ```python
176
+ from nemotron_parse.inference import DocumentParser, TransformersBackend
177
+
178
+ backend = TransformersBackend(model, processor, generation_config=generation)
179
+ with DocumentParser(backend=backend) as parser:
180
+ document = parser.parse_triple(image)
181
+ ```
182
+
183
+ This uses the same image/crop orchestration without a server or plugin. The adapter
184
+ serializes calls to the shared model, uses inference mode, applies stage settings,
185
+ and restores the CPU/current-GPU RNG after generation. Model weights and processor
186
+ remain caller-owned. Reaching the token cap is conservatively reported as
187
+ truncation, including when generation forces an EOS at the cap.
188
+
189
+ Other inference implementations can supply a callable
190
+ `backend(image, *, prompt, stage, settings)` returning
191
+ `{'raw_out': text, 'finish_reason': 'stop', 'usage': {...}}`. A string return is also
192
+ accepted, but then the custom backend must detect truncation itself. Custom
193
+ backends used with `parse_many` should support concurrent calls or use concurrency 1.
194
+
195
+ ## Command line
196
+
197
+ ```bash
198
+ nemotron-parse --image page.png --mode double --output parsed-page
199
+ nemotron-parse --image-dir pages --mode triple --triple-regions union --output parsed-pages
200
+ ```
201
+
202
+ The download-only equivalent is `python -m nemotron_parse.inference` with the same
203
+ arguments. The default outputs are compact `documents.jsonl.gz` and `metrics.json`, containing
204
+ blocks, raw stages, settings and timing. Add `--write-page-files` for individual
205
+ Markdown and JSON exports. Use a new/empty output directory. Files are written only
206
+ after all pages complete. The API accepts PIL images and image paths; the CLI
207
+ accepts image files. Render PDF pages to images before calling it.
208
+
209
+ ## Validation and scope
210
+
211
+ Run the focused CPU regression suite from the downloaded repository:
212
+
213
+ ```bash
214
+ python -m pip install pytest
215
+ python -m pytest -q tests/test_postprocessing.py tests/test_inference.py tests/test_batch.py
216
+ ```
217
+
218
+ The 86 focused tests passed from both source and the installed wheel. They cover
219
+ table structure, text preservation, chart defaults and opt-outs, crop geometry,
220
+ merge guards, HTTP handling, explicit truncation reporting, batch ordering,
221
+ independent-stage overlap, early crop submission, a shared concurrency bound,
222
+ and staged/pipelined region and output equivalence with deterministic responses.
223
+ The Transformers adapter is checked with a small CPU model stub. The real-model
224
+ H100 runs and official full-page scoring are recorded below and in
225
+ [the validation receipt](../reference/validation/postprocessing.json). The pinned reproduction
226
+ bundle and its recorded headline result remain unchanged.
227
+
228
+ ## Prepared batches and timing
229
+
230
+ `parser.prepare(images, workers=8)` returns a reusable in-memory batch containing
231
+ decoded RGB pixels and encoded image requests. Existing RGB JPEG/PNG/WebP payloads
232
+ are retained without another lossy encode. Other inputs are encoded as PNG.
233
+ The preparation time is reported separately, and cached images can occupy several
234
+ GB for thousands of document pages.
235
+
236
+ `parser.parse_prepared(batch, mode="double", concurrency=128, postprocess_workers=8)`
237
+ returns a `BatchResult` with `documents` and `metrics`. The default
238
+ `schedule="pipelined"` overlaps independent full-page and detection requests,
239
+ submits detector crops as soon as their regions are ready, and adds parser-only
240
+ regions in the original union order. Double-pass crops similarly start as each
241
+ page finishes its full-page request. Ready crops take the next available HTTP
242
+ slot, and new pages fill remaining slots. All stages share one bounded
243
+ `concurrency` window, including requests waiting inside vLLM. Crop preparation
244
+ uses separate CPU threads; finished pages merge and render while other pages
245
+ continue inference. Large batches use spawned rendering processes.
246
+
247
+ Run standalone scripts under a main guard, or choose `postprocess_workers=1`.
248
+ HTTP `parse_many` uses this same pipelined batch engine and returns only the
249
+ documents. Its default request window is 128; a custom backend retains the
250
+ four-worker default. Pass `concurrency=1` for a backend that requires serial calls.
251
+ Use `schedule="staged"` for stage-barrier comparisons. A custom Transformers
252
+ backend still serializes its shared model calls.
253
+
254
+ Metrics include separately reported initial preparation, pipeline elapsed time,
255
+ request counts, token-limit counts, and processed-page and fully completed-page
256
+ throughput. Pipeline time excludes
257
+ initial preparation and output-file writing; model-dependent crop preparation is
258
+ included. A benchmark should also report serialization and warmup/server-startup
259
+ exclusions explicitly. The same prepared batch can be reused for different modes;
260
+ each call generates its own responses and provides an independent pipeline timing.
261
+ Pipelined stage spans overlap and must not be added together.
262
+ `request_service_seconds` sums concurrent request latency, including server queue
263
+ wait; it is not GPU compute time. `peak_inflight_requests` records the client
264
+ window, while actual server running/waiting requests require vLLM metrics.
265
+
266
+ Strict generation handling remains the default. Set `allow_partial=True` (CLI:
267
+ `--allow-partial`) only when partial results are useful: capped raw responses are
268
+ preserved, affected pages have `complete=False` and `generation_warnings`, and
269
+ truncated crops are excluded from refinement. HTTP/transport errors and empty
270
+ responses still raise. A successful benchmark execution does not imply that every
271
+ page completed within its token limit; inspect both coverage and throughput.
272
+
273
+ The CLI supports `--no-split-chart-value-percent` and
274
+ `--no-relocate-chart-captions` to disable the default presentation rules.
275
+
276
+ ## Measured prepared-batch performance
277
+
278
+ The following matched scheduler comparison used the earlier **guarded** merge
279
+ policy in package 3.5.0.post4. The restored default and its fresh results are in
280
+ [accuracy restoration](#accuracy-restoration-with-the-faster-scheduler).
281
+
282
+ Measured on all 2,078 unique ParseBench pages with one H100 80GB, vLLM 0.26.0,
283
+ `--distributed-executor-backend uni`, tensor parallelism 1, one-token MTP, FA3,
284
+ `max_num_seqs=192`, `max_num_batched_tokens=16384`, and `max_model_len=16384`.
285
+ Both chart presentation rules were enabled. Each run generated all of its own
286
+ responses. The same-server comparison used the same prepared images and
287
+ per-mode concurrency limit for both schedulers.
288
+
289
+ | Mode | Concurrency | Staged pages/s | Pipelined pages/s | Pipelined elapsed | Fully completed pages |
290
+ | --- | ---: | ---: | ---: | ---: | ---: |
291
+ | Single | 128 | 14.56 | 14.91 | 139.4 s | 2047/2078 |
292
+ | Double | 256 | 11.16 | 11.87 | 175.0 s | 2038/2078 |
293
+ | Triple | 128 | 7.31 | 10.90 | 190.6 s | 2039/2078 |
294
+
295
+ Initial decoding/encoding of the full batch took 9.7 seconds and was excluded
296
+ from these rates. Timed work includes all model calls, predicted-region crop
297
+ preparation, merge and rendering; startup, warmup and output serialization are
298
+ excluded. The receipt separately reports serialization-inclusive rates.
299
+
300
+ These diagnostic runs explicitly enabled `allow_partial=True`. Token-limited
301
+ responses remain visible and affected pages count as incomplete. The table reports
302
+ processed-page throughput; fully completed-page throughput and cap counts are in
303
+ [the benchmark receipt](../reference/validation/batch_benchmarks.json). Strict failure handling remains
304
+ the API default. A successful scoring run does not make truncated generations complete.
305
+
306
+ Concurrency 128 and 256 were compared on a 256-page pilot; the selected settings
307
+ above were then checked on the full batch. The earlier full single-pass sweep reached
308
+ 15.09 pages/s at 256. These are measured serving profiles, not a throughput ceiling.
309
+ Sampling is nonzero: changed batching can change output lengths and crop counts.
310
+ The receipt includes request and completion-token totals for each run.
311
+ Stages share one bounded client request window. In the pipelined runner, crops
312
+ receive available slots while independent full-page/detection requests continue.
313
+ Stage spans overlap; adding them does not produce elapsed time. Queue averages
314
+ include pipeline ramp-up and final drain, so mean running-request counts need not
315
+ equal the configured limit.
316
+
317
+ ### Quality and the reference output contract
318
+
319
+ | Previous guarded merge, pipelined | Official overall (%) |
320
+ | --- | ---: |
321
+ | Single | 72.79 |
322
+ | Double | 73.28 |
323
+ | Triple | 73.48 |
324
+
325
+ Each full-run output shown here was freshly scored on all 2,078 pages with the
326
+ pinned official scorer
327
+ `9af4102e26b51f234ab5f037e19fec05c0696ec6`, with all 241 Python source hashes
328
+ verified and zero official scoring errors. Capped generations are included in scoring.
329
+
330
+ The pinned reference merge can retain an original Table/Chart block and an
331
+ overlapping crop alternative when their text differs. The chart evaluator searches
332
+ rendered tables for the best matching data. The previous guarded policy uses
333
+ replacement and rejects overlapping same-class crop additions; raw alternatives
334
+ remain in `stages.crops` for inspection.
335
+
336
+ A controlled replay of identical baseline triple responses scored 73.44
337
+ with the previous guarded merge and 75.19 with reference-style merging of
338
+ the same completed crops. The latter inserted 1,660 overlapping alternative blocks.
339
+ This identified the output contract as the cause of the score gap. Package
340
+ 3.5.0.post5 restores alternatives as the default, keeping the faster scheduler.
341
+ Use the separately pinned reproduction pipeline for the exact headline 75.20
342
+ contract. The receipt includes category metrics and the merge-only replay checks.
343
+
344
+ ## Accuracy restoration with the faster scheduler
345
+
346
+ Package 3.5.0.post5 defaults to `merge_policy="alternatives"`. The scheduler,
347
+ model settings, region selection and chart presentation defaults are unchanged.
348
+ The merge retains differing full-page/crop hypotheses as the reference does;
349
+ it adds no model calls. `merge_policy="guarded"` remains available explicitly.
350
+
351
+ Fresh model inference on all 2,078 pages with one H100, the same uni/FA3/MTP server
352
+ profile, and prepared inputs produced:
353
+
354
+ | Pipeline | Concurrency | Pages/s | Elapsed | Official overall (%) | Fully completed pages |
355
+ | --- | ---: | ---: | ---: | ---: | ---: |
356
+ | Double | 256 | 11.64 | 178.5 s | 74.92 | 2043/2078 |
357
+ | Triple | 128 | 10.61 | 195.8 s | 75.20 | 2038/2078 |
358
+
359
+ Timing includes crop preparation and merge/rendering. Preparation, startup, warmup
360
+ and serialization are excluded; the receipt also reports serialization-inclusive
361
+ and fully completed-page rates. These diagnostic runs explicitly used
362
+ `allow_partial=True`; token-limit cases remain marked incomplete.
363
+
364
+ The same saved responses from the earlier staged and pipelined runs were also
365
+ rescored with the restored merge. This isolates the merge from generation:
366
+
367
+ | Saved responses | Guarded overall (%) | Alternatives overall (%) |
368
+ | --- | ---: | ---: |
369
+ | Double Staged | 73.25 | 74.88 |
370
+ | Double Pipelined | 73.28 | 74.96 |
371
+ | Triple Staged | 73.51 | 75.23 |
372
+ | Triple Pipelined | 73.48 | 75.23 |
373
+
374
+ All six outputs were freshly scored on 2,078 unique pages with the pinned official
375
+ scorer and all 241 source hashes verified, with zero official scoring errors.
376
+ Batching at nonzero temperature can change individual responses; this does not
377
+ establish bit-identical generations or a guarantee for every document.
378
+
379
+ The reference-compatible score includes alternative tables/charts. The evaluator
380
+ can match the best alternative, so score recovery does not prove that a single
381
+ chosen transcription is equally accurate. The alternatives are present in the
382
+ actual returned document and its raw stages. Use the guarded policy for a more
383
+ compact document when that tradeoff fits the application.
384
+
385
+ See [the restoration receipt](../reference/validation/accuracy_restoration.json) for category
386
+ scores, generation coverage, exact settings, request/token counts, hashes and
387
+ controlled replay results.
388
+
389
+
390
+ ## Inference throughput with prepared pages
391
+
392
+ For prediction throughput, use `result.metrics["inference_pages_per_second"]`
393
+ (package 3.5.0.post6 or later). Its wall clock runs from the first model request
394
+ start to the last model response across all passes. It includes server queueing,
395
+ image encoding inside the server, generation, HTTP transfer and any gaps waiting
396
+ for predicted-region selection, crop encoding or dispatch. It excludes initial
397
+ page preparation, startup/warmup, final merge/rendering after inference, and writes.
398
+ `pipeline_seconds` and `processed_pages_per_second` retain their earlier meanings,
399
+ including merge/rendering, for applications that need complete documents.
400
+ Concurrent rendering can still compete for CPU during inference; that observed
401
+ contention remains in the wall time. We do not subtract overlapping CPU time or
402
+ sum concurrent request latencies to claim a higher rate.
403
+
404
+ The fastest observed profiles compatible with the restored output quality are:
405
+
406
+ | Pipeline | Concurrency | Schedule | Prediction pages/s | Inference wall time | Fully completed pages |
407
+ | --- | ---: | --- | ---: | ---: | ---: |
408
+ | Single | 256 | Staged | **15.42** | 134.78 s | 2045/2078 |
409
+ | Double | 256 | Pipelined | **11.65** | 178.35 s | 2043/2078 |
410
+ | Triple | 128 | Pipelined | **10.62** | 195.70 s | 2038/2078 |
411
+
412
+ These use 2,078 unique prepared ParseBench page images on one H100 80GB and the
413
+ same uni/FA3/MTP serving profile. The single-pass measurement predates the merge
414
+ restoration; it has no crops and is unaffected by that merge change. Its saved
415
+ stage clock includes executor setup/teardown and is slightly conservative.
416
+ Double/triple times are reconstructed exactly from saved stage start/end spans,
417
+ including gaps between calls. These are existing measured runs, not a new GPU
418
+ run of the timing-only post6 release. See the [timing receipt](../reference/validation/inference_benchmarks.json).
419
+
420
+ The earlier guarded-merge runs reached 11.88/10.91 prediction pages/s for
421
+ double/triple, respectively, but had the lower scores documented above. Use the
422
+ restored profiles when comparing speed while preserving the reference output
423
+ contract. The restored double/triple scores are 74.92/75.20.
424
+
425
+ This is realistic batch prediction throughput when pages are prepared ahead of
426
+ time and enough work is queued. It is not PDF ingestion throughput or single-page
427
+ latency, and is not a measured hardware ceiling. Document complexity, generation
428
+ length, crop count, CPU capacity, network placement and batching affect speed.
429
+ The numerator includes token-limited pages; these diagnostic runs explicitly
430
+ allow partial output. Use `complete_inference_pages_per_second` for the number
431
+ of fully completed pages divided by the same wall time. Strict errors remain the
432
+ default outside these diagnostic runs.
433
+
434
+ ```python
435
+ prepared = parser.prepare(page_images, workers=8) # outside inference clock
436
+ result = parser.parse_prepared(
437
+ prepared, mode="triple", concurrency=128, postprocess_workers=8,
438
+ )
439
+ print(result.metrics["inference_seconds"])
440
+ print(result.metrics["inference_pages_per_second"])
441
+ ```
442
+
443
+ For double pass, use `mode="double", concurrency=256`. The measured fastest
444
+ single-pass profile uses `mode="single", concurrency=256, schedule="staged"`;
445
+ a single-pass pipelined run at concurrency 128 measured 14.92 prediction pages/s.
446
+ A pipelined single-pass run at concurrency 256 has not been measured here.
docs/postprocessing.md CHANGED
@@ -1,446 +1,125 @@
1
- # Document postprocessing and multipass parsing
2
 
3
- The public helpers operate on model predictions and ordinary page images. They do
4
- not load benchmark labels, scorer code, category IDs, reference answers, or
5
- page-specific rules. They are adapted from the general conversion and crop-merge
6
- components of the bundled ParseBench pipeline. The pinned reproduction bundle
7
- remains unchanged so its recorded hashes and results stay reproducible.
8
 
9
- ## Installation
10
 
11
- For vLLM, use the model card's repository-source installation:
12
 
13
  ```bash
14
- hf download nvidia/Nemotron-3.5-Parse --local-dir nemotron-parse
15
- cd nemotron-parse
16
- python -m pip install '.[vllm,client]'
17
  ```
18
 
19
- This installs the plugin, public `nemotron_parse` Python package, compatibility
20
- modules, and `nemotron-parse` command. No prebuilt wheel is required.
21
- The repository source installs the vLLM plugin, parsing helpers and CLI together.
22
- Archived release artifacts and their digests are listed in the
23
- [build evidence](../reference/package/README.md).
24
- Use version 3.5.0.post5 or later for the restored merge default and post7 or later
25
- for the corrected third-party notices.
26
 
27
- For Transformers, keep the model card's inference dependencies. To download the
28
- helpers without installing the package:
 
 
29
 
30
- ```bash
31
- python -m pip install 'beautifulsoup4==4.13.3' 'Pillow==12.2.0' 'numpy==2.2.6' 'httpx==0.28.1'
32
- hf download nvidia/Nemotron-3.5-Parse \
33
- --include 'postprocessing.py' 'latex2html.py' 'nemotron_parse/**' --local-dir .
 
 
 
 
 
 
 
 
 
 
34
  ```
35
 
36
- Run Python in that directory, or put it on your Python import path. Basic text/table
37
- postprocessing only needs Beautiful Soup; the image wrappers also need Pillow and
38
- NumPy. The HTTP backend needs httpx. Downloaded source and installed packages
39
- provide the same public API.
 
 
40
 
41
- ## Render an existing prediction
 
 
 
 
 
42
 
43
  ```python
44
  from nemotron_parse import postprocess_document, PostprocessOptions
 
45
 
46
  options = PostprocessOptions(
47
- infer_headers=True,
48
- render_charts=True,
49
- split_chart_value_percent=True,
50
- relocate_chart_captions=True,
51
  )
52
- document = postprocess_document(raw_model_output, image_size=(width, height), options=options)
53
- print(document['markdown'])
54
- print(document['blocks'])
 
55
  ```
56
 
57
- `raw_out` contains the cleaned model serialization. Each block has its original
58
- class, normalized `bbox`, literal `text`, and rendered `content`. Supplying
59
- `image_size` adds clipped, ordered `bbox_pixels`. `markdown` renders the complete
60
- page in model order, with section headings and HTML tables for span preservation.
61
- Raw per-block text remains available independently of presentation changes.
62
- Malformed table markup that cannot be converted is preserved rather than passed
63
- through a lossy row splitter; document `warnings` identify these blocks.
64
-
65
- Default cleanup preserves empty cells, spans, line breaks, nested inline styles,
66
- and escaped literals. It removes exact repeated blocks at identical coordinates,
67
- repairs empty incomplete serialization prefixes, removes internal continuation
68
- markers, and normalizes existing bullets and soft hyphens in textual roles.
69
- Code/math roles and marked code/math text are protected from soft-hyphen cleanup.
70
- Table conversion is applied to Table/Chart blocks; literal LaTeX in prose, code,
71
- formulas, or Picture blocks retains its source representation.
72
- Header inference uses predicted span topology and existing bold styling, never an
73
- English vocabulary list. It can still make mistakes; disable `infer_headers` to
74
- use only explicit predicted headers. Unknown classes and page numbers are retained.
75
-
76
- Chart titles, subtitles, and explicit panel labels can be rendered with their
77
- associated tables. Two guarded presentation choices are enabled by default and can be disabled:
78
-
79
- - `split_chart_value_percent=True` splits consistently predicted numeric pairs
80
- such as `32 (16.6%)` into Value and Percent subcolumns. It requires at least two
81
- matching nonempty cells, adds those column labels, and does not calculate values.
82
- - `relocate_chart_captions=True` associates a plain caption immediately above a
83
- chart when geometry and text-preservation checks pass. Notes below remain
84
- standalone. Set `relocate_chart_captions=False` to retain the standalone caption in its source order.
85
-
86
- `normalize_text=False`, `deduplicate=False`, and `render_charts=False` disable the
87
- corresponding cleanup/rendering choices. The existing root imports continue to
88
- work:
89
-
90
- ```python
91
- from postprocessing import extract_classes_bboxes, postprocess_text
92
- from latex2html import convert_html_table_to_json_hierarchical
93
- ```
94
 
95
- `postprocess_text(..., cls='Table', table_format=...)` supports LaTeX, HTML,
96
- Markdown, record JSON, hierarchical JSON, and CSV. HTML retains merged-cell
97
- structure. Flat exports expand spans and use neutral column names for headerless
98
- tables without consuming the first data row as a header. Duplicate column names
99
- are disambiguated without overwriting values. Hierarchical JSON retains the
100
- existing `headers`, `columns`, and flat `data` fields and additionally exposes
101
- `body_cells` with explicit text, span, and header-role metadata.
102
 
103
- ## Parse a page with a running vLLM server
104
 
105
- Start the server using the model card. Then:
106
 
107
  ```python
108
- from nemotron_parse.inference import DocumentParser
109
-
110
- with DocumentParser(base_url='http://localhost:8000/v1', model='nemotron-parse') as parser:
111
- single = parser.parse('page.png')
112
- double = parser.parse_double('page.png')
113
- triple = parser.parse_triple('page.png', triple_regions='union')
114
- documents = parser.parse_many(['one.png', 'two.png'], mode='double', concurrency=128)
 
115
  ```
116
 
117
- | Mode | Work performed |
118
- | --- | --- |
119
- | Single | Full-page parse and document rendering |
120
- | Double | Full-page parse, then Table/Chart crops from its predicted regions |
121
- | Triple | Full-page parse, separate detection, then Table/Chart crop parsing |
122
-
123
- A pass denotes a stage, not one request: each retained crop needs its own model
124
- call. `triple_regions='union'` retains detector regions first and adds parser
125
- regions after overlap filtering; `'detector'` uses only the separate detector.
126
- The region budget defaults to 80 per page and can be changed with `max_regions`.
127
- Crops use 4% plus 12-pixel margins and JPEG quality 95, configurable margins, and
128
- content-normalized coordinates mapped back to the original image. Tiny crops are
129
- skipped. Crops are made in memory and no temporary image files remain.
130
-
131
- The default `merge_policy="alternatives"` preserves differing overlapping
132
- Table/Chart predictions from the full-page and crop passes. Near-identical blocks
133
- are deduplicated using geometry and text. Guarded table refinement checks native
134
- grid validity and compatible column counts; the original block order is preserved
135
- and crop alternatives are inserted by their predicted geometry. This policy
136
- matches the reference approach using only model predictions, without labels,
137
- benchmark categories or scorer feedback.
138
 
139
- A returned document can contain overlapping or conflicting Table/Chart hypotheses.
140
- Use `DocumentParser(merge_policy="guarded")` (CLI: `--merge-policy guarded`) when
141
- one selected prediction per overlapping same-class region is preferable. This
142
- option applies conservative structural replacement and rejects overlapping
143
- same-class additions. It can discard a correct alternative, reducing recall.
144
- Raw stage responses remain available with either policy.
145
 
146
- Returned results include `stages` with original raw responses and usage, and
147
- `inference` with request counts, regions, sampling, and crop/rendering settings.
148
- Empty, failed, filtered, or token-limited generations raise `GenerationError`;
149
- its `stage` and `response` expose the failed response. Successful stage responses
150
- from the same page are only returned when parsing completes. No automatic retry
151
- policy changes the request settings.
152
 
153
- Sampling is configurable per stage:
154
 
155
  ```python
156
- from nemotron_parse.inference import DocumentParser, GenerationSettings
157
-
158
- with DocumentParser(
159
- fullpage=GenerationSettings(temperature=0, top_k=1, repetition_penalty=1.1),
160
- detection=GenerationSettings(temperature=0, top_k=1, max_tokens=4096),
161
- crop=GenerationSettings(temperature=0, top_k=1, repetition_penalty=1.0),
162
- ) as parser:
163
- document = parser.parse_double('page.png')
164
- ```
165
-
166
- Defaults are temperature 0.2 / repetition penalty 1.05 for full-page and detection,
167
- and 0.1 / 1.0 for crops, top-k 50, top-p 1.0, seed 0. Token caps are 8,744 for
168
- parsing and 4,096 for detection. These are practical starting settings rather than
169
- a claim of optimal sampling for every document type.
170
-
171
- ## Use an already loaded Transformers model
172
-
173
- Continue from the model card's Transformers setup:
174
-
175
- ```python
176
- from nemotron_parse.inference import DocumentParser, TransformersBackend
177
-
178
- backend = TransformersBackend(model, processor, generation_config=generation_config)
179
- with DocumentParser(backend=backend) as parser:
180
- document = parser.parse_triple(image)
181
- ```
182
-
183
- This uses the same image/crop orchestration without a server or plugin. The adapter
184
- serializes calls to the shared model, uses inference mode, applies stage settings,
185
- and restores the CPU/current-GPU RNG after generation. Model weights and processor
186
- remain caller-owned. Reaching the token cap is conservatively reported as
187
- truncation, including when generation forces an EOS at the cap.
188
-
189
- Other inference implementations can supply a callable
190
- `backend(image, *, prompt, stage, settings)` returning
191
- `{'raw_out': text, 'finish_reason': 'stop', 'usage': {...}}`. A string return is also
192
- accepted, but then the custom backend must detect truncation itself. Custom
193
- backends used with `parse_many` should support concurrent calls or use concurrency 1.
194
-
195
- ## Command line
196
-
197
- ```bash
198
- nemotron-parse --image page.png --mode double --output parsed-page
199
- nemotron-parse --image-dir pages --mode triple --triple-regions union --output parsed-pages
200
- ```
201
-
202
- The download-only equivalent is `python -m nemotron_parse.inference` with the same
203
- arguments. The default outputs are compact `documents.jsonl.gz` and `metrics.json`, containing
204
- blocks, raw stages, settings and timing. Add `--write-page-files` for individual
205
- Markdown and JSON exports. Use a new/empty output directory. Files are written only
206
- after all pages complete. The API accepts PIL images and image paths; the CLI
207
- accepts image files. Render PDF pages to images before calling it.
208
-
209
- ## Validation and scope
210
-
211
- Run the focused CPU regression suite from the downloaded repository:
212
-
213
- ```bash
214
- python -m pip install pytest
215
- python -m pytest -q tests/test_postprocessing.py tests/test_inference.py tests/test_batch.py
216
- ```
217
-
218
- The 86 focused tests passed from both source and the installed wheel. They cover
219
- table structure, text preservation, chart defaults and opt-outs, crop geometry,
220
- merge guards, HTTP handling, explicit truncation reporting, batch ordering,
221
- independent-stage overlap, early crop submission, a shared concurrency bound,
222
- and staged/pipelined region and output equivalence with deterministic responses.
223
- The Transformers adapter is checked with a small CPU model stub. The real-model
224
- H100 runs and official full-page scoring are recorded below and in
225
- [the validation receipt](../reference/validation/postprocessing.json). The pinned reproduction
226
- bundle and its recorded headline result remain unchanged.
227
-
228
- ## Prepared batches and timing
229
-
230
- `parser.prepare(images, workers=8)` returns a reusable in-memory batch containing
231
- decoded RGB pixels and encoded image requests. Existing RGB JPEG/PNG/WebP payloads
232
- are retained without another lossy encode. Other inputs are encoded as PNG.
233
- The preparation time is reported separately, and cached images can occupy several
234
- GB for thousands of document pages.
235
-
236
- `parser.parse_prepared(batch, mode="double", concurrency=128, postprocess_workers=8)`
237
- returns a `BatchResult` with `documents` and `metrics`. The default
238
- `schedule="pipelined"` overlaps independent full-page and detection requests,
239
- submits detector crops as soon as their regions are ready, and adds parser-only
240
- regions in the original union order. Double-pass crops similarly start as each
241
- page finishes its full-page request. Ready crops take the next available HTTP
242
- slot, and new pages fill remaining slots. All stages share one bounded
243
- `concurrency` window, including requests waiting inside vLLM. Crop preparation
244
- uses separate CPU threads; finished pages merge and render while other pages
245
- continue inference. Large batches use spawned rendering processes.
246
-
247
- Run standalone scripts under a main guard, or choose `postprocess_workers=1`.
248
- HTTP `parse_many` uses this same pipelined batch engine and returns only the
249
- documents. Its default request window is 128; a custom backend retains the
250
- four-worker default. Pass `concurrency=1` for a backend that requires serial calls.
251
- Use `schedule="staged"` for stage-barrier comparisons. A custom Transformers
252
- backend still serializes its shared model calls.
253
-
254
- Metrics include separately reported initial preparation, pipeline elapsed time,
255
- request counts, token-limit counts, and processed-page and fully completed-page
256
- throughput. Pipeline time excludes
257
- initial preparation and output-file writing; model-dependent crop preparation is
258
- included. A benchmark should also report serialization and warmup/server-startup
259
- exclusions explicitly. The same prepared batch can be reused for different modes;
260
- each call generates its own responses and provides an independent pipeline timing.
261
- Pipelined stage spans overlap and must not be added together.
262
- `request_service_seconds` sums concurrent request latency, including server queue
263
- wait; it is not GPU compute time. `peak_inflight_requests` records the client
264
- window, while actual server running/waiting requests require vLLM metrics.
265
-
266
- Strict generation handling remains the default. Set `allow_partial=True` (CLI:
267
- `--allow-partial`) only when partial results are useful: capped raw responses are
268
- preserved, affected pages have `complete=False` and `generation_warnings`, and
269
- truncated crops are excluded from refinement. HTTP/transport errors and empty
270
- responses still raise. A successful benchmark execution does not imply that every
271
- page completed within its token limit; inspect both coverage and throughput.
272
-
273
- The CLI supports `--no-split-chart-value-percent` and
274
- `--no-relocate-chart-captions` to disable the default presentation rules.
275
-
276
- ## Measured prepared-batch performance
277
-
278
- The following matched scheduler comparison used the earlier **guarded** merge
279
- policy in package 3.5.0.post4. The restored default and its fresh results are in
280
- [accuracy restoration](#accuracy-restoration-with-the-faster-scheduler).
281
-
282
- Measured on all 2,078 unique ParseBench pages with one H100 80GB, vLLM 0.26.0,
283
- `--distributed-executor-backend uni`, tensor parallelism 1, one-token MTP, FA3,
284
- `max_num_seqs=192`, `max_num_batched_tokens=16384`, and `max_model_len=16384`.
285
- Both chart presentation rules were enabled. Each run generated all of its own
286
- responses. The same-server comparison used the same prepared images and
287
- per-mode concurrency limit for both schedulers.
288
-
289
- | Mode | Concurrency | Staged pages/s | Pipelined pages/s | Pipelined elapsed | Fully completed pages |
290
- | --- | ---: | ---: | ---: | ---: | ---: |
291
- | Single | 128 | 14.56 | 14.91 | 139.4 s | 2047/2078 |
292
- | Double | 256 | 11.16 | 11.87 | 175.0 s | 2038/2078 |
293
- | Triple | 128 | 7.31 | 10.90 | 190.6 s | 2039/2078 |
294
-
295
- Initial decoding/encoding of the full batch took 9.7 seconds and was excluded
296
- from these rates. Timed work includes all model calls, predicted-region crop
297
- preparation, merge and rendering; startup, warmup and output serialization are
298
- excluded. The receipt separately reports serialization-inclusive rates.
299
-
300
- These diagnostic runs explicitly enabled `allow_partial=True`. Token-limited
301
- responses remain visible and affected pages count as incomplete. The table reports
302
- processed-page throughput; fully completed-page throughput and cap counts are in
303
- [the benchmark receipt](../reference/validation/batch_benchmarks.json). Strict failure handling remains
304
- the API default. A successful scoring run does not make truncated generations complete.
305
-
306
- Concurrency 128 and 256 were compared on a 256-page pilot; the selected settings
307
- above were then checked on the full batch. The earlier full single-pass sweep reached
308
- 15.09 pages/s at 256. These are measured serving profiles, not a throughput ceiling.
309
- Sampling is nonzero: changed batching can change output lengths and crop counts.
310
- The receipt includes request and completion-token totals for each run.
311
- Stages share one bounded client request window. In the pipelined runner, crops
312
- receive available slots while independent full-page/detection requests continue.
313
- Stage spans overlap; adding them does not produce elapsed time. Queue averages
314
- include pipeline ramp-up and final drain, so mean running-request counts need not
315
- equal the configured limit.
316
-
317
- ### Quality and the reference output contract
318
-
319
- | Previous guarded merge, pipelined | Official overall (%) |
320
- | --- | ---: |
321
- | Single | 72.79 |
322
- | Double | 73.28 |
323
- | Triple | 73.48 |
324
-
325
- Each full-run output shown here was freshly scored on all 2,078 pages with the
326
- pinned official scorer
327
- `9af4102e26b51f234ab5f037e19fec05c0696ec6`, with all 241 Python source hashes
328
- verified and zero official scoring errors. Capped generations are included in scoring.
329
-
330
- The pinned reference merge can retain an original Table/Chart block and an
331
- overlapping crop alternative when their text differs. The chart evaluator searches
332
- rendered tables for the best matching data. The previous guarded policy uses
333
- replacement and rejects overlapping same-class crop additions; raw alternatives
334
- remain in `stages.crops` for inspection.
335
-
336
- A controlled replay of identical baseline triple responses scored 73.44
337
- with the previous guarded merge and 75.19 with reference-style merging of
338
- the same completed crops. The latter inserted 1,660 overlapping alternative blocks.
339
- This identified the output contract as the cause of the score gap. Package
340
- 3.5.0.post5 restores alternatives as the default, keeping the faster scheduler.
341
- Use the separately pinned reproduction pipeline for the exact headline 75.20
342
- contract. The receipt includes category metrics and the merge-only replay checks.
343
-
344
- ## Accuracy restoration with the faster scheduler
345
-
346
- Package 3.5.0.post5 defaults to `merge_policy="alternatives"`. The scheduler,
347
- model settings, region selection and chart presentation defaults are unchanged.
348
- The merge retains differing full-page/crop hypotheses as the reference does;
349
- it adds no model calls. `merge_policy="guarded"` remains available explicitly.
350
-
351
- Fresh model inference on all 2,078 pages with one H100, the same uni/FA3/MTP server
352
- profile, and prepared inputs produced:
353
-
354
- | Pipeline | Concurrency | Pages/s | Elapsed | Official overall (%) | Fully completed pages |
355
- | --- | ---: | ---: | ---: | ---: | ---: |
356
- | Double | 256 | 11.64 | 178.5 s | 74.92 | 2043/2078 |
357
- | Triple | 128 | 10.61 | 195.8 s | 75.20 | 2038/2078 |
358
-
359
- Timing includes crop preparation and merge/rendering. Preparation, startup, warmup
360
- and serialization are excluded; the receipt also reports serialization-inclusive
361
- and fully completed-page rates. These diagnostic runs explicitly used
362
- `allow_partial=True`; token-limit cases remain marked incomplete.
363
-
364
- The same saved responses from the earlier staged and pipelined runs were also
365
- rescored with the restored merge. This isolates the merge from generation:
366
-
367
- | Saved responses | Guarded overall (%) | Alternatives overall (%) |
368
- | --- | ---: | ---: |
369
- | Double Staged | 73.25 | 74.88 |
370
- | Double Pipelined | 73.28 | 74.96 |
371
- | Triple Staged | 73.51 | 75.23 |
372
- | Triple Pipelined | 73.48 | 75.23 |
373
-
374
- All six outputs were freshly scored on 2,078 unique pages with the pinned official
375
- scorer and all 241 source hashes verified, with zero official scoring errors.
376
- Batching at nonzero temperature can change individual responses; this does not
377
- establish bit-identical generations or a guarantee for every document.
378
-
379
- The reference-compatible score includes alternative tables/charts. The evaluator
380
- can match the best alternative, so score recovery does not prove that a single
381
- chosen transcription is equally accurate. The alternatives are present in the
382
- actual returned document and its raw stages. Use the guarded policy for a more
383
- compact document when that tradeoff fits the application.
384
-
385
- See [the restoration receipt](../reference/validation/accuracy_restoration.json) for category
386
- scores, generation coverage, exact settings, request/token counts, hashes and
387
- controlled replay results.
388
-
389
-
390
- ## Inference throughput with prepared pages
391
-
392
- For prediction throughput, use `result.metrics["inference_pages_per_second"]`
393
- (package 3.5.0.post6 or later). Its wall clock runs from the first model request
394
- start to the last model response across all passes. It includes server queueing,
395
- image encoding inside the server, generation, HTTP transfer and any gaps waiting
396
- for predicted-region selection, crop encoding or dispatch. It excludes initial
397
- page preparation, startup/warmup, final merge/rendering after inference, and writes.
398
- `pipeline_seconds` and `processed_pages_per_second` retain their earlier meanings,
399
- including merge/rendering, for applications that need complete documents.
400
- Concurrent rendering can still compete for CPU during inference; that observed
401
- contention remains in the wall time. We do not subtract overlapping CPU time or
402
- sum concurrent request latencies to claim a higher rate.
403
-
404
- The fastest observed profiles compatible with the restored output quality are:
405
-
406
- | Pipeline | Concurrency | Schedule | Prediction pages/s | Inference wall time | Fully completed pages |
407
- | --- | ---: | --- | ---: | ---: | ---: |
408
- | Single | 256 | Staged | **15.42** | 134.78 s | 2045/2078 |
409
- | Double | 256 | Pipelined | **11.65** | 178.35 s | 2043/2078 |
410
- | Triple | 128 | Pipelined | **10.62** | 195.70 s | 2038/2078 |
411
-
412
- These use 2,078 unique prepared ParseBench page images on one H100 80GB and the
413
- same uni/FA3/MTP serving profile. The single-pass measurement predates the merge
414
- restoration; it has no crops and is unaffected by that merge change. Its saved
415
- stage clock includes executor setup/teardown and is slightly conservative.
416
- Double/triple times are reconstructed exactly from saved stage start/end spans,
417
- including gaps between calls. These are existing measured runs, not a new GPU
418
- run of the timing-only post6 release. See the [timing receipt](../reference/validation/inference_benchmarks.json).
419
-
420
- The earlier guarded-merge runs reached 11.88/10.91 prediction pages/s for
421
- double/triple, respectively, but had the lower scores documented above. Use the
422
- restored profiles when comparing speed while preserving the reference output
423
- contract. The restored double/triple scores are 74.92/75.20.
424
-
425
- This is realistic batch prediction throughput when pages are prepared ahead of
426
- time and enough work is queued. It is not PDF ingestion throughput or single-page
427
- latency, and is not a measured hardware ceiling. Document complexity, generation
428
- length, crop count, CPU capacity, network placement and batching affect speed.
429
- The numerator includes token-limited pages; these diagnostic runs explicitly
430
- allow partial output. Use `complete_inference_pages_per_second` for the number
431
- of fully completed pages divided by the same wall time. Strict errors remain the
432
- default outside these diagnostic runs.
433
-
434
- ```python
435
- prepared = parser.prepare(page_images, workers=8) # outside inference clock
436
  result = parser.parse_prepared(
437
  prepared, mode="triple", concurrency=128, postprocess_workers=8,
 
438
  )
439
- print(result.metrics["inference_seconds"])
440
  print(result.metrics["inference_pages_per_second"])
 
441
  ```
442
 
443
- For double pass, use `mode="double", concurrency=256`. The measured fastest
444
- single-pass profile uses `mode="single", concurrency=256, schedule="staged"`;
445
- a single-pass pipelined run at concurrency 128 measured 14.92 prediction pages/s.
446
- A pipelined single-pass run at concurrency 256 has not been measured here.
 
 
 
 
 
 
 
1
+ # Parse documents and export tables
2
 
3
+ These helpers use predictions and page images; they do not load benchmark answers.
 
 
 
 
4
 
5
+ ## Downloaded helpers
6
 
7
+ With [the native vLLM server](serving.md#native-dflash2) running:
8
 
9
  ```bash
10
+ python -m pip install beautifulsoup4 Pillow numpy httpx
 
 
11
  ```
12
 
13
+ No serving plugin is required. Add the downloaded repository to Python's import path:
 
 
 
 
 
 
14
 
15
+ ```python
16
+ import sys
17
+ sys.path.insert(0, "./parse35")
18
+ from nemotron_parse.inference import DocumentParser
19
 
20
+ def main():
21
+ with DocumentParser(
22
+ base_url="http://localhost:8000/v1", model="nemotron-parse",
23
+ ) as parser:
24
+ documents = parser.parse_many(
25
+ ["one.png", "two.png"], mode="triple",
26
+ concurrency=128, triple_regions="union",
27
+ )
28
+ for document in documents:
29
+ print(document["markdown"])
30
+ print(document["blocks"])
31
+
32
+ if __name__ == "__main__":
33
+ main()
34
  ```
35
 
36
+ `single` parses each full page. `double` also refines predicted Table/Chart crops.
37
+ `triple` adds independent detection and refines the detector/parser region union.
38
+ `parse_many` overlaps parsing and detection, submits crops as they become ready,
39
+ and shares one concurrency window across stages. Put multiprocessing entry points
40
+ under the main guard. The one-page `parse`, `parse_double` and `parse_triple`
41
+ convenience methods execute their dependent stages serially.
42
 
43
+ The default alternatives merge retains differing overlapping table/chart hypotheses.
44
+ Use `DocumentParser(merge_policy="guarded")` for conservative replacement and a
45
+ single selected hypothesis; this can discard correct alternatives. Stage responses
46
+ remain available in `document["stages"]`.
47
+
48
+ ## Convert an existing prediction
49
 
50
  ```python
51
  from nemotron_parse import postprocess_document, PostprocessOptions
52
+ from postprocessing import postprocess_text
53
 
54
  options = PostprocessOptions(
55
+ infer_headers=True, render_charts=True,
56
+ split_chart_value_percent=True, relocate_chart_captions=True,
 
 
57
  )
58
+ document = postprocess_document(raw_output, image_size=image.size, options=options)
59
+ table = next(b for b in document["blocks"] if b["class"] == "Table")
60
+ print(postprocess_text(table["text"], cls="Table", table_format="csv"))
61
+ print(postprocess_text(table["text"], cls="Table", table_format="json_hierarchical"))
62
  ```
63
 
64
+ Blocks retain class, normalized `bbox`, literal `text` and rendered `content`.
65
+ `image_size=(width,height)` adds clipped pixel boxes. Document Markdown uses
66
+ HTML tables to preserve merged cells. `HTML` and `json_hierarchical` preserve
67
+ cell spans; `markdown`, `csv` and record `json` are flat exports that expand spans.
68
+ `latex` retains the predicted table representation. Headerless tables retain
69
+ their first data row; duplicate column names are disambiguated.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
+ Set any presentation option above to `False` to disable it. Caption association
72
+ moves existing text; value/percentage splitting separates existing predictions
73
+ and does not calculate values. Raw block text remains available. Malformed tables
74
+ are retained and reported in warnings rather than forced into a lossy row splitter.
75
+ For strict output schemas, select fields after a full-structure parse; prompt
76
+ switches can leave residual structural tokens.
 
77
 
78
+ ## Draw predicted boxes
79
 
80
+ Continue from the prediction conversion above to save an image overlay:
81
 
82
  ```python
83
+ from PIL import ImageDraw
84
+
85
+ overlay = image.copy()
86
+ draw = ImageDraw.Draw(overlay)
87
+ for block in document["blocks"]:
88
+ if block.get("bbox_pixels"):
89
+ draw.rectangle(block["bbox_pixels"], outline="red", width=2)
90
+ overlay.save("prediction.png")
91
  ```
92
 
93
+ Use the same image dimensions supplied to `postprocess_document`. This recipe
94
+ draws the predicted boxes without changing their geometry or the source image.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
 
96
+ ## Completion and prepared batches
 
 
 
 
 
97
 
98
+ Strict generation handling is the default. Token-limited, empty, failed or
99
+ filtered output raises `GenerationError`. If partial results are useful, pass
100
+ `allow_partial=True`: affected documents have `complete=False` and
101
+ `generation_warnings`; truncated crops are excluded from refinement. Transport
102
+ errors and empty responses still raise. Do not count partial pages as completed.
 
103
 
104
+ For repeated processing of the same page images:
105
 
106
  ```python
107
+ prepared = parser.prepare(page_images, workers=8)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  result = parser.parse_prepared(
109
  prepared, mode="triple", concurrency=128, postprocess_workers=8,
110
+ triple_regions="union", schedule="pipelined", allow_partial=True,
111
  )
 
112
  print(result.metrics["inference_pages_per_second"])
113
+ print(result.metrics["complete_inference_pages_per_second"])
114
  ```
115
 
116
+ Run this inside the guarded main function while `parser` is open. Preparation is
117
+ reported separately. The inference clock includes model/HTTP calls, queueing and
118
+ dependent crop preparation; final rendering and serialization are reported
119
+ separately. Use pipeline rates when end-to-end merge/render cost matters. Stage
120
+ spans overlap and must not be added together.
121
+
122
+ For crop margins, generation controls, a loaded Transformers backend, CLI use,
123
+ and historical validation, see the [extended reference](postprocessing-reference.md).
124
+ The CLI can run from downloaded source as `python -m nemotron_parse.inference`;
125
+ installing the serving plugin is unnecessary for that invocation.
docs/serving-reference.md ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Nemotron 3.5 Parse: Transformers and vLLM
2
+
3
+ ## Native DFlash2 speculative decoding (new)
4
+
5
+ For vLLM with native Nemotron Parse and `DFlash2DraftModel` support, use the
6
+ drafter included in this repository:
7
+
8
+ ```bash
9
+ hf download nvidia/Nemotron-3.5-Parse --local-dir ./parse35
10
+
11
+ vllm serve ./parse35 \
12
+ --trust-remote-code \
13
+ --speculative-config '{"method":"dflash","model":"./parse35/dflash2","num_speculative_tokens":32}'
14
+ ```
15
+
16
+ Validated build: `0.32.1rc1.dev505+g00b6c4c56` on H200/BF16, with Model Runner V2
17
+ selected automatically. This native path needs no additional model package or
18
+ worker plugin. Older versions, including the 0.26.0 reference plugin environment
19
+ documented below, are not qualified for this DFlash2 command. See the
20
+ [drafter guide](../dflash2/README.md) for draft-length tuning, benchmark results
21
+ and numerical-output limitations. The generation contract below still applies.
22
+
23
+ ## Installation (reference MTP plugin environment)
24
+
25
+ Use Python 3.12 and a fresh environment.
26
+
27
+ The reference serving contract is vLLM 0.26.0, Transformers 5.14.1,
28
+ huggingface-hub 1.24.0, and BF16 on one NVIDIA H100. The package declares the exact
29
+ core dependencies; its `[vllm,client]` extras add serving and the HTTP evaluation
30
+ client. See `pyproject.toml` for pinned direct dependencies.
31
+
32
+ Download the repository and install its serving extras:
33
+
34
+ ```bash
35
+ python3.12 -m venv .venv
36
+ source .venv/bin/activate
37
+ python -m pip install "huggingface-hub==1.24.0"
38
+ hf download nvidia/Nemotron-3.5-Parse --local-dir nemotron-parse
39
+ cd nemotron-parse
40
+ export MODEL_REPO="$PWD"
41
+ python -m pip install ".[vllm,client]"
42
+ python -m pip check
43
+ ```
44
+
45
+ One-token MTP and the compatible FA3 scheduler are enabled automatically for this model.
46
+
47
+ For Transformers-only inference, no Nemotron package is required. Follow the
48
+ [Quick Start](../README.md#quick-start) to load the model directly from the Hub.
49
+
50
+ ## Generation contract
51
+
52
+ The recommended prompt is identical in Transformers, vLLM, and evaluation:
53
+
54
+ `</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>`
55
+
56
+ Use one RGB page per request, temperature 0, top-k 1, repetition penalty 1.1,
57
+ `max_tokens=8744`, and `skip_special_tokens=False`. Preserve the coordinate and
58
+ class tokens in the raw prediction used by postprocessing and scoring.
59
+
60
+ Boxes are normalized to the evaluated image content. Scale x by that image's
61
+ width and y by its height; no legacy center-pad inverse is needed. The image
62
+ processor accepts dynamically sized pages and applies the exported NaViT
63
+ preprocessing configuration.
64
+
65
+ ## One-token MTP
66
+
67
+ `model.safetensors` contains the main model and all four trained MTP tensors.
68
+ No auxiliary weight sidecar is required. The model has **630,800,496 unique
69
+ trainable parameters**, including **2,099,200 MTP parameters**. The decoder
70
+ embedding and LM head share weights and are counted once. Eight stored scalar
71
+ buffers are excluded from the parameter count.
72
+
73
+ Transformers generation uses the normal decoder. vLLM enables the trained
74
+ one-token proposer automatically; it shares the decoder embedding and output
75
+ head.
76
+
77
+ ```bash
78
+ vllm serve "$MODEL_REPO" \
79
+ --served-model-name nemotron-parse \
80
+ --trust-remote-code \
81
+ --dtype bfloat16 \
82
+ --distributed-executor-backend uni \
83
+ --tensor-parallel-size 1 \
84
+ --data-parallel-size 1 \
85
+ --max-model-len 16384 \
86
+ --max-num-seqs 192 \
87
+ --max-num-batched-tokens 16384 \
88
+ --no-enable-prefix-caching \
89
+ --limit-mm-per-prompt '{"image":1}' \
90
+ --attention-config '{"flash_attn_version":3}' \
91
+ --chat-template "$MODEL_REPO/chat_template.jinja" \
92
+ --host 127.0.0.1 \
93
+ --port 8000
94
+ ```
95
+
96
+ This is the reference H100 throughput profile. Reduce `--max-num-seqs` when
97
+ using a GPU with less memory. Set `NP_VLLM_MTP=0` before startup to run the matched normal-decoding path. Clients use `model="nemotron-parse"`, matching
98
+ the served model name. Startup must show MTP with one speculative token; vLLM's
99
+ `SpecDecoding metrics` report its measured draft acceptance during generation.
100
+
101
+ ## Verification and references
102
+
103
+ The current prepared-batch inference and official scoring records are in the
104
+ [validation receipts](../reference/validation/). The
105
+ [reference reproduction records](../reference/README.md) retain their pinned
106
+ model, runtime and page-set contracts. See
107
+ [runtime metadata](../reference/model/runtime_compatibility.json) and
108
+ [package evidence](../reference/package/README.md) for artifact identities and
109
+ verification scope.
110
+
111
+ Set `NP_VLLM_MTP=0` before starting vLLM to use normal decoding.
112
+
113
+
114
+ ### Docker alternative
115
+
116
+ From the downloaded folder, run the included Compose recipe:
117
+
118
+ ```bash
119
+ docker compose up --build
120
+ ```
121
+
122
+ Use the OpenAI-compatible client in the [Quick Start](../README.md#quick-start). Container verification details are in [reference/README.md](https://huggingface.co/nvidia/Nemotron-3.5-Parse/blob/main/reference/README.md).
123
+
124
+ ### HTTP client
125
+
126
+ See [vllm_example.py](../vllm_example.py) for an OpenAI-compatible HTTP client.
docs/serving.md CHANGED
@@ -1,126 +1,61 @@
1
- # Nemotron 3.5 Parse: Transformers and vLLM
2
 
3
- ## Native DFlash2 speculative decoding (new)
4
 
5
- For vLLM with native Nemotron Parse and `DFlash2DraftModel` support, use the
6
- drafter included in this repository:
7
 
8
  ```bash
9
  hf download nvidia/Nemotron-3.5-Parse --local-dir ./parse35
10
-
11
  vllm serve ./parse35 \
 
12
  --trust-remote-code \
13
  --speculative-config '{"method":"dflash","model":"./parse35/dflash2","num_speculative_tokens":32}'
14
  ```
15
 
16
- Validated build: `0.32.1rc1.dev505+g00b6c4c56` on H200/BF16, with Model Runner V2
17
- selected automatically. This native path needs no additional model package or
18
- worker plugin. Older versions, including the 0.26.0 reference plugin environment
19
- documented below, are not qualified for this DFlash2 command. See the
20
- [drafter guide](../dflash2/README.md) for draft-length tuning, benchmark results
21
- and numerical-output limitations. The generation contract below still applies.
22
-
23
- ## Installation (reference MTP plugin environment)
24
-
25
- Use Python 3.12 and a fresh environment.
26
 
27
- The reference serving contract is vLLM 0.26.0, Transformers 5.14.1,
28
- huggingface-hub 1.24.0, and BF16 on one NVIDIA H100. The package declares the exact
29
- core dependencies; its `[vllm,client]` extras add serving and the HTTP evaluation
30
- client. See `pyproject.toml` for pinned direct dependencies.
31
 
32
- Download the repository and install its serving extras:
33
 
34
- ```bash
35
- python3.12 -m venv .venv
36
- source .venv/bin/activate
37
- python -m pip install "huggingface-hub==1.24.0"
38
- hf download nvidia/Nemotron-3.5-Parse --local-dir nemotron-parse
39
- cd nemotron-parse
40
- export MODEL_REPO="$PWD"
41
- python -m pip install ".[vllm,client]"
42
- python -m pip check
43
  ```
44
 
45
- One-token MTP and the compatible FA3 scheduler are enabled automatically for this model.
46
-
47
- For Transformers-only inference, no Nemotron package is required. Follow the
48
- [Quick Start](../README.md#quick-start) to load the model directly from the Hub.
49
-
50
- ## Generation contract
51
 
52
- The recommended prompt is identical in Transformers, vLLM, and evaluation:
 
 
53
 
54
- `</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>`
55
 
56
- Use one RGB page per request, temperature 0, top-k 1, repetition penalty 1.1,
57
- `max_tokens=8744`, and `skip_special_tokens=False`. Preserve the coordinate and
58
- class tokens in the raw prediction used by postprocessing and scoring.
 
 
59
 
60
- Boxes are normalized to the evaluated image content. Scale x by that image's
61
- width and y by its height; no legacy center-pad inverse is needed. The image
62
- processor accepts dynamically sized pages and applies the exported NaViT
63
- preprocessing configuration.
64
 
65
  ## One-token MTP
66
 
67
- `model.safetensors` contains the main model and all four trained MTP tensors.
68
- No auxiliary weight sidecar is required. The model has **630,800,496 unique
69
- trainable parameters**, including **2,099,200 MTP parameters**. The decoder
70
- embedding and LM head share weights and are counted once. Eight stored scalar
71
- buffers are excluded from the parameter count.
72
-
73
- Transformers generation uses the normal decoder. vLLM enables the trained
74
- one-token proposer automatically; it shares the decoder embedding and output
75
- head.
76
-
77
- ```bash
78
- vllm serve "$MODEL_REPO" \
79
- --served-model-name nemotron-parse \
80
- --trust-remote-code \
81
- --dtype bfloat16 \
82
- --distributed-executor-backend uni \
83
- --tensor-parallel-size 1 \
84
- --data-parallel-size 1 \
85
- --max-model-len 16384 \
86
- --max-num-seqs 192 \
87
- --max-num-batched-tokens 16384 \
88
- --no-enable-prefix-caching \
89
- --limit-mm-per-prompt '{"image":1}' \
90
- --attention-config '{"flash_attn_version":3}' \
91
- --chat-template "$MODEL_REPO/chat_template.jinja" \
92
- --host 127.0.0.1 \
93
- --port 8000
94
- ```
95
-
96
- This is the reference H100 throughput profile. Reduce `--max-num-seqs` when
97
- using a GPU with less memory. Set `NP_VLLM_MTP=0` before startup to run the matched normal-decoding path. Clients use `model="nemotron-parse"`, matching
98
- the served model name. Startup must show MTP with one speculative token; vLLM's
99
- `SpecDecoding metrics` report its measured draft acceptance during generation.
100
-
101
- ## Verification and references
102
-
103
- The current prepared-batch inference and official scoring records are in the
104
- [validation receipts](../reference/validation/). The
105
- [reference reproduction records](../reference/README.md) retain their pinned
106
- model, runtime and page-set contracts. See
107
- [runtime metadata](../reference/model/runtime_compatibility.json) and
108
- [package evidence](../reference/package/README.md) for artifact identities and
109
- verification scope.
110
-
111
- Set `NP_VLLM_MTP=0` before starting vLLM to use normal decoding.
112
-
113
-
114
- ### Docker alternative
115
-
116
- From the downloaded folder, run the included Compose recipe:
117
-
118
- ```bash
119
- docker compose up --build
120
- ```
121
-
122
- Use the OpenAI-compatible client in the [Quick Start](../README.md#quick-start). Container verification details are in [reference/README.md](https://huggingface.co/nvidia/Nemotron-3.5-Parse/blob/main/reference/README.md).
123
-
124
- ### HTTP client
125
-
126
- See [vllm_example.py](../vllm_example.py) for an OpenAI-compatible HTTP client.
 
1
+ # Serve Nemotron 3.5 Parse
2
 
3
+ ## Native DFlash2
4
 
5
+ Download both models together. Use vLLM with native Nemotron Parse and
6
+ `DFlash2DraftModel` support; no model-specific plugin is needed.
7
 
8
  ```bash
9
  hf download nvidia/Nemotron-3.5-Parse --local-dir ./parse35
 
10
  vllm serve ./parse35 \
11
+ --served-model-name nemotron-parse \
12
  --trust-remote-code \
13
  --speculative-config '{"method":"dflash","model":"./parse35/dflash2","num_speculative_tokens":32}'
14
  ```
15
 
16
+ The speculator path is a local subdirectory, not a second Hub model ID.
17
+ Use 8, 16, or 32 speculative tokens to tune for your workload; the length stays
18
+ fixed for that server. See [performance](../dflash2/README.md#performance).
19
+ For base inference, omit `--speculative-config`.
 
 
 
 
 
 
20
 
21
+ Use the [model card's HTTP or Transformers examples](../README.md#run-parse).
22
+ Transformers does not need the serving plugin and uses normal decoding.
23
+ For overlapping document/crop requests, use the downloaded
24
+ [`DocumentParser` helpers](postprocessing.md).
25
 
26
+ ## Prompts
27
 
28
+ ```python
29
+ TASK_PROMPT = "</s><s><predict_bbox><predict_classes><output_markdown><predict_text_in_pic>"
 
 
 
 
 
 
 
30
  ```
31
 
32
+ Use this task string in Transformers and HTTP requests. Preserve the class and
33
+ coordinate tokens in generated text for postprocessing. For offline vLLM,
34
+ prepend the image placeholder directly: `"<pad>" + TASK_PROMPT`, with
35
+ `add_special_tokens=False`. Do not insert a newline between them.
 
 
36
 
37
+ The model takes RGB page images; render PDFs to pages first. Coordinates refer
38
+ to the evaluated image content. The [prompt controls](../README.md#task-prompts)
39
+ request boxes, classes, or plain text; table export formats are chosen after inference.
40
 
41
+ ## Throughput tuning
42
 
43
+ Concurrency is the number of outstanding requests across all stages, not the
44
+ number of documents. Increase it while observing memory, latency and completed
45
+ page throughput. Double and triple pass reuse page/crop images, so retain the
46
+ multimodal processor cache. Prefix caching, batching budgets and draft length
47
+ can affect different workloads differently.
48
 
49
+ Use [the measured profiles and protocols](../reference/dflash2-passes/README.md)
50
+ when reproducing a number. The basic launch command above prioritizes usability;
51
+ it does not set every benchmarking option. A page that hits its token limit is
52
+ partial output, even if the benchmark itself finishes successfully.
53
 
54
  ## One-token MTP
55
 
56
+ MTP weights are included in the target weights. The established MTP serving path
57
+ uses the repository's serving plugin. Follow the
58
+ [reference installation](serving-reference.md#installation-reference-mtp-plugin-environment)
59
+ and [MTP command](serving-reference.md#one-token-mtp) in a separate environment.
60
+ That guide preserves its pinned reproduction setup. Do not install its serving
61
+ extras into the native DFlash2 environment. Choose one speculator per server.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
reference/dflash2-passes/README.md ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DFlash2 single-, double-, and triple-pass throughput
2
+
3
+ One H200, BF16, all 2,078 ParseBench pages, three independent full-set trials per configuration. Each mode uses its best tested serving profile, selected by median fully completed-page throughput. The model card reports processed-page throughput; both measures and completion counts appear below.
4
+
5
+ | Mode | Pages/s | Observed range | Fully completed pages/s | Complete pages / 2078 |
6
+ | --- | ---: | --- | ---: | --- |
7
+ | single | 18.01 | 17.88–18.16 | 17.78 | [2049, 2051, 2050] |
8
+ | double | 14.26 | 13.90–14.76 | 14.00 | [2043, 2039, 2039] |
9
+ | triple | 12.99 | 12.91–13.18 | 12.76 | [2041, 2041, 2038] |
10
+
11
+ The inference clock runs from the first model request to the final response. It includes HTTP, server queueing and dependent crop preparation; it excludes initial page preparation, startup, warmup, output writing and final rendering after the last response. Each workload starts with a fresh server and separate synthetic warmup pages. This is prepared-page inference throughput, not PDF-ingestion throughput.
12
+
13
+ All modes use the published overlapping pipeline, alternatives merging, original image resolution and generation budgets. Triple pass refines the detector/parser union. Token-limited responses remain marked incomplete and do not count toward fully completed-page throughput. Timing does not establish new accuracy scores; the model card retains the separate reference-protocol scores.
14
+
15
+ ## Serving settings
16
+
17
+ | Mode | Draft tokens | Concurrency | Capacity | Batched tokens | Prefix cache | Processor cache GiB | GPU memory fraction |
18
+ | --- | ---: | ---: | ---: | ---: | --- | ---: | ---: |
19
+ | single | 16 | 128 | 128 | 32768 | True | 4 | 0.8 |
20
+ | double | 16 | 128 | 192 | 32768 | False | 4 | 0.8 |
21
+ | triple | 16 | 256 | 256 | 65536 | True | 8 | 0.9 |
22
+
23
+ Native vLLM, TP1, maximum context 16,384, FA3, async scheduling and chunked prefill on, model compilation off with full-decode CUDA graphs. Eight preparation/render workers. The commands below preserve the measured graph shapes.
24
+
25
+ Full-page/detection defaults: temperature 0.2, repetition penalty 1.05; crops: temperature 0.1, repetition penalty 1.0. Top-k 50, top-p 1, seed 0; parsing cap 8,744 and detection cap 4,096. These settings are unchanged across the tuning study.
26
+
27
+ ## Concurrency range
28
+
29
+ The table shows the best confirmed HTTP single-pass profile at each tested concurrency. The main card’s base/MTP/DFlash2 figure uses a separate native greedy protocol; these rates must not be combined with it.
30
+
31
+ | Concurrency | Draft | Batch tokens | Prefix cache | Processor cache GiB | Pages/s | Completed pages/s |
32
+ | ---: | ---: | ---: | --- | ---: | ---: | ---: |
33
+ | 1 | 32 | 32768 | False | 4 | 2.64 | 2.60 |
34
+ | 2 | 32 | 32768 | False | 4 | 4.78 | 4.70 |
35
+ | 4 | 32 | 32768 | False | 4 | 7.83 | 7.73 |
36
+ | 8 | 32 | 32768 | False | 4 | 11.44 | 11.30 |
37
+ | 16 | 32 | 32768 | False | 4 | 13.93 | 13.72 |
38
+ | 32 | 16 | 32768 | False | 4 | 16.45 | 16.25 |
39
+ | 64 | 8 | 32768 | False | 4 | 17.32 | 17.04 |
40
+ | 128 | 16 | 32768 | True | 4 | 18.01 | 17.78 |
41
+ | 256 | 16 | 32768 | False | 4 | 17.90 | 17.67 |
42
+ | 512 | 16 | 32768 | False | 4 | 17.44 | 17.22 |
43
+
44
+ For concurrency 512, the confirmed profile uses fresh HTTP connections after a pooled-client file-descriptor failure. The failed attempt is excluded; three replacement full-set trials completed. Other profiles use a 1-second idle connection lifetime.
45
+
46
+ [Download confirmed metrics and settings](optimization.json). Ranges are observed min/max, not confidence intervals. Best tested settings are workload-specific; output lengths and crop counts can change with nonzero sampling.
47
+
48
+ ## Use the measured profiles
49
+
50
+ Start the server for your chosen mode with one of these native vLLM commands:
51
+
52
+ - [Single pass](serve-single.sh)
53
+ - [Double pass](serve-double.sh)
54
+ - [Triple pass](serve-triple.sh)
55
+
56
+ Download the complete model repository as `./parse35` first. These scripts use its bundled DFlash2 weights and do not install a serving plugin. Each mode has its own measured concurrency, draft length and server settings.
57
+
58
+ Run from the directory containing `./parse35`, for example `bash ./parse35/reference/dflash2-passes/serve-triple.sh`. The client below uses the matching request window and HTTP connection settings. Images must already be RGB pages; PDF rendering is excluded from these timings.
59
+
60
+ ```python
61
+ import sys
62
+ from pathlib import Path
63
+ import httpx
64
+ sys.path.insert(0, "./parse35")
65
+ from nemotron_parse.inference import DocumentParser
66
+
67
+ PROFILES = {'single': {'concurrency': 128, 'keepalive': 'pooled'}, 'double': {'concurrency': 128, 'keepalive': 'pooled'}, 'triple': {'concurrency': 256, 'keepalive': 'pooled'}}
68
+
69
+ def main():
70
+ mode = sys.argv[1]
71
+ profile = PROFILES[mode]
72
+ concurrency = profile["concurrency"]
73
+ keepalive = 0 if profile["keepalive"] == 0 else max(64, concurrency)
74
+ pages = sys.argv[2:]
75
+ with httpx.Client(
76
+ timeout=1800, limits=httpx.Limits(
77
+ max_connections=max(64, concurrency),
78
+ max_keepalive_connections=keepalive, keepalive_expiry=1.0,
79
+ ),
80
+ ) as client:
81
+ with DocumentParser(
82
+ base_url="http://localhost:8000/v1", model="nemotron-parse", client=client,
83
+ ) as parser:
84
+ prepared = parser.prepare(pages, workers=8)
85
+ result = parser.parse_prepared(
86
+ prepared, mode=mode, concurrency=concurrency, postprocess_workers=8,
87
+ triple_regions="union", schedule="pipelined", allow_partial=True,
88
+ )
89
+ print(result.metrics)
90
+
91
+ if __name__ == "__main__":
92
+ main()
93
+ ```
94
+
95
+ Call `python ./parse35/reference/dflash2-passes/run_profile.py triple pages/*.png` after starting the corresponding server. Preparation, warmup and output writing must be handled consistently when reproducing timings. `allow_partial=True` retains and marks capped pages; inspect the complete-page count as well as speed.
96
+
97
+ Generation defaults and scoring reproduction are preserved in the [reference pipeline](../parsebench/pipeline/README.md).
reference/dflash2-passes/optimization.json ADDED
@@ -0,0 +1,1012 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "nvidia/Nemotron-3.5-Parse",
3
+ "hardware": "One H200, BF16",
4
+ "pages_per_trial": 2078,
5
+ "independent_repeats": 3,
6
+ "statistic": "Median; observed min/max are not confidence intervals",
7
+ "selection_metric": "Fully completed pages per inference second",
8
+ "winners": {
9
+ "single": {
10
+ "settings": {
11
+ "mode": "single",
12
+ "concurrency": 128,
13
+ "capacity": 128,
14
+ "draft": 16,
15
+ "batch_tokens": 32768,
16
+ "prefix": true,
17
+ "cache": 4,
18
+ "memory": 0.8,
19
+ "keepalive": "pooled"
20
+ },
21
+ "completed_rate": 17.777170543750234,
22
+ "processed_rate": 18.011194729357868,
23
+ "completed_range": [
24
+ 17.63583791664956,
25
+ 17.908738148240406
26
+ ],
27
+ "processed_range": [
28
+ 17.876717654047702,
29
+ 18.16220491558983
30
+ ],
31
+ "complete_pages": [
32
+ 2049,
33
+ 2051,
34
+ 2050
35
+ ],
36
+ "tokens": [
37
+ 2678232,
38
+ 2674047,
39
+ 2680942
40
+ ],
41
+ "requests": [
42
+ {
43
+ "fullpage": 2078,
44
+ "detection": 0,
45
+ "crop": 0
46
+ },
47
+ {
48
+ "fullpage": 2078,
49
+ "detection": 0,
50
+ "crop": 0
51
+ },
52
+ {
53
+ "fullpage": 2078,
54
+ "detection": 0,
55
+ "crop": 0
56
+ }
57
+ ]
58
+ },
59
+ "double": {
60
+ "settings": {
61
+ "mode": "double",
62
+ "concurrency": 128,
63
+ "capacity": 192,
64
+ "draft": 16,
65
+ "batch_tokens": 32768,
66
+ "prefix": false,
67
+ "cache": 4,
68
+ "memory": 0.8,
69
+ "keepalive": "pooled"
70
+ },
71
+ "completed_rate": 13.995984844135963,
72
+ "processed_rate": 14.263686368864409,
73
+ "completed_range": [
74
+ 13.635665159920789,
75
+ 14.507522594142927
76
+ ],
77
+ "processed_range": [
78
+ 13.896474841743698,
79
+ 14.756060670890358
80
+ ],
81
+ "complete_pages": [
82
+ 2043,
83
+ 2039,
84
+ 2039
85
+ ],
86
+ "tokens": [
87
+ 3791781,
88
+ 3839100,
89
+ 3819316
90
+ ],
91
+ "requests": [
92
+ {
93
+ "fullpage": 2078,
94
+ "detection": 0,
95
+ "crop": 2337
96
+ },
97
+ {
98
+ "fullpage": 2078,
99
+ "detection": 0,
100
+ "crop": 2353
101
+ },
102
+ {
103
+ "fullpage": 2078,
104
+ "detection": 0,
105
+ "crop": 2343
106
+ }
107
+ ]
108
+ },
109
+ "triple": {
110
+ "settings": {
111
+ "mode": "triple",
112
+ "concurrency": 256,
113
+ "capacity": 256,
114
+ "draft": 16,
115
+ "batch_tokens": 65536,
116
+ "prefix": true,
117
+ "cache": 8,
118
+ "memory": 0.9,
119
+ "keepalive": "pooled"
120
+ },
121
+ "completed_rate": 12.760647624071124,
122
+ "processed_rate": 12.991977345820576,
123
+ "completed_range": [
124
+ 12.665496310560572,
125
+ 12.948023577542324
126
+ ],
127
+ "processed_range": [
128
+ 12.914083088000426,
129
+ 13.18275011961438
130
+ ],
131
+ "complete_pages": [
132
+ 2041,
133
+ 2041,
134
+ 2038
135
+ ],
136
+ "tokens": [
137
+ 4192165,
138
+ 4190074,
139
+ 4207913
140
+ ],
141
+ "requests": [
142
+ {
143
+ "fullpage": 2078,
144
+ "detection": 2078,
145
+ "crop": 2625
146
+ },
147
+ {
148
+ "fullpage": 2078,
149
+ "detection": 2078,
150
+ "crop": 2633
151
+ },
152
+ {
153
+ "fullpage": 2078,
154
+ "detection": 2078,
155
+ "crop": 2610
156
+ }
157
+ ]
158
+ }
159
+ },
160
+ "confirmed_profiles": [
161
+ {
162
+ "settings": {
163
+ "mode": "single",
164
+ "concurrency": 1,
165
+ "capacity": 64,
166
+ "draft": 32,
167
+ "batch_tokens": 32768,
168
+ "prefix": false,
169
+ "cache": 4,
170
+ "memory": 0.8,
171
+ "keepalive": "pooled"
172
+ },
173
+ "completed_rate": 2.6001723809921358,
174
+ "processed_rate": 2.6382608436043253,
175
+ "completed_range": [
176
+ 2.575941521411921,
177
+ 2.6236829217680655
178
+ ],
179
+ "processed_range": [
180
+ 2.6136750397919783,
181
+ 2.6621157770674024
182
+ ],
183
+ "complete_pages": [
184
+ 2048,
185
+ 2048,
186
+ 2048
187
+ ],
188
+ "tokens": [
189
+ 2690504,
190
+ 2690504,
191
+ 2690504
192
+ ],
193
+ "requests": [
194
+ {
195
+ "fullpage": 2078,
196
+ "detection": 0,
197
+ "crop": 0
198
+ },
199
+ {
200
+ "fullpage": 2078,
201
+ "detection": 0,
202
+ "crop": 0
203
+ },
204
+ {
205
+ "fullpage": 2078,
206
+ "detection": 0,
207
+ "crop": 0
208
+ }
209
+ ]
210
+ },
211
+ {
212
+ "settings": {
213
+ "mode": "single",
214
+ "concurrency": 2,
215
+ "capacity": 2,
216
+ "draft": 32,
217
+ "batch_tokens": 32768,
218
+ "prefix": false,
219
+ "cache": 4,
220
+ "memory": 0.8,
221
+ "keepalive": "pooled"
222
+ },
223
+ "completed_rate": 4.70235904598427,
224
+ "processed_rate": 4.775905228521658,
225
+ "completed_range": [
226
+ 4.682969565196626,
227
+ 4.824188615533726
228
+ ],
229
+ "processed_range": [
230
+ 4.753888987043766,
231
+ 4.894855440956583
232
+ ],
233
+ "complete_pages": [
234
+ 2046,
235
+ 2048,
236
+ 2047
237
+ ],
238
+ "tokens": [
239
+ 2708815,
240
+ 2695983,
241
+ 2698871
242
+ ],
243
+ "requests": [
244
+ {
245
+ "fullpage": 2078,
246
+ "detection": 0,
247
+ "crop": 0
248
+ },
249
+ {
250
+ "fullpage": 2078,
251
+ "detection": 0,
252
+ "crop": 0
253
+ },
254
+ {
255
+ "fullpage": 2078,
256
+ "detection": 0,
257
+ "crop": 0
258
+ }
259
+ ]
260
+ },
261
+ {
262
+ "settings": {
263
+ "mode": "single",
264
+ "concurrency": 4,
265
+ "capacity": 4,
266
+ "draft": 32,
267
+ "batch_tokens": 32768,
268
+ "prefix": false,
269
+ "cache": 4,
270
+ "memory": 0.8,
271
+ "keepalive": "pooled"
272
+ },
273
+ "completed_rate": 7.726758637907933,
274
+ "processed_rate": 7.83229485345009,
275
+ "completed_range": [
276
+ 7.507347378031041,
277
+ 8.179612482828606
278
+ ],
279
+ "processed_range": [
280
+ 7.617318286888918,
281
+ 8.287291437990172
282
+ ],
283
+ "complete_pages": [
284
+ 2051,
285
+ 2050,
286
+ 2048
287
+ ],
288
+ "tokens": [
289
+ 2667442,
290
+ 2683911,
291
+ 2695038
292
+ ],
293
+ "requests": [
294
+ {
295
+ "fullpage": 2078,
296
+ "detection": 0,
297
+ "crop": 0
298
+ },
299
+ {
300
+ "fullpage": 2078,
301
+ "detection": 0,
302
+ "crop": 0
303
+ },
304
+ {
305
+ "fullpage": 2078,
306
+ "detection": 0,
307
+ "crop": 0
308
+ }
309
+ ]
310
+ },
311
+ {
312
+ "settings": {
313
+ "mode": "single",
314
+ "concurrency": 8,
315
+ "capacity": 8,
316
+ "draft": 32,
317
+ "batch_tokens": 32768,
318
+ "prefix": false,
319
+ "cache": 4,
320
+ "memory": 0.8,
321
+ "keepalive": "pooled"
322
+ },
323
+ "completed_rate": 11.300312866641013,
324
+ "processed_rate": 11.443494218752448,
325
+ "completed_range": [
326
+ 11.114101752060728,
327
+ 11.302029176217788
328
+ ],
329
+ "processed_range": [
330
+ 11.260411233925984,
331
+ 11.445232274941796
332
+ ],
333
+ "complete_pages": [
334
+ 2051,
335
+ 2052,
336
+ 2052
337
+ ],
338
+ "tokens": [
339
+ 2670519,
340
+ 2674332,
341
+ 2675976
342
+ ],
343
+ "requests": [
344
+ {
345
+ "fullpage": 2078,
346
+ "detection": 0,
347
+ "crop": 0
348
+ },
349
+ {
350
+ "fullpage": 2078,
351
+ "detection": 0,
352
+ "crop": 0
353
+ },
354
+ {
355
+ "fullpage": 2078,
356
+ "detection": 0,
357
+ "crop": 0
358
+ }
359
+ ]
360
+ },
361
+ {
362
+ "settings": {
363
+ "mode": "single",
364
+ "concurrency": 16,
365
+ "capacity": 16,
366
+ "draft": 32,
367
+ "batch_tokens": 32768,
368
+ "prefix": false,
369
+ "cache": 4,
370
+ "memory": 0.8,
371
+ "keepalive": "pooled"
372
+ },
373
+ "completed_rate": 13.72132422096978,
374
+ "processed_rate": 13.929121510100247,
375
+ "completed_range": [
376
+ 13.629552372710384,
377
+ 13.868329751046273
378
+ ],
379
+ "processed_range": [
380
+ 13.80897602656859,
381
+ 14.044049328788576
382
+ ],
383
+ "complete_pages": [
384
+ 2052,
385
+ 2051,
386
+ 2047
387
+ ],
388
+ "tokens": [
389
+ 2664515,
390
+ 2667117,
391
+ 2692456
392
+ ],
393
+ "requests": [
394
+ {
395
+ "fullpage": 2078,
396
+ "detection": 0,
397
+ "crop": 0
398
+ },
399
+ {
400
+ "fullpage": 2078,
401
+ "detection": 0,
402
+ "crop": 0
403
+ },
404
+ {
405
+ "fullpage": 2078,
406
+ "detection": 0,
407
+ "crop": 0
408
+ }
409
+ ]
410
+ },
411
+ {
412
+ "settings": {
413
+ "mode": "single",
414
+ "concurrency": 32,
415
+ "capacity": 32,
416
+ "draft": 16,
417
+ "batch_tokens": 32768,
418
+ "prefix": false,
419
+ "cache": 4,
420
+ "memory": 0.8,
421
+ "keepalive": "pooled"
422
+ },
423
+ "completed_rate": 16.24820263620281,
424
+ "processed_rate": 16.454076548747288,
425
+ "completed_range": [
426
+ 15.913943267172057,
427
+ 16.505446511638127
428
+ ],
429
+ "processed_range": [
430
+ 16.139177212876298,
431
+ 16.70643831036728
432
+ ],
433
+ "complete_pages": [
434
+ 2053,
435
+ 2049,
436
+ 2052
437
+ ],
438
+ "tokens": [
439
+ 2665461,
440
+ 2678495,
441
+ 2668148
442
+ ],
443
+ "requests": [
444
+ {
445
+ "fullpage": 2078,
446
+ "detection": 0,
447
+ "crop": 0
448
+ },
449
+ {
450
+ "fullpage": 2078,
451
+ "detection": 0,
452
+ "crop": 0
453
+ },
454
+ {
455
+ "fullpage": 2078,
456
+ "detection": 0,
457
+ "crop": 0
458
+ }
459
+ ]
460
+ },
461
+ {
462
+ "settings": {
463
+ "mode": "single",
464
+ "concurrency": 64,
465
+ "capacity": 64,
466
+ "draft": 8,
467
+ "batch_tokens": 32768,
468
+ "prefix": false,
469
+ "cache": 4,
470
+ "memory": 0.8,
471
+ "keepalive": "pooled"
472
+ },
473
+ "completed_rate": 17.03946058790172,
474
+ "processed_rate": 17.322895842299303,
475
+ "completed_range": [
476
+ 16.779610418138926,
477
+ 17.116187503834503
478
+ ],
479
+ "processed_range": [
480
+ 17.00050241291696,
481
+ 17.3753969872829
482
+ ],
483
+ "complete_pages": [
484
+ 2044,
485
+ 2047,
486
+ 2051
487
+ ],
488
+ "tokens": [
489
+ 2703005,
490
+ 2687559,
491
+ 2677871
492
+ ],
493
+ "requests": [
494
+ {
495
+ "fullpage": 2078,
496
+ "detection": 0,
497
+ "crop": 0
498
+ },
499
+ {
500
+ "fullpage": 2078,
501
+ "detection": 0,
502
+ "crop": 0
503
+ },
504
+ {
505
+ "fullpage": 2078,
506
+ "detection": 0,
507
+ "crop": 0
508
+ }
509
+ ]
510
+ },
511
+ {
512
+ "settings": {
513
+ "mode": "double",
514
+ "concurrency": 128,
515
+ "capacity": 128,
516
+ "draft": 16,
517
+ "batch_tokens": 32768,
518
+ "prefix": false,
519
+ "cache": 4,
520
+ "memory": 0.8,
521
+ "keepalive": "pooled"
522
+ },
523
+ "completed_rate": 13.871913662638613,
524
+ "processed_rate": 14.116472375594045,
525
+ "completed_range": [
526
+ 13.521083161335971,
527
+ 14.320910857155429
528
+ ],
529
+ "processed_range": [
530
+ 13.772946475125563,
531
+ 14.573385289504888
532
+ ],
533
+ "complete_pages": [
534
+ 2042,
535
+ 2042,
536
+ 2040
537
+ ],
538
+ "tokens": [
539
+ 3792654,
540
+ 3811233,
541
+ 3810040
542
+ ],
543
+ "requests": [
544
+ {
545
+ "fullpage": 2078,
546
+ "detection": 0,
547
+ "crop": 2341
548
+ },
549
+ {
550
+ "fullpage": 2078,
551
+ "detection": 0,
552
+ "crop": 2340
553
+ },
554
+ {
555
+ "fullpage": 2078,
556
+ "detection": 0,
557
+ "crop": 2343
558
+ }
559
+ ]
560
+ },
561
+ {
562
+ "settings": {
563
+ "mode": "double",
564
+ "concurrency": 128,
565
+ "capacity": 128,
566
+ "draft": 16,
567
+ "batch_tokens": 32768,
568
+ "prefix": true,
569
+ "cache": 4,
570
+ "memory": 0.8,
571
+ "keepalive": "pooled"
572
+ },
573
+ "completed_rate": 13.857578244206481,
574
+ "processed_rate": 14.101884226964284,
575
+ "completed_range": [
576
+ 13.427124064834844,
577
+ 14.14685037641301
578
+ ],
579
+ "processed_range": [
580
+ 13.650471529709787,
581
+ 14.375136959504271
582
+ ],
583
+ "complete_pages": [
584
+ 2042,
585
+ 2044,
586
+ 2045
587
+ ],
588
+ "tokens": [
589
+ 3817020,
590
+ 3819064,
591
+ 3799365
592
+ ],
593
+ "requests": [
594
+ {
595
+ "fullpage": 2078,
596
+ "detection": 0,
597
+ "crop": 2338
598
+ },
599
+ {
600
+ "fullpage": 2078,
601
+ "detection": 0,
602
+ "crop": 2342
603
+ },
604
+ {
605
+ "fullpage": 2078,
606
+ "detection": 0,
607
+ "crop": 2344
608
+ }
609
+ ]
610
+ },
611
+ {
612
+ "settings": {
613
+ "mode": "double",
614
+ "concurrency": 128,
615
+ "capacity": 192,
616
+ "draft": 16,
617
+ "batch_tokens": 32768,
618
+ "prefix": false,
619
+ "cache": 4,
620
+ "memory": 0.8,
621
+ "keepalive": "pooled"
622
+ },
623
+ "completed_rate": 13.995984844135963,
624
+ "processed_rate": 14.263686368864409,
625
+ "completed_range": [
626
+ 13.635665159920789,
627
+ 14.507522594142927
628
+ ],
629
+ "processed_range": [
630
+ 13.896474841743698,
631
+ 14.756060670890358
632
+ ],
633
+ "complete_pages": [
634
+ 2043,
635
+ 2039,
636
+ 2039
637
+ ],
638
+ "tokens": [
639
+ 3791781,
640
+ 3839100,
641
+ 3819316
642
+ ],
643
+ "requests": [
644
+ {
645
+ "fullpage": 2078,
646
+ "detection": 0,
647
+ "crop": 2337
648
+ },
649
+ {
650
+ "fullpage": 2078,
651
+ "detection": 0,
652
+ "crop": 2353
653
+ },
654
+ {
655
+ "fullpage": 2078,
656
+ "detection": 0,
657
+ "crop": 2343
658
+ }
659
+ ]
660
+ },
661
+ {
662
+ "settings": {
663
+ "mode": "single",
664
+ "concurrency": 128,
665
+ "capacity": 128,
666
+ "draft": 16,
667
+ "batch_tokens": 32768,
668
+ "prefix": true,
669
+ "cache": 4,
670
+ "memory": 0.8,
671
+ "keepalive": "pooled"
672
+ },
673
+ "completed_rate": 17.777170543750234,
674
+ "processed_rate": 18.011194729357868,
675
+ "completed_range": [
676
+ 17.63583791664956,
677
+ 17.908738148240406
678
+ ],
679
+ "processed_range": [
680
+ 17.876717654047702,
681
+ 18.16220491558983
682
+ ],
683
+ "complete_pages": [
684
+ 2049,
685
+ 2051,
686
+ 2050
687
+ ],
688
+ "tokens": [
689
+ 2678232,
690
+ 2674047,
691
+ 2680942
692
+ ],
693
+ "requests": [
694
+ {
695
+ "fullpage": 2078,
696
+ "detection": 0,
697
+ "crop": 0
698
+ },
699
+ {
700
+ "fullpage": 2078,
701
+ "detection": 0,
702
+ "crop": 0
703
+ },
704
+ {
705
+ "fullpage": 2078,
706
+ "detection": 0,
707
+ "crop": 0
708
+ }
709
+ ]
710
+ },
711
+ {
712
+ "settings": {
713
+ "mode": "single",
714
+ "concurrency": 128,
715
+ "capacity": 192,
716
+ "draft": 16,
717
+ "batch_tokens": 32768,
718
+ "prefix": false,
719
+ "cache": 4,
720
+ "memory": 0.8,
721
+ "keepalive": "pooled"
722
+ },
723
+ "completed_rate": 17.419733802275566,
724
+ "processed_rate": 17.666279571073023,
725
+ "completed_range": [
726
+ 17.10274000419257,
727
+ 17.97142015619434
728
+ ],
729
+ "processed_range": [
730
+ 17.353268422222733,
731
+ 18.225774077389868
732
+ ],
733
+ "complete_pages": [
734
+ 2049,
735
+ 2049,
736
+ 2048
737
+ ],
738
+ "tokens": [
739
+ 2681005,
740
+ 2673131,
741
+ 2688923
742
+ ],
743
+ "requests": [
744
+ {
745
+ "fullpage": 2078,
746
+ "detection": 0,
747
+ "crop": 0
748
+ },
749
+ {
750
+ "fullpage": 2078,
751
+ "detection": 0,
752
+ "crop": 0
753
+ },
754
+ {
755
+ "fullpage": 2078,
756
+ "detection": 0,
757
+ "crop": 0
758
+ }
759
+ ]
760
+ },
761
+ {
762
+ "settings": {
763
+ "mode": "triple",
764
+ "concurrency": 128,
765
+ "capacity": 192,
766
+ "draft": 16,
767
+ "batch_tokens": 32768,
768
+ "prefix": false,
769
+ "cache": 4,
770
+ "memory": 0.8,
771
+ "keepalive": "pooled"
772
+ },
773
+ "completed_rate": 12.187296867472998,
774
+ "processed_rate": 12.396085604801218,
775
+ "completed_range": [
776
+ 12.009630198553252,
777
+ 12.6213920745905
778
+ ],
779
+ "processed_range": [
780
+ 12.23333899636944,
781
+ 12.856496436764244
782
+ ],
783
+ "complete_pages": [
784
+ 2043,
785
+ 2040,
786
+ 2040
787
+ ],
788
+ "tokens": [
789
+ 4183215,
790
+ 4188764,
791
+ 4191600
792
+ ],
793
+ "requests": [
794
+ {
795
+ "fullpage": 2078,
796
+ "detection": 2078,
797
+ "crop": 2621
798
+ },
799
+ {
800
+ "fullpage": 2078,
801
+ "detection": 2078,
802
+ "crop": 2605
803
+ },
804
+ {
805
+ "fullpage": 2078,
806
+ "detection": 2078,
807
+ "crop": 2601
808
+ }
809
+ ]
810
+ },
811
+ {
812
+ "settings": {
813
+ "mode": "single",
814
+ "concurrency": 256,
815
+ "capacity": 256,
816
+ "draft": 16,
817
+ "batch_tokens": 32768,
818
+ "prefix": false,
819
+ "cache": 4,
820
+ "memory": 0.8,
821
+ "keepalive": "pooled"
822
+ },
823
+ "completed_rate": 17.6721021229776,
824
+ "processed_rate": 17.89601764695295,
825
+ "completed_range": [
826
+ 17.107707265642375,
827
+ 17.85725949121545
828
+ ],
829
+ "processed_range": [
830
+ 17.375276489738443,
831
+ 18.05712176289329
832
+ ],
833
+ "complete_pages": [
834
+ 2046,
835
+ 2052,
836
+ 2055
837
+ ],
838
+ "tokens": [
839
+ 2683495,
840
+ 2666175,
841
+ 2660412
842
+ ],
843
+ "requests": [
844
+ {
845
+ "fullpage": 2078,
846
+ "detection": 0,
847
+ "crop": 0
848
+ },
849
+ {
850
+ "fullpage": 2078,
851
+ "detection": 0,
852
+ "crop": 0
853
+ },
854
+ {
855
+ "fullpage": 2078,
856
+ "detection": 0,
857
+ "crop": 0
858
+ }
859
+ ]
860
+ },
861
+ {
862
+ "settings": {
863
+ "mode": "triple",
864
+ "concurrency": 256,
865
+ "capacity": 512,
866
+ "draft": 16,
867
+ "batch_tokens": 32768,
868
+ "prefix": false,
869
+ "cache": 4,
870
+ "memory": 0.8,
871
+ "keepalive": "pooled"
872
+ },
873
+ "completed_rate": 12.648139018891586,
874
+ "processed_rate": 12.883741608459175,
875
+ "completed_range": [
876
+ 12.063085322992798,
877
+ 12.983478678422928
878
+ ],
879
+ "processed_range": [
880
+ 12.305886745792359,
881
+ 13.199446523367342
882
+ ],
883
+ "complete_pages": [
884
+ 2040,
885
+ 2037,
886
+ 2044
887
+ ],
888
+ "tokens": [
889
+ 4196553,
890
+ 4211493,
891
+ 4171417
892
+ ],
893
+ "requests": [
894
+ {
895
+ "fullpage": 2078,
896
+ "detection": 2078,
897
+ "crop": 2604
898
+ },
899
+ {
900
+ "fullpage": 2078,
901
+ "detection": 2078,
902
+ "crop": 2609
903
+ },
904
+ {
905
+ "fullpage": 2078,
906
+ "detection": 2078,
907
+ "crop": 2611
908
+ }
909
+ ]
910
+ },
911
+ {
912
+ "settings": {
913
+ "mode": "triple",
914
+ "concurrency": 256,
915
+ "capacity": 256,
916
+ "draft": 16,
917
+ "batch_tokens": 65536,
918
+ "prefix": true,
919
+ "cache": 8,
920
+ "memory": 0.9,
921
+ "keepalive": "pooled"
922
+ },
923
+ "completed_rate": 12.760647624071124,
924
+ "processed_rate": 12.991977345820576,
925
+ "completed_range": [
926
+ 12.665496310560572,
927
+ 12.948023577542324
928
+ ],
929
+ "processed_range": [
930
+ 12.914083088000426,
931
+ 13.18275011961438
932
+ ],
933
+ "complete_pages": [
934
+ 2041,
935
+ 2041,
936
+ 2038
937
+ ],
938
+ "tokens": [
939
+ 4192165,
940
+ 4190074,
941
+ 4207913
942
+ ],
943
+ "requests": [
944
+ {
945
+ "fullpage": 2078,
946
+ "detection": 2078,
947
+ "crop": 2625
948
+ },
949
+ {
950
+ "fullpage": 2078,
951
+ "detection": 2078,
952
+ "crop": 2633
953
+ },
954
+ {
955
+ "fullpage": 2078,
956
+ "detection": 2078,
957
+ "crop": 2610
958
+ }
959
+ ]
960
+ },
961
+ {
962
+ "settings": {
963
+ "mode": "single",
964
+ "concurrency": 512,
965
+ "capacity": 512,
966
+ "draft": 16,
967
+ "batch_tokens": 32768,
968
+ "prefix": false,
969
+ "cache": 4,
970
+ "memory": 0.8,
971
+ "keepalive": 0
972
+ },
973
+ "completed_rate": 17.215383924028252,
974
+ "processed_rate": 17.44201257636797,
975
+ "completed_range": [
976
+ 16.814386036148,
977
+ 17.33674505992429
978
+ ],
979
+ "processed_range": [
980
+ 17.07736763593135,
981
+ 17.590701286388025
982
+ ],
983
+ "complete_pages": [
984
+ 2048,
985
+ 2046,
986
+ 2051
987
+ ],
988
+ "tokens": [
989
+ 2679913,
990
+ 2697997,
991
+ 2675209
992
+ ],
993
+ "requests": [
994
+ {
995
+ "fullpage": 2078,
996
+ "detection": 0,
997
+ "crop": 0
998
+ },
999
+ {
1000
+ "fullpage": 2078,
1001
+ "detection": 0,
1002
+ "crop": 0
1003
+ },
1004
+ {
1005
+ "fullpage": 2078,
1006
+ "detection": 0,
1007
+ "crop": 0
1008
+ }
1009
+ ]
1010
+ }
1011
+ ]
1012
+ }
reference/dflash2-passes/run_profile.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ from pathlib import Path
3
+ import httpx
4
+ sys.path.insert(0, "./parse35")
5
+ from nemotron_parse.inference import DocumentParser
6
+
7
+ PROFILES = {'single': {'concurrency': 128, 'keepalive': 'pooled'}, 'double': {'concurrency': 128, 'keepalive': 'pooled'}, 'triple': {'concurrency': 256, 'keepalive': 'pooled'}}
8
+
9
+ def main():
10
+ mode = sys.argv[1]
11
+ profile = PROFILES[mode]
12
+ concurrency = profile["concurrency"]
13
+ keepalive = 0 if profile["keepalive"] == 0 else max(64, concurrency)
14
+ pages = sys.argv[2:]
15
+ with httpx.Client(
16
+ timeout=1800, limits=httpx.Limits(
17
+ max_connections=max(64, concurrency),
18
+ max_keepalive_connections=keepalive, keepalive_expiry=1.0,
19
+ ),
20
+ ) as client:
21
+ with DocumentParser(
22
+ base_url="http://localhost:8000/v1", model="nemotron-parse", client=client,
23
+ ) as parser:
24
+ prepared = parser.prepare(pages, workers=8)
25
+ result = parser.parse_prepared(
26
+ prepared, mode=mode, concurrency=concurrency, postprocess_workers=8,
27
+ triple_regions="union", schedule="pipelined", allow_partial=True,
28
+ )
29
+ print(result.metrics)
30
+
31
+ if __name__ == "__main__":
32
+ main()
reference/dflash2-passes/serve-double.sh ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ export OMP_NUM_THREADS=4
4
+ vllm serve ./parse35 \
5
+ --served-model-name nemotron-parse \
6
+ --trust-remote-code \
7
+ --host 127.0.0.1 \
8
+ --port 8000 \
9
+ --dtype bfloat16 \
10
+ --max-model-len 16384 \
11
+ --max-num-seqs 192 \
12
+ --max-num-batched-tokens 32768 \
13
+ --gpu-memory-utilization 0.8 \
14
+ --no-enable-prefix-caching \
15
+ --mm-processor-cache-gb 4 \
16
+ --enable-chunked-prefill \
17
+ --async-scheduling \
18
+ --attention-config '{"backend": "FLASH_ATTN", "flash_attn_version": 3}' \
19
+ --compilation-config '{"mode": 0, "cudagraph_mode": "FULL_DECODE_ONLY", "cudagraph_capture_sizes": [1, 2, 4, 8, 16, 17, 32, 34, 64, 68, 128, 136, 192, 256, 272, 512, 544, 1024, 1088, 2048, 2176, 3072, 3264]}' \
20
+ --speculative-config '{"method": "dflash", "model": "./parse35/dflash2", "num_speculative_tokens": 16}'
reference/dflash2-passes/serve-single.sh ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ export OMP_NUM_THREADS=4
4
+ vllm serve ./parse35 \
5
+ --served-model-name nemotron-parse \
6
+ --trust-remote-code \
7
+ --host 127.0.0.1 \
8
+ --port 8000 \
9
+ --dtype bfloat16 \
10
+ --max-model-len 16384 \
11
+ --max-num-seqs 128 \
12
+ --max-num-batched-tokens 32768 \
13
+ --gpu-memory-utilization 0.8 \
14
+ --enable-prefix-caching \
15
+ --mm-processor-cache-gb 4 \
16
+ --enable-chunked-prefill \
17
+ --async-scheduling \
18
+ --attention-config '{"backend": "FLASH_ATTN", "flash_attn_version": 3}' \
19
+ --compilation-config '{"mode": 0, "cudagraph_mode": "FULL_DECODE_ONLY", "cudagraph_capture_sizes": [1, 2, 4, 8, 16, 17, 32, 34, 64, 68, 128, 136, 256, 272, 512, 544, 1024, 1088, 2048, 2176]}' \
20
+ --speculative-config '{"method": "dflash", "model": "./parse35/dflash2", "num_speculative_tokens": 16}'
reference/dflash2-passes/serve-triple.sh ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ export OMP_NUM_THREADS=4
4
+ vllm serve ./parse35 \
5
+ --served-model-name nemotron-parse \
6
+ --trust-remote-code \
7
+ --host 127.0.0.1 \
8
+ --port 8000 \
9
+ --dtype bfloat16 \
10
+ --max-model-len 16384 \
11
+ --max-num-seqs 256 \
12
+ --max-num-batched-tokens 65536 \
13
+ --gpu-memory-utilization 0.9 \
14
+ --enable-prefix-caching \
15
+ --mm-processor-cache-gb 8 \
16
+ --enable-chunked-prefill \
17
+ --async-scheduling \
18
+ --attention-config '{"backend": "FLASH_ATTN", "flash_attn_version": 3}' \
19
+ --compilation-config '{"mode": 0, "cudagraph_mode": "FULL_DECODE_ONLY", "cudagraph_capture_sizes": [1, 2, 4, 8, 16, 17, 32, 34, 64, 68, 128, 136, 256, 272, 512, 544, 1024, 1088, 2048, 2176, 4096, 4352]}' \
20
+ --speculative-config '{"method": "dflash", "model": "./parse35/dflash2", "num_speculative_tokens": 16}'