{"title":"Hi-RAG: A Hierarchical Retrieval-Augmented Generation Framework for Scalable and Generalisable Tool Selection in Large Language Model Agents","authors":"Wei Tian, Yuhao Zhou","doi":"10.1111/exsy.70341","DOIUrl":null,"url":null,"abstract":"<div>\n \n <p>As tool repositories for Large Language Model (LLM) agents grow from dozens to hundreds of endpoints, flat retrieval paradigms that treat the repository as an unstructured list suffer from context overload, cross-domain semantic collision and degraded selection accuracy. We propose Hi-RAG, a Hierarchical Retrieval-Augmented Generation framework that exploits the Type <span></span><math>\n <semantics>\n <mrow>\n <mo>→</mo>\n </mrow>\n <annotation>$$ \\to $$</annotation>\n </semantics></math> Service <span></span><math>\n <semantics>\n <mrow>\n <mo>→</mo>\n </mrow>\n <annotation>$$ \\to $$</annotation>\n </semantics></math> Tool structure of the Model Context Protocol (MCP) via a principled coarse-to-fine pipeline. Stage 1 applies a <i>Tool-as-Proxy</i> hybrid retrieval strategy (BM25 sparse retrieval combined with dense bi-encoder search, fused via Weighted Reciprocal Rank Fusion) to identify candidate services efficiently. Stage 2 performs type-aware re-ranking over a local heterogeneous graph, integrating a domain-level gating mechanism with contextualised tool attention for precise service scoring. We further introduce <i>MCPBench</i>, the first benchmark for hierarchical tool selection, comprising 201 tools across 40 real-enterprise services—23% of queries require multi-service reasoning. Experiments across five LLMs show Hi-RAG improves Top-1 accuracy by up to 7.5% (single-service) and 10.0% (multi-service) over Flat-RAG, while reducing token consumption by up to 89% against full-context injection. Comparisons with a strong late-interaction baseline (ColBERT-RAG) further confirm the superiority of Hi-RAG. Zero-shot evaluation on ToolLLM (16,464 tools) confirms scalability, and formal analyses establish <span></span><math>\n <semantics>\n <mrow>\n <mi>O</mi>\n <mfenced>\n <mn>1</mn>\n </mfenced>\n </mrow>\n <annotation>$$ O(1) $$</annotation>\n </semantics></math> context growth with respect to repository size.</p>\n </div>","PeriodicalId":51053,"journal":{"name":"Expert Systems","volume":"43 8","pages":""},"PeriodicalIF":3.4000,"publicationDate":"2026-06-30","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Expert Systems","FirstCategoryId":"94","ListUrlMain":"https://onlinelibrary.wiley.com/doi/10.1111/exsy.70341","RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q2","JCRName":"COMPUTER SCIENCE, ARTIFICIAL INTELLIGENCE","Score":null,"Total":0}
引用次数: 0
Abstract
As tool repositories for Large Language Model (LLM) agents grow from dozens to hundreds of endpoints, flat retrieval paradigms that treat the repository as an unstructured list suffer from context overload, cross-domain semantic collision and degraded selection accuracy. We propose Hi-RAG, a Hierarchical Retrieval-Augmented Generation framework that exploits the Type Service Tool structure of the Model Context Protocol (MCP) via a principled coarse-to-fine pipeline. Stage 1 applies a Tool-as-Proxy hybrid retrieval strategy (BM25 sparse retrieval combined with dense bi-encoder search, fused via Weighted Reciprocal Rank Fusion) to identify candidate services efficiently. Stage 2 performs type-aware re-ranking over a local heterogeneous graph, integrating a domain-level gating mechanism with contextualised tool attention for precise service scoring. We further introduce MCPBench, the first benchmark for hierarchical tool selection, comprising 201 tools across 40 real-enterprise services—23% of queries require multi-service reasoning. Experiments across five LLMs show Hi-RAG improves Top-1 accuracy by up to 7.5% (single-service) and 10.0% (multi-service) over Flat-RAG, while reducing token consumption by up to 89% against full-context injection. Comparisons with a strong late-interaction baseline (ColBERT-RAG) further confirm the superiority of Hi-RAG. Zero-shot evaluation on ToolLLM (16,464 tools) confirms scalability, and formal analyses establish context growth with respect to repository size.
随着大型语言模型(LLM)代理的工具库从数十个端点增长到数百个端点,将存储库视为非结构化列表的平面检索范式受到上下文过载、跨域语义冲突和选择准确性降低的影响。我们提出Hi-RAG,一个分层检索-增强生成框架,利用模型上下文协议(MCP)的类型→$$ \to $$服务→$$ \to $$工具结构,通过原则性的粗到细管道。阶段1应用工具即代理混合检索策略(BM25稀疏检索结合密集双编码器搜索,通过加权倒数秩融合融合)来有效地识别候选服务。阶段2在本地异构图上执行类型感知的重新排序,将域级门控机制与上下文化工具关注集成在一起,以实现精确的服务评分。我们进一步介绍了MCPBench,这是分层工具选择的第一个基准,包括40个实际企业服务中的201个工具% of queries require multi-service reasoning. Experiments across five LLMs show Hi-RAG improves Top-1 accuracy by up to 7.5% (single-service) and 10.0% (multi-service) over Flat-RAG, while reducing token consumption by up to 89% against full-context injection. Comparisons with a strong late-interaction baseline (ColBERT-RAG) further confirm the superiority of Hi-RAG. Zero-shot evaluation on ToolLLM (16,464 tools) confirms scalability, and formal analyses establish O 1 $$ O(1) $$ context growth with respect to repository size.
期刊介绍:
Expert Systems: The Journal of Knowledge Engineering publishes papers dealing with all aspects of knowledge engineering, including individual methods and techniques in knowledge acquisition and representation, and their application in the construction of systems – including expert systems – based thereon. Detailed scientific evaluation is an essential part of any paper.
As well as traditional application areas, such as Software and Requirements Engineering, Human-Computer Interaction, and Artificial Intelligence, we are aiming at the new and growing markets for these technologies, such as Business, Economy, Market Research, and Medical and Health Care. The shift towards this new focus will be marked by a series of special issues covering hot and emergent topics.