World model runs and plays games on Raspberry Pi Pico 2W

Original: A tiny world model running games on a Raspberry Pi Pico 2 W

Why This Matters

Shows ML inference and RL training are reaching sub-$10 embedded hardware.

Developer SheepSeb built two small neural networks that generate and play games entirely on a Raspberry Pi Pico 2W microcontroller, using looped transformers to keep memory usage low enough for embedded hardware.

A GitHub project called tinyworldformer demonstrates that world models — neural networks that predict future game states — can run on cheap microcontrollers. The setup uses two networks: one generates the next frame and reward given a current frame and action (the world model), while a second network picks actions based on those generated frames (the actor). Both run on a Raspberry Pi Pico 2W, a board that costs a few dollars and includes a floating-point unit.

The key trick is looped transformers: rather than stacking multiple distinct transformer layers, a single block is applied repeatedly with shared weights. This cuts memory footprint sharply without entirely sacrificing model capacity. The developer wrote the target games in NumPy first, which allowed frame-by-frame verification of what the world model was generating versus ground truth.

A streaming reinforcement learning agent was later added, letting the board learn to play inside its own generated dream environment — no external compute required. The project is written in Rust and Python, with quantization applied to make inference viable on constrained hardware. It has attracted 159 stars on GitHub since posting.

Source

github.com — Read original →