HeadlinesBriefing HeadlinesBriefing.com

NES CPU runs inside Qwen3.5 model via nesformer

Hacker News •
×

An NES CPU compiled into the weights of a stock Qwen3.5 model. The NES's 6502 CPU (the core of its 2A03 chip), its 2 KB of work RAM, and a cartridge's program ROM run inside a standard Qwen3_5For Causal LM checkpoint. Nobody trained these weights; a compiler computed every one.

When you play a game, the model predicts the CPU's execution log one token at a time. A small host program plays the rest of the console around it: it draws the picture, reads the controller, and fires the vblank interrupt. nesformer builds on Qwenputer by Divyansh Agrawal, which compiled a CHIP-8 and then a RISC‑V CPU into Qwen3.5‑4B. It reuses Qwenputer's compiler and its central trick: the model's Gated Delta Net state is the machine's memory.

Super Mario Bros. (World 1‑1) full game by Doug Fraker (title screen and first level)Every CPU token in these runs came from the model. For the bundled test games, every frame also matches a conventional 6502 emulator's output exactly (see How it was checked). Quick start includes folder layout, Python installation, and a simple command to run a ROM, generate frames, and save an animated GIF.

The first run spends about 20 seconds compiling the engine with numba; after that, each frame takes 1–6 seconds, so 600 frames (10 seconds of NES time) take roughly 25 minutes. The project works with NROM board games like Super Mario Bros., Donkey Kong, and Excitebike, and supports detailed controller scripts for precise button timing.

Source: Hacker News · Summarized by HeadlinesBriefing