divsim-code / docs /EXPERIMENT_PROTOCOL.md
anonymousfileupload's picture
divsim reproducibility bundle: simulator, sweeps, analyses (step_marks fix)
dd138ec verified
|
Raw History Blame Contribute Delete
8.89 kB

Experiment Protocol: Disentangling Models from Personas in LLM Social Simulations

Overview

This document is the canonical reproducibility narrative for the dyadic, triadic, and four-way (tetradic) sweep experiments and the lexical/content analyses reported in the paper. It complements the code in sweep/, oasis/, launch/, and analyses/ by explaining the experimental design decisions that are not obvious from code alone.


Simulator

We adapt the OASIS simulator (v0.2.5, https://github.com/camel-ai/oasis) to support heterogeneous multi-model populations. The key modifications are in oasis/run_v9.py:

  • hetero mode: 2 model families, 10 agents each
  • hetero3 mode: 3 model families, 10 agents each
  • Plackett-Luce feed ranking with Gumbel noise (T=5.0)
  • Post-share balancer: prevents one model family from dominating posts
  • Warm-up phase: all agents post once before the main loop; any run where a family has < 50% participation is aborted
  • SIGTERM-safe checkpoint/resume for preemptible SLURM allocations

Models

Five models are tested. All are served via vLLM 0.19.0 on 8× NVIDIA L40S 48 GB. See env/vllm_version.md for exact launch parameters.

Model HF ID TP Port
Qwen Qwen/Qwen3-32B 2 8002
gpt-oss openai/gpt-oss-20b 1 8003
Magistral mistralai/Magistral-Small-2509 2 8004
GLM-4 zai-org/GLM-4-32B-0414 2 8007
Gemma google/gemma-4-31B-it 2 8009

Persona initialization

Personas are sampled from the Moltbook community archive (HF dataset). The seed database (oasis/seed_db/hf-zero-50.sqlite) contains 50 real agent profiles: display names, bios, and prior post histories (up to 5 posts per agent, ~500 chars each).

A diversity filter ensures at most 1 HK CLAW minter persona per run (a narrow cluster that otherwise over-represents in random samples). The filter is deterministic given the RNG seed.

Each seed value produces a different persona sample. Seeds: [42, 137, 271, 314, 999] for dyadic runs; [42, 271, 999] for triadic runs.


Rotating assignments

For dyadic runs: 20 agents (10 per family), two orderings per seed (A=X,B=Y and A=Y,B=X). This gives 2 × C(5,2) × 5 = 100 runs.

For triadic runs: 30 agents (10 per family), 3 of 6 orderings per seed (selected by taking permutations at indices 0, 2, 4 for maximum positional diversity). This gives 3 × C(5,3) × 3 = 90 runs.


Simulation parameters

Parameter Value
Steps 100
Activation probability 0.3 per agent per step
Feed size (K) 20
Gumbel noise temperature T=5.0
Post-share tolerance δ=0.05
Input token limit 12,000
Max output tokens 1536 (512 for Gemma)
Temperature 0.85
Max tool-call attempts per turn 6

Metrics

Directed pairwise engagement homophily (H)

For families X and Y:

H_{X→Y} = obs(X→Y) / exp(X→Y) - 1

where obs(X→Y) = fraction of all directed comment edges from X to Y, and exp(X→Y) = null expectation under random mixing proportional to group sizes.

Two edge types are counted:

  1. commenter → post_author
  2. replier → parent_comment_author (threaded replies)

Positive H = X engages with Y more than random; negative = avoidance. Diagonal (X=X) = in-group self-preference.

Swap stability

For dyadic runs: mean |H_{X→Y}^(AB) - H_{X→Y}^(BA)| across seeds. For triadic runs: mean max-|ΔH| across the 3 orderings per (triplet, seed). Lower = more stable across persona-to-model assignment rotations.


Validity criteria

A run is included in the paper analysis if:

  • Dyadic: ≥ 18 distinct agents commented, ≥ 200 total comments
  • Triadic: ≥ 26 distinct agents commented, ≥ 200 total comments

These thresholds filter out runs that were aborted (e.g., server failure, warm-up failure) before completing enough interaction to yield reliable H estimates.

Note: The H-matrix figure scripts (analyses/plot_matrices.py) apply only nu ≥ 26 for triadic runs (no nc threshold), matching the original data selection used for the paper's H tables. The variance decomposition scripts (the variance scripts) apply nc ≥ 200 for both dyadic and triadic, which excludes one additional triadic run with nc=169. The paper's stated 182-run pool (100 dyadic + 82 triadic) was computed at an earlier snapshot; the current pool is 100 dyadic + 89 triadic = 189 runs (see data/MANIFEST.md).


Run identification convention

Database file names encode the run configuration:

sweep_{modelA[:3]}_{modelB[:3]}_s{seed}.db       # dyadic
sweep_tri_{A[:3]}_{B[:3]}_{C[:3]}_s{seed}.db     # triadic

Each .db file has a corresponding .metadata.json sidecar with the agent-to-model mapping, and .metadata.json + _chats.jsonl + _reasoning.jsonl side-car files.


Variance decomposition methodology

The variance decomposition (Appendix D) uses comments per post (CPP = in-degree / number of posts) as the dependent variable, restricted to agents with at least two posts. Raw in-degree conflates per-post appeal with posting volume (an agent that posts more mechanically receives more comments); CPP removes that exposure confound. Earlier drafts used raw in-degree, under which persona appears to dominate two-way mixtures purely as a posting-volume artifact.

Script What it produces
analyses/variance_cpp.py Hierarchical OLS R² decomposition + leave-one-model-out, on CPP (Tables D.1–D.2)
analyses/absolute_variance.py Variance components across dyadic / triadic / four-way regimes
analyses/plot_fig_variance_overview.py Figure: proportional CPP variance (model vs persona) + per-model H by mixture size

Model selection is the agent's own base model plus the unordered partner-pair (the other models present). In four-way runs all four models are present in every run, so the partner composition is constant and model selection reduces to own-model identity.


Reproducibility notes

  1. Stochastic elements: Two sources of randomness per run, both controlled by --rng-seed:

    • Persona selection (which agents from the seed DB)
    • Group allocation (which agents go to which model family)
    • Feed noise is per-agent Gumbel, not globally seeded; exact reproduction of feed orderings would require seeding each model call, which is not done.
  2. Model-side non-determinism: vLLM with temperature=0.85 is stochastic. Running the same configuration twice will produce different comments. The paper reports means ± std across seeds and rotations; individual runs are not expected to be identical.

  3. Checkpoint/resume: Partial DBs can be resumed with --resume. The _checkpoint.json sidecar records the exact last completed step.

  4. Warm-up ordering: Agents post in a seeded-random order during warm-up, ensuring the initial post distribution across model families is approximately uniform by construction.


Four-way (tetradic) runs

The four-way sweep uses the pool {gpt-oss, Qwen, Magistral, GLM-4}, 40 agents (10 per family), 100 steps, post-share balancer on, activation prob 0.3 (run_v9.py --mode hetero4). Two seeds (42, 271) each cover 12 distinct model->block rotations (a Latin-square-style set), for 24 valid runs.

  • Validity: >= 200 comments and all four models present.
  • Run identification: tetradic/tetra_s{seed}_r{rotation}.db.
  • Metrics: same directed engagement homophily (H) as dyadic/triadic; for the variance decomposition and content analyses, CPP as above.

Driver: launch/run_tetradic.sh. Per-model H over the 24 runs and the four-way H matrix/heatmap: analyses/tetradic_recompute_H.py, analyses/tetradic_results.py.


Content analysis

Finding 3 analyzes the text agents produce. Build the corpus once with analyses/extract_texts.py (-> data/texts.jsonl: one row per post/comment with its model and persona). Then:

  • analyses/lexical_table.py — TF-IDF (word 1–2-grams, English stop words removed,
    • char 3–5-grams) -> logistic regression recovering model / persona (Table 1).
  • analyses/svd_axes.py — agent-level TF-IDF -> truncated SVD (30 components); the first axis (document language) is dropped, leaving 29 style axes. Reports per-axis top terms from V^T.
  • analyses/content_engagement.py — decomposes CPP variance into length / style / model / persona blocks (single + leave-one-block-out unique R²).
  • analyses/style_geometry.py — per-model style-direction centroids, their split-half stability, and cosines to the engagement direction (linear probe on style).
  • analyses/cluster_model_persona.py, analyses/length_regimes.py — supporting checks (does style cluster by model vs persona; length/volume confound by regime).