Comparative Evaluation of Prompting and Fine-Tuning for Applying Large Language Models to Grid-Structured Geospatial Data

Akash Dhruv, Yangxinyu Xie, Jordan Branham, Tanwi MallickarXiv 2025 · DOI

Introduction

Large Language Models (LLMs) have demonstrated remarkable capabilities in natural language processing, yet they frequently struggle with the "numerical soup" characteristic of grid-structured geospatial data. This data, essential for climate resilience and weather forecasting, is typically organized in multidimensional arrays (latitude, longitude, time, and variable). This structure contrasts sharply with the linear text format LLMs are optimized to process.

Spatial representation of grid-structured data within the United States.

Researchers face three primary challenges when applying LLMs to this domain:

  1. Tokenization Disruption: Numbers are often treated as discrete, opaque tokens, obscuring mathematical relationships.
  2. Spatial/Temporal Blindness: Models struggle to maintain the integrity of relationships across a grid or time series.
  3. Reasoning Failures: Even with correct data retrieval, models often fail at "scientific common sense," such as confusing units or emissions scenarios (e.g., RCP 4.5 vs. RCP 8.5).

Methodology

This study evaluates two approaches using LLaMA 3.1 8B to bridge the gap between natural language and geospatial arrays: structured prompting and parameter-efficient fine-tuning (LoRA).

Structured Prompting

The base model was provided with a structured JSON block containing grid-indexed data, including historical values, future projections, and regional aggregates, alongside a natural language query.

Example of the structured JSON input and the corresponding model output for a climate projection query.

Parameter-Efficient Fine-Tuning (LoRA)

Using Low-Rank Adaptation (LoRA) via the Unsloth-AI API, the researchers updated a small subset of the model's parameters. This process employed 8-bit quantization and mixed-precision training (bfloat16) to ensure computational efficiency. Evaluation relied on a Python-based regex script for exact value accuracy and the all-MiniLM-L6-v2 embedding model for semantic similarity.

Datasets and Data Representation

The research utilizes the ClimRR (Climate Risk and Resilience) dataset, which provides high-resolution climate projections for the U.S. A curated dataset of 120 interaction examples was developed through a semi-automated pipeline:

  1. Querying ClimRR for specific grid cells and variables.
  2. Generating question-answer pairs via templates.
  3. Employing GPT-4 to introduce linguistic variety, preventing the model from simply memorizing templates.

Key Insights

  • The "Rounding" Trap: Base models frequently introduce rounding errors that can invalidate scientific assessments.
  • Scenario Defaulting: Prompt-only models often default to a single emissions scenario. Fine-tuning teaches the model to distinguish between or provide both RCP 4.5 and 8.5 scenarios.
  • Small Data, High Impact: Precision can be achieved with a surprisingly small, high-quality dataset (~100 examples).
  • Fluency vs. Precision: While prompting achieves high semantic similarity (sounding correct), it lacks the numerical accuracy required for scientific applications.

Results

The transition from prompting to fine-tuning resulted in a significant performance leap:

Model Similarity Score Accuracy Score
Base Model (Prompting) 0.8335 0.2889
Fine-tuned Model 0.8954 1.0000

The fine-tuned model achieved 100% accuracy in numerical retrieval and unit handling on the test subset, while also demonstrating superior qualitative reasoning in trend analysis and scenario comparison.

Conclusion and Future Work

While fine-tuning on small datasets provides a massive boost in precision, limitations remain regarding dataset scale and global generalization. Future research will focus on agentic workflows, where models interact directly with APIs to fetch real-time data, and testing generalization across diverse global geospatial datasets.

Summary updated

BibTeX
@misc{dhruv2025comparative,
  author = {Akash Dhruv and Yangxinyu Xie and Jordan Branham and Tanwi Mallick},
  title = {{Comparative Evaluation of Prompting and Fine-Tuning for Applying Large Language Models to Grid-Structured Geospatial Data}},
  year = {2025},
  eprint = {2505.17116},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.17116},
}
Figure