Infatoshi

Infatoshi / mafia

Public

Train an LLM to play Mafia via GRPO

15
1
100% credibility
Found Mar 18, 2026 at 18 stars -- GitGems finds repos before they trend. Get early access to the next one.
Sign Up Free
AI Analysis
Python
AI Summary

This repository provides a complete Python implementation for simulating Mafia games with language model AI agents, training the Mafia role to deceive via reinforcement learning, and visualizing training progress.

How It Works

1
🕵️ Discover AI Mafia

You find this fun project where smart computer players learn to play the classic game of Mafia, full of deception and detective work, just like family game nights.

2
📥 Get it ready

Download the simple files to your computer and prepare everything with easy steps so games can start right away.

3
🎮 Watch AI play

Kick off a game and see the AI villagers, doctor, detective, troll, and mafia chat, accuse, vote, and scheme through days and nights.

4
🔥 Thrilling deceptions unfold

Witness the mafia blending in, echoing the group, deflecting blame, and secretly eliminating threats to outsmart everyone.

5
👤 Jump in yourself

Choose a role like mafia or detective and chat live against the AI players, feeling the tension of every discussion and vote.

6
🚀 Train smarter mafia

Let it practice many games automatically to teach the mafia better tricks for winning without getting caught.

🏆 Unlock winning strategies

Review game logs and charts showing improved win rates, then use the sneaky tactics in your real-life Mafia games with friends.

Sign up to see the full architecture

5 more

Sign Up Free

Star Growth

See how this repo grew from 18 to 15 stars Sign Up Free
Repurpose This Repo

Repurpose is a Pro feature

Generate ready-to-use prompts for X threads, LinkedIn posts, blog posts, YouTube scripts, and more -- with full repo context baked in.

Unlock Repurpose
AI-Generated Review

What is mafia?

This GitHub mafia game implements a simulator for the social deduction game Mafia, where you train an LLM like Qwen2.5-7B to play as the deceptive Mafia against frozen town agents using GRPO reinforcement learning in Python with PyTorch and HuggingFace Transformers. Developers get a CLI to play games against the AI (including human mode), train models on a single GPU, evaluate win rates, and plot training curves--turning casual game nights into an RL experiment on deception. It's a github train ai model setup that spits out transcripts of AI learning to blend in, deflect suspicion, and manipulate votes.

Why is it gaining traction?

Unlike bloated RL frameworks, this github mafia bot runs one-file training loops with no extra deps beyond basics, fitting 8B models on H100s or local GPUs via Modal cloud. The hook is watching emergent behaviors: AI echoes group chat to build trust, targets threats at night, and occasionally slips up hilariously like self-accusing--pure entertainment plus a minimal GRPO example that beats baselines from 30% to 60% Mafia wins. For github train simulator fans, it's dead simple to fork and swap models.

Who should use this?

RLHF engineers prototyping group policy optimization on lightweight games; LLM researchers testing deception in multi-agent setups; indie game devs building smarter bots for Werewolf/Mafia apps. Perfect for teams doing github train llm from scratch who want quick wins without PPO complexity.

Verdict

Grab it for an educational dive into training deceptive AI--docs and CLI are polished, results reproducible--but with 15 stars and 1.0% credibility, treat as a proof-of-concept, not production-ready. Solid starting point to extend for your own mafia boss experiments.

(198 words)

Sign up to read the full AI review Sign Up Free

Similar repos coming soon.