Architecture Overview
dsRAG is built around three key methods that improve performance over vanilla RAG systems:
- Semantic sectioning
- AutoContext
- Relevant Segment Extraction (RSE)
Key Methods
Semantic Sectioning
Semantic sectioning uses an LLM to break a document into cohesive sections. The process works as follows:
- The document is annotated with line numbers
- An LLM identifies the starting and ending lines for each "semantically cohesive section"
- Sections typically range from a few paragraphs to a few pages long
- Sections are broken into smaller chunks if needed
- The LLM generates descriptive titles for each section
- Section titles are used in contextual chunk headers created by AutoContext
This process provides additional context to the ranking models (embeddings and reranker), enabling better retrieval.
AutoContext (Contextual Chunk Headers)
AutoContext creates contextual chunk headers that contain:
- Document-level context
- Section-level context
These headers are prepended to chunks before embedding. Benefits include:
- More accurate and complete representation of text content and meaning
- Dramatic improvement in retrieval quality
- Reduced rate of irrelevant results
- Reduced LLM misinterpretation in downstream applications
Relevant Segment Extraction (RSE)
RSE is a query-time post-processing step that:
- Takes clusters of relevant chunks
- Intelligently combines them into longer sections (segments)
- Provides better context to the LLM than individual chunks
RSE is particularly effective for:
- Complex questions where answers span multiple chunks
- Adapting the context length based on query type
- Maintaining coherent context while avoiding irrelevant information
Document Processing Flow
- Documents → VLM file parsing
- Semantic sectioning
- Chunking
- AutoContext
- Embedding
- Chunk and vector database upsert
Query Processing Flow
- Queries
- Vector database search
- Reranking
- RSE
- Results
For more detailed information about specific components and configuration options, please refer to: - Components Documentation - Configuration Options - Knowledge Base Details