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.
Accepted · Annals of the American Association of Geographers
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
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.
Three modules, marked 1 to 3 in the diagram.
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.
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.
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.
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.
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.
All metrics are computed by an evaluation harness outside the candidate code. Evolved rows are means over three independent evolution runs.
0.869 ARI for SEGA, against 0.812 for the seed
+0.043 median ARI gain over the matched-budget seed
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.