CoolFace
Apppublic

kristiyants/Prisoners-Dilemma-Benchmark

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
App README

AGI Arena - Prisoner's Dilemma Tournament ๐Ÿ”ฅ

The definitive platform for ranking Large Language Models through strategic game theory battles. Watch AIs clash in the ultimate test of cooperation vs. betrayal.

๐ŸŒ [Live Demo](https://game-theory-liart.vercel.app/) - See it in action!

![Support on Patreon](https://patreon.com/KristiyanTs)

๐Ÿš€ Features

  • โ€”Epic AI Battles: 10-round Prisoner's Dilemma matches between any OpenRouter-supported models
  • โ€”Real-time Leaderboard: Rankings based on wins, losses, and strategic performance
  • โ€”Detailed Analysis: Round-by-round reasoning from each AI's perspective
  • โ€”Rebellious Design: Dark mode with bold, modern styling that breaks the rules
  • โ€”Mobile-First: Fully responsive across all devices
  • โ€”Lightning Fast: Optimized with Next.js and Vercel deployment

๐Ÿ› ๏ธ Tech Stack

  • โ€”Frontend: Next.js 15, React 19, Tailwind CSS 4
  • โ€”Backend: Node.js, Express.js (Serverless Functions)
  • โ€”Database: Supabase (PostgreSQL)
  • โ€”AI Models: OpenRouter API
  • โ€”Deployment: Vercel
  • โ€”TypeScript: Full type safety

๐Ÿ”ง Setup & Installation

Prerequisites

  • โ€”Node.js 18+
  • โ€”Supabase account
  • โ€”OpenRouter API key
  • โ€”Vercel account (for deployment)

Environment Variables

Create a .env.local file with:

bash
# OpenRouter API Configuration
OPENROUTER_API_KEY=your_openrouter_api_key

# Supabase Configuration  
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key

# Admin Configuration
ADMIN_PASSWORD=your_secure_admin_password

# Next.js Configuration
NEXTAUTH_SECRET=your_secure_random_string
NEXTAUTH_URL=http://localhost:3000

Database Setup

  1. 1.Create a new Supabase project
  2. 2.Use Supabase CLI to link and push migrations:
bash
   supabase init
   supabase link --project-ref your-project-ref
   supabase db push
  1. 1.This creates the models, matches, and rounds tables with proper relationships

Local Development

bash
# Install dependencies
npm install

# Run development server
npm run dev

# Open http://localhost:3000

๐ŸŽฎ Usage

Running Matches

  1. 1.Navigate to /admin
  2. 2.Enter admin password
  3. 3.Select two different AI models (e.g., openai/gpt-4o vs anthropic/claude-3.5-sonnet)
  4. 4.Hit "Initiate Battle" and wait 2-5 minutes for completion
  5. 5.View detailed results with round-by-round analysis

Supported Models

Any OpenRouter model including:

  • โ€”GPT-4o, GPT-4o-mini
  • โ€”Claude 3.5 Sonnet, Claude 3.5 Haiku
  • โ€”Gemini 2.0 Flash
  • โ€”Llama 3.2 90B
  • โ€”Qwen 2.5 72B
  • โ€”Mistral Large
  • โ€”Command R+
  • โ€”Grok 2

๐Ÿ—๏ธ Architecture

Game Engine

  • โ€”10 rounds of strategic decision-making
  • โ€”Payoff matrix: Cooperate/Cooperate=3/3, Cooperate/Defect=0/5, Defect/Defect=1/1
  • โ€”History awareness: Each AI sees complete game history
  • โ€”Robust parsing: Extracts reasoning and moves from AI responses

API Endpoints

  • โ€”POST /api/matches/run - Execute new match
  • โ€”GET /api/matches - List recent matches
  • โ€”GET /api/matches/[id] - Match details with rounds
  • โ€”GET /api/models - Leaderboard data

Database Schema

  • โ€”models: AI model stats (wins, losses, total_score)
  • โ€”matches: Game records with participants and results
  • โ€”rounds: Individual round data with moves and reasoning

๐Ÿš€ Deployment

Vercel Deployment

  1. 1.Connect your GitHub repo to Vercel
  2. 2.Add environment variables in Vercel dashboard
  3. 3.Deploy with automatic optimization

Environment Variables for Production

Set these in your Vercel dashboard:

  • โ€”OPENROUTER_API_KEY
  • โ€”NEXT_PUBLIC_SUPABASE_URL
  • โ€”NEXT_PUBLIC_SUPABASE_ANON_KEY
  • โ€”SUPABASE_SERVICE_ROLE_KEY
  • โ€”ADMIN_PASSWORD
  • โ€”NEXTAUTH_SECRET

๐Ÿ’– Support the Project

This project is built with passion for exploring AI behavior through game theory. If you find it interesting and want to support its development:

  • โ€”๐ŸŽญ [Support on Patreon](https://patreon.com/KristiyanTs): Get exclusive access to new features, early AI model releases, and behind-the-scenes insights
  • โ€”๐Ÿ“„ [View My CV](https://github.com/KristiyanTs/game-theory/blob/main/CV.md): Learn more about the creator and their background

Your support helps us:

  • โ€”Add new AI models and game modes
  • โ€”Improve the tournament system
  • โ€”Develop advanced analytics
  • โ€”Keep the servers running for everyone
  • โ€”Create exclusive content and research insights

๐ŸŽฏ Roadmap

Phase 2: User-Prompted AI

  • โ€”User authentication
  • โ€”Custom AI personas and prompts
  • โ€”Prompt Arena battles

Phase 3: Tournaments & Monetization

  • โ€”Bracket-style tournaments
  • โ€”Entry fees via Stripe
  • โ€”Advanced analytics

๐Ÿ›ก๏ธ Security

  • โ€”Row Level Security (RLS) enabled on all tables
  • โ€”Admin password protection for match creation
  • โ€”API keys stored securely as environment variables
  • โ€”No client-side exposure of sensitive data

๐Ÿ“Š Game Theory

The Prisoner's Dilemma tests fundamental strategic thinking:

  • โ€”Cooperation: Risk trust for mutual benefit
  • โ€”Defection: Guarantee short-term gain, risk retaliation
  • โ€”Patterns: Tit-for-tat, always defect, pavlov, etc.
  • โ€”Evolution: How strategies adapt over 10 rounds

๐Ÿ”ฅ Why It's Rebellious

This isn't your typical corporate AI demo:

  • โ€”Dark by default: Embrace the shadows
  • โ€”Brutal honesty: No sugarcoating AI behavior
  • โ€”Strategic warfare: Competition over collaboration
  • โ€”Real analysis: Deep dive into AI reasoning
  • โ€”Unfiltered results: Let the best model win

Built for the rebellious minds who dare to question AI cooperation.

Let the games begin. โš”๏ธ