arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~

text2ql:通过与语言无关的中间表示实现多目标自然语言查询

text2ql: Multi-Target Natural Language Querying via a Language-Agnostic Intermediate Representation

Ritesh Kumar

arXiv 2609.02115首次发表:更新:

AI 中文总结

text2ql框架通过QueryIR中间表示和可插拔渲染器,解决传统数据库自然语言接口的三个局限,确定性模式实现100%执行准确率,消融研究证实感知模式提示对准确率提升作用显著。

AI 中文摘要

数据库的自然语言接口传统上存在三个结构性局限:仅针对关系型SQL、查询时无条件依赖大语言模型(LLM)推理,以及生成的查询在语义不正确时无任何运行时信号。本文提出text2ql,一个开源Python框架,通过与语言无关的中间表示(QueryIR)和可插拔渲染器架构解决了所有三个局限。一个包含七个阶段的检测管道同时支持SQL和GraphQL目标;零LLM确定性模式实现了100%的执行准确率,中位数延迟为3.2 ms且无API成本;每个生成的查询都带有一个通过加法信号模型计算的、范围在[0.15, 0.97]内的运行时置信度分数。在Spider和BIRD基准的50个查询随机样本上进行评估(为指示性结果,计划开展全数据集评估),LLM支持模式实现了62-70%的精确匹配率和84-91%的执行准确率;确定性模式在全部100个测试用例中实现了100%的执行准确率且无解析错误。消融研究表明,感知模式的提示是准确率提升的主要因素,在两个基准上相比无模式基线贡献了+18.4个百分点的精确匹配增益。text2ql根据Apache 2.0许可在该URL下公开可用。

英文摘要

Natural language interfaces to databases have traditionally suffered from three structural limitations: exclusive targeting of relational SQL, unconditional dependence on large language model (LLM) inference at query time, and absence of any runtime signal when generated queries are semantically incorrect. This paper presents text2ql, an open-source Python framework that addresses all three limitations through a language-agnostic Intermediate Representation (QueryIR) and a pluggable renderer architecture. A single seven-stage detection pipeline serves both SQL and GraphQL targets; a zero-LLM deterministic mode delivers 100% execution accuracy at a median latency of 3.2 ms with no API cost; and every generated query carries a runtime confidence score in [0.15, 0.97] computed from an additive signal model. Evaluated on 50-query random samples from the Spider and BIRD benchmarks (indicative results; full-set evaluation is planned), the LLM-backed mode achieves 62-70% exact match and 84-91% execution accuracy; the deterministic mode achieves 100% execution accuracy with zero parse errors across all 100 test cases. An ablation study isolates schema-aware prompting as the dominant accuracy lever, contributing +18.4 percentage points of exact-match gain over the schema-free baseline on both benchmarks. text2ql is publicly available at https://pypi.org/project/text2ql/ under the Apache 2.0 license.

DOI:10.5120/ijcaff3006d1ef8e

论文原文

arXiv 摘要页 · PDF 原文 · HTML 原文

↑