Loading patterns…
Hierarchical Index Retrieval (RAPTOR)(HIR)
Build the retrieval index as a multi-level tree instead of a flat list of chunks. RAPTOR recursively embeds, clusters, and summarizes chunks so a query can retrieve from any abstraction level, returning big-picture synthesis or leaf detail as needed. Anthropic contextual retrieval prepends an LLM-written context blurb to each chunk before embedding so isolated chunks stay grounded in the whole document.
In 30 seconds
- What
- Builds a multi-level tree index by recursively clustering and summarizing chunks, allowing retrieval from any abstraction level to return either broad synthesis or specific details.
- When to use
- Long documents where queries need both high-level overviews and precise leaf details, and where isolated chunks lose meaning without document context.
- Watch out
- High computational cost during indexing and significant complexity in implementation; misaligned clustering can create unhelpful abstraction levels that degrade retrieval quality.
Ask the AI expert about this pattern
Opens the assistant with your question prefilled. You review it before sending.
Hierarchical Index Retrieval (RAPTOR): Overview
Build the retrieval index as a multi-level tree instead of a flat list of chunks. RAPTOR recursively embeds, clusters, and summarizes chunks so a query can retrieve from any abstraction level, returning big-picture synthesis or leaf detail as needed. Anthropic contextual retrieval prepends an LLM-written context blurb to each chunk before embedding so isolated chunks stay grounded in the whole document.
- Recursive cluster-then-summarize tree
- Multi-level abstraction retrieval
- Collapsed-tree traversal across layers
- Contextual chunk augmentation before embedding
- Hybrid embedding plus BM25 candidate generation
- Reranking of merged candidates
The Agent Architect
One pattern, one tradeoff, one production failure story. A short weekly briefing for people building agentic systems.
Weekly email, one-click unsubscribe. We only use your address to send the briefing.
References
The papers, specifications, and repositories this pattern is based on.
From the engineer behind this catalog
Get your agent architecture reviewed
This page documents one pattern. Your system runs dozens, and most failures live in how they fit together. Have the whole design reviewed against the 288 patterns in this catalog: architecture, reliability, evaluation and cost, every finding mapped to the pattern that fixes it.
€750 instead of €1,500, one week, written report and walkthrough call, until 30 September