Enhancing SQL Query Generation with Neurosymbolic Reasoning

Abstract

We propose a neurosymbolic architecture aimed at boosting the performance of any Language Model (LM) for SQL query generation. This approach leverages symbolic reasoning to guide the LM's exploration of the search space by considering multiple paths, symbolically evaluating choices at each decision point to choose the next step, with the added novel ability to backtrack. A key innovation is the use of symbolic checks on both partially and fully generated SQL queries, enabling early truncation of unsuccessful search paths. Input consists of textual requirements on the desired query, along with optional example tuples to be selected by the query. Experiments on Xander, our open-source implementation, show it both reduces runtime and increases accuracy of the generated SQL. A specific result is an LM using Xander outperforming a four-times-larger LM.

Cite

Text

Princis et al. "Enhancing SQL Query Generation with Neurosymbolic Reasoning." AAAI Conference on Artificial Intelligence, 2025. doi:10.1609/AAAI.V39I19.34198

Markdown

[Princis et al. "Enhancing SQL Query Generation with Neurosymbolic Reasoning." AAAI Conference on Artificial Intelligence, 2025.](https://mlanthology.org/aaai/2025/princis2025aaai-enhancing/) doi:10.1609/AAAI.V39I19.34198

BibTeX

@inproceedings{princis2025aaai-enhancing,
  title     = {{Enhancing SQL Query Generation with Neurosymbolic Reasoning}},
  author    = {Princis, Henrijs and David, Cristina and Mycroft, Alan},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year      = {2025},
  pages     = {19959-19968},
  doi       = {10.1609/AAAI.V39I19.34198},
  url       = {https://mlanthology.org/aaai/2025/princis2025aaai-enhancing/}
}