raptor (recursive abstractive processing)
RAPTOR (Recursive Abstractive Processing for Tree-Organized Retrieval) builds hierarchical summaries for multi-level retrieval. **Problem**: Standard RAG retrieves leaf chunks, missing high-level context. Long documents need both summary understanding and detail access. **Architecture**: Split documents into chunks → summarize groups of chunks → summarize summaries → build tree hierarchy. Each level provides different granularity. **Retrieval strategy**: Can retrieve at any level - high-level for overview questions, leaf level for details, or combine levels. Tree traversal for focused retrieval. **Construction**: Bottom-up clustering and summarization, typically 3-5 levels depending on document size. **Summarization**: LLM generates abstractive summaries capturing key information at each cluster. **Query routing**: Match query against nodes at different levels, retrieve from appropriate granularity. **Benefits**: Handles both "what is this about" and "what was the specific number" queries. Better for long documents. **Costs**: Expensive construction (many LLM calls for summaries), storage for tree, query complexity. **Use cases**: Books, long reports, documentation sites, research paper collections.