Skip to content

feat: add LLM Schelling Segregation example using mesa-llm#363

Open
abhinavk0220 wants to merge 2 commits intomesa:mainfrom
abhinavk0220:add/llm-schelling-segregation
Open

feat: add LLM Schelling Segregation example using mesa-llm#363
abhinavk0220 wants to merge 2 commits intomesa:mainfrom
abhinavk0220:add/llm-schelling-segregation

Conversation

@abhinavk0220
Copy link

Summary

Implements Schelling's (1971) classic segregation model using LLM agents
instead of a fixed tolerance threshold.

Motivation

The classical Schelling model is the most cited ABM paper ever — but its
decision rule is a hard mathematical threshold. This example shows what
changes when agents reason in natural language about their neighborhood:
the same emergent segregation appears, but driven by genuine reasoning
rather than a fixed number.

This directly fulfills the GSoC 2026 goal of "examples sourced from
scientific papers with comparison to non-LLM agents."

What's included

  • agent.pySchellingAgent extending LLMAgent with CoT reasoning
  • model.pyLLMSchellingModel on OrthogonalMooreGrid with segregation index metric
  • app.py — SolaraViz with grid plot, happiness chart, and segregation index over time
  • README.md — explanation with comparison table vs classical Schelling

Reference

Schelling, T.C. (1971). Dynamic models of segregation.
Journal of Mathematical Sociology, 1(2), 143–186.

Related

abhinavKumar0206 and others added 2 commits March 6, 2026 15:57
…Schelling's (1971) classic segregation model using LLM agentsinstead of a fixed tolerance threshold.Each agent reasons in natural language about its neighborhood compositionand decides whether to stay ('happy') or relocate ('unhappy'). Thisproduces richer segregation dynamics than the classical threshold rule.Includes:- SchellingAgent extending LLMAgent with CoT reasoning- LLMSchellingModel on OrthogonalMooreGrid with torus=True- Segregation index metric tracked over time- SolaraViz with grid plot, happiness chart, and segregation index- README with comparison table vs classical Schelling modelReference: Schelling, T.C. (1971). Dynamic models of segregation.Journal of Mathematical Sociology, 1(2), 143-186.Related: mesa/mesa-llm#153
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant