TreeHop: Efficient Embedding-Level Query Rewriter
Zhonghao Li, Kunpeng Zhang, Jinghuai Ou, Shuliang Liu, Xuming Hu
University of Maryland · The Hong Kong University of Science and Technology (Guangzhou) · The Hong Kong University of Science and Technology
cs.IR, cs.AI, cs.HC, cs.LG
Submitted: 2026-08-10
Updated: 2026-08-11
Comments: 8 pages
Code: https://github.com/allen-li1231/TreeHop-RAG
License: http://creativecommons.org/licenses/by/4.0/
Importance score: 60/100
The gist: Retrieval-Augmented Generation (RAG) systems face "significant challenges in multi-hop question answering (MHQA), where complex queries require synthesizing information across multiple document
Terminology
Summary
Retrieval-Augmented Generation (RAG) systems face significant challenges in multi-hop question answering (MHQA), where complex queries require synthesizing information across multiple document chunks.
Conventional approaches to this problem typically rely on iterative LLM-based query rewriting and routing, resulting in high computational costs due to repeated LLM invocations and multi-stage processes.
To address these limitations, the authors propose TreeHop, an embedding-level framework without the need for LLMs in query refinement.
TreeHop dynamically updates query embeddings by fusing semantic information from prior queries and retrieved documents, enabling iterative retrieval through embedding-space operations alone.
This method collapses the traditional 'Retrieve-Rewrite-Vectorize-Retrieve' cycle... into a streamlined 'Retrieve-Embed-Retrieve' loop, significantly reducing computational overhead.
The core of the TreeHop architecture is a pair of cross-attention gates, the ForgetGate and the UpdateGate,
which together modulate how information from prior queries q and retrieved chunks c is discarded or is retained.
The update rule is defined as:
q r+1 = q r - ForgetGate(q r, c ir) + UpdateGate(q r, c ir)
Specifically, the ForgetGate term suppresses the semantics that the retrieved chunk has already resolved,
preventing redundant retrieval of information already captured.
Conversely, the UpdateGate selectively incorporates new information from c ir to form the next query.
Because the frozen encoder emits a single vector per query and per chunk,
the model replace[s] the dot products with element-wise products and take[s] the softmax along the d embedding dimensions instead, so that each gate produces one weight per dimension which scales its value vector independently.
To maintain efficiency and prevent unchecked iteration [that] grows the retrieved set exponentially,
TreeHop introduces two rule-based stopping criteria:
-
Redundancy Pruning: This
terminates paths where the document chunk has been retrieved in the previous iterations.
-
Layer-wise Top-K Pruning: This
retains only the top-K chunks with highest similarity scores across all generated query embeddings,
whichreduces the branching factor from O(n r) to O(nr).
The model is trained using contrastive learning
on a dataset constructed through a three-stage pipeline
consisting of Multi-Hop Composition,
Topology and Evidence Integrity Validation,
and the construction of a Contrastive Learning Graph.
The training utilizes the BGE-m3
multilingual embedding model, which remains frozen during training.
Experimental results indicate that "TreeHop rivals advanced RAG methods across four open-domain MHQA datasets, achieving comparable performance with only 2.2%-29.4% of the parameter size of concurrent solutions and reducing the query latency by 92.8%-97.8%. The authors note that
TreeHop reduces retrieval latency by 92.8%-97.8% compared to LLM-based methods while sacrificing only 0.9% of the recall rate at maximum."
A limitation of the framework is that TreeHop’s query-rewriting mechanism depends on query-chunk pair embeddings, limiting its capability to synthesize information across multiple chunks simultaneously.
Improvements for AI systems
1. Multi-Chunk Cross-Attention Synthesis
-
Improvement: Replace the pairwise query-chunk update rule with a multi-chunk aggregation mechanism that uses a transformer-style cross-attention layer to fuse a set of K retrieved chunks into a single contextual representation before applying the ForgetGate and UpdateGate.
-
Capability: The AI system can perform
simultaneous synthesis,
allowing it to resolve complex queries that require comparing, contrasting, or aggregating information spread across multiple disparate documents (e.g.,Compare the fiscal policies of the US and EU during the 2008 crisis
) rather than just following a linear, one-chunk-at-a-time reasoning path.
2. Tiered Hybrid Reasoning Orchestration
-
Improvement: Implement a two-tier architecture where the TreeHop embedding-level framework acts as a
high-speed reasoning scout
to navigate the document space and prune irrelevant branches, followed by a single, high-capacity LLM invocation only for the final answer synthesis. -
Capability: The AI system can provide LLM-grade reasoning quality for multi-hop questions while maintaining the extreme low latency and low computational cost of an embedding-only model, making complex RAG viable for real-time edge computing and high-throughput enterprise applications.
3. Entropy-Based Adaptive Pruning
-
Improvement: Enhance the
Layer-wise Top-K Pruning
by replacing static similarity scores with an information-gain metric that calculates the semantic entropy ornovelty
of a chunk relative to the current query embedding q r. -
Capability: The AI system can dynamically adjust its search breadth based on query complexity, preventing it from getting stuck in
semantic loops
(retrieving highly similar but non-progressive information) and allowing it to navigate much deeper reasoning paths without the exponential growth of the retrieved set.
4. Logical-Distractor Contrastive Training
-
Improvement: Augment the
Contrastive Learning Graph
training pipeline withlogical hard negatives
—document chunks that are semantically highly similar to the query but contain logically incorrect or non-bridgeable information for the next hop. -
Capability: The AI system can achieve much higher precision in highly technical domains (legal, medical, or scientific research) by learning to distinguish between
semantically related
text andlogically necessary
evidence, significantly reducing retrieval-based hallucinations.
Abstract
Retrieval-augmented generation (RAG) systems face significant challenges in multi-hop question answering (MHQA), where complex queries require synthesizing information across multiple document chunks. Existing approaches typically rely on iterative LLM-based query rewriting and routing, resulting in high computational costs due to repeated LLM invocations and multi-stage processes. To address these limitations, we propose TreeHop, an embedding-level framework without the need for LLMs in query refinement. TreeHop dynamically updates query embeddings by fusing semantic information from prior queries and retrieved documents, enabling iterative retrieval through embedding-space operations alone. This method replaces the traditional "Retrieve-Rewrite-Vectorize-Retrieve" cycle with a streamlined "Retrieve-Embed-Retrieve" loop, significantly reducing computational overhead. Moreover, a rule-based stopping criterion is introduced to further prune redundant retrievals, balancing efficiency and recall rate. Experimental results show that TreeHop rivals advanced RAG methods across four open-domain MHQA datasets, achieving comparable performance with only 2.2%-29.4% of the parameter size of concurrent solutions and reducing the query latency by 92.8%-97.8%. This makes TreeHop a faster and more cost-effective solution for low-resource or latency-sensitive deployment. For reproducibility purposes, codes and data are available here: https://github.com/allen-li1231/TreeHop-RAG
Sources
- The Llama 3 Herd of Models
- Qwen3-VL Technical Report
- Language Models are Few-Shot Learners
- Evaluating Open-Domain Question Answering in the Era of Large Language Models
- M3-Embedding: Multi-Linguality, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillation
- Large Language Models Struggle to Learn Long-Tail Knowledge
- A Simple Framework for Contrastive Learning of Visual Representations
- Generalization through Memorization: Nearest Neighbor Language Models
- DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning
- Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
- Refiner: Restructure Retrieval Content Efficiently to Advance Question-Answering Capabilities
- Query Rewriting for Retrieval-Augmented Large Language Models
- Retrieval-Augmented Generation for Large Language Models: A Survey
- Generating Benchmarks for Factuality Evaluation of Language Models
- Attention Is All You Need
- Deep Graph Library: A Graph-Centric, Highly-Performant Package for Graph Neural Networks
- FIBER: A Multilingual Evaluation Resource for Factual Inference Bias
- Training language models to follow instructions with human feedback
- Qwen2.5 Technical Report
- Qwen3 Technical Report
Related papers
- The Price of Isolation: Estimating the Ecosystem Cost of Symmetric Two-Sided A/B Testing
- SCAR: Semantic Continuity-Aware Retrieval for Efficient Context Expansion in RAG
- MixLoRA-DSI: Dynamically Expandable Mixture-of-LoRA Experts for Rehearsal-Free Generative Retrieval over Dynamic Corpora
- RRCM: Ranking-Driven Retrieval over Collaborative and Meta Memories for LLM Recommendation
- Right Family, Wrong Skill: Evaluating Risk Exposure in Agent Skill Retrieval
- UltRAG: a Universal Simple Scalable Recipe for Knowledge Graph RAG