Skip to content

igoyalsamarth/llm-hunger-games

Repository files navigation

LLM Hunger Games

A simulation where 5 personas (distinct personalities/memories) compete using a single local LLM. Each round consists of discussion, scoring, and elimination phases.

How It Works

  1. Discussion Phase: Each persona responds to a given situation/scenario. Responses are saved to round_X_discussion/*.txt files.

  2. Scoring Phase: Each persona evaluates and scores all other personas' responses based on their own values/propaganda. Scores are saved to round_X_scoring/*.json files.

  3. Elimination Phase: Average scores are calculated, the lowest-scoring persona is eliminated, and remaining personas react to the elimination. Results are saved to round_X_output/ with reactions in .txt files.

The game continues until only one persona remains.

Setup

This project uses uv for package management. Make sure you have uv installed:

# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh

Install dependencies:

uv sync

Prerequisites

Make sure you have Ollama installed and running:

# Install Ollama (if not already installed)
# Visit https://ollama.ai or use: curl -fsSL https://ollama.ai/install.sh | sh

# Start Ollama service
ollama serve

# Pull a model (in another terminal)
ollama pull llama3.1:8b
# or any other model you prefer

Usage

Basic Usage

Run with a single situation:

uv run llm-hunger-games run \
  --model llama3.1:8b \
  --situation "A group must decide how to allocate limited resources during a crisis"

Multiple Situations

Create a file with situations (one per line):

# situations.txt
A group must decide how to allocate limited resources during a crisis
A conflict arises between individual freedom and collective safety
A difficult choice between two equally important values must be made

Then run:

uv run llm-hunger-games run \
  --model llama3.1:8b \
  --situations-file situations.txt \
  --output my_game_output

List Available Models

uv run llm-hunger-games list-models

Output Structure

The game creates an output directory (default: game_output/) with the following structure:

game_output/
├── round_1_discussion/
│   ├── the_pragmatist.txt
│   ├── the_idealist.txt
│   ├── the_strategist.txt
│   ├── the_empath.txt
│   └── the_maverick.txt
├── round_1_scoring/
│   ├── the_pragmatist.json
│   ├── the_idealist.json
│   ├── the_strategist.json
│   ├── the_empath.json
│   └── the_maverick.json
├── round_1_output/
│   ├── elimination.json
│   ├── the_pragmatist_reaction.txt
│   ├── the_idealist_reaction.txt
│   └── ...
├── round_2_discussion/
│   └── ...
└── final_results.json

Default Personas

The game includes 5 default personas:

  1. The Pragmatist: Values efficiency, practical solutions, and data-driven decisions
  2. The Idealist: Values principles, ethics, and moral correctness
  3. The Strategist: Values long-term planning, calculation, and achieving goals
  4. The Empath: Values human connection, compassion, and harmony
  5. The Maverick: Values independence, innovation, and challenging norms

Project Structure

llm_hunger_games/
├── cli.py            # Typer CLI interface
├── models.py         # LLM model wrapper (Ollama API)
├── persona.py        # Persona class with personality and memory
├── game.py           # Game engine with discussion/scoring/elimination
└── main.py           # Entry point

Customization

You can modify the personas in cli.py to create your own set of competing personalities with different values and characteristics.

About

Bunch of persona-locked llm fight among themselves to crown the winner of the hunger games.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages