Course contentsShow
← Machine Learning and Deep Learning
Lesson 2048 of 3,53843. Retrieval-Augmented Generation: Advanced TechniquesFree lesson

Query Decomposition for Complex Questions

Breaking complex queries into sub-questions that are retrieved and answered independently.

Query Decomposition for Complex Questions

You'll learn: How to break down a multi-part or multi-hop question into simpler sub-questions that can be retrieved and answered independently, then combined for a complete response.

The Core Problem

When users ask complex questions like "What's the average salary of data scientists in cities where tech companies founded after 2015 are headquartered?", a single retrieval pass often fails. The question requires multiple pieces of information: recent tech company locations, their founding dates, and salary data for those specific cities.

Query decomposition solves this by systematically breaking the complex query into manageable sub-questions:

  1. "Which tech companies were founded after 2015?"
  2. "Where are these companies headquartered?"
  3. "What is the average data scientist salary in each of those cities?"

How It Works

Think of it like a research project: you wouldn't try to answer everything at once. Instead, you'd list the facts you need, research each one, then synthesize your findings.

In RAG systems, you can:

  • Use an LLM to parse the original question and generate sub-questions
  • Retrieve documents for each sub-question independently
  • Answer each sub-question with its retrieved context
  • Combine the intermediate answers into a final, comprehensive response

This approach dramatically improves accuracy for multi-hop reasoning, where the answer requires chaining multiple pieces of knowledge together.

Why It Matters

Without decomposition, vector search might return documents that only partially match the complex query. By isolating each information need, you ensure each retrieval step is focused and precise, leading to more complete and accurate final answers.

Key Takeaway: Query decomposition transforms complex, multi-part questions into a sequence of simpler sub-questions that can be independently retrieved and answered, enabling RAG systems to handle sophisticated reasoning tasks that would otherwise fail.