Advanced RAG Patterns

Query decomposition, agentic retrieval, knowledge graphs and multimodal RAG for questions that simple top-k retrieval cannot answer.

Advanced · about 6 hours · difficulty 4/5

Learn first: Evaluating Retrieval Quality, Tool and Function Calling

Basic RAG handles "what does the policy say about X". It struggles with questions that need several hops, aggregation over many documents, or relationships between entities.

Patterns worth knowing

  • Query decomposition: split "compare the leave policies of 2023 and 2025" into sub-queries, retrieve for each, then synthesize.
  • HyDE and query expansion: generate a hypothetical answer or several rephrasings and search with those.
  • Agentic RAG: give an agent search tools and let it decide what to search, read results, and search again until it has enough. More flexible, more expensive, harder to evaluate.
  • GraphRAG / knowledge graphs: extract entities and relationships into a graph for questions about connections and themes across a corpus.
  • Summaries and hierarchies: index document or section summaries for broad questions, and chunks for specific ones.
  • Multimodal RAG: retrieve images, charts and page screenshots with multimodal embeddings or vision models.
  • Structured data: route numeric or aggregate questions to SQL (text-to-SQL) instead of text retrieval.

Advice

Add complexity only when your eval shows a class of questions failing. Each technique adds latency, cost and new failure modes. Many "advanced RAG" wins in practice come from better chunking, hybrid search and reranking.

Good enough to move on

You can identify a category of failing questions in your eval and apply one targeted pattern that measurably fixes it.

Key concepts

  • Query decomposition
  • HyDE and query expansion
  • Agentic RAG
  • GraphRAG and knowledge graphs
  • Hierarchical summaries
  • Multimodal RAG
  • Text-to-SQL routing

Mini project

Find 10 multi-hop or comparison questions your RAG app fails, implement query decomposition or an agentic search loop, and report how many it now answers correctly and at what extra cost.

Check yourself

When would agentic RAG be a worse choice than a fixed retrieve-then-answer pipeline?

Free resources