While Text-to-SQL remains the dominant approach for database interaction, real-world analytics increasingly require the flexibility of general-purpose programming languages such as Python or Pandas to manage file-based data and complex analytical workflows. Despite this growing need, the reliability of Text-to-Python in core data retrieval remains underexplored relative to the mature SQL ecosystem. To address this gap, we introduce BIRD-Python, a benchmark designed for cross-paradigm evaluation. We systematically refined the original dataset to reduce annotation noise and align execution semantics, thereby establishing a consistent and standardized baseline for comparison. Our analysis reveals a fundamental paradigmatic divergence: whereas SQL leverages implicit DBMS behaviors through its declarative structure, Python requires explicit procedural logic, making it highly sensitive to underspecified user intent. To mitigate this challenge, we propose the Logic Completion Framework (LCF), which resolves ambiguity by incorporating latent domain knowledge into the generation process. Experimental results show that (1) performance differences primarily stem from missing domain context rather than inherent limitations in code generation, and (2) when these gaps are addressed, Text-to-Python achieves performance parity with Text-to-SQL. These findings establish Python as a viable foundation for analytical agents-provided that systems effectively ground ambiguous natural language inputs in executable logical specifications. Resources are available at https://anonymous.4open.science/r/Bird-Python-43B7/.


翻译:尽管文本转SQL仍是数据库交互的主流方法,但现实世界的数据分析日益需要通用编程语言(如Python或Pandas)的灵活性,以处理基于文件的数据和复杂分析工作流。尽管这一需求不断增长,但与成熟的SQL生态系统相比,文本转Python在核心数据检索方面的可靠性仍未得到充分探索。为填补这一空白,我们提出了BIRD-Python——一个专为跨范式评估设计的基准。我们系统性地优化了原始数据集以减少标注噪声并统一执行语义,从而建立了具有一致性和标准化的比较基线。我们的分析揭示了一个根本性的范式差异:SQL通过其声明式结构利用隐式的数据库管理系统行为,而Python需要显式的过程逻辑,使其对用户意图的未明确表述高度敏感。为应对这一挑战,我们提出了逻辑补全框架(LCF),该框架通过将潜在领域知识融入生成过程来解决模糊性问题。实验结果表明:(1)性能差异主要源于缺失的领域上下文,而非代码生成的内在局限性;(2)当这些差距被填补时,文本转Python能够达到与文本转SQL同等的性能水平。这些发现确立了Python作为分析智能体可行基础的地位——前提是系统能够将模糊的自然语言输入有效锚定至可执行的逻辑规范中。相关资源已发布于 https://anonymous.4open.science/r/Bird-Python-43B7/。

0
下载
关闭预览

相关内容

SQL 全名是结构化查询语言,是用于数据库中的标准数据查询语言,IBM 公司最早使用在其开发的数据库系统中。
【2022新书】Python文本分析:面向研究的指南,268页pdf
专知会员服务
71+阅读 · 2022年10月27日
【2022新书】Python数据科学导论,309页pdf
专知会员服务
82+阅读 · 2022年8月6日
【2020新书】Python文本分析,104页pdf
专知会员服务
100+阅读 · 2020年12月23日
【2022新书】Python数据分析第三版,579页pdf
专知
19+阅读 · 2022年8月31日
一文看懂怎么用 Python 做数据分析
大数据技术
24+阅读 · 2019年5月5日
手把手 | 基于TextRank算法的文本摘要(附Python代码)
大数据文摘
11+阅读 · 2018年12月27日
独家 | 基于TextRank算法的文本摘要(附Python代码)
数据派THU
14+阅读 · 2018年12月21日
在Python中使用SpaCy进行文本分类
专知
24+阅读 · 2018年5月8日
荐书丨Python数据分析从入门到精通
程序人生
18+阅读 · 2018年3月31日
福利 | 当Python遇上大数据与机器学习,入门so easy!
Tensorflow 文本分类-Python深度学习
Python程序员
12+阅读 · 2017年11月22日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
VIP会员
相关VIP内容
相关资讯
【2022新书】Python数据分析第三版,579页pdf
专知
19+阅读 · 2022年8月31日
一文看懂怎么用 Python 做数据分析
大数据技术
24+阅读 · 2019年5月5日
手把手 | 基于TextRank算法的文本摘要(附Python代码)
大数据文摘
11+阅读 · 2018年12月27日
独家 | 基于TextRank算法的文本摘要(附Python代码)
数据派THU
14+阅读 · 2018年12月21日
在Python中使用SpaCy进行文本分类
专知
24+阅读 · 2018年5月8日
荐书丨Python数据分析从入门到精通
程序人生
18+阅读 · 2018年3月31日
福利 | 当Python遇上大数据与机器学习,入门so easy!
Tensorflow 文本分类-Python深度学习
Python程序员
12+阅读 · 2017年11月22日
相关基金
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员