SAG: SQL-Retrieval Augmented Generation with Query-Time Dynamic Hyperedges
SAG employs SQL-driven dynamic hyperedges, boosting multi-hop reasoning with 80% Recall@5 on MuSiQue, surpassing prior methods.
Key Findings
Methodology
SAG constructs event-entity indexes from documents, using SQL joins to dynamically activate hyperedges during query time. Offline, documents are parsed into complete semantic events linked to entities, stored in SQL and vector indices. Online, seed retrieval via entity-guided filtering and vector similarity is followed by SQL-based multi-hop expansion, combining structured filtering with semantic expansion. The approach avoids prebuilt global graphs, enabling incremental updates and high concurrency. Core algorithms include event extraction, entity indexing, SQL join-based expansion, and combined vector-structure retrieval, integrated into a unified pipeline with LLM reranking.
Key Results
- On MuSiQue, SAG achieved 80.0% Recall@5, outperforming HippoRAG 2’s 65.1%, especially excelling in long reasoning chains with up to 4 hops. On HotpotQA and 2WikiMultiHop, it also achieved top scores, with an average Recall@5 of 88.2%. The results demonstrate that SQL-based hyperedge activation effectively mitigates information fragmentation and enhances multi-hop recall, especially in complex reasoning scenarios.
- Ablation studies confirmed that event-level semantic preservation, dynamic expansion, and SQL join mechanisms significantly contribute to performance. The system maintains seconds-level latency at scale, validating its engineering feasibility for real-world deployment.
- The system supports incremental writes and concurrent processing, making it scalable for large datasets. Its dynamic hyperedge activation outperforms static graph-based methods in complex multi-hop tasks, especially where reasoning chains are long and non-skippable.
Significance
This work advances the state-of-the-art in knowledge retrieval by eliminating the need for static, costly knowledge graphs. It combines the efficiency of relational databases with the flexibility of dynamic hyperedges, enabling precise, scalable multi-hop reasoning. The approach addresses core challenges in information fragmentation and maintenance overhead, offering a practical solution for real-time, large-scale knowledge systems. Its superior performance on multiple benchmarks underscores its potential to transform AI reasoning and retrieval tasks, bridging the gap between structured knowledge and large language models.
Technical Contribution
The key innovation lies in integrating SQL-based dynamic hyperedge activation into large-scale retrieval systems, replacing static graph construction. This enables deterministic, query-time multi-hop expansion over event-entity indices, leveraging standard database technology for incremental updates and high concurrency. The architecture fuses structured filtering, semantic expansion, and LLM-based reranking into a unified pipeline, significantly improving multi-hop recall and system scalability. This design provides a new paradigm for combining relational databases with neural retrieval, opening avenues for scalable, structured knowledge inference.
Novelty
This paper introduces the first SQL-driven dynamic hyperedge mechanism for multi-hop retrieval, avoiding preconstructed global graphs. Unlike prior static graph or vector-only methods, SAG dynamically activates local hyperedges at query time, preserving higher-order relations and reducing maintenance costs. Its event-entity index structure prevents semantic fragmentation, and the query-driven hyperedge activation offers a flexible, scalable alternative to existing graph neural or embedding-based approaches, especially suited for large, evolving datasets.
Limitations
- The effectiveness heavily depends on accurate event and entity extraction; errors here can propagate through the retrieval pipeline. Complex entity disambiguation remains challenging.
- SQL join depth (H) limits the extent of multi-hop expansion; longer chains may incur performance costs or incomplete coverage.
- In extremely large or highly concurrent environments, database bottlenecks could impact latency; distributed database solutions are needed for further scaling.
Future Work
Future directions include integrating distributed database architectures to handle larger datasets, enhancing entity disambiguation and event extraction robustness, and exploring multi-modal data integration. Additionally, optimizing hyperedge activation strategies via reinforcement learning or adaptive algorithms could further improve reasoning accuracy and efficiency.
AI Executive Summary
In the realm of large-scale knowledge systems, enabling efficient multi-hop reasoning remains a significant challenge. Traditional approaches rely heavily on static knowledge graphs or dense vector similarity, each with notable limitations. Static graphs require costly offline construction and maintenance, while dense retrieval often suffers from information fragmentation and path discontinuity during multi-hop inference. This paper introduces SAG, a novel architecture that leverages SQL-driven dynamic hyperedges to address these issues. Instead of prebuilding a global graph, SAG converts documents into event-entity indices, stored in relational databases, and activates local hyperedges at query time through SQL joins. This approach allows for flexible, incremental updates and efficient multi-hop expansion without global graph rebuilding. Experimental results on benchmarks like MuSiQue, HotpotQA, and 2WikiMultiHop demonstrate that SAG achieves up to 80% Recall@5, outperforming existing methods by significant margins, especially in complex, multi-hop reasoning scenarios. The system’s engineering deployment on hundreds of millions of data items confirms its scalability and real-time performance, with retrieval latency maintained within seconds. The core innovation—query-time dynamic hyperedges—enables deterministic, interpretable, and scalable reasoning pathways, bridging structured knowledge and neural models. Future work aims to extend this framework with distributed databases, multi-modal data, and adaptive hyperedge strategies, promising a new paradigm for intelligent, scalable knowledge inference in AI systems.
Deep Analysis
Background
随着大规模知识库和大模型的发展,信息检索逐步从单一向量匹配转向结构化、多跳推理。早期方法如Dense Retriever在单跳任务中表现优异,但在多跳推理中易碎片化,路径断裂。知识图谱技术如GraphRAG和StructRAG试图通过离线构建关系网络改善推理能力,但维护成本高,更新复杂。近年来,SQL和关系数据库被引入结构化检索,提供高效增量更新和复杂关系处理,但缺乏动态激活机制。本文结合事件抽取、实体索引和SQL连接,提出无需全局图的动态超边机制,解决大规模场景中的信息碎片化和维护难题,推动知识推理的实用化。
Core Problem
现有多跳推理方法在信息组织和维护方面存在瓶颈。静态知识图谱虽能表达复杂关系,但建设和维护成本高,难以应对动态数据。密集向量检索虽高效,但在多跳推理中路径易断裂,信息碎片化严重。如何在保证效率的同时,实现动态、多跳、结构化的知识检索,成为核心难题。特别是在大规模环境中,系统需支持实时增量写入和高并发访问,传统方案难以满足需求。
Innovation
本文创新点包括:
- �� 将文档拆分为事件-实体对,存入SQL和索引,保证语义完整性;
- �� 利用SQL连接实现多跳扩展,动态激活局部超边,避免预建全局图;
- �� 结合向量检索与结构化过滤,形成融合的检索管道,提升召回率;
- �� 支持增量写入和高并发,适应大规模场景。此设计突破静态图限制,为高效多跳推理提供新思路。
Methodology
- �� 离线阶段:将文档拆分为事件和实体,存入SQL数据库、向量索引和全文索引;
- �� 初步检索:通过实体引导的结构化召回和向量相似度检索,获得候选集;
- �� 查询扩展:利用SQL连接沿实体关系多跳扩展,激活局部超边,扩大候选范围;
- �� 精细筛选:结合向量相似和LLM重排序,筛选出最终证据;
- �� 融合结构化过滤与语义扩展,保证推理路径完整性。
Experiments
采用HotpotQA、2WikiMultiHopQA和MuSiQue三大多跳基准,比较SAG与HippoRAG 2等方法。指标为Recall@K,重点在多跳路径的召回能力。设置超参数(如H=1、Kseed=50、Kcand=100),在百万级数据下验证系统响应时间和扩展性。通过消融实验分析事件语义完整性、SQL扩展深度对性能的影响,确保在复杂推理场景中的优越性。
Results
SAG在MuSiQue上实现80.0%的Recall@5,优于HippoRAG 2的65.1%,在多跳推理中表现优异。HotpotQA和2WikiMultiHop也达最高指标,平均Recall@5达88.2%。动态SQL超边激活有效缓解信息碎片化,提升多跳路径召回率。消融验证了事件完整性和SQL扩展的关键作用,系统在大规模环境中保持秒级响应,验证了其实用性。
Applications
该方案适用于大规模知识问答、智能助手、企业知识管理等场景,支持实时多跳推理和结构化信息检索。只需将文档转化为事件-实体索引,即可实现高效知识组织与推理,极大提升信息访问效率。未来结合多模态数据,推动多源信息融合,拓展应用范围。
Limitations & Outlook
系统依赖事件和实体抽取的准确性,抽取误差会影响整体性能。长链推理受SQL连接深度限制,性能需优化。在极端大规模或高并发环境中,数据库瓶颈可能影响响应速度。未来将引入分布式架构和多模态融合技术,解决规模和性能瓶颈。
Plain Language Accessible to non-experts
想象你在一个大型工厂工作,工厂里有许多不同的机器和工人。每台机器代表一个事件,每个工人代表一个实体。你需要找到从原料到成品的完整生产流程,但每个环节都可能涉及不同的机器和工人。传统方法就像提前画好一张详细的生产流程图,遇到新订单时只能按照图纸操作,维护成本高,更新慢。而SAG就像在工厂里安装了智能连接器,能在需要时动态连接相关的机器和工人,快速找到生产路径。这样,无论订单多复杂,系统都能灵活应对,效率也大大提高。它不用事先准备好全部关系,而是在每次需要时即时连接,像拼积木一样灵活,既省事又高效。
ELI14 Explained like you're 14
想象你在学校的图书馆找资料,传统的方法就像提前把所有书都整理成一本大目录,遇到问题时只能靠那本目录找书,更新慢,还可能漏掉新书。而现在的系统更聪明,它像有个超级智能的助手,能在你提问时,马上根据关键词在数据库里找到相关的书和段落,然后还会根据你的问题,动态连接不同的书中的信息,帮你拼出答案。这个助手不用事先把所有书的内容都整理成一张大图,而是在你问问题时,实时连接相关内容,像拼拼图一样。这不仅快,还能应对不断增加的新书和新信息,帮你更快更准确地找到答案。就像有个万能的图书馆助手,随时帮你解答各种复杂的问题!
Abstract
Retrieval-Augmented Generation (RAG) offers an effective approach for large language models to access external knowledge. However, existing methods rely on dense similarity retrieval and face inherent limitations in handling structured constraints and multi-hop reasoning. Incorporating knowledge graphs partially alleviates these issues, but at the cost of semantic fragmentation, high maintenance overhead, and difficult incremental updates. This paper introduces SAG (SQLRetrieval Augmented Generation), a structured architecture for retrieval and agent systems. Instead of pre-building a global static graph, SAG converts each chunk into one semantically complete event and a set of indexing entities, then uses SQL join queries to dynamically link events that share entities into local hyperedges,constructing, at query time, a dynamically instantiated local index structure. This design avoids the need for global graph rebuilding and ongoing maintenance; the system naturally supports incremental writes, concurrent processing, and continuous scaling through its reliance on standard database infrastructure. Across HotpotQA, 2WikiMultiHop, and MuSiQue, three standard multi-hop benchmarks,SAG achieves the best results on 8 out of 9 Recall@K metrics, reaching 80.0% Recall@5 on MuSiQue, the benchmark with the highest multi-hop reasoning demands.SAG has also been deployed at a production scale of hundreds of millions of data items, with online retrieval latency kept within seconds. Project site and code are available at https://github.com/Zleap-AI/SAG-Benchmark.