<- all tokdocs

Docling: Fix Your RAG Pipeline's Worst Bottleneck

Watch on TikTok

View on TikTok ->

When you upload a PDF to an LLM, the model either treats it as an image or runs basic text extraction. Either way, the output is often wrong. Multi-column layouts get scrambled, tables turn into garbage, and reading order falls apart. Docling is an open-source tool that fixes this problem at the source, running entirely on your laptop with no cloud dependency.

The Parsing Problem

Consider a financial report with tables. A naive text extractor might read across rows incorrectly, breaking the relationship between headers and values. In a two-column research paper, it reads left to right across both columns instead of top to bottom within each one.

This matters because parsing is the first step in any RAG pipeline. Documents go through parsing, then chunking, then embedding, then into your vector database. If parsing produces garbage, you embed garbage, retrieve garbage, and your LLM receives garbage context.

Docling GitHub repository showing the project overview

How Docling Works

Docling uses three specialized AI models, each trained for a specific aspect of document understanding.

Layout Detection identifies what each element on the page actually is: paragraph, table, header, figure caption. It looks at the spatial arrangement and classifies each box.

Reading Order handles the sequencing problem. In a two-column paper, it knows to read column one top to bottom, then column two, rather than scanning left to right across both.

Tableformer is a dedicated table extraction model. It detects rows, columns, merged cells, and header relationships, even in tables without visible grid lines.

RAG pipeline diagram showing Docs to Parsing to Chunking to Embeddings to Vector DB to Retrieval to LLM, with the note: if parsing is messy, everything downstream is messy

Surprisingly Small Models

These models are not large. The layout model runs around 50 to 100 megabytes. Tableformer is roughly 200 megabytes. The vision language model is only 258 million parameters. No GPU required. The models download automatically from Hugging Face when you install.

Three diagrams showing Layout Detection, Reading Order, and Tableformer capabilities side by side

Integration

Installation is a single command: pip install docling. It plugs directly into LangChain, LlamaIndex, CrewAI, and Haystack. Your existing RAG pipeline gets clean, structured text instead of a mess, with no architectural changes needed.

pip install docling command with integration logos for LangChain, LlamaIndex, CrewAI, and Haystack

Key Takeaways

  • Docling fixes the parsing step of RAG pipelines using three small, specialized AI models for layout detection, reading order, and table extraction
  • It runs locally on your laptop with no GPU, no cloud calls, and no expensive APIs
  • Direct integration with LangChain, LlamaIndex, CrewAI, and Haystack means you can drop it into existing pipelines

Resources

  • Docling on GitHub -- Open-source document parsing library with layout detection and table extraction
  • Hugging Face -- Where the Docling models are hosted for automatic download

Published May 25, 2026. Writeup generated from a favorited TikTok.