Docling

On this page 7

Docling is an open-source document conversion toolkit, originally developed at IBM Research and released under the MIT license, that turns PDFs, office files, HTML and scanned images into a structured, machine-readable representation. In Document AI, it belongs to the family of PDF parsing and document-to-Markdown conversion tools, combining layout analysis, table structure recognition, reading order detection and optional OCR in one local pipeline.

The project became widely used because it runs entirely on local hardware, produces a rich document model rather than flat text, and integrates directly with retrieval-augmented generation frameworks. It is now hosted as a community project under the Linux Foundation’s AI and data umbrella, which signals vendor-neutral governance.

How the Docling pipeline processes a document

Docling processes a document in a sequence of specialized stages rather than with one monolithic model. For PDFs, a parser first extracts the programmatic text cells and their coordinates, then each page is rendered as an image for visual models that recover structure the raw file does not encode.

A layout analysis model, trained on the DocLayNet dataset of human-annotated pages, detects regions such as titles, paragraphs, lists, tables, figures, captions, page headers and footnotes. A separate table structure model, known as TableFormer, reconstructs rows, columns and spanning cells. Assembly logic then applies reading order and merges everything into a unified document object.

The table below summarizes the main stages and what each contributes.

StageFunctionOutput
PDF backendReads text cells, fonts and coordinatesPositioned text tokens
Layout modelClassifies page regionsLabeled bounding boxes
Table structure modelRecovers grid and cell spansStructured table objects
OCR engine (optional)Reads text from scanned regionsRecognized text with positions
Enrichment models (optional)Formulas, code, picture classificationAdditional semantic annotations
AssemblyReading order and hierarchyA unified DoclingDocument
Main stages of the standard Docling PDF pipeline

Input formats and output representations

Docling accepts many input formats through dedicated backends, and all of them converge on one internal model called the DoclingDocument. This shared representation stores text items, tables, pictures, groups and their provenance, meaning page number and bounding box, so downstream code does not depend on the source format.

CategorySupported examplesNotes
Paged documentsPDF, scanned images such as PNG and TIFFFull visual pipeline applies
Office formatsDOCX, PPTX, XLSXStructure read from the file markup
Web and markupHTML, Markdown, AsciiDocNo rendering or layout model needed
Export formatsMarkdown, HTML, JSON, DocTagsJSON preserves the full document model
Typical inputs and exports

Lossless JSON export matters for production systems: it keeps coordinates and element types that a Markdown export discards. Teams therefore often store JSON as the canonical artifact and derive Markdown only for language model prompts.

Docling sits between classic OCR engines and end-to-end vision-language parsers. It uses specialized models for each subtask, which makes its behavior more predictable and its compute cost lower than sending every page to a large multimodal model.

Tool or approachCore methodStrengthLimitation
DoclingModular layout, table and OCR modelsLocal, structured, open licenseWeaker on unusual layouts outside training data
TesseractLine-level OCRMature, many languagesNo layout or table semantics
NougatEnd-to-end transformer to markupStrong on scientific formulasSlower, prone to repetition errors
LlamaParseHosted parsing serviceLittle setup, model-assistedData leaves the organization
LLM-based extractionVision-language model per pageFlexible on complex pagesHigher cost and possible hallucination
Positioning against neighboring approaches

The project also offers a vision-language pipeline that uses compact models, such as SmolDocling and its successors, to emit the DocTags markup directly from page images. This option is useful for difficult pages but changes the speed and accuracy profile, so it should be evaluated separately.

Using Docling in retrieval and AI pipelines

The most common use of Docling is preparing documents for retrieval-augmented generation. Clean structure improves retrieval quality because chunks can follow section boundaries, tables stay intact and each chunk can carry its heading path as context.

Docling includes structure-aware chunkers, including a hybrid chunker that respects document hierarchy and a token limit at the same time. Integrations exist for popular orchestration frameworks such as LangChain, LlamaIndex and Haystack, and a command-line tool converts folders in batch.

SettingRecommended whenTrade-off
OCR disabledBorn-digital PDFs with embedded textMuch faster, misses text inside images
OCR enabledScans, faxes, photographed pagesSlower, accuracy depends on scan quality
Accurate table modeFinancial or technical tablesHigher latency per table
GPU accelerationLarge batch conversionsHardware cost, but far higher throughput
Configuration choices and their effects

Limitations and practical cautions

Docling is reliable on typical business and scientific documents, but no layout model generalizes perfectly. Accuracy drops on dense multi-column newspapers, heavily decorated brochures, handwritten forms and tables without ruling lines.

  • CPU-only throughput can be a bottleneck for millions of pages; plan capacity and consider GPUs.
  • OCR quality limits the result on poor scans; Docling does not repair image defects such as heavy skew or blur on its own.
  • Docling converts, it does not extract fields: invoice totals or contract clauses still require key information extraction on top.
  • Version changes alter output: model updates can shift chunk boundaries, so pin versions and rerun evaluations after upgrades.

A sound practice is to build a small evaluation set of 50 to 100 representative pages, with expected headings, tables and reading order, and to measure conversion quality on it before rollout. Teams that skip this step often discover silent errors, such as a merged table column or a footnote placed mid-paragraph, only after users report wrong answers from the downstream assistant.

Stripped to the essentials

Docling is a free tool that reads documents the way a careful person would. It looks at a PDF page and sees titles, paragraphs, tables and pictures. It then writes them out in a clean, organized digital form.

Many AI systems need text they can understand. A raw PDF often mixes columns, headers and table cells into a jumble. Docling sorts that out. It turns messy files into tidy text and tables that a computer can search and an AI assistant can answer questions about. It runs on your own computer, so the files stay with you.

Where it is applied

An engineering firm wants an internal assistant that answers questions from about 40,000 technical manuals, most of them born-digital PDFs with many specification tables. A small platform team runs Docling on two GPU servers, disables OCR for digital files and enables it only for roughly 3,000 scanned legacy manuals.

The team stores the JSON output as the master copy and uses the hybrid chunker to create chunks of about 500 tokens that keep each table whole and carry its section title. In a test of 200 real engineer questions, answers citing the correct table rise noticeably compared with the earlier plain-text extraction. The firm also keeps all documents on its own servers, which satisfies its confidentiality rules for client designs.