HeadlinesBriefing HeadlinesBriefing.com

Tiny World Model Generates Games On Pico 2W

Hacker News •
×

Using two small neural networks to generate and play games simultaneously on a Raspberry Pi Pico 2 W, this project demonstrates a memory-efficient approach to real-time game AI. The first network, a world model, predicts the next game frame and reward given the current frame and player action. The second network, an actor, selects actions based on generated frames.

The system employs a looped transformer architecture, reusing the same weights across multiple processing steps to minimize memory usage, making it feasible to run on a microcontroller. The world model and actor network are quantized to 8-bit integers, with the world model ranging from 26k to 131k parameters and the actor from 9k to 16k parameters. Each frame requires only 2 to 8 million multiply-adds for generation.

The pretrained actor can be swapped for a fresh reinforcement learning agent that learns from scratch on the device. Any button press hands control back to the user, allowing them to play the generated game dream directly. The repository includes several small games implemented in numpy, such as Breakout, Doom-lite, Flappy Bird, Pong, and Pac-Man lite, with varying parameter sizes and playability rates.

Users can run the real games in a terminal or watch the AI play its own dream. The project explores the potential of looped transformers for resource-constrained AI applications.

Source: Hacker News · Summarized by HeadlinesBriefing