Skip to main content
QUICK REVIEW

[论文解读] Evaluation of Code LLMs on Geospatial Code Generation

Piotr Gramacki, Bruno Martins|arXiv (Cornell University)|Oct 6, 2024
Semantic Web and Ontologies被引用 4
一句话总结

本文提出了一项新颖的手动构建的基准,用于评估地理空间数据科学领域中代码生成大型语言模型(LLMs)的表现,按复杂度、空间推理能力和工具使用情况进行分类。作者在该数据集上评估了多个7B/8B参数的LLM,揭示了显著的性能差距,尤其是在使用OSMNX和MovingPandas等专业地理空间库方面,凸显了进行领域特定微调的必要性。

ABSTRACT

Software development support tools have been studied for a long time, with recent approaches using Large Language Models (LLMs) for code generation. These models can generate Python code for data science and machine learning applications. LLMs are helpful for software engineers because they increase productivity in daily work. An LLM can also serve as a "mentor" for inexperienced software developers, and be a viable learning support. High-quality code generation with LLMs can also be beneficial in geospatial data science. However, this domain poses different challenges, and code generation LLMs are typically not evaluated on geospatial tasks. Here, we show how we constructed an evaluation benchmark for code generation models, based on a selection of geospatial tasks. We categorised geospatial tasks based on their complexity and required tools. Then, we created a dataset with tasks that test model capabilities in spatial reasoning, spatial data processing, and geospatial tools usage. The dataset consists of specific coding problems that were manually created for high quality. For every problem, we proposed a set of test scenarios that make it possible to automatically check the generated code for correctness. In addition, we tested a selection of existing code generation LLMs for code generation in the geospatial domain. We share our dataset and reproducible evaluation code on a public GitHub repository, arguing that this can serve as an evaluation benchmark for new LLMs in the future. Our dataset will hopefully contribute to the development new models capable of solving geospatial coding tasks with high accuracy. These models will enable the creation of coding assistants tailored for geospatial applications.

研究动机与目标

  • 为解决地理空间数据科学领域中代码LLM缺乏标准化评估的问题,该领域在空间推理和专用工具库方面具有独特挑战。
  • 构建一个高质量、手动整理的地理空间编码问题数据集,并配备自动化测试场景以实现正确性验证。
  • 评估现有代码生成LLM在空间推理、数据处理复杂度和库使用等维度上的能力与局限。
  • 识别当前LLM在地理空间任务中最具挑战性的类型,为未来模型开发提供指导。
  • 提供一个可复现、可扩展的基准,以支持地理空间感知AI编码助手的发展。

提出的方法

  • 作者根据复杂度(单步 vs. 多步)、所需空间推理能力以及特定地理空间工具(如shapely、H3、OSMNX、MovingPandas)对地理空间任务进行了分类。
  • 他们手动创建了编码问题数据集,包含精确的自然语言描述和对应的测试场景,以支持自动化正确性检查。
  • 该基准包含结构化输入(如经纬度对或Shapely Point对象),用于评估模型对数据格式的敏感性。
  • 对一组7B和8B参数的代码LLM(包括CodeLlama、Llama-3、Gemma和Mistral)进行了对比评估。
  • 通过预设测试用例验证模型输出,以衡量不同任务类别下的pass@1准确率。
  • 数据集和评估代码已公开发布于GitHub,以支持社区采纳与扩展。
Figure 1. Example of a prompt from the dataset, with an example solution generated (the highlighted part).
Figure 1. Example of a prompt from the dataset, with an example solution generated (the highlighted part).

实验结果

研究问题

  • RQ1RQ1:代码生成LLM能否解决不同类型地理空间任务?
  • RQ2RQ2:代码生成LLM在解决地理空间任务时,能否运用空间推理和世界知识?
  • RQ3RQ3:在广泛分类的地理空间任务中,当前哪些类型的问题对代码生成LLM更具挑战性?
  • RQ4RQ4:模型性能是否因输入格式(如lat/lon与Shapely几何对象)而异?
  • RQ5RQ5:LLM在多大程度上能有效利用OSMNX和MovingPandas等专用地理空间库?

主要发现

  • 当提供Shapely几何对象时,模型表现显著更优(例如,bigcode_starcoder2-7b的pass@1达到66.67%),而使用原始经纬度坐标时仅为33.33%。
  • 表现最佳的模型meta-llama_CodeLlama-7b-Python-hf在lat/lon任务上的pass@1为23.81%,在Shapely任务上为26.67%。
  • 模型在OSMNX和MovingPandas库的代码生成中完全失败,通常返回占位符函数而非实际实现。
  • 只有shapely和H3库被可靠使用,pass@1得分在4.76%至33.33%之间,具体取决于模型。
  • 大量模型输出在MovingPandas和OSMNX任务中不完整或语法错误,表明其对工具知识掌握不足。
  • 结果表明,当前代码LLM在地理空间库方面的接触仍显不足,需通过领域特定微调才能成为地理空间开发中的有效助手。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。