Skip to content

rcarbajalrc/econobiome

Repository files navigation

EconoBiome

An LLM-Augmented Agent-Based Model of Post-AI Economic Transitions

Measuring Ideological Bias and Structural Constraints in LLM Policy Reasoning

License: CC BY-NC 4.0 Python 3.12 Zenodo


Overview

EconoBiome is an agent-based model (ABM) of post-AI economic transitions in which large language models (LLMs) serve as the independent experimental variable rather than as simulation tools. The system models 8 heterogeneous agent types in a shared economic environment of 19 signals, calibrated to OECD 2025 macroeconomic data.

The framework is a direct methodological transfer from OncoBiome — an LLM-ABM of the pancreatic tumour microenvironment — to the economic domain. As KRAS G12D is the oncogene determining tumour regime in OncoBiome, AI market structure (diffuse vs. oligopolistic) is the "economic oncogene" determining social fracture in EconoBiome.

Key findings (from preprint)

  1. AI market structure is the dominant variable: diffuse (open-source) AI produces 18.9pp less social fracture than oligopolistic AI — robust across 9 parameter perturbations
  2. Vulnerability window: maximum social risk occurs at intermediate automation rates (ar = 0.45–0.55), not at maximum automation — explained by the gap between technological adoption velocity (6–8x historical) and institutional response velocity (1.5–2x)
  3. LLM equivalence: Claude Haiku and Sonnet produce statistically identical outcomes (Mann-Whitney p = 1.0, n = 10 per model) — differences reflect training-level biases, not capability
  4. Ideological bias: robot tax activation ranges from 0% (market frame) to 80% (neutral frame) — fiscal constraints systematically override ideological frames for high-cost policies

Model architecture

econobiome/
├── agents/
│   ├── estado_agent.py      # Government (LLM-driven) — robot_tax, RBU, antitrust
│   ├── empresa_agent.py     # Firms (LLM-driven) — automation, relocation
│   ├── trabajador_agent.py  # Workers — reskilling, anxiety
│   ├── consumidor_agent.py  # Consumers — demand, savings
│   ├── ia_agent.py          # AI diffusion — productivity, frontier gap
│   ├── sindicato_agent.py   # Union — collective bargaining, mobilisation
│   ├── migrante_agent.py    # Migration — labour supply, demographic dividend
│   └── plataforma_agent.py  # AI oligopoly — market capture, regulatory capture
├── core/
│   ├── signals.py           # 19 economic signals (cytokines)
│   ├── regimes.py           # 5 emergent social regimes
│   ├── environment.py       # Signal update logic
│   └── simulation.py        # Simulation runner
├── config/
│   ├── calibration_v3.py    # OECD 2025 calibration
│   └── ai_acceleration.py   # Heterogeneous acceleration matrix (5x central estimate)
├── analysis/
│   └── exp22_bias.py        # Ideological bias experiment
├── validation/
│   └── spain_historical.py  # Historical data (Spain 2008–2023)
├── outputs/
│   ├── EXPERIMENT_LOG.md    # Complete experiment registry (22 experiments, 421 runs)
│   └── exp22_sesgo_ideologico.json  # Ideological bias results
└── tests/
    └── test_smoke.py        # 7 smoke tests including Sprint4 agents

Economic signals (19)

productivity, tasa_desempleo, gini, concentracion_top1, cobertura_renta_basica, demanda_agregada, bienestar_subjetivo, confianza_social, inflacion, tension_politica, liquidez_circulante, poder_mercado, frontier_gap, ratio_dependencia, flujo_migratorio_neto, automation_rate, capacidad_fiscal, deuda_pib, jornada_media_horas

Emergent regimes

Regime Conditions
adaptive_abundance unemployment < 8%, Gini < 0.38, trust > 0.58
unstable_transition default — bifurcation possible
social_fracture unemployment > 25% OR Gini > 0.60
digital_feudalism frontier_gap > 0.65 AND market power > 0.60
creative_reinvention jornada < 33h AND RBU > 35% AND wellbeing > 0.65

Installation

git clone https://github.com/rcarbajalrc/econobiome
cd econobiome
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
pip install -r requirements.txt

