How To · LLM TechniqueAdvanced

How to Build Multimodal RAG

Build multimodal RAG for images, charts, and scanned PDFs: visual document retrieval, page-level embeddings, and citations that point at figures, not just text.

Layout OCRVisual embeddingsPage indexVLM generatorFigure citations17 min · 6 steps · Updated 2026-08-25
The short answer

To build multimodal RAG, index page images and text together, retrieve with visual document retrieval plus keyword/vector search, generate from the actual page (not only an OCR dump), and cite page numbers and figures so a reader can open the crop that supports the answer.

What you’ll build

  • A dual index: text hybrid search plus visual document retrieval over page images
  • Layout-aware ingest that keeps bounding boxes for words, tables, and figures
  • Answers that cite page numbers and figure IDs, with a crop the user can open
  • A fallback OCR path when the visual retriever is unsure
  • Evals that fail if the cited page does not contain the claimed number

Before you start

  • 01A corpus that actually needs pixels: scans, charts, screenshots, or slide decks — not only born-digital text
  • 02Storage for page images plus text layers, with ACLs identical to the source files
  • 03An embedding path for pages or patches (ColPali-style or caption-then-embed) and a text hybrid index
  • 04A generator that can accept images, or a captioner if your LLM is text-only
  • 05A golden set of questions whose answers live in a figure, table, or stamp, not in body text

Key takeaways

  • 01

    Multimodal RAG is for answers that live in pixels: scans, charts, stamps, and screenshots.

  • 02

    Visual document retrieval over pages complements BM25 and text embeddings; it does not replace them for error codes and IDs.

  • 03

    Keep bounding boxes at ingest so citations can highlight a figure, not only a filename.

  • 04

    Send the retrieved page image to a VLM when the claim is visual; fall back to text for born-digital prose.

  • 05

    Evaluate on questions whose gold evidence is a figure, or you will ship a text RAG with extra cost.

01

When multimodal RAG is the right system

If every answer lives in a well-exported wiki, you do not need multimodal RAG. You need better chunking. Build this system when users ask about invoices, engineering drawings, slide charts, stamped forms, or screenshots of consoles — documents where the layout is the meaning.

The product contract is the same as text RAG: retrieve, ground, cite, refuse on empty. The difference is the evidence object. Instead of a 400-token passage, the evidence is a page image plus a box. If you cannot open that crop in the UI, you built a captioning demo.

02

Pages, boxes, and dual indexes

Ingest at page granularity. Render PDFs at a consistent DPI, deskew scans, and store a lossless-enough web image for the UI plus a model-sized thumbnail for the VLM. Run layout detection so tables and figures have IDs. OCR is a layer, not the source of truth: keep it for keyword search and for generators that cannot take images.

Metadata is still the enterprise deal. Page number, document ACL, source URL, figure id, and whether the page is photo, chart, or text. Query-time permission filters apply to images. A VLM that has seen a restricted page can leak it in paraphrase, the same as a text model.

03

Visual document retrieval for images and PDFs

Visual document retrieval embeds the page (or patches of the page) so a query like 'which bar is Q3 APAC' can match a chart without waiting for OCR to spell APAC. ColPali-style late interaction and similar page encoders are the current default for scanned PDFs. For product photography, a separate image encoder and a type flag keep those vectors out of the contract index.

Never drop BM25. Users still paste invoice numbers and error codes. Fuse visual ranks with text ranks, then re-rank the top pages. A cross-encoder over page text is cheap; a VLM re-ranker is accurate and expensive — use it on the last 20 pages, not the whole corpus.

  • Text-native docs: existing hybrid RAG, no page images in the prompt
  • Scanned PDFs: page embeddings + OCR BM25, VLM on the hit pages
  • Charts/slides: page or figure crops into the VLM, caption as a fallback
  • Photos: dedicated image index, do not mix with 300-dpi text pages
04

Generation and citations to pages and figures

When the hit is a chart or a stamp, send the image. When the hit is a paragraph of OCR, send text and save tokens. Mixed questions get both: image plus the text layer so the model can quote a number and still see the axis. Cap pages per turn; five full pages will blow the cost budget and the model's attention.

Citations must be clickable: document, page, figure id, and a box. The UI opens the crop. A faithfulness check compares the claimed number to OCR in that box or to a second VLM pass that answers 'is this claim on this crop?' Hallucinated page numbers are worse than no citation — they train users to trust a map that is wrong.

05

Evals that notice missing figures

Build a golden set where at least half the questions are unanswerable from OCR alone. Score retrieval (right page in top k), citation accuracy (page and box), and answer correctness. A text-only RAG will look strong on the prose subset and fail the rest; that split is the point of the dashboard.

Watch cost. Visual embeddings and VLM generation are not the same invoice as a 7B text extract. Route text-native questions away from the VLM. Cache page embeddings. Re-embed only changed pages. If you cannot name cost per visual question, you will meet it in month two.

06

Delivery in your cloud

