Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Multi-agent LLM simulations testing algorithmic collusion and coordination breakdown in oligopoly markets.

License

NotificationsYou must be signed in to change notification settings

luciasauer/algorithmic_pricing_llms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

377 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License: MITPython 3.11+uv

Master's Thesis: Testing Folk Theorem Predictions in AI-Mediated Markets

Authors: Julian Romero, Lucia Sauer, Moritz Peist
Institution: Barcelona School of Economics
Programme: Data Science for Decision Making
Academic Year: 2024-2025
Supervisor: Christopher Rauh


Table of Contents


Overview

This repository contains the research infrastructure for investigating whether algorithmic collusion among Large Language Model (LLM) agents breaks down according to Folk Theorem predictions as market concentration decreases.

Research Question: Do LLM agent collusion mechanisms break down according to Folk Theorem predictions as the number of market participants increases from 2 to 5 agents?

Key Innovation: This study provides the first systematic test of theoretical collusion boundaries in AI-mediated markets, extending the work of Fish et al. (2025) from duopoly to oligopoly settings. Unlike traditional RL algorithms requiring extensive training, LLMs arrive pre-trained on vast corpora about markets and strategic behavior, enabling sophisticated coordination strategies.

Quick Start

Installation

# Clone repositorygit clone https://github.com/luciasauer/algorithmic-collusion-thesis.gitcd algorithmic-collusion-thesis# Install dependencies with uvuv sync

Environment Setup

Create a.env file in the project root:

MISTRAL_API_KEY=your_mistral_api_key_hereMODEL_NAME=mistral-large-2411

Running Experiments

# Run individual experimentspython experiments_synthetic/duopoly.pypython experiments_synthetic/oligopoly_3.pypython experiments_synthetic/oligopoly_4.pypython experiments_synthetic/oligopoly_5.py# Baseline monopoly experimentpython experiments_synthetic/monopoly.py

Data Analysis

# Start Jupyter for analysisjupyter lab# Key notebooks:# - notebooks/regression.ipynb - Core statistical analysis# - notebooks/plots.ipynb - Data visualization# - notebooks/text_analysis_clusters.ipynb - Agent reasoning analysis

Code Quality

# Lint and format coderuff checkruff format# Run pre-commit hookspre-commit run --all-files

Repository Structure

algorithmic-collusion-thesis/├── src/│   ├── agents/              # LLM agent implementations│   ├── environment/         # Market simulation (Calvano demand)│   ├── experiment/          # Experiment orchestration│   ├── prompts/             # Prompt engineering and management│   ├── analysis/            # Statistical analysis tools│   ├── plotting/            # Visualization utilities│   └── utils/               # Utility functions and logging├── experiments_synthetic/   # Experiment execution scripts├── notebooks/              # Jupyter analysis notebooks├── data/                   # Experimental data storage├── latex/                  # Thesis manuscript and figures└── pyproject.toml         # Dependencies (uv-managed)

Technical Architecture

Core Components:

  • LLM Agents: Mistral API integration with 100-period rolling memory
  • Market Environment: Calvano et al. (2020) demand specification with logit market shares
  • Experiment Framework: 300-period repeated pricing games with rate limiting
  • Analysis Pipeline: Statistical models and text analysis of agent reasoning

Key Dependencies:

  • polars - High-performance DataFrame operations
  • mistralai - LLM API integration
  • statsmodels/linearmodels - Econometric analysis
  • seaborn/matplotlib - Statistical visualization
  • sentence-transformers - Text analysis and embeddings

Troubleshooting

Common Issues:

  • API Rate Limits: Built-in rate limiting prevents overuse; adjustrate_limit_seconds if needed
  • Memory Usage: Large experiments may require substantial RAM for data processing
  • Model Availability: Ensure Mistral API key has access tomistral-large-2411

Development Tips:

  • Usenotebooks/ for exploratory analysis
  • Results are automatically saved in Parquet format indata/results/
  • All experiment parameters are logged for reproducibility

Key Findings

Core Statistical Results

MetricFindingSignificance
Group Size Effect-3.7% price reduction per additional competitorp < 0.001
Cumulative Impact-10.6% total price reduction (duopoly → 5-agent)Highly significant
Prompt Sensitivity-18.8% price difference between specificationsp < 0.001
Model Explanatory PowerR² > 0.66Strong fit

Theoretical Validation

  • Strong empirical support for Folk Theorem predictions
  • Smooth breakdown pattern - coordination erosion follows predictable patterns
  • Robust across specifications - effects consistent across alternative models
  • Independent prompt effects - market structure remains fundamental determinant

