Skip to content
mentoor

Topic 2 of 5 · 5 min read

Retrieving document pages as images

Goal: Decide whether a document collection should be retrieved as page images or as parsed text and justify it from the content types it holds.

Page-image retrieval indexes each page as a picture, so layout, charts and tables stay intact, while a parse-then-chunk pipeline turns pages into text and loses whatever the parser cannot read. The two approaches fit different documents.

Check yourself · 1 of 3

What does ColPali embed?

Choose one answer

Why it matters

The usual RAG pipeline runs OCR or a PDF parser, splits the text into chunks and embeds the chunks. On a clean text report that works. On a slide deck, a scanned form or a page where the answer lives in a bar chart, the parser drops or scrambles the content, and the answer never reaches the index. You cannot retrieve what the pipeline never captured.

The two pipelines

Parse then chunk. Extract text, tables and headings, chunk, embed, search. It is cheap per page, easy to inspect and works with keyword search. Its failure is lost structure: merged table cells, figures dropped, reading order wrong on two-column pages.

Page images with late interaction. ColPali feeds a page screenshot to a vision-language model and keeps many vectors per page, one per image patch. A query is also split into token vectors. The score sums, for each query token, its best match among the page patches. This is the late-interaction idea from ColBERT applied to pictures. No OCR step is needed, and the ColPali paper reports it beating text pipelines on its ViDoRe benchmark of visually rich documents.

The cost

Many vectors per page means a larger index and slower search than one vector per chunk. You also need a vision model at indexing time, and often at answer time, to read the retrieved page image.

How to decide

  1. Sample 30 pages from the collection.
  2. Mark what each answer depends on: plain prose, a table, a chart, a diagram, handwriting, layout.
  3. If most answers live in prose, parse then chunk. If a large share depends on charts, slides or scans, test page images, or run both and merge results.
  4. Compare both on labeled queries, not on impressions.

Before and after

Before: a company indexes 400 quarterly slide decks with a PDF parser. The question "which region grew fastest in Q3?" fails, because the answer is a bar chart with no text.

After: the decks are indexed as page images. The chart page is retrieved, and a vision model reads it.

What goes wrong

  • Choosing page images for plain-text contracts and paying for a heavy index that adds little.
  • Choosing text parsing for slides because it is the default.
  • Retrieving the right page and then answering from a poor parse of that page instead of the image.

Examples

Two collections, two choices

Collection Answers live in Pipeline
Employment contracts Prose clauses Parse then chunk
Sales slide decks Charts and short labels Page images
Scanned lab forms Handwriting and boxes Page images, plus OCR check

The file type is PDF in all three. The content is what differs.

Key points

  • Parse-then-chunk loses what the parser cannot read: charts, figure labels, merged table cells and scanned pages.
  • Late interaction keeps many vectors per page and scores each query token against its best-matching patch.
  • Page-image indexes are larger and costlier than chunk indexes, so use them where visual content decides the answer.
  • Decide from a sample of pages: what the answers depend on matters more than the file type.
  • A hybrid that runs both pipelines and merges results is a valid choice for mixed collections.

Common mistakes

  • Picking a pipeline by file type (everything is a PDF) instead of by what the answers depend on.
  • Assuming OCR output is complete without checking pages with charts or two-column layouts.
  • Indexing page images and then discarding them, answering only from the text version of the retrieved page.
  • Adopting page images with no recall comparison against the existing text pipeline.

Check yourself · 2 of 3

Where does a parse-then-chunk pipeline most often fail?

Choose one answer

Check yourself · 3 of 3

A collection is 95 percent plain-text policy pages. What is the sensible starting pipeline?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic