arXiv cs.CL· Vigneshwar Ravi Rao, Rupesh Swarnakar, Fayeq Jeelani Syed{\dag}·· 3 天前AI 评分26
基于 LangGraph 的迭代式 Text-to-SQL 智能体:芝加哥犯罪数据库的自然语言访问
An Iterative LangGraph Agent for Text-to-SQL: Natural Language Access to the Chicago Crime Database
AI 导读
研究者构建了一个六节点 LangGraph StateGraph 的 Text-to-SQL 智能体,仅靠提示词工程(未微调模型)完成问题相关性检查、实时 schema 获取、PostgreSQL 生成、dry run 校验、失败重试、查询执行与英文结果叙述。
正文 · 原文
Abstract:Non-technical stakeholders frequently cannot write the SQL needed to extract insights from operational databases. We built and evaluated a Text-to-SQL agent that closes this gap end to end: a six-node LangGraph StateGraph checks question relevance, fetches the live schema, generates PostgreSQL, validates it with a dry run, retries on failure, executes the query, and narrates the result set in plain English. The agent uses prompt engineering only; no model was fine-tuned. We evaluated it on the Chicago Crime dataset (approximately 8.5 million records, 22 attributes) against a hand-built benchmark of 100 natural language questions with ground-truth SQL, stratified into 30 Easy, 40 Medium and 30 Hard items. Comparing two prompt revisions of the same agent, the revised system (V2) reached a Valid SQL Rate of 93% (from 87%), an Execution Accuracy of 60% under a hybrid relational equivalence metric (from 47%; 19% from 12% under strict JSON matching), and a mean Synthesis Quality of 4.34 out of 5 (from 3.91). The single largest driver was removing a LIMIT 10 instruction from the system prompt, which had been truncating multi-row answers. Error analysis attributes the residual failures to relevance-checker false rejections, ambiguous question semantics, and free-tier API rate limits rather than to the language generation step. We report no comparison against an external baseline system or a public benchmark; the study is a single-model engineering evaluation.
| Subjects: | Computation and Language (cs.CL); Artificial Intelligence (cs.AI); Databases (cs.DB) |
| Cite as: | arXiv:2609.22917 [cs.CL] |
| (or arXiv:2609.22917v2 [cs.CL] for this version) | |
| https://doi.org/10.48550/arXiv.2609.22917 arXiv-issued DOI via DataCite |
Submission history
From: Fayeq Jeelani Syed [view email]
[v1]
Sat, 19 Sep 2026 09:54:16 UTC (62 KB)
[v2]
Wed, 14 Oct 2026 03:53:47 UTC (41 KB)
来源:arXiv cs.CL · arxiv.org