arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.25838cs.DB
收藏

相同数据,不同模式:基于LLM的文本到SQL的鲁棒性

Same Data, Different Schemas: Robustness of LLM-based Text-to-SQL

University of Maryland, College Park(马里兰大学帕克分校)

Nitin Kanchinadam, Aditya Menachery, Amol Deshpande

AI总结:

提出一个框架,通过从同一E/R模型生成多个等价关系模式变体,评估LLM在文本到SQL任务中对模式变化的鲁棒性,发现模式结构显著影响模型行为,且提供E/R规范可改善但不完全消除不一致性。

摘要:

大型语言模型(LLM)在文本到SQL基准测试中持续取得强劲结果,但对其模式变化的鲁棒性仍知之甚少。最近的研究表明模式结构很重要,但并未提供清晰且系统的方法来评估当不同模式表示相同底层数据时模型的行为。我们通过提出一个框架来解决这个问题,该框架用于评估和基准测试基于等价关系模式(从公共E/R模型生成)的文本到SQL技术。通过改变用于将概念设计转换为关系的“分片”选择,我们创建了多个结构不同但保留相同底层语义的模式变体。这为我们提供了一个受控设置,其中自然语言问题和数据保持不变,只有模式发生变化。我们使用该框架评估了四个领先的LLM在多个模式变体(针对两个独立领域)上的相同问题,并使用成对比较热图总结了一致性模式。我们的结果表明,模式结构显著影响LLM行为:在概念上等价的模式中,模型经常生成答案差异很大的SQL查询。我们还发现,提供额外的上下文(特别是原始的E/R规范)可以提高性能,但不能完全消除不一致性。除了证明当前的文本到SQL评估缺少一个重要的鲁棒性概念外,我们的框架还提供了一种生成大量合成数据集的方法,这些数据集可用于训练新模型,并提出了一种通过系统模式变化为给定自然语言查询生成额外候选计划来使文本到SQL更加鲁棒的机制。

英文摘要:

Large language models (LLMs) consistently achieve strong results on text-to-SQL benchmarks, but their robustness to schema variations remains poorly understood. Recent work suggests that the schema structure matters, but does not provide a clear and systematic way to evaluate model behavior when different schemas represent the same underlying data. We address this problem by presenting a framework to evaluate and benchmark text-to-SQL techniques over equivalent relational schemas generated from a common E/R model. By varying the ``shredding'' choices used to translate the conceptual design into relations, we create multiple schema variants that differ structurally while preserving the same underlying semantics. This gives us a controlled setting in which the natural language questions and data remain fixed, and only the schema changes. We use this framework to evaluate four leading LLMs on the same questions across multiple schema variants (for two separate domains), and summarize consistency patterns using pairwise comparison heatmaps. Our results show that schema structure significantly affects LLM behavior: across conceptually equivalent schemas, models often produce SQL queries with very different answers. We also find that providing additional context (specifically, the original E/R specification) improves the performance, but does not fully ameliorate the inconsistencies. In addition to demonstrating that the current text-to-SQL evaluations miss an important notion of robustness, our framework provides a way to generate a large number of synthetic datasets that can be used to train new models, and suggests a mechanism to make text-to-SQL more robust by generating additional candidate plans for a given natural language query through systematic schema variations.

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

↑