# Set API key
cp .env.example .env
# Edit .env and set ANTHROPIC_API_KEY=your_key_here
# NO_LLM=true by default — safe mode, no API calls

Quick start

from core.simulation import EconoBiomeSimulation, SimulationConfig

# Rule engine (no LLM, no API cost)
cfg = SimulationConfig(
    cycles=15,
    automation_rate=0.50,
    seed=42,
    no_llm=True,
    tipo_ia='difusa',          # 'difusa' | 'mixta' | 'plataforma'
    tipo_estado='inclusivo',   # 'inclusivo' | 'extractivo'
    incluir_plataforma=True,
    n_sindicatos=1,
    n_migrantes=5,
)
sim = EconoBiomeSimulation(cfg)
results = sim.run()
print(results['dominant_regime'])
print(results['final_signals']['tasa_desempleo'])
# With LLM (requires ANTHROPIC_API_KEY and NO_LLM=false in .env)
cfg = SimulationConfig(
    cycles=15,
    automation_rate=0.50,
    seed=42,
    no_llm=False,
    agent_model='claude-haiku-4-5-20251001',  # or 'claude-sonnet-4-6'
    incluir_plataforma=True,
    n_sindicatos=1,
    n_migrantes=5,
)

Run tests

cd econobiome
source .venv/bin/activate
PYTHONPATH=. python tests/test_smoke.py
# Expected: ✅ 7/7 tests passed

Experiments

All 22 experiments are documented in outputs/EXPERIMENT_LOG.md with:

  • Full configuration parameters
  • Run IDs for every simulation
  • Numerical results
  • Scientific interpretation

Reproduce main results

# Baseline rule engine (Sprint4, ar=[0.25, 0.50, 0.75], 5 seeds)
PYTHONPATH=. python -c "
from core.simulation import EconoBiomeSimulation, SimulationConfig
import numpy as np

for ar in [0.25, 0.50, 0.75]:
    fracs = []
    for seed in range(5):
        cfg = SimulationConfig(cycles=15, automation_rate=ar, seed=seed,
                               no_llm=True, incluir_plataforma=True,
                               n_sindicatos=1, n_migrantes=5)
        s = EconoBiomeSimulation(cfg).run()
        counts = s['regime_counts']
        fracs.append(counts.get('fractura_social',0)/sum(counts.values())*100)
    print(f'ar={ar}: fracture={np.mean(fracs):.1f}%')
"

Calibration

Parameter Value Source
Initial automation rate 0.25 McKinsey GI (2025)
ar growth rate +4%/year McKinsey GI (2025)
AI acceleration factor 5x vs. Industrial Revolution
Initial Gini 0.34 Eurostat / WID (2025)
Initial unemployment 12% OECD (2025)
Initial debt/GDP 0.85 Eurostat (2025)
Robot tax Laffer threshold 20% Acemoglu (2024)

Full calibration in config/calibration_v3.py and config/ai_acceleration.py.


Historical validation

Country Period MAE unemployment MAE Gini Scope
Spain 2008–2023 5.0pp 0.033 In scope
France 2010–2023 4.5pp 0.073 In scope
Germany 2010–2023 9.3pp 0.074 Out of scope (Kurzarbeit)

Model scope: OECD economies with structural unemployment > 10% and Gini > 0.30.


Conflict of interest

This study uses the Anthropic API (Claude Haiku and Sonnet). Anthropic is explicitly modelled as PlataformaAgent in the simulation — one of the oligopolistic AI platform actors under study. The author has no financial relationship with Anthropic beyond standard API usage fees (~20 EUR total for all experiments).


Citation

@misc{carbajal2026econobiome,
  title   = {EconoBiome: An LLM-Augmented Agent-Based Model of Post-AI Economic Transitions},
  author  = {Carbajal, Roberto},
  year    = {2026},
  month   = {April},
  note    = {Preprint, Independent Researcher, Barcelona, Spain},
  doi     = {10.5281/zenodo.19534508},
  url     = {https://github.com/rcarbajalrc/econobiome}
}

License

CC BY-NC 4.0 — free for research and educational use, not for commercial use.

EconoBiome is a sibling project of OncoBiome.

About

LLM-augmented ABM of post-AI economic transitions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages