Every team building with generative AI hits the same wall within weeks: the knowledge they want to feed the model lives in PDFs, Word files, slide decks, scanned contracts, spreadsheets, and increasingly in audio and video, while the model wants clean, structured text. Writing one parser per format is a career; buying one is a subscription you never own. Docling, an open-source document conversion engine that started at IBM Research Zurich and is now hosted by the LF AI & Data Foundation, solves this properly. It parses an enormous range of formats โ including genuinely advanced PDF understanding โ and emits everything into one unified, typed representation that downstream AI systems can consume directly. With around 67,000 GitHub stars and an MIT license, it has become the default choice for document preparation in the gen AI era.
The problem Docling attacks is subtle. It is not enough to extract raw text; meaning lives in structure. Tables need to remain tables, reading order must survive multi-column layouts, formulas and code blocks need to stay intact, and scanned pages demand OCR before anything else can happen. The overview below shows how the project turns messy inputs into clean deliverables.
High-level overview: documents flow through the conversion core โ backends, pipelines, and models โ and emerge as a unified DoclingDocument, exported to Markdown, HTML, JSON, or RAG chunks.
Why You Need This
If you are building a chatbot over your company handbook, a search engine over research papers, or an agent that reads invoices, you are building on top of documents. Garbage extraction silently poisons all of it: the retrieval system finds the right page, the model reads a mangled table, and the answer is confidently wrong. Document quality is the foundation, and it is exactly the layer most projects hand-roll badly.
Docling also pays off the moment your inputs diversify. The supported format list reads like a corporate archive checklist: PDF and DOCX, PowerPoint and Excel, HTML and Markdown, EPUB e-books, Apple Pages, ODF documents, email files, images, LaTeX, XML schemas for patents, scientific articles, and financial reports, plus audio via speech recognition and even video files with transcripts and keyframes. One converter for all of them means one dependency, one API, and one set of behaviors to trust.
Third, locality. Many documents are confidential โ contracts, medical records, financial filings. Docling runs entirely on your own hardware, including in air-gapped environments, so sensitive data never has to leave the building.
How It Works
The codebase is a clean study in layered design, and the detailed diagram below maps the whole thing.
Detailed architecture: the converter routes formats to specialized backends, pipelines orchestrate model stages, and results are typed against the external docling-core schema.
Everything funnels through a single entry point, DocumentConverter, defined in docling/document_converter.py. You hand it a path or a URL, and it does two kinds of routing: it picks a backend to parse the file format, and it picks a pipeline to drive the conversion.
The backend layer under docling/backend holds more than thirty format parsers behind one abstract interface โ from a Microsoft Word backend to HTML, EPUB, email, LaTeX, iWork, and image backends. For PDF, the hard case, Docling delegates low-level parsing to its dedicated docling-parse engine or to pdfium, then hands structured pages onward.
The pipeline layer is where the intelligence lives. The standard PDF pipeline runs a sequence of AI stages: a layout model detects reading order and page structure, a table model reconstructs table topology, and OCR engines kick in for scanned content. There is also a VLM pipeline that swaps the classic stage stack for a visual language model like GraniteDocling, a compact 258-million-parameter model purpose-built for document understanding, plus ASR and video pipelines for media inputs. Model behavior is configured through typed Pydantic options rather than loose dictionaries, which makes the whole stack pleasantly predictable.
Whatever route you take, the output converges on the same destination: a DoclingDocument, defined in the companion docling-core package. It is a typed, lossless representation of the document โ sections, tables, figures, formulas, captions, and metadata. From there you can export to Markdown, HTML, JSON, or DocTags, run the built-in chunkers to prepare retrieval-friendly segments, or hand it straight to LangChain, LlamaIndex, CrewAI, or Haystack through the native integrations. If you prefer a service, the sibling docling-serve project wraps it all in a REST API, and an MCP server lets coding agents call conversions as tools.
Advantages
- One engine, all formats. Dozens of parsers and three pipeline families behind a single, stable API.
- Structure-aware extraction. Reading order, tables, formulas, code, and even chart understanding are first-class concerns, not afterthoughts.
- Runs anywhere. Local execution on macOS, Linux, and Windows for sensitive and air-gapped workloads.
- Typed end to end. Pydantic-validated options and a versioned document schema keep integrations honest.
- Ecosystem-native. RAG frameworks, a REST service, and an MCP server are all officially supported exits.
Benefits
The direct benefit is accuracy in your AI stack: better structure in means fewer confidently wrong answers out, and the difference shows up immediately on tables and multi-column layouts. The second benefit is leverage. A conversion layer this capable turns previously unusable archives โ scanned PDFs, old decks, patent filings โ into queryable knowledge, which multiplies the value of data you already own.
There is also an operational benefit: because Docling is a library rather than an API subscription, you keep your documents, your weights, and your compute. For teams, the consistent document schema becomes a shared contract between data engineering and AI engineering, which is precisely the seam where most retrieval projects tear.
Usage
Getting productive takes minutes:
- Install from PyPI:
pip install docling. Python 3.10 or higher is required. - Convert from the CLI with a URL or a local file:
docling https://arxiv.org/pdf/2206.01062writes a ready Markdown file next to you. - Use the SDK in Python: create a
DocumentConverter, callconvert(source), and printresult.document.export_to_markdown(). - Switch pipelines when needed:
--pipeline vlm --vlm-model granite_doclingruns the visual-language route for hard pages. - Feed the result onward: export JSON for full fidelity, chunk it for retrieval, or point a RAG integration at it. The examples collection and the usage guide cover recipes from OCR to chart extraction.
The chunking half pairs naturally with retrieval frameworks โ our WeKnora overview shows one such RAG stack, and the code-graph RAG approach explores what happens when the documents are repositories themselves.
Conclusion
Docling is the rare infrastructure project that disappears into everything you build. It does not host a model, sell a dashboard, or lock you into a cloud; it takes the oldest, messiest data format in existence and hands your AI a clean, typed, lossless view of it. The engineering discipline is visible at every layer โ abstract backends, staged pipelines, a versioned document schema โ and the ecosystem around it means the output has somewhere to go the moment it exists. If your AI project touches documents, spend an afternoon with Docling; it is the shortest path from the filing cabinet to the model. Enjoyed this post? Never miss out on future posts by following us