Table of Contents
Fetching ...

Neuro-Symbolic Query Compiler

Yuyao Zhang, Zhicheng Dou, Xiaoxi Li, Jiajie Jin, Yongkang Wu, Zhonghua Li, Qi Ye, Ji-Rong Wen

TL;DR

The paper tackles the difficulty of precise search intent recognition for complex, nested queries in Retrieval-Augmented Generation by introducing QCompiler, a neuro-symbolic framework built around a minimal yet sufficient grammar $G[q]$. It translates natural language into BNF-based expressions, parses them into Abstract Syntax Trees via a Lexical-Syntax Parser, and executes them with a Recursive Descent Processor, yielding atomic leaf sub-queries for targeted retrieval. Empirically, QCompiler achieves state-of-the-art results on four multi-hop benchmarks, improving efficiency by reducing redundant retrievals while maintaining strong accuracy, and demonstrates robust behavior across model scales and query types. The approach is designed as a plug-in to existing RAG pipelines, offering interpretable, verifiable query decomposition and reasoning with broad practical impact for real-world information systems.

Abstract

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.

Neuro-Symbolic Query Compiler

TL;DR

The paper tackles the difficulty of precise search intent recognition for complex, nested queries in Retrieval-Augmented Generation by introducing QCompiler, a neuro-symbolic framework built around a minimal yet sufficient grammar . It translates natural language into BNF-based expressions, parses them into Abstract Syntax Trees via a Lexical-Syntax Parser, and executes them with a Recursive Descent Processor, yielding atomic leaf sub-queries for targeted retrieval. Empirically, QCompiler achieves state-of-the-art results on four multi-hop benchmarks, improving efficiency by reducing redundant retrievals while maintaining strong accuracy, and demonstrates robust behavior across model scales and query types. The approach is designed as a plug-in to existing RAG pipelines, offering interpretable, verifiable query decomposition and reasoning with broad practical impact for real-world information systems.

Abstract

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 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.
Paper Structure (39 sections, 5 equations, 4 figures, 9 tables, 1 algorithm)

This paper contains 39 sections, 5 equations, 4 figures, 9 tables, 1 algorithm.

Figures (4)

  • Figure 1: Illustration of how QCompiler enhances the RAG system.
  • Figure 2: Illustration of QCompiler, including the grammars, components, and an example of processing complex queries with QCompiler.
  • Figure 3: Illustration of the atomicity of sub-queries in leaf nodes, comparing with traditional RAG systems and Iterative RAG systems, QCompiler has few documents retrieval and more accurate response.
  • Figure 4: The number of correctly answered queries for each type compiled by QCompiler across different methods.