MS-RAGS(ALL-IN-ONE) Docs

How To Choose

RAG type selection should follow the failure mode. If a simple vector lookup works, keep it simple. If retrieval misses context, use query enhancement or fusion. If answers are unsupported, use self-checking or corrective patterns. If documents are long, preserve parent context.

NeedChooseReason
First working baselineNaive RAGSimple, fast, easy to debug.
Production support botAdvanced RAGAdds quality controls around retrieval.
Complex tool-using tasksAgentic RAGUses LangGraph to plan retrieval, query rewriting, direct answering, and approved tool use.
Long documentsParent-Child RAGSmall chunks retrieve, larger parent passages answer.
Cross-document analysisGraphRAGUses relationships, entities, and communities.
Ambiguous questionsMulti-Query RAG or RAG-FusionSearches multiple phrasings.
Strict groundingSelf-RAG or Corrective RAGGrades retrieved evidence, checks answer support, or uses approved corrective fallback.

RAG Recommendation Matrix

Use this table when the user asks, "Which RAG should I choose?" The recommendation should come from the problem shape, not from what sounds most advanced.

RAG typeRecommended conditionUse it whenAvoid it whenBest companion settings
Naive RAGFirst baseline and simple Q&A.Documents are clean, questions are direct, and you need a working system quickly.Questions are ambiguous, multi-hop, or answers need strict verification.Recursive chunking, Dense Vector retrieval, top_k 4-8.
Advanced RAGDefault production starting point.The baseline works but retrieval quality, grounding, or answer consistency must improve.You have not inspected retrieved chunks yet.Query rewriting, hybrid retrieval, reranking, RAGAS/DeepEval checks.
Modular RAGCustom architecture with replaceable stages.Different content types need different retrievers, prompts, or routing paths.A single simple pipeline is enough.Clear module boundaries, structured logs, evaluation per module.
Agentic RAGTool-using or multi-step workflows.The system should retrieve, optionally call user-approved tools through explicit triggers, use approved memory, and then answer with traceable steps.Latency must be predictable or the question is a simple lookup.LangGraph traces, conservative tools, strict permissions.
Self-RAGStrict grounded answers.You need relevance grading on retrieved documents and an answer support check before returning.You cannot afford extra LLM checks.High-quality embeddings, lower top_k, faithfulness metrics.
Corrective RAGCorpus coverage is uncertain.Retrieved chunks may be wrong, missing, stale, or incomplete, and the system may need an approved Web Search fallback.Your corpus is complete and retrieval is already strong.Document grading, fallback logging, source-quality review.
Speculative RAGHypothesis-first retrieval.A draft answer or hypothesis can help find better evidence.The model is likely to invent unsupported claims.Reranking, strict grounding prompt, answer verification.
GraphRAGCross-document relationship analysis.Questions depend on entities, relationships, communities, or facts spread across many documents.Your documents are small or relationship extraction is unnecessary.Entity extraction, graph metadata, analytical evaluation queries.
HyDE RAGQuery wording differs from document wording.User questions are abstract but the corpus uses different technical language.The generated hypothetical answer may drift too far from the corpus.Strong generation model, reranking, drift checks.
Multi-Query RAGAmbiguous or underspecified questions.One query phrasing misses useful chunks.Latency/cost must stay minimal.3-5 query variants, deduplication, reranking.
RAG-FusionMultiple retrieval paths need merged ranking.You want better recall and ranking from several rewritten queries.A single retrieval call already returns strong context.Reciprocal rank fusion, hybrid retrieval, top_k tuning.
Step-Back RAGQuestions need background principles.The answer needs both general concepts and specific source facts.Questions are direct factual lookups.Broad query generation, original query retrieval, final synthesis prompt.
Parent-Child RAGLong documents need surrounding context.Small chunks retrieve the right location but answers need the larger section around it.Documents are already short and self-contained.Child chunks 300-600 tokens, parent chunks 1200-2500 tokens.
Adaptive RAGMixed simple and retrieval-heavy workloads.Some questions can be answered directly while others should retrieve corpus evidence first.You cannot reliably route query complexity.Routing prompts, LangGraph traces, per-route evaluation.
Contextual Compression RAGRetrieved chunks are long or noisy.Relevant chunks contain too much irrelevant text and the final prompt overflows.Chunks are already short and clean.Embeddings filters first, LLM extraction only when necessary.

Technical Selection Criteria

Latency

Naive RAG and Dense Vector retrieval are usually fastest. Multi-query, RAG-Fusion, Self-RAG, Corrective RAG, and Agentic RAG add extra LLM or retrieval calls.

Recall

Multi-Query RAG, RAG-Fusion, HyDE, and Step-Back RAG improve recall when one query phrasing does not find enough useful context.

Grounding

