NESFormer Compiles a Full NES 6502 CPU Into 1GB of Qwen3.5 Weights Without Training
Nobody trained NESFormer. A compiler computed the weights.
The project, released this week by Drew Breunig, packs the NES’s 6502 CPU (the heart of the 2A03 chip), 2KB of work RAM, and a game cartridge’s program ROM into a standard Qwen3.5 model checkpoint. The resulting file is roughly 1GB. When you run it, the model generates the CPU’s execution log one token at a time — one token per instruction — and a lightweight host program handles the rest: drawing frames, reading the controller, firing the vblank interrupt.
The Core Trick
The key is the model’s Gated DeltaNet state. Instead of serving as learned language priors, that state becomes the machine’s memory. The CPU registers, the stack, the 2KB work RAM — it all lives in what would otherwise be the model’s recurrent context. The compiler, borrowed from Divyansh Agrawal’s Qwenputer project, maps the 6502 instruction set to the transformer’s computation graph and writes the weights accordingly.
This is not a model that learned to simulate a CPU by watching emulator outputs. It is a CPU that was mechanically translated into the weight space of a transformer architecture. The distinction matters: the weights are correct by construction, not by approximation.
Verification
Breunig tested the output against a conventional 6502 emulator for the bundled test ROMs. Every frame matches exactly. The README includes SHA256 checksums on the weight files to confirm the download is intact.
The demo shows NESFormer running Super Mario Bros. World 1-1 start to finish. Every jump, every enemy, every block interaction computed inside the transformer.
Context
NESFormer builds directly on Qwenputer, which compiled a CHIP-8 virtual machine and then a RISC-V CPU into Qwen3.5-4B weights. NESFormer extends that to real hardware: the 6502 is a genuine CPU that shipped in 60 million units, not a toy instruction set. The step from CHIP-8 to 6502 closes most of the gap between academic demonstrations and actual computing history.
The DoomFormer project, also active this week, encodes an id Software game engine into integer neural network weights using a different architectural approach — exact integer arithmetic rather than floating-point transformer computation. The two projects arrive at the same destination from opposite directions.
NESFormer is MIT licensed and available on GitHub. Weights ship separately as a zip file alongside the Python package.