Zing Forum

Reading

SanityGame: Training AI Agents to Avoid Hallucinations Through Gamification

A multiplayer hidden-state arcade game based on the May 2026 attractor basin research, where AI agents learn to avoid hallucinations through game mechanics. The project implements core strategies such as planning, pausing, evidence collection, and backtracking, providing an interactive experimental environment to understand the hallucination mechanisms of LLMs.

AI hallucinationLLM safetymulti-agent gameattractor basinmeta-cognitionreinforcement learningepistemic training
Published 2026-05-31 22:11Recent activity 2026-05-31 22:21Estimated read 7 min
SanityGame: Training AI Agents to Avoid Hallucinations Through Gamification
1

Section 01

SanityGame Overview: Game-Based Training for AI Hallucination Avoidance

SanityGame is a multi-agent hidden state arcade game based on May 2026 attractor basin research. It trains AI agents to avoid hallucinations through core strategies like planning, pausing (HALT), evidence collection, and backtracking. The project provides an interactive experimental environment to understand LLM hallucination mechanisms. Key keywords: AI hallucination, LLM safety, multi-agent game, attractor basin, meta-cognition, reinforcement learning, epistemic training.

2

Section 02

Background: The Challenge of AI Hallucination & Traditional Limitations

Large language models' hallucination is a core AI safety challenge. Traditional methods (fine-tuning, prompt engineering, post-processing) offer single-step interventions but struggle to fundamentally change model behavior. SanityGame takes a unique approach: turning hallucination avoidance training into a multi-agent game where agents actively learn via game behaviors instead of passive training.

3

Section 03

Core Scientific Hypothesis: Attractor Basins & Hallucination

The project's theoretical foundation comes from May 2026 attractor basin research, which states: LLM hallucinations occur because autoregressive generation commits to specific attractor basins in hidden state space; single-step interventions fail as models rebuild hallucination signals within 2-3 tokens. Key implications:

  1. Hallucinations are not random errors but inevitable in specific hidden state geometries.
  2. Single-step fixes are ineffective; multi-step interventions are needed.
  3. Prevention is better than treatment—agents need to identify and avoid dangerous regions before entering.
4

Section 04

Game Design: Translating Cognitive Science into Mechanics

SanityGame creates a "hidden state arcade" environment. Core game loop: Agents move in 2D space to collect evidence while avoiding "basin traps". Game state includes player state (position, confidence, uncertainty, basin distance, real distance), basin geometry (hidden dangerous areas), evidence points (rewards), and leaderboard (incentives). Four core strategies:

  1. Plan: Freeze 40 ticks to simulate future paths (reward +25, punishes blind action).
  2. HALT: Pause to check basin contours when near danger (reward +15, punishment -400 if trapped).
  3. Seek Evidence: Collect evidence for Bayesian updates (reward +100, reduces uncertainty).
  4. Backtrack: Restore to last checkpoint (reward +50, avoids -500 collapse penalty; +1 per tick survival).
5

Section 05

Technical Architecture & Agent Example

Service-side Architecture: server.js (Node.js game engine + WebSocket hub), index.html (human observation dashboard), game.js (deprecated single-agent version). Communication Protocol: Uses WebSocket for real-time interaction (register, action commands like Steer/Plan/Halt/Backtrack, state broadcast, observation requests). REST API endpoints: GET /api/leaderboard, GET /api/players, GET /api/state, POST /api/register. Agent Strategy Example: A Python client uses meta-cognitive indicators (confidence <0.15 → Plan; basin distance <0.3 → HALT; else Steer) to make actions.

6

Section 06

Research Significance & Application Prospects

Contributions to AI Safety:

  1. Quantify strategy effectiveness via leaderboards.
  2. Study multi-agent collaboration (evidence sharing).
  3. Explore emergent meta-cognition. Implications for LLM Training:
  4. Reinforcement learning + meta-cognitive rewards (reward planning/halt/evidence collection).
  5. Multi-step intervention training.
  6. Treat reasoning as hidden state space navigation. Potential Extensions: Dynamic basin geometry, social dimensions (evidence sharing/misleading), human-AI competition, real LLM integration.
7

Section 07

Limitations & Future Improvements

Current Limitations:

  1. Simplified basin model (highly simplified LLM hidden state space).
  2. Discrete action space (vs real LLM's continuous token distribution).
  3. Single focus (only hallucination avoidance, no other AI safety dimensions). Future Improvements:
  4. Continuous state space (smoother confidence/uncertainty).
  5. Multi-objective optimization (balance accuracy, efficiency, calibration).
  6. Real model integration (combine with actual LLM reasoning).