Docling OCRIndependent Docling guide

Performance

Why Docling is slow (and how to make it fast)

Docling's defaults optimize for correctness, not speed. The same four-line script can take nine seconds or nine minutes per page depending on OCR, GPU and thread settings — and most of the time the slowdown is a single flag you can turn off.

Updated 2026-10-26 · 4 min read

The short version

  • –The single biggest win is --no-ocr on born-digital PDFs. OCR is ~38% of pipeline time and only runs when a page has no text layer, so on a text PDF it is pure waste.
  • –On an NVIDIA L4 the measured ceiling is ~3.3 pages/sec with OCR and VLM off; enabling OCR drops it to ~1.5, VLM to ~0.83, and both to ~0.64.
  • –Thread oversubscription is the classic self-inflicted wound: setting num_threads above your core count turned a 4-page PDF from 6 minutes into 40.
  • –VLM mode eats ~58% of runtime and can be slow even on an RTX 5090. Serve the model with vLLM or Ollama instead of running it in-process.

Where the time actually goes

A Docling conversion is a sequence of stages, not one model. Layout analysis and table structure dominate the cost on most documents; OCR only runs on pages that have no text layer, and the VLM pipeline is an optional heavyweight that re-does much of the same work with a vision model.

One community benchmark on an NVIDIA L4 (24 GB) gives a useful split: with everything enabled, the VLM accounted for ~58% of runtime and OCR ~38%. That is why turning features off beats tuning batch sizes — most of the wall-clock is concentrated in one or two stages.

The fastest fix: turn off what you are not using

Docling ships with OCR, table structure, code and formula enrichment enabled where relevant. For a born-digital PDF with a real text layer, several of those stages are doing nothing except burning time. Disabling them is the highest-leverage change you can make.

CLI — skip OCR and enrichment on a text PDF
# a digital PDF has a text layer; OCR adds nothing
docling convert report.pdf --to md --no-ocr
docling convert report.pdf --to json --no-ocr

CPU vs GPU — where the accelerator actually helps

Layout and table models speed up substantially on a GPU; OCR benefits far less. On a CPU, expect roughly seconds per complex page; on a GPU, sub-second to a couple of seconds per page for the same document. The gap widens on table-heavy files.

Docling accepts a device through AcceleratorOptions(device=AcceleratorDevice.CUDA) in Python or DOCLING_DEVICE=cuda in the environment, and --device cuda on the CLI. Apple silicon users can pass --device mps rather than nothing.

Python — CPU-only, OCR off, explicit threads
from docling.datamodel.base_models import AcceleratorOptions, AcceleratorDevice
from docling.document_converter import DocumentConverter, PdfPipelineOptions

pipeline = PdfPipelineOptions()
pipeline.do_ocr = False                 # text-native PDF only
pipeline.accelerator_options = AcceleratorOptions(
    num_threads=4,                      # match your cores, do not overshoot
    device=AcceleratorDevice.CUDA,      # or CPU / MPS
)
conv = DocumentConverter(pipeline_options=pipeline)
result = conv.convert("report.pdf")

Threads and batching: two traps, one rule

The first trap is oversubscription. A 4-page PDF with a table took a user 6 minutes on a laptop and 40 minutes on a 6-vCPU VM — the difference was num_threads set higher than the machine had cores, forcing the runtime to thrash. Set threads to your physical core count, not higher.

The second trap is assuming bigger batches help. For 100+ page documents, chunking and concurrency matter (page_chunk_size=50, doc_batch_concurrency=10 are sensible defaults), but the pipeline is stage-bound, not GPU-saturated — one benchmark reported ~24–29% GPU utilization even at full speed. Cranking batch size made no difference.

OCR engine speed: RapidOCR vs EasyOCR

When you do need OCR, the engine is a real speed dial. RapidOCR is ONNX and CPU-friendly, around 6 seconds per scanned page; EasyOCR on GPU is roughly 9 seconds per page but with higher ceiling on hard scripts. Neither is universally faster on quality — see the OCR engines guide for the full trade.

  • Light, CPU-only, English or Chinese scans → rapidocr.
  • Mixed scripts and you already have PyTorch → easyocr.
  • Mac, no model download → ocrmac.
  • Digital PDFs → leave OCR off entirely.

The VLM pipeline is powerful and expensive

The VLM path (--pipeline vlm, running Granite Docling and similar) gets better results on hard, low-quality scans, but it is the single most expensive thing you can turn on. A user on an RTX 5090 reported 399 seconds on a simple PDF running the VLM in-process.

If you need VLM quality at throughput, serve the model behind an inference server — vLLM, LM Studio or Ollama — and point Docling at it, instead of loading the vision model into the conversion process itself. The VLM pipeline guide covers the wiring.

Memory spikes worth knowing about

Formula and code enrichment have a known habit of spiking memory on documents with dense math — reports of hitting 99% RAM on formula-heavy papers are common. If you do not need enriched LaTeX out of a paper, disabling formula enrichment is both faster and less likely to OOM. The troubleshooting guide has the out-of-memory playbook.

The one-minute recipe

  • Text-native PDF → docling convert file.pdf --to md --no-ocr.
  • Still slow → add a GPU (--device cuda) for layout and tables.
  • Scan → rapidocr for speed, easyocr for hard scripts.
  • Huge batch → page_chunk_size + doc_batch_concurrency, and stop raising threads.
  • VLM → serve the model with vLLM/Ollama, not in-process.

Every number here is from community measurements on specific hardware and documents. Measure on your own files before you optimize — a 40-page benchmark with a known-correct transcription tells you more than any blog number.

Frequently asked questions

Why is Docling so slow on my machine?+

Usually one of three things: OCR running on text-native PDFs (turn it off), CPU-only layout/table models on large documents (add a GPU), or num_threads set above your core count. Try --no-ocr first — it is the most common fix.

Does Docling need a GPU?+

No. It runs on CPU, and a GPU mainly accelerates layout and table structure, not OCR. A GPU matters most for table-heavy documents and for the VLM pipeline.

How fast is Docling?+

On an NVIDIA L4, roughly 3.3 pages/sec with OCR and VLM off, 1.5 with OCR, and under 1 page/sec with VLM. Real numbers depend heavily on document complexity and hardware.

Why does Docling use all my RAM?+

Formula and code enrichment are the usual culprits on math-heavy documents. Disable them when you do not need enriched output, and see the troubleshooting guide for OOM handling.

Does increasing the batch size make it faster?+

Usually no. The pipeline is stage-bound, not GPU-bound — measured GPU utilization stays low even at full throughput. Chunking and concurrency help more than batch size.

Try it online

Run the same pipeline in the browser — no install, no uploads stored.

Try it in the browser

Keep reading