Most “AI plays a video game” projects have the AI watching the screen and pressing buttons. nesformer does something stranger: the game console itself is running inside the AI. There’s no screen-watching, no reinforcement learning agent, and no training run at all — the NES’s actual CPU has been compiled directly into the weight matrices of a stock large language model.
What it actually is
nesformer, built by Dan Breunig (GitHub: dbreunig), compiles an NES’s 6502 CPU, its 2KB of work RAM, and a cartridge’s program ROM into a Qwen3.5 checkpoint — specifically a Qwen3_5ForCausalLM model with 466.6 million parameters, of which only 9.3 million are nonzero. As the “game” runs, the model doesn’t predict next words — it predicts the CPU’s execution log, one token at a time. A small host program handles the parts that stay outside the model: it draws the resulting picture to screen, reads controller input, and fires the vertical-blank interrupt the NES expects on every frame.
No training. A compiler instead.
The critical detail that separates this from an AI-plays-games project: nobody trained these weights. A compiler — borrowed from a related project called Qwenputer — computed them directly. The trick that makes this possible is repurposing the model’s internal state as literal machine memory: nesformer uses the Gated DeltaNet architecture’s state matrix as the emulated console’s RAM, with each row of that state matrix functioning as one memory cell. The language model’s own recurrent state is the NES’s working memory, not a representation of it.
The lineage
nesformer builds on Qwenputer, a project by Divyansh Agrawal that first demonstrated this technique by compiling a CHIP-8 interpreter and a RISC-V core into a Qwen3.5-4B model. nesformer is the same idea pushed onto real, 8-bit console hardware — a leap from a simple fantasy-console target and a general-purpose RISC chip to an actual, specific, commercially released CPU with a cartridge-dependent program running on top of it.
Why this is worth paying attention to
This sits at an unusual intersection: retrocomputing, emulator design, and the internal mechanics of transformer-family language models, treated as a single engineering problem rather than three separate fields. It’s not useful as a way to actually play NES games — a real emulator is faster and simpler by every practical measure. What it demonstrates instead is that a modern LLM’s weight space and recurrent state are expressive enough to host a deterministic, cycle-accurate computation that has nothing to do with language, computed by a compiler rather than learned by example. That’s a different claim than “AI can play games,” and arguably a more interesting one for anyone thinking about what these architectures are actually capable of representing.
Related Reading
- nesformer — GitHub repository
- Someone Compiled a Neural Network Into a DOOM Map, Using Voodoo Dolls as Logic Gates — our coverage of another “the machine is the game” project
- Hackaday’s 2026 Retrocomputing Challenge: Open Call — our coverage of a related open call for retro-hardware projects
- Model Quantization: Getting Started — our tutorial on reducing a model’s footprint, a relevant adjacent technique