← peng-luo.com

Accepted · Annals of the American Association of Geographers

Toward Self-Evolving Geospatial Algorithms: An LLM-Driven Framework with a Case Study on Spatial Regime Discovery

Xiayin Lou1, Peng Luo2,3,∗, Liqiu Meng1

1Chair of Cartography and Visual Analytics, Technical University of Munich  ·  2School of Earth, Environment, and Sustainability, University of Iowa  ·  3Senseable City Lab, Massachusetts Institute of Technology  ·  ∗Corresponding author

Schematic: a human defines the question and metric; in expert-driven discovery the researcher iterates between reasoning, knowledge retrieval and revising the algorithm, while in self-evolving discovery LLM agents carry out that loop.
Expert-driven and self-evolving discovery. The researcher defines the question and the metric in both. In self-evolving discovery, LLM agents carry out the loop of reasoning, knowledge retrieval and revision that an expert would otherwise run by hand.

Summary

Geospatial algorithms have been improved by hand: a researcher spots a limitation, proposes a fix and tests it. SEGA (Self-Evolving Geospatial Algorithms) lets LLM agents take over much of this inner loop of generating, testing and selecting algorithm variants, while the researcher defines the question, the objective and the evaluation. It combines a two-loop evolution engine that retrieves geographic knowledge every round, an automatic code formatter that prepares any seed algorithm for evolution, and a simulation-driven protocol that evolves only on synthetic data with known ground truth, so that results on real data stay out of sample. In a case study on spatial regime discovery, the evolved algorithm recovers planted regimes better than its seed and four classical regionalization methods on 150 simulated grids, and transfers unchanged to 11 real-world datasets.

The SEGA framework

Three modules, marked 1 to 3 in the diagram.

SEGA framework diagram with the evolution engine (1), the code formatter (2) and the simulation-driven training protocol (3).

1Evolution engine

A two-loop engine. The inner loop mutates and selects code. After each round, an outer loop analyzes the best program, retrieves geographic knowledge for the gaps it finds, and rewrites the prompt of the next round.

2Code formatter

LLM chains turn a raw seed algorithm into the standardized input the engine needs: an evolvable program, an evaluator and a configuration. The evolved code is returned in the same form.

3Simulation-driven protocol

Evolution sees only synthetic data with a known ground truth. The best algorithm is then frozen and applied unchanged to real data, which it never saw during the search.

Case study: evolving a spatial regime algorithm

Spatial regime discovery partitions a study area into contiguous regions, each with its own regression relationship. Starting from Two-stage K-Models, SEGA ran 10 rounds of 10 iterations. The fitness was the Rand Index against the planted partition, averaged over three training grids; candidates never see that partition.

Seed

Fitness: mean Rand Index on the three training grids

Accepted changes in this round

    Where this came from

    This view reports what the search produced. The geographic knowledge retrieved at each round, the prompt that carried it, the full program and its diff against the previous round are in the evolution trace.

    +new idea↻code change{#}parameter changeround without an accepted change
    The evolution, round by round. Left: fitness of the best program after each round, as logged during the run. Right: the changes the inner loop accepted, and the knowledge gap the outer loop flagged afterwards, with its search queries; the retrieved passages shape the next round's prompt. Below: each training grid's planted regimes next to the partition of the current best program, colours matched to the planted regions; ARI is the chance-corrected agreement. The maps re-run each round's best program with a fixed random seed; their mean Rand Index reproduces the logged fitness to within 0.0011. Play the animation or drag the slider.

    Results

    All metrics are computed by an evaluation harness outside the candidate code. Evolved rows are means over three independent evolution runs.

    Simulation

    150 high-noise grids · mean ARI

    0.869 ARI for SEGA, against 0.812 for the seed

    Search effort or algorithm?

    Seed given the same search at matched runtime · ablations

    +0.043 median ARI gain over the matched-budget seed

    Real-world transfer

    11 datasets in climate, health, hydrology and politics

    0.658 mean SSR Reduction, the highest of six methods

    Simulation: Table 3 of the manuscript; whiskers show the SD over three evolution runs. Matched budget and ablations: Appendix D, where the unmodified seed searches the same six initial cluster counts with random restarts for as long as the evolved algorithm runs, and each ablation removes one component of the evolved algorithm. Real world: Table 4, cross-dataset means; the evolved algorithm also has the lowest mean RMSE (1.220). Evidence comes from one seed and one task family.

    Resources