用编译器思想解析复杂查询,提升RAG系统精准度
Neuro-Symbolic Query Compiler
- 借鉴语法和编译器设计,构建最小化语法规范
- 将复杂查询转为抽象语法树,提升子查询原子性
- 适合处理嵌套依赖的复杂查询,尤其资源受限场景
在资源受限且查询结构复杂、存在嵌套与依赖的情况下,检索增强生成(RAG)系统中精确识别搜索意图仍是难题。本文提出QCompiler,一个受语言学语法规则和编译器设计启发的神经符号框架。该框架理论上设计了一个最小但完备的巴科斯-诺尔范式(BNF)语法 $G[q]$,用于形式化复杂查询,既保证完整性又避免冗余。基于此,QCompiler包含查询表达式转换器、词法语法解析器和递归下降处理器,可将查询编译为抽象语法树(AST),叶节点上的子查询原子性确保更精准的文档检索与结果生成,显著提升RAG系统处理复杂查询的能力。
原文摘要 · Abstract (English)
Precise recognition of search intent in Retrieval-Augmented Generation (RAG) systems remains a challenging goal, especially under resource constraints and for complex queries with nested structures and dependencies. This paper presents QCompiler, a neuro-symbolic framework inspired by linguistic grammar rules and compiler design, to bridge this gap. It theoretically designs a minimal yet sufficient Backus-Naur Form (BNF) grammar $G[q]$ to formalize complex queries. Unlike previous methods, this grammar maintains completeness while minimizing redundancy. Based on this, QCompiler includes a Query Expression Translator, a Lexical Syntax Parser, and a Recursive Descent Processor to compile queries into Abstract Syntax Trees (ASTs) for execution. The atomicity of the sub-queries in the leaf nodes ensures more precise document retrieval and response generation, significantly improving the RAG system's ability to address complex queries.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。