Code and simulation data for Belief Coevolution in a Social Network of Generalist and Specialist Large Language Models:
@misc{savcisens2026coevolvesim,
title={Belief Coevolution in a Social Network of Generalist and Specialist Large Language Models},
author={Germans Savcisens and Samantha Dies and Courtney Maynard and Tina Eliassi-Rad},
year={2026},
doi={10.48550/arXiv.2607.27512},
publisher={arXiv},
url={https://arxiv.org/abs/2607.27512},
}CoevolveSim is a framework for studying belief diffusion within networked LLM populations. Generalist and specialist LLM agents are placed on a social network (Erdős–Rényi or Watts–Strogatz) and exchange beliefs about medical-indication statements over several rounds, each agent revising its belief after observing a summary of its neighbors' beliefs. Across four scenarios:
- I. baseline generalists,
- II. generalists with random social roles,
- III. specialists with random roles,
- IV. specialists with roles matched to their domain.
These simulations isolate the effects of persona-style role assignment, domain specialization (model heterogeneity), and role–specialization alignment on individual belief revision and population-level consensus. A hierarchy of classical opinion-dynamics surrogate models (M1–M4) is then fit to test which mechanisms (persistence, social belief composition, agent identity) are needed to reproduce the observed dynamics.
src: simulation framework, agent/network configs, and analysis code (installed as an editable package).tests: unit tests.data: raw simulation output (data/outputs/) and derived analysis tables/figures (data/analysis/).notebooks: cleaned, documented notebooks that reproduce every table and figure in the paper; see Notebooks below.
notebooks contains the documented, reproducible pipeline behind the paper's results. Each notebook's own intro cell states exactly which figures/tables/sections it produces:
maximin_selection.ipynb: reproduces the maximin selection of the 16 network realizations and 20 discussion statements used across all runs.sanity_check.ipynb: check that all data is in placeX1_data.ipynb: turns raw per-run simulation output (data/outputs/runs/) into the two aggregated tables every later notebook builds on (agent_level_data.parquet,run_level_data.parquet).X2_agent_analysis.ipynb: agent-level analysis (§What drives belief revisions?): estimated marginal means and planned contrasts for plasticity, directedness, and outgoing influence across the four scenarios and two network types, plus the variance-decomposition/ICC analysis behind opinion leaders and followers.X3_run_analysis.ipynb: population-level analysis: estimated marginal means and planned contrasts for consensus change across the four scenarios and two network types (Fig. 2C), plus per-scenario convergence rates.X4_manuscript_plots.ipynb: combines theX2/X3outputs into the manuscript-ready tables and the combined contrast-forest figure.X5_surrogates.ipynb: fits/pools the M1–M4 surrogate opinion-dynamics models (persistence; +global belief composition; +local neighborhood composition; +agent identity) and produces the final-state MCC and consensus-fidelity figures/tables (§Can classical opinion-dynamics models explain these dynamics?).
This project uses uv for Python environment management. Run the setup script for initial configuration:
./setup.sh # Install dependencies and configure environmentIf you have uv installed, just run uv sync from this directory.
Canonical entrypoint:
uv run python src/experiment.pyExample run with Hydra overrides:
uv run python src/experiment.py \
catalog=random_roles \
prompt=wR_L \
network=erdos-renyi \
network.params.n=48 \
network.params.p=0.3 \
statement=false_0 \
probe=zeroshot \
seed=814183 \
experiment.max_rounds=10Note
- Some model configurations require a Hugging Face access token in
src/configs/model/*.yaml. - A subset of analysis notebooks relies on
R/rpy2tooling (see notebooks/r_utils.py and notebook comments for details).
Important
This code is licensed under the MIT License. See LICENSE for more information.
Warning
- This is research software. While we strive for correctness and reproducibility, please verify results for your specific use case.
- GitHub Copilot and Claude Code contributed to code annotations, docstrings, and formatting. All algorithmic logic, methodological design, and scientific claims were developed and reviewed by the authors.
Correspondence: g.savcisens@northeastern.edu