Generative AI · Advanced level

Advanced level · Module 6: Advanced RAG Architecture and Evaluation · Lesson 1 of 3

Query Transformation and Hierarchical Retrieval

Learners rewrite and expand queries, retrieve small chunks but return their parent sections, and measure improvements.

In this lesson you will

  • Apply query rewriting and expansion
  • Implement parent–child retrieval

Key concepts

query rewritingquery expansionsmall-to-big retrievalparent sectionsmeasured gains

The lesson

User questions are often vague or use different words from the documents. A query-rewriting step produces clearer search queries; expansion adds synonyms or sub-questions.

Parent–child retrieval indexes small chunks for precise matching but passes their larger parent section to the model, giving context without losing precision.

Each technique adds cost and latency, so measure retrieval hit rate and answer quality before keeping it.

Step by step

  1. Add a query-rewriting step.
  2. Index child chunks with parent IDs.
  3. Return parent sections to the generator.
  4. Compare hit rate and faithfulness with the Intermediate pipeline.

Practice activity

Implement and evaluate query rewriting and parent–child retrieval.

Expected result: Measured improvements (or honest non-improvements) for each technique.

Check your understanding

  1. What is parent–child retrieval?

    Show answer

    Matching on small chunks but passing their larger parent sections to the model.

  2. Why measure each RAG technique?

    Show answer

    Each adds cost and may not help on your data.

Further learning

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.