RAG, measured

Documents

Before anything can be searched, a file has to become text. The reader you choose decides what survives: tables, headings, scanned pages.

The first step

FilePDF, Word, slidesReaderfile to textTextwith or without tablesPassageslesson 2FilePDF, Word, slidesReaderfile to textTextwith or without tablesPassageslesson 2
Everything after the reader works on its text. What it drops, no later step can bring back.

Three readers

ReaderOn a balance sheetHeadingsScanned pagesTime
pypdfium2Every row on its own line. The years appear once, at the top.NoNo0.9 s for the report
markitdownThe table falls apart: the years and some rows end up outside it.NoNo33 s for the report
DoclingOne table, with the years in its header row.YesYes, it reads them (OCR)About 6 min per 100 pages
Measured on 3M's 2018 annual report, 160 pages. Docling's time is the lab's measure on CPU.

One page, read three times

The top of 3M's 2018 balance sheet, as each reader hands it on. Look for the years.

3M 2018 annual report, page 58, read on 24 October 2026 with each reader's defaults. Shown down to total current assets.

3M's 2018 balance sheet, page 58
The page itself: 3M's consolidated balance sheet, 2018 against 2017.

pypdfium2

Table of Contents
3M Company and Subsidiaries
Consolidated Balance Shee t
At December 31
December 31, December 31,
(Dollars in millions, except per share amount) 2018 2017
Assets
Current assets
Cash and cash equivalents $ 2,853 $ 3,053
Marketable securities — current 380 1,076
Accounts receivable — net of allowances of $95 and $103 5,020 4,911
Inventories
Finished goods 2,120 1,915
Work in process 1,292 1,218
Raw materials and supplies 954 901
Total inventories 4,366 4,034
Prepaids 741 937
Other current assets 349 266
Total current assets 13,709 14,277

markitdown

Table of Contents
3M Company and Subsidiaries
Consolidated Balance Shee t
At December 31

|     |      December 31, |      December 31, |     |
| --- | ----------------- | ----------------- | --- |
(Dollars in millions, except per share amount)      2018      2017
| Assets                          |     |          |        |
| ------------------------------- | --- | -------- | ------ |
| Current assets                  |     |          |        |
| Cash and cash equivalents       |   $ | 2,853  $ | 3,053  |
| Marketable securities — current |     | 380      | 1,076  |
Accounts receivable — net of allowances of $95 and $103     5,020    4,911
| Inventories                         |     |             |           |
| ----------------------------------- | --- | ----------- | --------- |
| Finished goods                      |     | 2,120       | 1,915     |
| Work in process                     |     | 1,292       | 1,218     |
| Raw materials and supplies          |     | 954         | 901       |
| Total inventories                   |     | 4,366       | 4,034     |
| Prepaids                            |     | 741         | 937       |
| Other current assets                |     | 349         | 266       |
| Total current assets                |     | 13,709      | 14,277    |

Docling

## 3M Company and Subsidiaries Consolidated Balance Shee t At December 31

| (Dollars in millions, except per share amount)              | December 31, 2018   | December 31, 2017   |
|-------------------------------------------------------------|---------------------|---------------------|
| Assets                                                      |                     |                     |
| Current assets                                              |                     |                     |
| Cash and cash equivalents                                   | $ 2,853             | $ 3,053             |
| Marketable securities - current                             | 380                 | 1,076               |
| Accounts receivable - net of allowances of $95 and $103     | 5,020               | 4,911               |
| Inventories                                                 |                     |                     |
| Finished goods                                              | 2,120               | 1,915               |
| Work in process                                             | 1,292               | 1,218               |
| Raw materials and supplies                                  | 954                 | 901                 |
| Total inventories                                           | 4,366               | 4,034               |
| Prepaids                                                    | 741                 | 937                 |
| Other current assets                                        | 349                 | 266                 |
| Total current assets                                        | 13,709              | 14,277              |

A page like this is longer than one passage. Cut it, and the passages after the first are rows of figures with no year and no statement name: “Accounts payable 2,266 1,945”. Which one is 2018? The model has to guess.

What the header row bought

70 → 82

Putting the header row back at the top of every passage cut from a statement page: 82 right answers out of 150 instead of 70, with no more text sent to the model.

FinanceBench: 150 questions over 84 annual reports. Answers by Qwen3-8B from 5 passages, planning step on. 14 fixed, 2 broken.

One question to ask your team

Which reader turns our documents into text, and has anyone looked at what it does to our tables?
For engineers

What the readers do, and what was tested.

  • The app reads PDF, Word and PowerPoint with Docling, offline, with OCR and tables kept as Markdown, and plain-text formats with markitdown. The retrieval tests used pypdfium2 text, which is fast enough to compare settings.
  • Docling took 52.7 s on this one page, most of it loading its layout and table models; per page it is far less. The lab measured about six minutes per 100-page report on CPU.
  • The header rule tested: on a page over 8% digits, the lines above the first row of figures (64 tokens at most) lead every chunk cut from that page, inside the 256-token budget. 43,902 chunks became 44,773 (+2.0%).
  • Planner page hit@10 went from 0.753 to 0.780 with the headers; the answers moved more than the retrieval did. Of the 14 fixed, 8 had the right page in the 5 chunks before and after.