ReinforcedX implements multimodal RAG in the client's VPC: ingest, dual index, citation UI, and the visual golden set. Model-agnostic on both embedders and VLMs. You own the page images, boxes, evals, and runbooks. No token markup.

Four weeks covers a pilot corpus, not the entire historical scan archive. Week 1 picks the pixel-native sources, week 2 indexes a slice, week 3 shadow-modes next to text RAG, week 4 hands over. Thirty days on-call is for the first bad scanner batch, which will arrive.

Step-by-step build

  1. 1

    Separate pixel-native documents from text-native ones

    Route born-digital HTML and DOCX through the text RAG path; route scans, slides, photos, and chart-heavy PDFs through a page-image pipeline.

  2. 2

    Ingest pages with layout, not just strings

    Render each page to an image, run layout OCR for a text layer, and store bounding boxes for words, tables, and figures next to the page id.

  3. 3

    Build visual document retrieval

    Embed pages or patches with a document-vision model (or ColPali-style late interaction) and keep a parallel BM25 index on the OCR/text layer.

  4. 4

    Fuse text and visual hits

    Reciprocal-rank-fuse page hits from both indexes, filter by the user's ACL, and cap the prompt at a small number of pages plus their text layers.

  5. 5

    Generate with the page in context

    Pass page images to a VLM for chart and stamp questions; pass text layers for prose; require a page number and optional bounding box on every claim.

  6. 6

    Evaluate on visual evidence

    Golden questions must point at a page and box; fail the case if the model cites a different page or invents a number not in the crop.

Common pitfalls

The mistakes that show up in real deployments — each one costs a week if you learn it the hard way.

OCR-only on a chart corpus

OCR reads axis labels poorly and misses the line the user is asking about. If the answer is in the plot, you need visual retrieval or a VLM over the page, not more Tesseract.

Embedding captions and throwing away the image

Captions are lossy. 'Revenue grew' is not Q3 12.4%. Keep the page image for generation even if you retrieved via a caption.

Citing the PDF filename

A 80-page scan cited as 'budget.pdf' is not a citation. Store page index and a bounding box so the UI can open the figure.

One embedding space for photos and contracts

Natural-image models and document-page models are different. Mixing product photos with 300-dpi invoices in one index without a type flag pollutes both.

No permission filter on images

Pixels leak as easily as text. Apply the same query-time ACL to page images that you apply to chunks, and do not send unauthorized pages to the VLM.

Frequently asked questions

What is multimodal RAG?

Multimodal RAG retrieves and generates over more than text: page images, charts, scans, and figures, with citations that point at those pixels. It is the right design when the answer is in a plot or a stamp. If your corpus is already clean HTML, text RAG with better chunking is enough.

How do I run RAG on images and PDFs with visual document retrieval?

Render pages, embed them with a document-vision model, keep OCR in a BM25 index, fuse the ranks, and send hit pages to a VLM with a required page/figure citation. Filter images by ACL before the VLM sees them. Score the system on questions whose gold evidence is a figure, not a paragraph.

Do I still need OCR if I have a vision model?

Yes, for keyword search, for invoice IDs, and for generators you do not want to pay per image. OCR is the text layer. The vision path is for layout and charts. Dropping either one shows up immediately on a mixed corpus.

How should multimodal RAG cite a chart?

Cite document, page, figure id, and a bounding box, and show the crop in the UI. Do not cite the PDF filename. Run a faithfulness check that the claimed number appears in that crop or that a second pass agrees the crop supports the claim.

Can ReinforcedX index our scans without taking the files off-network?

Yes. Work runs in your cloud. You own the page images, datasets, evals, and runbooks. Four-week pilot, 30 days on-call, model-agnostic, no token markup. We will not require a SaaS upload of your invoice archive. The page index stays in your VPC; we do not keep a copy of the scans after handover.

Want this built for your team?

From architecture review to a deployed, evaluated system your engineers own — we ship it with you.

FAQ

Working with us

How soon can this build work start?

Typically within a week or two of a scope being agreed. The first delivery is deliberately a small batch so you can check the output against your expectations before volume ramps.

What do you need from our team?

One process owner who knows the workflow, one engineer with access to the systems involved, and a weekly 45-minute review. No standing committee, and no requirement for an ML specialist on your side.

Who owns the output and the data?

You do. Datasets, labels, weights, evaluation suites and runbooks are yours and are handed over at the end. Your data trains your models only, with zero-retention provider settings by default.

Can you scale volume up quickly if we need it?

Yes, and the quality bar holds because the rubric and gold set are already agreed by that point. Ramping is a staffing question, not a re-scoping one, so it usually takes days rather than a new engagement.

We already have a vendor for this. Why switch?

Often you should not. The cases where teams move to us are when they cannot get a quality number out of their current vendor, or when the work is delivered as an opaque batch with no trace of how disagreements were resolved.

What happens after the engagement ends?

We stay on-call for 30 days at no extra cost, then move to an optional support retainer. Most teams also keep a quarterly evaluation review with us to catch drift early.

Copyright © 2026
ReinforcedX, Inc.
All rights reserved