SchemaRouter: Field-Aware Tool Routing for Efficient Heterogeneous Agentic RAG
SchemaRouter: Field-Aware Tool Routing for Efficient Heterogeneous Agentic RAG
Abstract: Heterogeneous agentic retrieval-augmented generation (RAG) systems increasingly orchestrate external APIs, internal databases, vector stores, and graph stores. Exposing all tool descriptions to an LLM agent, or selecting tools only by vector similarity, causes two costly failures: over-fetching, which increases payload size, token use, and latency, and under-fetching, which omits fields needed to answer the query.
摘要: 异构智能体检索增强生成(RAG)系统正越来越多地协调外部 API、内部数据库、向量存储和图数据库。将所有工具描述暴露给大语言模型(LLM)智能体,或仅通过向量相似度选择工具,会导致两种代价高昂的失败:一是“过度获取”(over-fetching),这会增加负载大小、Token 使用量和延迟;二是“获取不足”(under-fetching),这会导致遗漏回答查询所需的字段。
We present SchemaRouter, a lightweight routing layer that represents tools, endpoints, parameters, response fields, domain concepts, units, provenance, and license policies as a schema graph. Given a query, SchemaRouter emits an executable tool plan specifying which tools to call and which fields to retrieve. A small LLM extracts intent, concepts, and source constraints, while field selection is deterministic over the graph through intent-group projection and concept-field matching with an alias layer.
我们提出了 SchemaRouter,这是一个轻量级的路由层,它将工具、端点、参数、响应字段、领域概念、单位、来源和许可策略表示为一个模式图(schema graph)。给定一个查询,SchemaRouter 会生成一个可执行的工具计划,明确指出要调用哪些工具以及要检索哪些字段。一个小型的 LLM 负责提取意图、概念和来源约束,而字段选择则通过意图组投影(intent-group projection)以及带有别名层的概念-字段匹配,在图上进行确定性计算。
On a materials-science benchmark of 110 queries, SchemaRouter achieves answer accuracy of 0.71, matching fetch-everything within overlapping confidence intervals and exceeding prompt-all’s 0.66, though their intervals overlap. It uses 227 retrieved-context tokens versus 2,066 for fetch-everything and achieves 2.7x lower end-to-end latency than prompt-all. It also obtains the best tool-exact rate of 0.93 and parameter validity of 1.0. SchemaRouter grounds provenance and license information in 62 percent of answers, compared with approximately 0 percent for all baselines.
在包含 110 个查询的材料科学基准测试中,SchemaRouter 的回答准确率达到了 0.71,在重叠的置信区间内与“获取全部”(fetch-everything)方法持平,并超过了“提示全部”(prompt-all)方法的 0.66(尽管它们的区间存在重叠)。它仅使用 227 个检索上下文 Token,而“获取全部”方法需要 2,066 个,且其端到端延迟比“提示全部”方法降低了 2.7 倍。此外,它还获得了 0.93 的最佳工具精确率和 1.0 的参数有效性。SchemaRouter 在 62% 的回答中提供了来源和许可信息,而所有基准方法在该指标上几乎均为 0%。
We also find that minimizing selected-field count is counterproductive: it reduces answer accuracy to 0.56 with negligible token savings, while recall-preserving projection restores top accuracy. SchemaRouter improves efficiency, schema-size-independent scaling, and verifiable provenance/license-grounded answering at competitive accuracy.
我们还发现,最小化所选字段的数量反而适得其反:这会将回答准确率降低至 0.56,且 Token 节省微乎其微,而保留召回率的投影则能恢复最高准确率。SchemaRouter 在保持竞争性准确率的同时,提升了效率、实现了与模式规模无关的扩展,并提供了可验证的、基于来源/许可的回答。