Skip to content
Forward Deployed

Forward Deployed
Lessons and contents
Advanced Indexing StrategiesLesson 4 of 7
7 lessons
Learn

Hierarchical indices: summary tier and detail tier

Source
From the RAG & Agents Engineering course
By
Sourav Banerjee
Last updated
9 Nov 2026

Report an issue

In practice: section summaries for the Larkspur handbook

For the Larkspur handbook, each section ("Refunds and cancellations", "Outages and service credits", "Data export and retention") would be one summary. Do I get service credits automatically after an outage? would pick the outage summary first and then compare only that section's chunks, so a refund chunk about "Credits from SLA breaches" cannot crowd it out. Three settings keep it that way:

  1. One summary per section, regenerated whenever the section changes.
  2. A prompt budget set by both numbers: 3 sections × 5 chunks is up to 15 chunks per question.
  3. A log of the sections chosen for every question, which lets a miss be traced to the summary tier.

Next: lesson 4 of T5.6 changes the key again, from what a chunk says to the questions a reader would ask about it.

Run the notebooks

The code for this lesson is in these notebooks. Colab runs one in your browser: install the packages its first cell imports and set the API keys it reads. To run every notebook as written, clone the repository and use its uv environment.

Notebook GitHub Colab
Hierarchical indices Open on GitHub Open in Colab

Key Takeaways

  • A hierarchical index picks the best pages from a summary tier, then searches chunks only inside them. Chunks compete with their neighbours, not with look-alikes on unrelated pages.
  • The summary tier caps recall: a page it misses is never searched. Log which pages it chose so a miss can be traced.
  • Summaries cost one LLM call per page and go stale when pages change. The model receives up to k_summaries × k_chunks chunks, so both numbers set the prompt budget.

Check yourself

1. For the question about service credits after an outage, why can a refund chunk about credits from SLA breaches not crowd out the answer?

The question first picks the best section summaries, so the outage summary wins as a whole. The detail search then runs only inside the chosen pages, and chunks compete only with their neighbours. A chunk with matching words on an unrelated page never enters the result.

2. With 3 summaries and 5 chunks per summary, how many chunks can reach the model, and what happens if you raise the chunk count to 10?

Up to 15 chunks, because the result size is k_summaries × k_chunks. Raising k_chunks to 10 allows up to 30, so changing either number changes the prompt budget.

3. A chunk that would score well against the question never appears in the results. Which tier do you check first, and what should you log?

The summary tier. If the right page is not in the top 3 summaries, its chunks are never searched, however well they would score. Log which pages the summary tier chose, so a miss can be traced to the tier that caused it.

Rate your confidence and keep notes on the module page.