RAG Isn't Just Retrieval: Chunking, Re-Ranking, and Graph Strategies That Make Agents Actually Work
Most RAG demos stop at a vector database and call it done. Real deployments break on multi-hop questions, stale documents, and retrieval that returns semantically similar but useless text. The techniques here—hybrid search, re-ranking, parent-child chunking, and knowledge graphs—are what separate a toy from a system that answers questions correctly in production.
Pure vector search fails when semantic similarity doesn't equal answer relevance. Hybrid retrieval combines dense embeddings with BM25 keyword matching, then a re-ranking model like Cohere's rerank-v3.5 filters the top candidates. Query rewriting and HyDE—generating a hypothetical answer to use as the search query—further improve recall.
Knowledge graphs fill a gap that vectors can't touch: multi-hop relational queries. GraphCypherQAChain translates natural language into Cypher queries against Neo4j, and Microsoft's GraphRAG extracts entity communities, summarizes them, and retrieves within relevant clusters. For documents, parent-child chunking retrieves on small chunks for precision but returns larger parent chunks for context.
Production RAG also needs to solve "lost in the middle" attention drop-off, multi-hop reasoning through iterative retrieval loops, and conflicting information across sources. Incremental indexing with content hashing and versioned rollback keeps the knowledge base current without full rebuilds—an outdated knowledge base is worse than none.
RAG's hardest problems are not about embeddings or vector databases—they are about information architecture: how you chunk, how you order results, and how you handle conflicting sources.
The "lost in the middle" phenomenon means that even perfect retrieval can fail if the most relevant chunk lands in the LLM's attention dead zone, making document ordering a surprisingly high-leverage fix.
HyDE inverts the retrieval paradigm: instead of hoping the query matches the right document, you generate a plausible answer and search for documents that resemble it, which often works better for open-ended questions.
Knowledge graphs and vector search are not competitors—they solve different query shapes. A production RAG system needs both, plus a router that decides which path a question takes.
Most RAG tutorials treat the knowledge base as static, but real-world documents change constantly. The engineering effort shifts from building the index to maintaining it over time.