Self-RAG, Corrective RAG, reranking, compression, and stricter system prompts help reduce unsupported answers.

Document shape

Parent-Child RAG and Contextual Compression RAG are best when documents are long, verbose, or contain multiple topics per retrieved chunk.

Technical Architecture Diagrams

Each picture shows the actual shape of the runtime path. Use these diagrams when deciding which extra steps are worth the latency, credentials, and operational complexity for your users.

Naive RAG

QueryEmbedVector DBTop-k ContextLLM Answer

Single retrieval path. Best for a first baseline and easy debugging.

Advanced RAG

QueryRewrite / HyDEHybrid RetrieveRerankCompressAnswer

Adds quality controls around the baseline path for production Q&A.

Modular RAG

QueryRouterRetriever ModulePrompt ModuleEvaluator ModuleAnswer

Stages are replaceable, so teams can swap modules per domain or file type.

Agentic RAG

QueryLangGraph PlannerRetrieveApproved ToolsMemoryTrace + Answer

Uses permission-gated tools, memory, and routing for multi-step tasks.

Self-RAG

QueryNeed Retrieval?RetrieveGrade EvidenceGenerateSupport Check

Reflects on retrieval and verifies whether the answer is grounded.

Corrective RAG

QueryRetrieveGrade ChunksRewrite RetryApproved Web SearchCorrected Answer

Repairs weak retrieval with explicit checks and approved fallback paths.

Speculative RAG

QueryDraft HypothesisEvidence SearchVerifyFinal Answer

Uses an initial draft to guide retrieval, then verifies against evidence.

GraphRAG

DocumentsEntities + RelationsGraph StoreCommunitiesVector EvidenceLocal / Global Answer

Builds persistent graph context for cross-document relationship questions.

HyDE RAG

QueryHypothetical DocEmbed HypothesisRetrieve Real ChunksAnswer

Useful when user wording is abstract but documents use different terms.

Multi-Query RAG

QueryQuery VariantsRetrieve ARetrieve BRetrieve CMerge ContextAnswer

Improves recall by searching multiple phrasings of the same question.

RAG-Fusion

QueryGenerated QueriesParallel RetrievalReciprocal Rank FusionAnswer

Merges result rankings from multiple retrieval paths for stronger recall.

Step-Back RAG

QueryBroader QuestionOriginal QuestionBackground ContextSpecific EvidenceSynthesis

Combines general principles with source-specific facts.

Parent-Child RAG

DocumentsParent ChunksChild IndexRetrieve ChildReturn Parent ContextAnswer

Small chunks find the location; larger parent context gives the answer.

Adaptive RAG

QueryComplexity RouterDirect AnswerNaive RAGRewrite + RetrieveAnswer

Routes simple, normal, and complex questions to different paths.

Contextual Compression RAG

QueryRetrieve ChunksFilter / ExtractCompressed ContextAnswer

Removes irrelevant text before generation to reduce noise and prompt size.

Supported RAG Architectures

Default baseline

Naive RAG

How it works: query embedding, top-k vector retrieval, context inserted into prompt, answer generated.

Use when: documents are clean and the user needs straightforward Q&A.

Tradeoff: weak on ambiguous, multi-hop, or noisy queries.

Production default

Advanced RAG

How it works: adds query rewriting, HyDE, reranking, or compression around the basic RAG flow.

Use when: quality matters more than raw latency.

Tradeoff: more moving parts and more model calls.

Modular RAG

How it works: treats routing, retrieval, fusion, memory, and generation as replaceable modules.

Use when: teams need full control over each stage.

Tradeoff: more architecture decisions for users.

LangGraph

Agentic RAG

How it works: plans whether to retrieve, rewrite, call approved tools, or answer directly, then follows the selected graph path.

Use when: tasks need approved tools, memory, URL reading, file reading, API reads, or multi-step reasoning.

Tradeoff: less predictable latency and cost.

LangGraph

Self-RAG

How it works: reflects on retrieval need, grades retrieved document relevance, generates, and checks whether the final answer is supported by context.

Use when: hallucination control matters.

Tradeoff: slower than simple RAG.

LangGraph

Corrective RAG (CRAG)

How it works: grades retrieved chunks, removes irrelevant content, rewrites weak queries, and can use approved Web Search fallback when the corpus is insufficient.

Use when: corpus coverage is uncertain.

Tradeoff: needs additional relevance checks.

Speculative RAG

How it works: drafts an answer first, then retrieves evidence to verify or improve it.

Use when: a hypothesis can guide retrieval.

Tradeoff: early guesses must be carefully grounded.

GraphRAG

How it works: extracts entities and relationships during ingestion, stores a persistent graph, builds community summaries, then combines graph context with hybrid evidence retrieval.

Use when: questions span many documents and entity names or relationships matter.

Requirement: configure a graph store and keyword store.

