开发者展示了一种名为tinyworldformer的项目,实现了在Raspberry Pi Pico 2 W微控制器上实时生成并游玩Pac-Man、Doom-lite等小型游戏 1。该模型由两个神经网络组成:一个用于预测游戏下一帧(世界模型),另一个用于选择动作(智能体) 1。通过采用循环Transformer架构和int8量化技术,模型被压缩至足以在资源受限的硬件上运行 1。
硬件平台选用搭载RP2350芯片的Raspberry Pi Pico 2 W,并利用其浮点运算单元(FPU)支持计算 1。在架构方面,项目使用循环Transformer,单个块应用1至4次以平衡速度与精度 1。权重采用int8格式并配合量化感知训练(QAT),激活值也转为int8或uint8 1。具体性能指标显示,Pac-Man占用600 KB Flash和460 KB SRAM,而Breakout占用361 KB Flash和299 KB SRAM 1。
该项目还实现了板载在线强化学习功能,允许智能体在模型生成的“梦境”中从头开始学习策略 1。学习机制支持Stream AC(λ)算法,无需回放缓冲区即可在设备上实时运行 1。验证方法表明,在Doom-lite中,当循环次数为2次时,针对特定测试步的预测帧错误单元格数为0,相比1次循环有显著改善 1。此外,代码同时编译为no_std Rust固件和WebAssembly模块,具备多平台支持能力 1。
A developer has demonstrated a compact world model capable of running games on the resource-constrained Raspberry Pi Pico 2 W microcontroller. The system, part of the "tinyworldformer" project, relies on two small neural networks: a world model that predicts subsequent game frames and an agent that selects actions based on those predictions 1. By leveraging the floating-point unit within the RP2350 chip, the implementation supports real-time generation and gameplay for titles such as Pac-Man and Doom-lite 1.
The architecture employs looped Transformers, where a single block is applied one to four times to balance computational speed with prediction accuracy 1. To fit the models into the limited memory available on the hardware, weights are quantized to int8 format using Quantization Aware Training (QAT), while activation values are also converted to int8 or uint8 1. Performance metrics indicate that the Pac-Man model requires 600 KB of Flash and 460 KB of SRAM, whereas the Breakout model consumes 361 KB of Flash and 299 KB of SRAM 1. Validation tests in Doom-lite showed that increasing the loop count from one to two resulted in zero erroneous cells in predicted frames for specific test steps, marking a significant improvement over single-loop execution 1.
Beyond static inference, the project implements on-device online reinforcement learning using the Stream AC(λ) algorithm 1. This approach eliminates the need for a replay buffer, allowing the agent to learn strategies from scratch directly within the "dreams" generated by the world model on the device 1. The codebase is versatile, compiling simultaneously into no_std Rust firmware and WebAssembly modules 1.
评论
还没有评论,欢迎留下第一条。