GeoCode-GPT: A large language model for geospatial code generation

• Introduced GeoCode-GPT-7B, the first LLM for geospatial code generation. • Developed and open-sourced GeoCode-PT, GeoCode-SFT, and GeoCode-Eval datasets. • Proposed a pretraining and fine-tuning strategy combining QLoRA and LoRA. • Established an evaluation framework for geospatial code generation. The increasing demand for spatiotemporal data and modeling tasks in geosciences has made geospatial code generation technology a critical factor in enhancing productivity. Although large language models (LLMs) have demonstrated potential in code generation tasks, they often encounter issues such as refusal to code or hallucination in geospatial code generation due to a lack of domain-specific knowledge and code corpora. To address these challenges, this paper presents and open-sources the GeoCode-PT and GeoCode-SFT corpora, along with the GeoCode-Eval evaluation dataset. Additionally, by leveraging QLoRA and LoRA for pretraining and fine-tuning, we introduce GeoCode-GPT-7B, the first LLM focused on geospatial code generation, fine-tuned from Code Llama-7B. Furthermore, we establish a comprehensive geospatial code evaluation framework, incorporating option matching, expert validation, and prompt engineering scoring for LLMs, and systematically evaluate GeoCode-GPT-7B using the GeoCode-Eval dataset. Experimental results reveal that GeoCode-GPT significantly outperforms existing models across multiple tasks. For multiple-choice tasks, its accuracy improves by 9.1% to 32.1%. In code summarization, it achieves superior scores in completeness, accuracy, and readability, with gains ranging from 1.7 to 25.4 points. For code generation, its performance in accuracy, readability, and executability surpasses benchmarks by 1.2 to 25.1 points. Grounded in the fine-tuning paradigm, this study introduces and validates an approach to enhance LLMs in geospatial code generation and associated tasks. These findings extend the application boundaries of such models in geospatial domains and offer a robust foundation for exploring their latent potential.

Authors

Institutions

Publication Details

Journal
International Journal of Applied Earth Observation and Geoinformation
Published
2025-03-05
DOI
https://doi.org/10.1016/j.jag.2025.104456
Citations
24
Primary Topic
Scientific Computing and Data Management
Type
article
Field-Weighted Citation Impact
100.05

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

GeoCode-GPT: A large language model for geospatial code generation

Rui Li, Huayi Wu, Jianyuan Liang, Xuefeng Guan et al.
24 citations
International Journal of Applied Earth Observation and Geoinformation
Scientific Computing and Data Management
100.05
article

GeoCode-GPT: A large language model for geospatial code generation

Rui Li, Huayi Wu, Jianyuan Liang, Xuefeng Guan, Zhipeng Gui, Zhangxiao Shen, Anqi Zhao, Shuyang Hou
article en
24 citations

Abstract

• Introduced GeoCode-GPT-7B, the first LLM for geospatial code generation. • Developed and open-sourced GeoCode-PT, GeoCode-SFT, and GeoCode-Eval datasets. • Proposed a pretraining and fine-tuning strategy combining QLoRA and LoRA. • Established an evaluation framework for geospatial code generation. The increasing demand for spatiotemporal data and modeling tasks in geosciences has made geospatial code generation technology a critical factor in enhancing productivity. Although large language models (LLMs) have demonstrated potential in code generation tasks, they often encounter issues such as refusal to code or hallucination in geospatial code generation due to a lack of domain-specific knowledge and code corpora. To address these challenges, this paper presents and open-sources the GeoCode-PT and GeoCode-SFT corpora, along with the GeoCode-Eval evaluation dataset. Additionally, by leveraging QLoRA and LoRA for pretraining and fine-tuning, we introduce GeoCode-GPT-7B, the first LLM focused on geospatial code generation, fine-tuned from Code Llama-7B. Furthermore, we establish a comprehensive geospatial code evaluation framework, incorporating option matching, expert validation, and prompt engineering scoring for LLMs, and systematically evaluate GeoCode-GPT-7B using the GeoCode-Eval dataset. Experimental results reveal that GeoCode-GPT significantly outperforms existing models across multiple tasks. For multiple-choice tasks, its accuracy improves by 9.1% to 32.1%. In code summarization, it achieves superior scores in completeness, accuracy, and readability, with gains ranging from 1.7 to 25.4 points. For code generation, its performance in accuracy, readability, and executability surpasses benchmarks by 1.2 to 25.1 points. Grounded in the fine-tuning paradigm, this study introduces and validates an approach to enhance LLMs in geospatial code generation and associated tasks. These findings extend the application boundaries of such models in geospatial domains and offer a robust foundation for exploring their latent potential.

International Journal of Applied Earth Observation and GeoinformationVol. 138
Wuhan University (CN), State Key Laboratory of Information Engineering in Surveying Mapping and Remote Sensing (CN)
National Natural Science Foundation of China
Openalex Percentile: Top 0%
Scientific Computing and Data Management
100.05
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.