HyDE RAG

How it works: creates a hypothetical ideal answer document, embeds it, and retrieves real chunks close to it.

Use when: query wording differs from document wording.

Tradeoff: hypothetical content can drift.

Multi-Query RAG

How it works: generates multiple query variants and retrieves for each variant.

Use when: one query phrasing misses good context.

Tradeoff: multiple retrieval calls.

RAG-Fusion

How it works: retrieves from multiple generated queries and merges rankings with reciprocal rank fusion.

Use when: ranking quality is more important than speed.

Tradeoff: more retrieval work per question.

Step-Back RAG

How it works: asks a broader conceptual question, retrieves background principles, then combines with original context.

Use when: questions need theory plus facts.

Tradeoff: not needed for simple lookup.

Parent-Child RAG

How it works: indexes small child chunks, stores parent document state, then returns the larger parent context for generation.

Use when: legal, research, policy, or book-length documents need surrounding context.

Requirement: original sources must remain available for saved-session rebuilds.

LangGraph

Adaptive RAG

How it works: routes simple prompts to direct generation, standard questions to retrieval, and complex analytical questions to rewrite-plus-retrieval.

Use when: workloads mix easy prompts and corpus-grounded questions.

Tradeoff: requires reliable routing logic.

Contextual Compression RAG

How it works: retrieves chunks, then filters or extracts only relevant parts before generation.

Use when: chunks are verbose or noisy.

Tradeoff: compression adds latency.

Agentic And Corrective Tools

Agentic RAG can use all configured tools. Corrective RAG can use the Web Search tool as an approved fallback. MS-RAGS(ALL-IN-ONE) keeps tools permission-gated: the runtime cannot read a URL, local file, memory store, or API unless the user enabled that tool during setup and approved the required allowlist or credential.

ToolWhen to use itPermission requiredRuntime trigger
Web SearchThe private corpus has no matching context and the answer needs current public information.Tavily or Brave Search API key, max result count, timeout.Automatic fallback only when retrieval returns no documents.
Memory SystemsThe agent should remember approved session facts, long-term facts, semantic notes, episodic events, or user profile preferences.Enabled memory types and a JSON memory path that can be mounted in production.Automatic memory recall for Agentic RAG queries.
URL Fetch / Web Page ReaderThe user asks the agent to inspect a specific docs page, blog, changelog, or official URL.Allowed domains, timeout, max page size.Include a visible https://... URL in the query.
File System ReadThe user wants the agent to compare or summarize changing local files.Strict path allowlist and max file size.Use file:<approved-path> in the query.
Document SummarizationTool output is too long to pass directly to the answer prompt.Uses the selected LLM; no extra key.Automatic when enabled and tool output is large.
API RequestThe agent must read a safe business API such as status, tickets, inventory, or metrics.Allowed base URLs, allowed HTTP methods, optional auth env var and credential.Use api GET https://api.example.com/v1/status.

For deployment, keep secrets in environment variables or the interactive credential prompt, mount persistent memory storage, and keep URL/file/API allowlists narrow. If a selected tool is missing approval or credentials, MS-RAGS(ALL-IN-ONE) raises a clear runtime error instead of silently pretending the tool worked.

RAG Type Internals

RAG typeInternal flowRecommended companion settings
Naive RAGquery -> embed -> vector search -> prompt -> LLMRecursive chunking, Dense Vector retrieval, top_k 4-8.
Advanced RAGquery enhancement -> retrieval -> reranking/compression -> LLMQuery rewriting, hybrid retrieval, Cohere/BGE reranker, RAGAS evaluation.
Modular RAGrouter -> selected modules -> retriever/fusion -> generatorUse when users need different retrievers or prompts per content type.
Agentic RAGplan -> retrieve/rewrite/tools/direct answer -> generateLangGraph tracing, conservative tool access, evaluation on full traces.
Self-RAGretrieval-need reflection -> retrieve/direct -> relevance check -> generate -> support checkUse lower top_k, high-quality embeddings, and strict faithfulness metrics.
Corrective RAGretrieve -> grade chunks -> rewrite/retry or approved web fallback -> answerUse when documents may be incomplete; log fallback events.
GraphRAGingest -> extract entities/relations -> graph store -> community summaries -> local/global graph retrieval -> hybrid evidence -> grounded answerBest with Neo4j/Aura, Kuzu, or Local JSON graph store plus a keyword store.
HyDE RAGquery -> hypothetical document -> embed hypothetical -> retrieve real chunksUse with good generation model and reranking to prevent drift.
Parent-Child RAGretrieve small child -> return larger parent context -> answerUse child chunks around 300-600 tokens and parent chunks around 1200-2500 tokens.
Contextual Compression RAGretrieve -> filter/extract relevant spans -> promptUse embeddings filter first; add LLM extraction only when needed.