Docling: PDFs beyond simple chunking
Your AI answers from your PDFs. How the text gets out of them matters. Docling is software that reads documents, before a model ever sees them.
Chapters
- 0:00Introduction
- 0:06Where this fits: The AI stack
- 0:12The simple way: Cut it every so often
- 0:24What Docling does: Read the page first
- 0:35What you get: One structured document
- 0:45Check the settings: Extras you switch on
- 0:59Chunking, step one: Follow the structure
- 1:10Chunking, step two: Fit the model
- 1:24Privacy: On your own machine
- 1:36Before you trust it: Look at the output
- 1:48Wrap up
Read the transcript
Introduction
Your AI answers from your PDFs. How the text gets out of them matters.
Where this fits: The AI stack
Docling is software that reads documents, before a model ever sees them.
The simple way: Cut it every so often
The simple way pulls out the text, and cuts it into pieces of a set size. Each piece is a chunk. That can split a table, part a heading from its text, or mix up two columns.
What Docling does: Read the page first
Docling looks at the page first: its layout, the reading order, and how tables are built. For scanned pages, it can use text recognition, called OCR.
What you get: One structured document
It builds one structured document, holding text, tables, pictures and how they're arranged. You can export it as Markdown or JSON.
Check the settings: Extras you switch on
Some extras are off until you turn them on: reading formulas as maths, extra work on code, and describing pictures. Headings from a PDF also come out at one level, unless you turn on heading levels.
Chunking, step one: Follow the structure
Then it can chunk by structure. The hierarchical chunker works from the parts it found: paragraphs, tables, and lists. It keeps headings and captions with each chunk.
Chunking, step two: Fit the model
The hybrid chunker then fits chunks to your embedding model's limit. It splits ones that are too big. It joins small neighbours that share headings. And when a table is split, it repeats the header row by default.
Privacy: On your own machine
Docling can run on your own machine. It downloads its models the first time, so fetch them ahead if you'll be offline. Sending anything to a remote service has to be switched on.
Before you trust it: Look at the output
It won't get every page right. Compare a table, a two column page and a scan with the originals. Check each model's licence too. Docling's own code is MIT.
Wrap up
Read the structure first, then chunk with it.
Sources
- docling-project.github.io/docling
- docling-project.github.io/docling/concepts/chunking
- docling-project.github.io/docling/usage/enrichments
- docling-project.github.io/docling/usage/advanced_options
- github.com/docling-project/docling