Chengshuo Dai
Back to Blog

Advanced RAG Architectures: Parent Document Retrieval and Semantic Chunking

RAG

Retrieval-Augmented Generation (RAG) has become the standard architecture for grounding LLMs in external knowledge. However, naive RAG implementations—which simply chunk documents, embed them, and retrieve the top-k matches—often suffer from context fragmentation and poor retrieval accuracy. Advanced RAG architectures address these issues through sophisticated indexing and retrieval strategies.

One major challenge in naive RAG is the chunk size dilemma. Small chunks provide highly precise embeddings for retrieval but lack the surrounding context the LLM needs to generate a comprehensive answer. Large chunks provide ample context but dilute the embedding, making it harder for the vector search to find exact matches. Parent Document Retrieval (or Auto-Merging Retrieval) solves this by decoupling the retrieval chunk from the synthesis chunk.

In this architecture, documents are split into a hierarchy of chunks: large "parent" chunks and smaller "child" chunks. Only the child chunks are embedded and stored in the vector database. Each child chunk maintains a metadata link to its parent. During retrieval, the system searches against the precise child chunks. Once the most relevant child chunks are identified, the system fetches their corresponding parent chunks and feeds those larger, context-rich blocks to the LLM.

Another critical advancement is Semantic Chunking. Instead of splitting documents arbitrarily by character count or overlapping windows, semantic chunking analyzes the text to split it at logical boundaries. This can be achieved by calculating the cosine similarity between sequential sentences; a significant drop in similarity indicates a shift in topic, marking an ideal boundary for a new chunk. This ensures that a single chunk encapsulates a complete thought, preventing critical information from being split across two separate vectors. Combined with robust metadata filtering (e.g., filtering by date or document type before vector search), these techniques drastically reduce hallucinations and improve the reliability of enterprise RAG systems.

References:

  1. LlamaIndex Blog: Evaluating the Ideal Chunk Size for a RAG System - https://www.llamaindex.ai/blog/evaluating-the-ideal-chunk-size-for-a-rag-system-today-58d6f56d011d
  2. Pinecone: Advanced RAG Techniques - https://www.pinecone.io/learn/advanced-rag-techniques/