Overview β’ Key Innovations β’ Quick Start β’ Experiments β’ Citation
Can LLM agent societies develop complex social structuresβwealth inequality, dynasties, and governanceβthrough emergent dynamics alone?
This project demonstrates that populations of LLM agents, when given economic incentives and governance mechanisms, spontaneously develop:
- Dynasties: Family lineages that persist across generations
- Inequality: Wealth concentration (Gini > 0.4)
- Governance: Agents propose and vote on their own rules
Generation 0 Generation 100 Generation 500
βββββββββββββββ βββββββββββββββ βββββββββββββββββββ
β 100 identicalβ ββββ β Specialized β ββββ β Complex Society β
β agents β β dynasties β β with laws β
βββββββββββββββ βββββββββββββββ βββββββββββββββββββ
Equal wealth Wealth diverges Emergent governance
@dataclass
class CivilizationAgent:
system_prompt: str # Evolvable role
wealth: float = 100.0 # Economic resource
parent_id: str = None # Lineage tracking
def can_reproduce(self) -> bool:
return self.wealth >= REPRODUCTION_COST # e.g., 200
def is_alive(self) -> bool:
return self.wealth > 0 # Death when bankruptSuccessful agents spawn offspring with inherited (mutated) prompts:
Founder (Gen 0)
βββ Child 1 (Gen 1)
βββ Grandchild 1 (Gen 2)
βββ Grandchild 2 (Gen 2)
βββ Great-grandchild (Gen 3)
Agents propose and vote on rulesβwe don't program specific rules:
| Category | Example Emergent Rule |
|---|---|
| Taxation | "Agents with wealth > 500 pay 10% to common pool" |
| Meritocracy | "Only top performers can reproduce" |
| Welfare | "Minimum wealth guarantee of 20" |
| Oligarchy | "High-wealth agents get double votes" |
async def propose_rule(agent, society_state):
"""Agent proposes a rule based on their position and values"""
proposal = await llm.generate(f"""
You are {agent.id} with wealth {agent.wealth}.
Society Gini: {society_state.gini}
Propose ONE rule that would benefit you or society.
""")
return parse_rule(proposal)git clone https://github.com/HowardLiYH/Emergent-Civilizations.git
cd Emergent-Civilizations
pip install -r requirements.txt
export OPENAI_API_KEY="your-key"from src.genesis import CivilizationSimulation
sim = CivilizationSimulation(
n_agents=100,
n_generations=300,
reproduction_enabled=True,
governance_enabled=True,
voting_system="equal"
)
results = await sim.run()
print(f"Final Gini: {results.gini:.3f}")
print(f"Active dynasties: {results.n_active_dynasties}")
print(f"Passed rules: {results.n_passed_rules}")| # | Experiment | Question | Scale |
|---|---|---|---|
| 1 | Dynasty Formation | Do lineages dominate? | 50 agents, 200 gen |
| 2 | Inequality Emergence | Does wealth concentrate? | 50 agents, 200 gen |
| 3 | Governance Emergence | What rules emerge? | 100 agents, 300 gen |
| 4 | Voting Comparison | How does voting affect outcomes? | 3 Γ 100 agents |
| 5 | Parallel Civilizations | Do initial conditions matter? | 10 Γ 100 agents |
| 6 | Scale Test | What emerges at 1000 agents? | 1000 agents, 500 gen |
Run 10 societies with different initial conditions:
| Society | Variation | Expected Outcome |
|---|---|---|
| A | Equal start | Baseline |
| B | Unequal start | Faster concentration |
| C | High reproduction cost | Fewer dynasties |
| D | Low reproduction cost | Population explosion |
| E | Frequent governance | More rules |
| F | No governance | Pure economy |
| G | 8 task types | More specialists |
| H | 2 task types | Less diversity |
| I | 200 agents | Larger society |
| J | 16 agents | Smaller society |
emergent_civilizations/
βββ src/genesis/
β βββ civilization_agent.py # Extended agent with wealth, lineage
β βββ reproduction.py # Offspring creation with inheritance
β βββ death.py # Death/extinction mechanics
β βββ dynasty.py # Dynasty tracking and analysis
β βββ governance.py # Rule proposals, voting, enforcement
β βββ society_metrics.py # Gini, governance entropy, mobility
β βββ civilization.py # Main orchestrator
βββ experiments/
β βββ exp_dynasty_formation.py
β βββ exp_governance_emergence.py
β βββ exp_parallel_civilizations.py
βββ results/
βββ paper/
| Metric | Formula | Interpretation |
|---|---|---|
| Gini | Wealth inequality | 0 = equal, 1 = one has all |
| Governance Entropy | Rule diversity | High = diverse laws |
| Dynasty Concentration | Top 3 dynasties' share | Measures oligarchy |
| Social Mobility | Rank changes over time | Measures fluidity |
| Metric | Target |
|---|---|
| Gini at convergence | > 0.4 |
| Top 3 dynasties control | > 50% of population |
| Distinct rule categories | > 5 |
| Cross-society variance | Significant |
This work bridges multiple disciplines:
| Field | Connection |
|---|---|
| Evolutionary Biology | Selection, inheritance, extinction |
| Economics | Wealth dynamics, inequality emergence |
| Political Science | Governance emergence, voting systems |
| Sociology | Social stratification, class formation |
| AI Safety | Emergent behavior in agent populations |
Social structures emerge not from top-down design, but from the interaction of simple rules: compete, accumulate, reproduce, vote. The complexity is emergent.
| Project | Relationship |
|---|---|
| Emergent-Specialization | Paper 1: Rule-based agents (foundation) |
| Emergent-Prompt-Evolution | Paper 2: LLM prompt evolution (prerequisite) |
@article{emergent_civilizations_2027,
title={Emergent Governance in Self-Organizing LLM Civilizations},
author={Li, Yuhao and others},
journal={Nature Machine Intelligence},
year={2027}
}MIT License - See LICENSE for details.
Part of the Emergent Specialization Research Series
Paper 3 of 3
