Content area
Fine-tuning GPT-4o-mini on geospatial queries significantly improves Python code generation for spatial analysis tasks The fine-tuned model achieved an 89.7% accuracy rate, improving 49.2 percentage points over the baseline.
Integrating LLMs into geospatial dashboards enables real-time, user-friendly analysis for smart city management. This framework offers scalable potential for domain-specific AI tools in geospatial science and smart urban analytics. This study investigates the potential of fine-tuned large language models (LLMs) to enhance geospatial intelligence by translating natural language queries into executable Python code. Traditional GIS workflows, while effective, often lack usability and scalability for non-technical users. LLMs offer a new approach by enabling conversational interaction with spatial data. We evaluate OpenAI’s GPT-4o-mini model in two forms: an “As-Is” baseline and a fine-tuned version trained on 600+ prompt–response pairs related to geospatial Python scripting in Virginia. Using U.S. Census shapefiles and hospital data, we tested both models across six types of spatial queries. The fine-tuned model achieved 89.7%, a 49.2 percentage point improvement over the baseline’s 40.5%. It also demonstrated substantial reductions in execution errors and token usage. Key innovations include the integration of spatial reasoning, modular external function calls, and fuzzy geographic input correction. These findings suggest that fine-tuned LLMs can improve the accuracy, efficiency, and usability of geospatial dashboards when they are powered by LLMs. Our results further imply a scalable and replicable approach for future domain-specific AI applications in geospatial science and smart cities studies.
Details
Spatial analysis;
Accuracy;
Usability;
Generative artificial intelligence;
Cities;
Python;
Spatial data;
Performance evaluation;
Large language models;
Cognition & reasoning;
Chatbots;
Efficiency;
Natural language;
Case studies;
Translating;
Research methodology;
Geography;
Dashboards;
Queries;
Decision making;
Public health;
Artificial intelligence;
Geographic information systems;
Rural areas;
Urban areas;
Geographical information systems;
Real time;
Natural language processing;
Computer programming
; Jin-Hee, Cho 2
; Zhang Mengxi 3 ; Kim, Junghwan 1
1 Department of Geography, Virginia Tech, Blacksburg, VA 24060, USA; [email protected] (Z.S.); [email protected] (S.S.D.)
2 Department of Computer Science, Virginia Tech Research Center, 900 N Glebe Rd, Arlington, VA 22203, USA; [email protected]
3 Department of Health Systems and Implementation Science, Virginia Tech Carilion School of Medicine, 2 Riverside Circle, Roanoke, VA 24016, USA; [email protected]