让AI智能选择用数据库还是文档回答问题,更准更快。
Learning to Route: A Rule-Driven Agent Framework for Hybrid-Source Retrieval-Augmented Generation
- 根据问题类型自动判断该查数据库还是文档,靠规则而非盲目尝试。
- 在三个测试集上准确率超越传统方法,且计算开销可控。
- 适合需要实时、精准数据的金融、医疗等专业领域使用。
大语言模型在通用问答任务中表现优异,但在需准确、实时信息的垂直领域常显不足。检索增强生成(RAG)通过引入外部知识缓解此问题,但现有系统多依赖非结构化文档,忽视了可提供精确、高效查询的结构化数据库,在金融、医疗和科研等领域至关重要。我们系统分析发现:(i) 数据库与文档在不同查询下互补;(ii) 直接混合使用会引入噪声且成本高,却无稳定精度提升;(iii) 按查询选择最优来源对效率与效果平衡至关重要。进一步观察到查询类型与检索路径间存在规律性匹配,表明可通过规则驱动路由决策。为此,我们提出一个规则驱动的路由框架:路由代理基于显式规则评分并选择最优路径;规则制定专家代理通过问答反馈持续优化规则以保持适应性;路径级元缓存复用语义相似查询的历史路由决策,降低延迟与成本。在三个问答基准上的实验表明,本框架持续优于静态策略和学习型路由基线,在保证适度计算开销的同时实现更高准确率。
原文摘要 · Abstract (English)
Large Language Models (LLMs) have shown remarkable performance on general Question Answering (QA), yet they often struggle in domain-specific scenarios where accurate and up-to-date information is required. Retrieval-Augmented Generation (RAG) addresses this limitation by enriching LLMs with external knowledge, but existing systems primarily rely on unstructured documents, while largely overlooking relational databases, which provide precise, timely, and efficiently queryable factual information, serving as indispensable infrastructure in domains such as finance, healthcare, and scientific research. Motivated by this gap, we conduct a systematic analysis that reveals three central observations: (i) databases and documents offer complementary strengths across queries, (ii) naively combining both sources introduces noise and cost without consistent accuracy gains, and (iii) selecting the most suitable source for each query is crucial to balance effectiveness and efficiency. We further observe that query types show consistent regularities in their alignment with retrieval paths, suggesting that routing decisions can be effectively guided by systematic rules that capture these patterns. Building on these insights, we propose a rule-driven routing framework. A routing agent scores candidate augmentation paths based on explicit rules and selects the most suitable one; a rule-making expert agent refines the rules over time using QA feedback to maintain adaptability; and a path-level meta-cache reuses past routing decisions for semantically similar queries to reduce latency and cost. Experiments on three QA benchmarks demonstrate that our framework consistently outperforms static strategies and learned routing baselines, achieving higher accuracy while maintaining moderate computational cost.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。