tinyworldformer: a tiny world model that generates games on a Raspberry Pi Pico 2 W
tinyworldformer is a project that runs a tiny world model[1] on a Raspberry Pi Pico 2 W, where two small neural networks generate and play a game at the same time. The world model predicts the next frame and reward from the current frame and action, while the action network chooses the next action by looking only at the screen the world model produces. The world model is an int8 looped transformer[2] that applies the same block's weights 1–4 times per frame, with 26,000–131,000 parameters per game and roughly 2M–8M MACs[3] per frame. Thanks to int8 quantization and a no_std Rust implementation, even the largest game, Pac-Man lite, fits in 600KB of flash and 460KB of SRAM; the same engine also runs in WebAssembly, and the Pico's own frame rate has not been measured.
Five games are supported — Breakout, Doom-lite, Flappy Bird, Pong and Pac-Man lite — and on the chip there are no real game rules: the NumPy implementations of those rules serve only to generate training data and check the model's predictions. On transitions held out of training, predicted frames match the real game exactly in 100% of frames for Flappy Bird, 99.99% for Breakout, 99.45% for Pong, 86.4% for Pac-Man lite and 83.6% for Doom-lite. Pressing a button hands control to a human, and instead of the pretrained action network a Stream AC(λ)[4] agent can be loaded and trained on the board from scratch, one transition at a time, without a replay buffer or batches. Because agents can exploit world model errors — one trained only in the generated environment scored 210 points there but 28 in the real game, where the maximum is 56 — generated frames are checked against the real rules and extra data is collected to patch the exploits.
Read the original github.comDiscussion on GeekNews
Discussion
Commenters ask what hardware the training used; the author says the world model was trained on an RTX 4060, while the playing agent trains on the Pico itself with stream-ac. Many find it notable that looped transformers were needed for mini-Doom but not for the simpler games. Asked whether one model covers all games, the author answers that each game has its own networks, though merging them into one model should be easy.
Sources
-
KRGeekNews KO
tinyworldformer - Raspberry Pi Pico 2 W에서 게임을 생성하는 초소형 월드 모델
-
github.com
A tiny world model running games on a Raspberry Pi Pico 2 W


