Problem
A team building question answering over PDF, HTML or DOCX files must decide how to extract components, chunk them, index them and retrieve them. Documents mix narrative text, tables, images and captions that cannot be treated alike. An LLM has a limited context window and works better with little irrelevant text, so the chunking choice changes what a query returns. Naive splitting breaks tables and arguments, and a chunk like "He won the World Cup in 2022" loses its subject.
Example from the article: a 600-word paragraph cut by a 500-word fixed splitter lands in two chunks, which can break its argument.
Solution in brief
Partition each document into typed components and chunk each type so its structure survives. Index LLM-made summaries, propositions or hypothetical questions that point back to the original chunk. At query time, generate several query variants and merge the ranked lists with reciprocal rank fusion.
Questions this case answers
- How to split and index mixed-content documents so that retrieval returns complete, self-contained evidence for a question
- How to improve recall of a retrieval step when user wording differs from the wording in the indexed documents
- How to choose a chunking strategy for PDF, HTML and DOCX documents in a RAG pipeline?
- How to index text, tables and images in one vector database so a question can retrieve any of them?
Tools and methods
- Unstructured — splits a file into typed elements (Title, NarrativeText, ListItem).
- LangChain text splitters — fixed-size, recursive and format-aware chunking.
- Proposition-based chunking — LLM rewrites text into self-contained atomic facts.
- CLIP — embeds text and images in one vector space.
- MultiVectorStore — indexes summaries or questions, returns the original chunk.
- RAG Fusion, Reciprocal Rank Fusion — several generated queries, one merged ranking.
- RAGAS — RAG evaluation, can run in CI/CD.
Google or a one-time email code. No password.