NES emulator compiled into Qwen weights
Developer dbreunig packed a 6502 CPU into the weights of a Qwen3.5 model: a 933 megabyte file in which only 9.3 million parameters are nonzero.
In short
Yes, nesformer really runs an NES game, but the 6502 processor lives inside a 933 megabyte weight file in stock Qwen3.5 format rather than in executable code.
At a glance
- The file holds 466.6 million parameters in bf16 (933 MB); only 9.3 million are nonzero, compressing to 3.3 MB.
- Compiled in: a 6502 CPU with all 151 official opcodes, 2 KB of work RAM, 32 KB of PRG-ROM.
- Memory is the DeltaNet state: each head keeps a 128×128 matrix serving as RAM, registers and cartridge.
- Speed: about 1,650 tokens per second on one CPU core, 150–290× slower than real hardware in play.
- Limits: NROM cartridges only (iNES mapper 0), no sound, no bank-switching games.
Yes, nesformer really runs an NES game, but the 6502 processor lives inside a 933 megabyte weight file in stock Qwen3.5 format rather than in executable code. Developer dbreunig compiled the chip into model weights instead of writing an emulator loop, so each instruction is produced by inference. Of the file's 466.6 million parameters, only 9.3 million are nonzero, and the whole thing compresses to 3.3 MB.
What the weights actually contain
Per the repository, all 151 official 6502 opcodes sit in the weights together with 2 KB of work RAM, 32 KB of PRG-ROM, the flags, the stack, NMI handling, controllers and APU registers. Memory is not a separate array: every Gated DeltaNet head carries a 128×128 state matrix that doubles as RAM, registers and cartridge. The config lists seven DeltaNet layers plus one attention layer filled entirely with zeros, a hidden size of 768, 16 key heads and 32 value heads, and an MLP width of 9,216. The vocabulary is an unusual 263,808 entries, because tokens are what carry the CPU's state transitions.
A Python host program still handles everything outside the weights: the scanline renderer, palette work, the answers to I/O reads, and the injection of NMI timing.
Fast enough for a demo, not for a console
| Engine | Tokens per second |
|---|---|
| Default, compiled with numba | about 1,650 |
| NumPy | about 210 |
| Unmodified transformers | about 10 |
Real silicon pushes 60 frames per second, and that is where the gap shows: the author puts gameplay at 150–290× slower than hardware. A Thwaite test run produced 271 frames from 1.9 million tokens, while a Super Mario Bros run needed 2.6 million tokens for 420 frames. Detecting and skipping idle loops cuts the token count by 2.6–4.2×.
Where it stops working
The limitations are listed openly. Only NROM cartridges work, meaning iNES mapper 0, so anything relying on bank switching is out. Unofficial opcodes are missing, code has to execute from ROM, and interrupts arrive only through BRK and NMI. Sprite-0 hit and sprite overflow are approximations, no audio is synthesized, and mid-scanline PPU tricks are not modeled.
What is verified, and what is not
Three checks are documented. The reference CPU matches the nestest golden log across 3,348 instructions, the circuit's predictions were compared against the py65 emulator over 5.7 million instructions, and the free-running weights reproduce the same traces as the reference CPU. Running it takes Python 3.11 or newer plus NumPy, SciPy, numba and Pillow, with torch 2.6 and transformers 5.22 or later needed only for the Hugging Face engine. The project is MIT-licensed and builds on Qwenputer by Divyansh Agrawal.
One caveat on our side: exactly one independent source was readable for this piece, the repository itself. Every figure above is the author's own measurement, and we have seen no third-party reproduction of the 1,650 tokens per second. It also remains unresolved why the repository names a 4 billion parameter Qwen3.5 model as the base while the shipped file carries 466.6 million parameters; without a second source we read that label as architecture and config lineage rather than a parameter count.
FAQ
Does nesformer actually play games?
It does. The repository documents runs of 271 frames from Thwaite and 420 frames from Super Mario Bros, though gameplay is 150–290× slower than real hardware.
Which model does nesformer use?
A weight file in stock Qwen3.5 format with seven Gated DeltaNet layers and one all-zero attention layer, 466.6 million parameters in size, of which 9.3 million are nonzero.
Can it run any NES game?
No. Only NROM cartridges with iNES mapper 0 are supported, there is no sound, and bank-switching games will not load.