Economic Magnitude

Moving from duopoly (n=2) to five-agent competition (n=5):

  • Price reduction: (e^(-0.0373 × 3) - 1) × 100% = -10.6%
  • Demonstrates: Algorithmic collusion faces substantial constraints as market participants increase
  • Implication: Quantitative evidence for theoretical predictions about coordination difficulty in larger groups

TheFolk Theorem establishes that collusion requires δ ≥ (π^D - π^C)/π^D where π^C = π^M/n. As n increases, the required discount factor approaches 1, theoretically making collusion unsustainable.


Experimental Results

Monopoly Model Validation

ModelMean PriceStd. Dev.Near 99% ProfitOutside Conv. Range
mistral-large-24111.80280.0233100%0
magistral-small-25061.80830.157398%4

Note: Mistral-Large-2411 demonstrates superior convergence to monopoly pricing with zero periods outside convergence range.

Duopoly Experiment Results

Key Observations:

  • Sustained supracompetitive pricing above Nash equilibrium
  • Prompt-dependent coordination levels with systematic differences
  • Reward-punishment mechanisms evidenced in price dynamics

Oligopoly Breakdown Patterns

Folk Theorem Validation:

  • Systematic price erosion as group size increases
  • Maintained coordination even in 5-agent settings
  • Predictable degradation following theoretical predictions

Run-Level Regression Results

Dependent Variable: ln(Price)                    (1) Baseline    (2) With ControlsGroup Size         -0.0373***      -0.0373***                   (0.0055)        (0.0054)P2 Prompt          -0.2082***      -0.2082***                   (0.0125)        (0.0125)α = 3.2                            0.0303**                                   (0.0140)α = 10.0                           0.0166                                   (0.0157)Constant           0.6573***       0.6417***                   (0.0203)        (0.0218)Observations       168             168R-squared          0.666           0.675Notes: *** p<0.01, ** p<0.05, * p<0.1Robust standard errors (HC3) in parentheses.

Methodology

Experimental Framework

Synthetic Market EnvironmentLLM Agent CompetitionStrategic Outcome Analysis

Experimental Design

Experimental Design:

  • Base Framework: Extension of Fish et al. (2025) synthetic market simulation
  • Market Structures: 2, 3, 4, 5 competing LLM agents
  • Game Duration: 300-period repeated pricing games
  • Demand Function: Calvano et al. (2020) specification for clean counterfactuals
  • Strategic Setting: Bertrand competition with differentiated products

LLM Implementation:

  • Primary Model:mistral-large-2411 (superior convergence)
  • Alternative:magistral-small-2506 (robustness testing)
  • Prompt Engineering: Two systematic specifications (P1, P2) testing coordination propensity
  • Memory Architecture: 100-period rolling history for strategic learning

Market Environment:Following Calvano et al. (2020): q_i = (a_i - p_i + μ∑p_j) / (1 + μ(n-1))

Where a_i is demand intercept for firm i, μ is substitutability parameter, and n is number of competitors.

Analysis Methodology

Run-Level Equilibrium Analysis:Focus on final 50 periods (251-300) for convergence:ln(Price_run) = β₀ + β₁·GroupSize + β₂·PromptType + X'γ + ε

Textual Reasoning Analysis:

  • Clustering: HDBSCAN algorithm on sentence embeddings
  • Validation: Human interpretation verification
  • Strategic Patterns: Identification of reward-punishment language

Robustness Testing:

  • Alternative aggregation windows (25, 75, 100 periods)
  • Non-linear specifications with interaction terms
  • Bootstrap confidence intervals
  • Outlier sensitivity analysis

Technical Implementation

Development Workflow:

  1. Configure API keys in.env file
  2. Run experiments using scripts inexperiments_synthetic/
  3. Analyze results using Jupyter notebooks innotebooks/
  4. Generate visualizations and statistical outputs

Key Technical Features:

  • Automated experiment execution with rate limiting
  • Real-time statistical analysis with multiple model specifications
  • Advanced text clustering for agent reasoning analysis
  • Publication-ready visualizations with economic benchmark overlays
  • Comprehensive robustness testing across specifications

License

This project is licensed under the MIT License. This research is conducted for academic purposes under standard fair use principles.

About

Multi-agent LLM simulations testing algorithmic collusion and coordination breakdown in oligopoly markets.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2026 Movatter.jp