Docling Pipeline Configuration#
All pipeline configuration lives in docling/datamodel/pipeline_options.py — a Pydantic model hierarchy that controls OCR engine selection, table extraction, enrichment models, and more. The CLI (docling/cli/main.py) maps docling convert flags directly to fields on these classes.
Three concrete pipeline option classes cover different input types:
| Class | Input type | CLI flag |
|---|---|---|
PdfPipelineOptions | PDF, images | --pipeline standard (default) |
VlmPipelineOptions | PDF, images via VLM | --pipeline vlm |
AsrPipelineOptions | Audio/video (Whisper) | automatic for audio inputs |
Inheritance Hierarchy#
PipelineOptions # document_timeout, accelerator_options, enable_remote_services, artifacts_path
└── ConvertPipelineOptions # do_picture_classification, do_picture_description, do_chart_extraction
└── PaginatedPipelineOptions # images_scale, generate_page_images, generate_picture_images
├── PdfPipelineOptions # do_ocr, do_table_structure, do_code_enrichment, do_formula_enrichment
└── VlmPipelineOptions # vlm_options, force_backend_text
AsrPipelineOptions # asr_options (directly extends PipelineOptions)
Key fields by layer:
PipelineOptions:document_timeout,accelerator_options,enable_remote_services(defaultFalse),allow_external_plugins(defaultFalse),artifacts_path.ConvertPipelineOptions:do_picture_classification,do_picture_description,picture_description_options,do_chart_extraction,chart_extraction_options. All picture/chart flags default toFalse.PaginatedPipelineOptions:images_scale(default1.0; CLI sets2.0when image export is requested),generate_page_images(defaultFalse),generate_picture_images(defaultFalse).VlmPipelineOptions: inherits all of the above; overridesgenerate_page_images=True(VLM requires rendered pages); addsvlm_options(default preset:"granite_docling"),force_backend_text(defaultFalse).AsrPipelineOptions:asr_options(defaultWHISPER_TINY). Does not extendConvertPipelineOptions.
CLI → PipelineOptions Mapping#
The convert command (cli/main.py:700) constructs a PipelineOptions subclass based on --pipeline and wires each flag to the corresponding field .
Standard pipeline (--pipeline standard → PdfPipelineOptions)#
| CLI flag | Default | PdfPipelineOptions field |
|---|---|---|
--ocr / --no-ocr | True | do_ocr |
--force-ocr | False | ocr_options.force_full_page_ocr |
--tables / --no-tables | True | do_table_structure |
--ocr-engine | "auto" | ocr_options (via factory create_options(kind=...)) |
--ocr-lang | None | ocr_options.lang |
--psm | None | ocr_options.psm (Tesseract only) |
--table-mode | ACCURATE | table_structure_options.mode |
--enrich-code | False | do_code_enrichment |
--enrich-formula | False | do_formula_enrichment |
--enrich-picture-classes | False | do_picture_classification |
--enrich-picture-description | False | do_picture_description |
--enrich-chart-extraction | False | do_chart_extraction |
--artifacts-path | None | artifacts_path |
--document-timeout | None | document_timeout |
--device | AUTO | accelerator_options.device |
--num-threads | 4 | accelerator_options.num_threads |
VLM pipeline (--pipeline vlm → VlmPipelineOptions)#
--vlm-model <preset> selects the VLM via VlmConvertOptions.from_preset(vlm_model) . The default preset is "granite_docling". Available presets are enumerated at import time from VlmConvertOptions.list_preset_ids() .
ASR pipeline (audio inputs → AsrPipelineOptions)#
--asr-model <type> maps through _resolve_asr_options() to an InlineAsrOptions preset (e.g., WHISPER_TURBO). The AsrPipelineOptions instance is always built regardless of pipeline mode and attached to InputFormat.AUDIO .
OCR Engine Selection#
PdfPipelineOptions.ocr_options defaults to OcrAutoOptions() — kind="auto". At runtime, OcrAutoModel probes the environment in order:
- macOS →
OcrMacModel - Linux →
NemotronOcrModel - Fallback chain: RapidOCR (onnxruntime) → EasyOCR → RapidOCR (torch)
Because OcrAutoOptions.lang defaults to [] , language selection is deferred to whichever engine is chosen. To control languages, specify an explicit engine class.
All engine option classes inherit force_full_page_ocr (default False) and bitmap_area_threshold (default 0.05) from OcrOptions.
Available engines#
| Class | kind | Default lang |
|---|---|---|
OcrAutoOptions | "auto" | [] |
EasyOcrOptions | "easyocr" | ["fr","de","es","en"] |
TesseractCliOcrOptions | "tesseract" | ["fra","deu","spa","eng"] |
TesseractOcrOptions | "tesserocr" | ["fra","deu","spa","eng"] |
OcrMacOptions | "ocrmac" | ["fr-FR","de-DE","es-ES","en-US"] |
RapidOcrOptions | "rapidocr" | ["chinese"] |
NemotronOcrOptions | "nemotron-ocr" | [] |
KserveV2OcrOptions | "kserve_v2_ocr" | ["english","chinese"] |
The deprecated OcrEngine enum is no longer the canonical list — use get_ocr_factory().registered_kind to enumerate all registered engines at runtime, including third-party plugins.
The CLI --ocr-engine flag accepts the kind string (e.g., --ocr-engine easyocr); it passes the value to ocr_factory.create_options(kind=ocr_engine, ...) .
Enrichment Feature Flags#
All enrichment models are disabled by default because they require additional model inference . The two exceptions are do_ocr and do_table_structure, which default to True on PdfPipelineOptions.
| Flag | Class where defined | Default | What it enables |
|---|---|---|---|
do_ocr | PdfPipelineOptions | True | OCR on bitmap regions |
do_table_structure | PdfPipelineOptions | True | TableFormer table extraction |
do_code_enrichment | PdfPipelineOptions | False | Sets CodeItem.code_language via VLM; requires pip install docling[vlm] |
do_formula_enrichment | PdfPipelineOptions | False | Extracts LaTeX into TextItem.text for FORMULA-labeled items; requires [vlm] |
do_picture_classification | ConvertPipelineOptions | False | Categorizes PictureItem by type (chart, logo, diagram, etc.) |
do_picture_description | ConvertPipelineOptions | False | VLM captioning stored in PictureItem.meta.description |
do_chart_extraction | ConvertPipelineOptions | False | Extracts chart data (bar/pie/line) to tabular; auto-enables picture classification |
Code/formula enrichment options#
PdfPipelineOptions.code_formula_options is a CodeFormulaVlmOptions instance. Two presets are registered :
"codeformulav2"— default"granite_docling"— IBM Granite-Docling-258M
Switch presets via CodeFormulaVlmOptions.from_preset("granite_docling").
Runtime override constraint#
Only do_* boolean flags may be overridden at conversion time, and only in the True → False direction. Changing any other field (including ocr_options or images_scale) or re-enabling a disabled flag raises an error .
Key Source Files#
| File | Purpose |
|---|---|
docling/datamodel/pipeline_options.py | All PipelineOptions subclasses, OCR option classes, enrichment option classes |
docling/cli/main.py | CLI flag → PipelineOptions field wiring |
docling/datamodel/vlm_engine_options.py | TransformersVlmEngineOptions, MlxVlmEngineOptions, VllmVlmEngineOptions, ApiVlmEngineOptions |
docling/datamodel/stage_model_specs.py | Preset registrations for VLM, picture description, code/formula |
docling/models/factories/__init__.py | get_ocr_factory() — plugin-based engine registry for resolving --ocr-engine |