arXiv:2605.00782cs.SEcs.AI2026-05

让大模型生成的地理分析代码真正符合空间规则。

GeoContra: From Fluent GIS Code to Verifiable Spatial Analysis with Geography-Grounded Repair

论文配图:GeoContra: From Fluent GIS Code to Verifiable Spatial Analysis with Geography-Grounded Repair
图 1 · 摘自论文原文
  • 用地理契约约束代码,确保坐标、拓扑和单位正确
  • 在15个区域测试中,空间正确率提升26.6%以上
  • 适合需要高可靠性地理分析的研究与应用

可靠的地理信息科学空间分析需保持坐标语义、拓扑关系、单位一致性和地理合理性。当前基于大模型的GIS系统生成流畅脚本,但难以规模化地遵循这些地理规则。我们提出GeoContra,一个用于大模型驱动的Python GIS工作流的验证与修复框架。该框架将每个任务表示为可执行的地理契约——包含自然语言问题、数据模式、坐标系元数据、预期输出、空间谓词、拓扑要求、度量标准、必需操作及禁止捷径。生成的程序经过静态规则检查、运行时验证和语义验证,违规项反馈至有限修复循环。在波士顿15个区域、11类任务、11个开源模型(每模型600次运行)上评估,对封闭模型的地理正确率从47.6%(DeepSeek-V4)提升至77.5%,从57.7%(Kimi-K2.5)提升至81.5%。总体平均正确率提升26.6%。GeoContra将流畅代码生成转化为可验证的空间分析,有效捕捉负向旅行时间、坐标系/字段模式违规、缺失谓词和脆弱的输出类型转换,避免生成可执行但地理无效的结果。

原文摘要 · Abstract (English)

Reliable spatial analysis in GIScience requires preserving coordinate semantics, topology, units, and geographic plausibility. Current LLM-based GIS systems generate fluent scripts but rarely enforce these geographic rules at scale. We present GeoContra, a verification and repair framework for LLM-driven Python GIS workflows. It represents each task as an executable geospatial contract-including natural-language questions, schemas, CRS metadata, expected outputs, spatial predicates, topology, metrics, required operations, and forbidden shortcuts. Generated programs undergo static rule inspection, runtime validation, and semantic verification, with violations fed back into a bounded repair loop. Evaluated on 7,079 real geospatial tasks across 15 Boston-area zones, 9 task families, and 11 open-source models (600 runs each), GeoContra improves spatial correctness on closed models from 47.6% to 77.5% for DeepSeek-V4 and from 57.7% to 81.5% for Kimi-K2.5. Across 11 open models, average correctness rises by 26.6%. GeoContra turns fluent code production into verifiable spatial analysis, catching negative travel times, CRS/field-schema violations, missing predicates, and brittle output casts that otherwise yield executable but geographically invalid results.

地理分析大模型验证修复空间正确性

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