arXiv:2411.10753cs.SEcs.AI2024-11被引 7

CoP框架提升大模型生成地理空间代码的准确性与可执行性。

Chain-of-Programming (CoP) : Empowering Large Language Models for Geospatial Code Generation

  • 分五步流程分解代码生成,融合知识库与用户反馈
  • 代码可执行率提升3.0%至48.8%,逻辑与语法错误减少
  • 适合需精准地理计算的科研与工程人员使用

随着跨学科对地理空间建模需求的增长及大语言模型(LLMs)的兴起,地理空间代码生成技术取得显著进展。然而,现有大模型常因用户需求不完整或缺乏特定平台语法知识,生成不可执行代码,即“代码幻觉”。为此,本文提出链式编程(Chain of Programming, CoP)框架,将代码生成过程分解为需求分析、算法设计、代码实现、代码调试和代码注释五个步骤,引入共享信息池、知识库检索与用户反馈机制,构建无需模型微调的端到端生成流程。基于地理问题分类框架与评估基准,CoP策略在逻辑清晰度、语法正确性与代码可执行性方面均显著提升,改进幅度达3.0%至48.8%。对比与消融实验验证了其优于其他优化方法,并确认核心组件的必要性。通过建筑数据可视化与火灾数据分析等案例,证明了CoP在多种地理空间场景中的有效性。该框架为大模型驱动的地理空间代码生成提供系统化路径,显著提升性能,也为其他垂直领域代码生成提供参考。

原文摘要 · Abstract (English)

With the rapid growth of interdisciplinary demands for geospatial modeling and the rise of large language models (LLMs), geospatial code generation technology has seen significant advancements. However, existing LLMs often face challenges in the geospatial code generation process due to incomplete or unclear user requirements and insufficient knowledge of specific platform syntax rules, leading to the generation of non-executable code, a phenomenon known as "code hallucination." To address this issue, this paper proposes a Chain of Programming (CoP) framework, which decomposes the code generation process into five steps: requirement analysis, algorithm design, code implementation, code debugging, and code annotation. The framework incorporates a shared information pool, knowledge base retrieval, and user feedback mechanisms, forming an end-to-end code generation flow from requirements to code without the need for model fine-tuning. Based on a geospatial problem classification framework and evaluation benchmarks, the CoP strategy significantly improves the logical clarity, syntactical correctness, and executability of the generated code, with improvements ranging from 3.0% to 48.8%. Comparative and ablation experiments further validate the superiority of the CoP strategy over other optimization approaches and confirm the rationality and necessity of its key components. Through case studies on building data visualization and fire data analysis, this paper demonstrates the application and effectiveness of CoP in various geospatial scenarios. The CoP framework offers a systematic, step-by-step approach to LLM-based geospatial code generation tasks, significantly enhancing code generation performance in geospatial tasks and providing valuable insights for code generation in other vertical domains.

地理空间代码生成大模型CoP

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