Valid Text-to-SQL Generation with Unification-based DeepStochLog

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Jiao, Ying, De Raedt, Luc, Marra, Giuseppe
Formato: Preprint
Publicado: 2025
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866915201986592768
author Jiao, Ying
De Raedt, Luc
Marra, Giuseppe
author_facet Jiao, Ying
De Raedt, Luc
Marra, Giuseppe
contents Large language models have been used to translate natural language questions to SQL queries. Without hard constraints on syntax and database schema, they occasionally produce invalid queries that are not executable. These failures limit the usage of these systems in real-life scenarios. We propose a neurosymbolic framework that imposes SQL syntax and schema constraints with unification-based definite clause grammars and thus guarantees the generation of valid queries. Our framework also builds a bi-directional interface to language models to leverage their natural language understanding abilities. The evaluation results on a subset of SQL grammars show that all our output queries are valid. This work is the first step towards extending language models with unification-based grammars. We demonstrate this extension enhances the validity, execution accuracy, and ground truth alignment of the underlying language model by a large margin. Our code is available at https://github.com/ML-KULeuven/deepstochlog-lm.
format Preprint
id arxiv_https___arxiv_org_abs_2503_13342
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Valid Text-to-SQL Generation with Unification-based DeepStochLog
Jiao, Ying
De Raedt, Luc
Marra, Giuseppe
Computation and Language
Artificial Intelligence
Large language models have been used to translate natural language questions to SQL queries. Without hard constraints on syntax and database schema, they occasionally produce invalid queries that are not executable. These failures limit the usage of these systems in real-life scenarios. We propose a neurosymbolic framework that imposes SQL syntax and schema constraints with unification-based definite clause grammars and thus guarantees the generation of valid queries. Our framework also builds a bi-directional interface to language models to leverage their natural language understanding abilities. The evaluation results on a subset of SQL grammars show that all our output queries are valid. This work is the first step towards extending language models with unification-based grammars. We demonstrate this extension enhances the validity, execution accuracy, and ground truth alignment of the underlying language model by a large margin. Our code is available at https://github.com/ML-KULeuven/deepstochlog-lm.
title Valid Text-to-SQL Generation with Unification-based DeepStochLog
topic Computation and Language
Artificial Intelligence
url https://arxiv.org/abs/2503.13342