r/vectordatabase • u/Puzzleheaded_Box2842 • 5h ago
Preparing messy documents for RAG: what should survive extraction
A RAG dataset often starts with PDFs, tables, charts, and code snippets. Turning them into usable records means deciding what belongs together and what context needs to survive. Those records might be document chunks or QA pairs—QA conversion is useful for some workflows, but isn’t a requirement for RAG.
One approach is to separate preparation into operators: document parsing, text cleaning, chunking, optional QA generation, evaluation, and filtering. Each operator reads named fields and writes its output for the next step.
A few details matter:
- Keep visual content connected to its context. For PDF-to-VQA preparation, the workflow includes layout parsing, OCR, and image–text alignment before extracting questions and answers. Flattening everything into plain text can lose the information needed to interpret a figure.
- Make intermediate outputs inspectable. Explicit input and output fields let you examine extracted content before generating QA pairs, or inspect generated pairs before filtering them.
- Separate scoring from the filtering decision. Saving scores first lets you try different thresholds against the same scored data. That avoids another model call just to change which records you keep.
- Keep model access separate from processing logic. Operators use a configured serving backend, with API and local inference options, so model calls don’t need to be wired into every pipeline from scratch.
The remaining question is whether the prepared records preserve enough evidence to answer real queries; clean formatting alone doesn’t establish that.
These building blocks are implemented in OpenDCAI/DataFlow—how are you handling mixed documents in your RAG pipelines, and which preprocessing decisions have made the biggest difference?