Authors’ overview
Retrieval-Augmented Generation (RAG) is widely used to ground large language models in external knowledge sources. However, when applied to heterogeneous corpora and multi-step queries, Naive RAG pipelines often degrade in quality due to flat knowledge representations and the absence of explicit workflows. In this work, we introduce DCD (Domain-Collection-Document), a domain-oriented design to structure knowledge and control query processing in RAG systems without modifying the underlying language model. The proposed approach relies on a hierarchical decomposition of the information space and multi-stage routing based on structured model outputs, enabling progressive restriction of both retrieval and generation scopes. The architecture is complemented by smart chunking, hybrid retrieval, and integrated validation and generation guardrail mechanisms. We describe the DCD architecture and workflow and discuss evaluation results on synthetic evaluation dataset, highlighting their impact on robustness, factual accuracy, and answer relevance in applied RAG scenarios.
Introduction
RAG has gained widespread adoption as a practical approach for integrating language models with external knowledge sources [Lewis et al., 2020]. Even basic Naive RAG implementations can effectively address a broad range of applied tasks, from customer support query handling to enterprise document analysis [Izacard et al., 2021].
However, as data volumes grow and user queries become more complex, the limitations of standard RAG pipelines become increasingly apparent. In particular, the linear architecture of Naive RAG exhibits degraded performance on multi-step queries that require sequential interpretation, retrieval across multiple knowledge slices, and result aggregation [Wei et al., 2023]. Another critical issue is the sensitivity of RAG systems to document segmentation parameters. These factors limit the applicability of Naive RAG in scenarios demanding high accuracy and predictable behavior.
Existing approaches often improve RAG systems through additional reasoning loops or agent orchestration layers. In contrast, this work follows an architectural rather than agentic direction. We propose DCD (Domain–Collection–Document), a domain-oriented RAG design that improves retrieval robustness through an explicit hierarchical organization of knowledge and a controlled query-processing workflow. Instead of relying on additional reasoning mechanisms, DCD constrains retrieval through hierarchical decomposition of the knowledge base. The proposed approach improves answer quality for multi-step queries while preserving reproducibility, controllability, and operational safety without modifying the underlying language models.
Retrieval-Augmented Generation
Throughout this work, Naive RAG refers to a linear pipeline without explicit knowledge structuring, query decomposition, or multi-stage generation control. We deliberately focus not on modifying the language model itself, but on organizing knowledge and workflows around it.
In many practical RAG implementations, retrieval is performed once at the beginning of the pipeline and remains fixed throughout the generation process. This design assumes that a single retrieval step can provide all information required to answer the query. However, when the knowledge corpus contains documents from multiple semantic domains, similarity-based retrieval may return fragments that are locally relevant but belong to different knowledge contexts. As a result, the retrieved context may contain partially compatible evidence, forcing the language model to reconcile inconsistent information during generation [Li et al., 2025].
Chunking
The quality of a RAG system is highly dependent on document segmentation strategies. Common chunking approaches include paragraph-based segmentation, fixed-length chunks, and sliding-window techniques [Gao et al., 2021]. In our implementation, we apply a sliding-window segmentation strategy with overlap ranging from 5–10% of the chunk size. A 5% overlap is typically sufficient to preserve contextual continuity between adjacent chunks. For documents containing semantically similar or repetitive sections, the overlap is increased to 10% to better capture contextual dependencies.
Guardrails
Classical RAG implementations typically rely on built-in safety mechanisms of language models and lack explicit architectural procedures for validating generated outputs [Ji et al., 2023]. In particular, they provide no systematic means to verify alignment between generated answers and retrieved context or to refuse generation outside the system’s functional scope [Lin et al., 2022]. Our system incorporates a guardrails mechanism combined with a hallucination prevention module. This mechanism consists of two interrelated components. The first component analyzes user queries for prohibited topics using a composite dictionary that includes both a base set of stop-words and custom elements defined by the system owner. The second component analyzes generated outputs, ensuring the absence of prohibited content and detecting hallucinations. This is achieved by comparing the original query, the retrieved context, and the generated response, enabling early detection of deviations during generation.
Key Assumption
The central methodological assumption of this work is that answer quality significantly improves when retrieval and generation are constrained to semantically homogeneous knowledge regions — a subset of the corpus whose documents share a common topical scope, terminology, and expected user intent, while remaining clearly distinguishable from documents belonging to other regions [Yao et al., 2023]. Within such a region, documents address closely related subject areas and therefore compete primarily with semantically relevant sources during retrieval.
This constraint allows the retrieval process to operate within a bounded semantic space, reducing interference from unrelated documents and improving the alignment between retrieved evidence and the informational structure of the query. Rather than operating over a monolithic document store, we assume a prior decomposition of the corpus into independent subspaces, within which documents compete only with semantically similar sources [Khot et al., 2023].
This issue is closely related to the organization of the knowledge space itself. When retrieval operates over a heterogeneous corpus without explicit semantic boundaries, documents from different knowledge regions compete within the same search space. In such settings, embedding similarity alone may not reflect the structural dependencies between pieces of information required to answer the query. As a result, retrieved evidence may be individually relevant but collectively insufficient for coherent reasoning [Li et al., 2025].
Evidence retrieval studies for long documents demonstrate that coarse-to-fine search strategies can improve the identification of relevant evidence compared to flat fragment-level retrieval. In such approaches, higher-level structural segments are first identified and only then used to guide fine-grained passage selection. By narrowing the search space to semantically coherent regions of a document, retrieval systems preserve global contextual relationships and improve the reliability of downstream question answering [Nair et al., 2023].
Experimental Validation of the Assumption
To validate this assumption, we conducted experiments on a synthetic dataset constructed to approximate real-world RAG scenarios. The corpora consist of heterogeneous documents with varying structures and semantic granularity — conditions under which pipelines most frequently degrade due to flat knowledge organization and unstable retrieval.
All datasets were anonymized for confidentiality: client identifiers and sensitive metadata were removed. The paper reports procedures and observed effects without disclosing document contents. In addition to quality metrics, we recorded operational characteristics of the pipeline, including total evaluation time, mean end-to-end response time, and time to first token, allowing analysis of the trade-off between accuracy and latency under increased workflow complexity.
DCD: Domain–Collection–Document
The DCD (Domain–Collection–Document) Design is an approach to organizing knowledge in RAG systems through explicit hierarchical segmentation of the information space. Its primary goal is to minimize overlap between knowledge areas and prevent irrelevant context from being passed to the language model [Makin, 2024].
Hierarchical Levels
A Domain defines top-level search boundaries and is constructed to minimize semantic overlap with other domains. A Collection represents a narrower thematic slice within a domain and further restricts the retrieval space. Examples include legal documents, reference materials, or user FAQs within a single domain. A Document is the basic unit used in the RAG process. Documents are enriched with metadata and may be further segmented into chunks for context retrieval. Information retrieval follows a top-down principle: from domain to collection to document.
Navigation through the hierarchy is performed by the DCD Router, which sequentially selects the most relevant domain, collection, and document for a given query. At each level, routing is formulated as a selection task over a limited candidate set [Shazeer et al., 2017]. Router decisions are produced using structured outputs from the language model, ensuring transparency, reproducibility, and intermediate result caching. To improve robustness, fallback elements (main domain, main collection, main document) are defined at each level.
DCD Router
The functional core of domain segmentation is the DCD Router, a specialized module responsible for identifying the target knowledge segment for retrieval. Like most system components, it relies on structured language model outputs (JSON), enabling high-precision processing and transparent decision-making [OpenAI, 2024].
Initial configuration involves defining domain and collection structures and assigning knowledge assets accordingly. Documents retain their original titles, while domains and collections receive manually defined identifiers. Upon receiving a user query, the system submits it — along with the registry of available domains — to the language model to identify the most relevant domain. This procedure is repeated hierarchically for collections and documents. If the language model produces incorrect outputs, fallback elements at each level ensure system robustness and guarantee a response even after multiple failed routing attempts.
Higher hierarchy levels are described with richer metadata to reduce routing errors, since mistakes at upper levels may propagate downstream and restrict the search space to an incorrect semantic region of the knowledge base. Providing clearer semantic descriptions for domains and collections improves the reliability of the initial routing decisions and helps maintain stable navigation across the hierarchy.
In the present study, routing accuracy at individual hierarchy levels was not evaluated as a separate classification metric. Instead, the routing mechanism is considered as part of the overall retrieval pipeline, and its effectiveness is reflected in downstream system behaviour, including answer relevance, factual accuracy, and retrieval coverage.
Integration with the RAG Pipeline
By constraining the retrieval space upfront, DCD reduces the likelihood of irrelevant context inclusion and improves generation robustness on multi-step queries. While Naive RAG employs a linear processing pipeline — chunking, embedding, retrieval, and generation — DCD preserves a similar user interface but introduces a fundamentally different internal organization based on multi-level processing.
Smart Chunking
Smart chunking is an integral component of the DCD design. Although DCD can operate with classical chunking methods, the selected strategy provided the most stable behaviour within the proposed architecture, as it better preserves the structural properties of the underlying knowledge base.
In this approach, documents are segmented using a sliding window mechanism with partial overlap between neighbouring fragments. This segmentation strategy preserves local semantic continuity and reduces the likelihood that relevant contextual information will be lost at chunk boundaries. As a result, logically connected statements that span multiple sentences or paragraphs remain accessible during retrieval, which is particularly important for queries requiring compositional reasoning.
Each fragment is additionally enriched with chunk-level metadata derived from the document structure. These metadata describe the fragment’s position within the document hierarchy and maintain references to the corresponding document-level entity. Such structural annotations allow the retrieval stage to operate not only on semantic similarity but also on contextual relationships between fragments originating from the same document or collection.
The combination of overlapping segmentation and structured metadata improves the consistency of fragment retrieval and reduces the probability of assembling answers from semantically unrelated contexts. This design enables the retrieval pipeline to better align selected evidence with the conceptual structure of the query and contributes to more stable answer generation in retrieval-augmented workflows, as reflected in the experimental evaluation presented later in the paper.
Fast Guardrails
In addition to the main retrieval and generation pipeline, the system introduces a fast guardrails mechanism for early response validation. The system includes a guardrails mechanism combined with hallucination prevention and a fast pre-check function that evaluates responses before full generation completes [Manakul et al., 2023].
System Completeness Summary
The DCD architecture demonstrates significant advantages in adaptability when processing heterogeneous data and structurally complex queries. Its flexibility yields substantial accuracy improvements in multi-level knowledge scenarios while integrating critical validation and control stages absent in Naive RAG systems. While initial configuration requires additional setup effort, these costs are offset by superior performance and rapid amortization through improved operational efficiency.
Experiment
The experiment employed a simplified variation of DCD, in which an LLM classifier with structured outputs is applied before vector retrieval and sequentially identifies the target domain and collection associated with a query. The underlying corpus was constructed from real information about residential complexes provided by a real-estate development client. Real names and numerical values were replaced with synthetic ones while preserving the original structure and relationships within the data.
The evaluated baselines included Naive RAG, Naive RAG with reranking, Contextual RAG, and RAPTOR. In addition to the baseline DCD configuration, two extensions were evaluated: DCD with cross-encoder reranking and a hybrid configuration operating on top of a contextual index.
The evaluated approaches are briefly described below. Naive RAG is a standard retrieval-augmented generation pipeline. User queries are embedded using a single embedding model, top-k chunks are retrieved from a unified vector index, and the retrieved chunks are passed to the language model as context for answer generation. Naive RAG + Reranker extends the baseline pipeline with a cross-encoder reranker. The top-20 retrieved candidates are reranked through full query-document interaction, and the highest-ranked top-10 chunks are used for answer generation.
Contextual RAG [Anthropic, 2024] modifies the indexing stage by enriching each chunk with an LLM-generated prefix describing its position within the hierarchy (domain, collection, document). Retrieval is then performed over the enriched index and combined with reranking. RAPTOR [Sarthi et al., 2024] employs a hierarchical retrieval index. Chunks are recursively clustered, an LLM generates summaries for each cluster, and a multi-level abstraction tree is constructed. Retrieval is performed simultaneously across all hierarchy levels.
Configuration Complexity
The DCD approach introduces additional configuration complexity as the size and heterogeneity of the knowledge base increase. Maintaining clear semantic boundaries between domains and collections becomes more difficult as the number of knowledge areas grows, especially when adjacent domains share overlapping terminology or document structures [Yao et al., 2023].
The experimental evaluation was conducted using a reduced routing configuration in which retrieval-space restriction is performed at the domain and collection levels through a structured-output classifier. This setup preserves the core principle of hierarchical retrieval-space restriction while reducing inference overhead and simplifying the experimental setup.
Fully Unstructured Data
DCD assumes the presence of at least minimal semantic organization within the knowledge corpus. When applied to fully unstructured data, the effectiveness of structured retrieval and routing mechanisms degrades, often converging toward the behavior of advanced naive RAG pipelines [Gao et al., 2021].
Computational Overhead
It is important to consider the specifics of the generated dataset: all documents have a template-based structure in which texts within each domain are almost identical and differ only in specific values such as names and numerical characteristics, while preserving the same overall syntactic and semantic structure. [Shazeer et al., 2017].
Conclusion
We introduced DCD, a domain-oriented RAG design based on explicit knowledge hierarchies and controlled multi-stage retrieval workflows. Unlike conventional RAG pipelines that operate over a unified retrieval space, DCD constrains retrieval through hierarchical decomposition of the knowledge base and sequential routing across semantic levels. The approach is designed to leverage knowledge structures that are already present in many enterprise information systems.
To evaluate the proposed approach, we constructed a synthetic benchmark derived from real client data and compared DCD against Naive RAG, Contextual RAG, RAPTOR, and reranking-based baselines. The results demonstrate that hierarchical retrieval-space restriction can improve retrieval quality and factual consistency while maintaining predictable computational costs. In particular, DCD achieved the highest factual accuracy among the evaluated approaches and demonstrated highly reliable routing performance according to the proposed structural metrics.
The findings suggest that explicit knowledge organization can serve as an effective alternative to increasingly complex agentic and reasoning-based retrieval architectures in domains where semantic boundaries are already known and can be formalized. Rather than introducing additional reasoning loops, DCD improves retrieval robustness through controllable knowledge partitioning and constrained search.
Several limitations remain. The current study was conducted on a synthetic benchmark derived from a single application domain, and the evaluated DCD configuration employed only a two-level hierarchy without explicit document-level routing. Future work includes large-scale evaluation on heterogeneous enterprise corpora, replacing general-purpose LLM routers with specialized lightweight classifiers, and extending the approach with backward navigation and contextual relevance validation mechanisms.


