arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2604.28028cs.CLcs.AIcs.DBcs.IR
收藏

可靠重复问题的答案:通过模板约束解码提升文本到SQL准确性

Reliable Answers for Recurring Questions: Boosting Text-to-SQL Accuracy with Template Constrained Decoding

Department of Computer Science and Engineering, Indian Institute of Technology Bombay(计算机科学与工程系,印度理工学院班加罗尔)

Smit Jivani, Sarvam Maheshwari, Sunita Sarawagi

AI总结:

本文提出TeCoD系统,通过利用标注工作负载中查询模式的重复性,提升文本到SQL的准确性,并在匹配查询上降低延迟。

摘要:

大型语言模型(LLMs)已革新了文本到SQL生成,使用户能够更轻松地用自然语言查询结构化数据。然而,实际部署仍具挑战性,尤其是在复杂或未见的模式中,由于准确性不一致和生成无效SQL的风险。我们引入了模板约束解码(TeCoD),通过利用标注工作负载中查询模式的重复性来解决这些限制。TeCoD将历史NL-SQL对转换为可重用的模板,并引入一个鲁棒的模板选择模块,利用微调的自然语言推理模型高效匹配或拒绝查询。一旦选择模板,TeCoD通过语法约束解码强制执行SQL生成,通过一种新的分区策略确保语法有效性和效率。这些组件共同使执行准确性比上下文学习(ICL)高36%,并在匹配查询上降低2.2倍的延迟。

英文摘要:

Large language models (LLMs) have revolutionized Text-to-SQL generation, allowing users to query structured data using natural language with growing ease. Yet, real-world deployment remains challenging, especially in complex or unseen schemas, due to inconsistent accuracy and the risk of generating invalid SQL. We introduce Template Constrained Decoding (TeCoD), a system that addresses these limitations by harnessing the recurrence of query patterns in labeled workloads. TeCoD converts historical NL-SQL pairs into reusable templates and introduces a robust template selection module that uses a fine-tuned natural language inference model to match or reject queries efficiently. Once the template is selected, TeCoD enforces it during SQL generation through grammar-constrained decoding, implemented via a novel partitioned strategy that ensures both syntactic validity and efficiency. Together, these components yield up to 36% higher execution accuracy than in-context learning (ICL) and 2.2x lower latency on matched queries.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