Alfaxad commited on
Commit
706f82a
·
verified ·
1 Parent(s): 55e2732

Update launch README diagrams

Browse files
Files changed (1) hide show
  1. README.md +35 -113
README.md CHANGED
@@ -16,6 +16,7 @@ pinned: false
16
 
17
  **Play the Space:** [build-small-hackathon/mafia](https://huggingface.co/spaces/build-small-hackathon/mafia)
18
  **Demo video:** [YouTube](https://youtu.be/aAsZYAHKZ9Q)
 
19
  **Model:** [mafia-gemma-4-12B-it](https://huggingface.co/build-small-hackathon/mafia-gemma-4-12B-it)
20
  **GGUF:** [mafia-gemma-4-12B-it-gguf](https://huggingface.co/build-small-hackathon/mafia-gemma-4-12B-it-gguf)
21
  **Dataset:** [mafia-dataset](https://huggingface.co/datasets/build-small-hackathon/mafia-dataset)
@@ -33,9 +34,9 @@ Social deduction is useful because the game forces language and action to meet.
33
 
34
  Time-to-Talk studies asynchronous group communication in Mafia and shows that when an agent speaks matters, not only what it says. The key idea we used is a non-player moderator with a scheduler and generator: the scheduler decides whether to wait or give the floor, and the generator produces a role-hidden cue for one speaker.
35
 
36
- ![Time-to-Talk performance figure](./blog_assets/time_to_talk_llm_performance.png)
37
 
38
- *Figure 1. Time-to-Talk reports model performance and communication dynamics in Mafia-style games. We used its scheduler-plus-generator pattern as the basis for our non-player moderator.*
39
 
40
  Mini-Mafia isolates smaller role-play skills such as detection, disclosure, and deception. One of its strongest lessons is uncomfortable but useful: larger raw models don't automatically win. A smaller model with the right protocol can outperform a stronger model in a poorly matched setup.
41
 
@@ -45,12 +46,20 @@ Mini-Mafia isolates smaller role-play skills such as detection, disclosure, and
45
 
46
  Bayesian Social Deduction and GRAIL make hidden-role tracking explicit through factor graphs, role counts, and belief propagation. That matters in Mafia because many losses come from impossible claims or votes that contradict public role evidence.
47
 
48
- ![Bayesian social deduction table](./blog_assets/bayesian_social_deduction_table.png)
49
 
50
- *Figure 3. Bayesian Social Deduction frames table state as structured hidden-role inference. Our agent keeps a role-count constraint layer for the same reason.*
51
 
52
  WOLF and Wolf-Enhance focus on Werewolf-style deception, suspicion, and social ledgers. ReVAC contributes a compact review loop: objective, evidence, risk, alternatives, and final action. Those ideas became the basis for our agent architecture.
53
 
 
 
 
 
 
 
 
 
54
  ## Mafia Gemma
55
 
56
  Mafia Gemma is a fine-tuned `gemma-4-12B-it` variant trained for Mafia play. The goal wasn't to make a general chat model. The goal was narrower: legal game actions, role-conditioned choices, claim tracking, deception-aware discussion, night actions, votes, and private/public information discipline.
@@ -65,50 +74,9 @@ The player agent architecture is **HOLY GRAIL**: **Hierarchical Objective-guided
65
 
66
  The name is literal. The agent starts from its role objective, updates structured ledgers, applies graph-style role constraints, considers evidence and risk, and only then emits a legal action or short public message. Mafia, Detective, Doctor, and Villager use the same architecture, but the role policy changes after assignment.
67
 
68
- ```mermaid
69
- flowchart LR
70
- subgraph Obs["Observation"]
71
- Pub["Public transcript\nclaims, votes, deaths"]
72
- Priv["Private role state\nteam, checks, protects"]
73
- Legal["Legal action space"]
74
- end
75
- subgraph Memory["Structured memory"]
76
- Ledger["Event ledger"]
77
- RoleGraph["GRAIL role-belief graph"]
78
- Social["WOLF social graph"]
79
- Profiles["Player profiles"]
80
- end
81
- subgraph Controller["HOLY GRAIL controller"]
82
- Revac["ReVAC review\nobjective, evidence, risk"]
83
- Constraints["Role-count constraints"]
84
- Signals["Suspicion and deception signals"]
85
- Judge["Public-evidence adjudicator"]
86
- Policy{"Role-adaptive policy"}
87
- Guard["Message and action guardrails"]
88
- end
89
- subgraph Out["Executor"]
90
- JSON["Legal JSON action"]
91
- Msg["Public message"]
92
- end
93
- Pub --> Ledger
94
- Priv --> Ledger
95
- Legal --> Revac
96
- Ledger --> RoleGraph
97
- Ledger --> Social
98
- Ledger --> Profiles
99
- Profiles --> Revac
100
- RoleGraph --> Constraints
101
- Social --> Signals
102
- Revac --> Judge
103
- Constraints --> Judge
104
- Signals --> Judge
105
- Judge --> Policy
106
- Policy --> Guard
107
- Guard --> JSON
108
- Guard --> Msg
109
- ```
110
-
111
- *Figure 4. HOLY GRAIL combines ReVAC-style private review, GRAIL-style role constraints, WOLF-style social/deception ledgers, and role-specific action policies.*
112
 
113
  The most important implementation decision was to make target actions architectural, not purely model-generated. Votes, Mafia kills, Detective checks, and Doctor saves are scored by the architecture and emitted as legal JSON. The model still writes language, but the controller prevents many failure modes: impossible claims, weak herd votes, leaking private information, and ignoring public Detective evidence.
114
 
@@ -116,21 +84,9 @@ The most important implementation decision was to make target actions architectu
116
 
117
  The moderator is not a player. It assigns roles, gates phases, controls floor timing, asks for actions, and keeps hidden information private. We use a Time-to-Talk scheduler-plus-generator pattern: the scheduler decides whether to wait or send, and the generator picks a living player and a neutral cue. In the live game, the moderator also accepts human messages and schedules them into the public discussion.
118
 
119
- ```mermaid
120
- sequenceDiagram
121
- participant T as Table state
122
- participant S as TTT scheduler
123
- participant G as Moderator generator
124
- participant P as Player or human
125
- T->>S: transcript, alive set, phase, floor history
126
- S-->>T: wait or send
127
- T->>G: if send, choose speaker and cue
128
- G->>P: private floor cue or action request
129
- P->>T: public message, vote, or night action
130
- T->>S: updated transcript
131
- ```
132
-
133
- *Figure 5. The non-player moderator keeps the game moving without becoming an eighth player.*
134
 
135
  ## What the benchmarks say
136
 
@@ -184,63 +140,29 @@ HOLY GRAIL made the largest difference for Mafia Gemma and GPT-5-mini. Claude Op
184
 
185
  The live Space uses a Gradio Server backend and a custom frontend adapted from an OpenGame-generated prototype. OpenGame gave us a fast path to cinematic state transitions, room setup, role reveal, table layout, voting, and endgame presentation. We then replaced the prototype backend with the Mafia engine, ZeroGPU model calls, private/public views, event logs, the Time-to-Talk moderator, and HOLY GRAIL agents.
186
 
187
- [OpenGame development video](./blog_assets/opengame_demo.mp4)
188
 
189
- *Figure 6. OpenGame helped bootstrap the visual direction. The final Space wires the generated interface to our own engine, agents, and ZeroGPU backend.*
190
 
191
  The game architecture follows one rule: the backend owns truth, the frontend owns presentation. The browser never receives hidden roles except the human player's own role and legal private results, such as a Detective investigation.
192
 
193
- ```mermaid
194
- flowchart LR
195
- subgraph Browser["Browser"]
196
- UI["Custom game UI\nonboarding, table, chat, vote, endgame"]
197
- Scene["Scene director\ntransitions, sounds, layout"]
198
- end
199
- subgraph Server["Gradio Server Space"]
200
- API["ASGI/API layer"]
201
- Session["Session state"]
202
- Views["Projected player view"]
203
- Engine["Authoritative Mafia engine"]
204
- Mod["Time-to-Talk moderator"]
205
- Agents["Six HOLY GRAIL agents"]
206
- end
207
- subgraph GPU["Hugging Face ZeroGPU"]
208
- PlayerModel["mafia-gemma-4-12B-it BF16"]
209
- ModeratorModel["base Gemma 4 12B BF16"]
210
- end
211
- UI --> API
212
- API --> Session
213
- Session --> Views
214
- Views --> UI
215
- Engine --> Views
216
- API --> Engine
217
- Engine --> Mod
218
- Engine --> Agents
219
- Mod --> ModeratorModel
220
- Agents --> PlayerModel
221
- PlayerModel --> Agents
222
- ModeratorModel --> Mod
223
- Engine --> Session
224
- UI --> Scene
225
- ```
226
-
227
- *Figure 7. The Space keeps hidden game state server-side, projects only legal views to the browser, and calls ZeroGPU for player and moderator reasoning.*
228
 
229
  During research and evaluation we used Modal for training and controlled full-game runs. The production Space uses ZeroGPU, but the same split remains: game loop, moderator, agents, model backend, logs, and metrics.
230
 
231
- ```mermaid
232
- flowchart LR
233
- Dataset["mafia-dataset"] --> Train["Modal SFT\nUnsloth LoRA, 1000 steps"]
234
- Train --> Merged["Merged BF16 model"]
235
- Train --> GGUF["Q8 GGUF export"]
236
- Merged --> Eval["Full-game harness"]
237
- GGUF --> Eval
238
- Eval --> Reports["Architecture and model reports"]
239
- Merged --> Space["HF Space ZeroGPU"]
240
- Space --> Human["1 human + 6 agents"]
241
- ```
242
-
243
- *Figure 8. Modal was used for fine-tuning and evaluation; Hugging Face ZeroGPU runs the public game.*
244
 
245
  ## What this means for AI-native games
246
 
 
16
 
17
  **Play the Space:** [build-small-hackathon/mafia](https://huggingface.co/spaces/build-small-hackathon/mafia)
18
  **Demo video:** [YouTube](https://youtu.be/aAsZYAHKZ9Q)
19
+ **Launch post:** [X / Twitter](https://x.com/alfxad/status/2066665429507137681?s=20)
20
  **Model:** [mafia-gemma-4-12B-it](https://huggingface.co/build-small-hackathon/mafia-gemma-4-12B-it)
21
  **GGUF:** [mafia-gemma-4-12B-it-gguf](https://huggingface.co/build-small-hackathon/mafia-gemma-4-12B-it-gguf)
22
  **Dataset:** [mafia-dataset](https://huggingface.co/datasets/build-small-hackathon/mafia-dataset)
 
34
 
35
  Time-to-Talk studies asynchronous group communication in Mafia and shows that when an agent speaks matters, not only what it says. The key idea we used is a non-player moderator with a scheduler and generator: the scheduler decides whether to wait or give the floor, and the generator produces a role-hidden cue for one speaker.
36
 
37
+ ![Time-to-Talk agent logic](./blog_assets/time_to_talk_agent_logic.png)
38
 
39
+ *Figure 1. Time-to-Talk's agent logic: a scheduler prompt decides whether to send or wait, and a generator prompt writes the message once the floor opens. We use the same scheduler-plus-generator pattern for our non-player moderator.*
40
 
41
  Mini-Mafia isolates smaller role-play skills such as detection, disclosure, and deception. One of its strongest lessons is uncomfortable but useful: larger raw models don't automatically win. A smaller model with the right protocol can outperform a stronger model in a poorly matched setup.
42
 
 
46
 
47
  Bayesian Social Deduction and GRAIL make hidden-role tracking explicit through factor graphs, role counts, and belief propagation. That matters in Mafia because many losses come from impossible claims or votes that contradict public role evidence.
48
 
49
+ ![GRAIL architecture overview](./blog_assets/grail_overview.png)
50
 
51
+ *Figure 3. GRAIL tracks hidden roles with a factor graph and uses inferred beliefs to guide action selection and message generation. HOLY GRAIL keeps this role-count constraint layer, then adds social/deception ledgers and role-specific policies.*
52
 
53
  WOLF and Wolf-Enhance focus on Werewolf-style deception, suspicion, and social ledgers. ReVAC contributes a compact review loop: objective, evidence, risk, alternatives, and final action. Those ideas became the basis for our agent architecture.
54
 
55
+ ![WOLF deception framework](./blog_assets/wolf_diagram.png)
56
+
57
+ *Figure 4. WOLF-style work treats social deduction as memory, statements, hidden roles, and win-condition pressure. We use that framing for suspicion, deception, and vote-pressure ledgers.*
58
+
59
+ ![Wolf-Enhance framework](./blog_assets/wolf_enhance_framework.png)
60
+
61
+ *Figure 5. Wolf-Enhance separates listener, thinker, and presenter behavior. This influenced the split between private review, action scoring, and public message generation in HOLY GRAIL.*
62
+
63
  ## Mafia Gemma
64
 
65
  Mafia Gemma is a fine-tuned `gemma-4-12B-it` variant trained for Mafia play. The goal wasn't to make a general chat model. The goal was narrower: legal game actions, role-conditioned choices, claim tracking, deception-aware discussion, night actions, votes, and private/public information discipline.
 
74
 
75
  The name is literal. The agent starts from its role objective, updates structured ledgers, applies graph-style role constraints, considers evidence and risk, and only then emits a legal action or short public message. Mafia, Detective, Doctor, and Villager use the same architecture, but the role policy changes after assignment.
76
 
77
+ ![HOLY GRAIL primary architecture diagram](./blog_assets/holy_grail_primary_architecture.png)
78
+
79
+ *Figure 6. HOLY GRAIL combines current observations, structured memory, ReVAC-style review, GRAIL-style role constraints, WOLF-style social/deception signals, role-adaptive policies, legal action scoring, and message guardrails.*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
  The most important implementation decision was to make target actions architectural, not purely model-generated. Votes, Mafia kills, Detective checks, and Doctor saves are scored by the architecture and emitted as legal JSON. The model still writes language, but the controller prevents many failure modes: impossible claims, weak herd votes, leaking private information, and ignoring public Detective evidence.
82
 
 
84
 
85
  The moderator is not a player. It assigns roles, gates phases, controls floor timing, asks for actions, and keeps hidden information private. We use a Time-to-Talk scheduler-plus-generator pattern: the scheduler decides whether to wait or send, and the generator picks a living player and a neutral cue. In the live game, the moderator also accepts human messages and schedules them into the public discussion.
86
 
87
+ ![Time-to-Talk moderator pipeline](./blog_assets/moderator_ttt_pipeline.png)
88
+
89
+ *Figure 7. The non-player moderator keeps the game moving without becoming an eighth player.*
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
  ## What the benchmarks say
92
 
 
140
 
141
  The live Space uses a Gradio Server backend and a custom frontend adapted from an OpenGame-generated prototype. OpenGame gave us a fast path to cinematic state transitions, room setup, role reveal, table layout, voting, and endgame presentation. We then replaced the prototype backend with the Mafia engine, ZeroGPU model calls, private/public views, event logs, the Time-to-Talk moderator, and HOLY GRAIL agents.
142
 
143
+ ![OpenGame generated demo still](./blog_assets/opengame_demo_still.png)
144
 
145
+ *Figure 8. A still from the OpenGame-generated demo process. OpenGame helped bootstrap the visual direction; the final Space wires the generated interface to our own engine, agents, and ZeroGPU backend.*
146
 
147
  The game architecture follows one rule: the backend owns truth, the frontend owns presentation. The browser never receives hidden roles except the human player's own role and legal private results, such as a Detective investigation.
148
 
149
+ ![Hugging Face Space runtime architecture](./blog_assets/hf_space_runtime_architecture.png)
150
+
151
+ *Figure 9. The Space keeps hidden game state server-side, projects only legal views to the browser, and calls ZeroGPU for player and moderator reasoning.*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
 
153
  During research and evaluation we used Modal for training and controlled full-game runs. The production Space uses ZeroGPU, but the same split remains: game loop, moderator, agents, model backend, logs, and metrics.
154
 
155
+ ![Modal fine-tuning pipeline](./blog_assets/modal_finetuning_pipeline.png)
156
+
157
+ *Figure 10. Fine-tuning pipeline for Mafia Gemma: canonical SFT data, Modal training, cached volumes, W&B tracking, evaluation, merged BF16 export, and Q8 GGUF export.*
158
+
159
+ ![Modal inference runtime](./blog_assets/modal_inference_runtime.png)
160
+
161
+ *Figure 11. Modal inference runtime used during evaluation: BF16 Mafia Gemma, base Gemma moderator, Q8 GGUF fallback, provider routing, secrets, caches, and response metrics.*
162
+
163
+ ![Full-game evaluation pipeline](./blog_assets/full_game_evaluation_pipeline.png)
164
+
165
+ *Figure 12. Full-game evaluation pipeline: scenarios and model providers feed the Mafia harness, Time-to-Talk moderator, agent architectures, legal validators, game statistics, raw games, summary CSVs, and markdown reports.*
 
 
166
 
167
  ## What this means for AI-native games
168