Abstract
Long-context large language models (LC LLMs) combined with retrieval-augmented generation (RAG) hold strong potential for complex multi-hop and large-document tasks. However, existing RAG systems often suffer from imprecise retrieval, incomplete context coverage under constrained windows, and fragmented information from suboptimal context construction. We introduce Multi-scale Adaptive Context RAG (MacRAG), a hierarchical RAG framework that compresses and partitions documents into coarse-to-fine granularities, then adaptively merges relevant contexts through real-time chunk- and document-level expansions. By initiating with finest-level retrieval and progressively incorporating broader, higher-level context, MacRAG constructs effective query-specific long contexts, optimizing both precision and coverage. Evaluations on challenging LongBench expansions of HotpotQA, 2WikiMultihopQA, and Musique confirm MacRAG consistently surpasses baseline RAG pipelines in single- and multi-step generation using Llama-3.1-8B, Gemini-1.5-pro, and GPT-4o.
Introduction
Retrieval-Augmented Generation (RAG) has become the standard for grounding Large Language Models (LLMs) in external data, but it faces a persistent "Goldilocks" problem. If a system retrieves small, fine-grained text chunks, it achieves high precision but loses the broader context needed for complex reasoning. Conversely, retrieving large chunks or entire documents provides better coverage but often drowns the model in irrelevant "noise," leading to the "lost in the middle" phenomenon where models ignore crucial facts buried in long contexts.
Existing systems struggle with three key trade-offs: balancing recall with precision, choosing the right chunking granularity, and managing the computational costs of broader context. MacRAG addresses these challenges through a "compress, slice, and scale-up" approach that balances retrieval precision with context coverage.
Methodology
MacRAG utilizes a two-phase, multi-scale approach to optimize context construction dynamically.
Phase 1: Top-down Hierarchical Indexing
Instead of simply splitting documents into uniform chunks, MacRAG builds a multi-layered hierarchy during the offline indexing phase. Documents are first split into overlapping chunks (200–500 tokens). Each chunk is then summarized using an LLM to reduce redundancy while retaining core facts. Finally, these summaries are sliced into tiny, fine-grained units (50–200 tokens) for the vector index. This ensures that the initial search is as precise as possible.
Phase 2: Bottom-up Multi-scale Adaptive Retrieval
At runtime, MacRAG reconstructs the context dynamically through a five-step process:
- Initial Retrieval: The system identifies the most relevant fine-grained "slices."
- Parent Mapping: Slices are mapped back to their original "parent" chunks.
- Re-ranking: Parent chunks are re-ranked based on their relevance scores.
- Scaling-Up: A scaling factor ($\alpha$) is used to consider a broader set of borderline candidate chunks, and top-$k_2$ parent documents are selected.
- Neighbor Expansion: Within the top-ranked documents, the system merges neighboring chunks ($h$-hop expansion). This restores narrative flow and provides the LLM with the local context needed to understand retrieved facts.
Evaluation and Results
The authors evaluated MacRAG on three challenging multi-hop question-answering benchmarks from LongBench: HotpotQA, 2WikiMultihopQA, and Musique. Testing across models like GPT-4o, Gemini-1.5-pro, and Llama-3.1-8B revealed several key advantages:
- Superior Performance: MacRAG consistently outperformed state-of-the-art baselines like RAPTOR and LongRAG. On the difficult Musique dataset, MacRAG with Gemini-1.5-pro achieved a +26.34% relative F1-score gain over LongRAG.
- Token Efficiency: MacRAG is significantly more "token-frugal." On 2WikiMultihopQA, it achieved higher accuracy than LongRAG while using 8.19% less context. On Musique, it reduced context length by 45.87% while still outperforming the baseline.
- Speed: Despite the hierarchy, MacRAG's retrieval and re-ranking phase is efficient, taking only ~0.23 seconds per query—38% faster than RAPTOR.
Conclusion
MacRAG establishes a new paradigm for hierarchical RAG by flipping the traditional top-down retrieval model. By starting with the most precise "needles" (slices) and adaptively rebuilding the "haystack" (neighboring context) around them, it solves the precision-coverage paradox. While current limitations include fixed hyperparameters and indexing overhead for summarization, MacRAG provides a scalable, efficient solution for real-world long-context reasoning tasks.
Summary updated