arXiv:2510.21045cs.AIcs.DB2025-10被引 5

用多智能体框架让非专家也能准确把自然语言转成空间SQL。

From Questions to Queries: An AI-powered Multi-Agent Framework for Spatial Text-to-SQL

  • 分阶段拆解任务,由不同智能体协作处理地理意图与空间函数选择。
  • 在新基准上达87.7%准确率,加纠错后比无审查提升11个百分点。
  • 适合需要可靠空间查询的地理信息分析场景,如城市规划、环境监测。

SQL的复杂性与PostGIS的空间语义给非专家使用空间数据带来障碍。尽管大模型可将自然语言转为SQL,但空间Text-to-SQL更易出错,需解决地理意图识别、模式歧义、几何字段处理、空间函数选择及坐标系与度量假设等问题。本文提出一种多智能体框架,通过分阶段解释、模式定位、逻辑规划、SQL生成和执行反馈实现端到端处理。框架依托包含程序化模式分析、语义增强和基于嵌入检索的知识库。在非空间的KaggleDBQA和新的多层级、覆盖广的SpatialQueryQA基准上评估:在KaggleDBQA上经纠错后达到81.2%准确率(221/272);在SpatialQueryQA上达87.7%准确率(79/90),较无审查阶段提升11个百分点。结果表明,将任务分解为紧密耦合的专用智能体能显著提升鲁棒性,尤其对空间敏感查询。该研究提升了空间分析的可访问性,推动了更可靠的自动化空间Text-to-SQL系统发展。

原文摘要 · Abstract (English)

The complexity of SQL and the spatial semantics of PostGIS create barriers for non-experts working with spatial data. Although large language models can translate natural language into SQL, spatial Text-to-SQL is more error-prone than general Text-to-SQL because it must resolve geographic intent, schema ambiguity, geometry-bearing tables and columns, spatial function choice, and coordinate reference system and measurement assumptions. We introduce a multi-agent framework that addresses these coupled challenges through staged interpretation, schema grounding, logical planning, SQL generation, and execution-based review. The framework is supported by a knowledge base with programmatic schema profiling, semantic enrichment, and embedding-based retrieval. We evaluated the framework on the non-spatial KaggleDBQA benchmark and on SpatialQueryQA, a new multi-level and coverage-oriented benchmark with diverse geometry types, workload categories, and spatial operations. On KaggleDBQA, the system reached 81.2% accuracy, 221 of 272 questions, after reviewer corrections. On SpatialQueryQA, the system achieved 87.7% accuracy, 79 of 90, compared with 76.7% without the review stage. These results show that decomposing the task into specialized but tightly coupled agents improves robustness, especially for spatially sensitive queries. The study improves access to spatial analysis and provides a practical step toward more reliable spatial Text-to-SQL systems and autonomous GIS.

文本转SQL空间查询多智能体GIS

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。