NES Emulator Runs Inside AI Model Weights
Researchers demonstrate a novel technique where a Nintendo Entertainment System emulator is encoded directly into neural network weights, allowing the AI model
A developer has successfully embedded a working Nintendo Entertainment System CPU emulator directly into the weights of a language model, enabling NES games to run through inference alone.
Drew Breunig’s nesformer project builds on earlier work by Divyansh Agrawal, who demonstrated that transformer models could learn to emulate simpler processors. Breunig extended this concept to the NES’s 6502 CPU, using Qwen3.5-4B as the base model. The result allows classic games like Super Mario Bros to execute inside a language model, though performance remains far below the console’s original 1.79 MHz clock speed.
Training Approach
According to a Hacker News comment, Breunig relied on Claude Opus to design and implement the system. The initial prompt directed Opus to read Agrawal’s qwenputer article at https://divagr.com/blog/qwenputer and explore whether the same technique could emulate the NES hardware stack, including both the 6502 chip and RAM. The prompt specifically asked about model size requirements and whether smaller, faster models could approach the NES’s standard clock speed.
A follow-up prompt committed to building the emulator “just for fun,” accepting that speed would be limited. The goal was producing weights and a command-line interface capable of loading ROM files. Opus reportedly discovered and incorporated a collection of conformance tests for the NES CPU that Christopher Pow released 15 years ago, ensuring the emulated processor behaved correctly across edge cases.
Notable Results
The project demonstrates that transformer models can internalize the complete instruction set and state management of a relatively complex 8-bit processor. By encoding CPU behavior in model weights rather than traditional code, nesformer represents an unusual intersection of neural networks and systems emulation.
Users can point the CLI at NES ROM files and watch games execute through inference passes. Each CPU cycle translates to forward passes through the model, with the weights effectively serving as a learned lookup table for processor operations, memory access patterns, and timing behavior.
Running Locally
The project uses Qwen3.5-4B, a 4-billion parameter model small enough to run on consumer hardware with sufficient RAM. Developers can access the weights and CLI through the dbreunig/nesformer repository, though specific installation instructions depend on the implementation details Breunig chose.
The CLI accepts ROM files as input, allowing any legally obtained NES game to run through the model. Performance remains the primary constraint - inference overhead means games execute orders of magnitude slower than on original hardware or traditional emulators.
Trade-offs
Embedding an emulator in model weights trades efficiency for novelty. Traditional NES emulators execute millions of instructions per second on modest hardware, while nesformer’s inference-based approach introduces substantial overhead for each CPU cycle. This makes the project impractical for actual gameplay but valuable as a proof of concept.
The approach also highlights an emerging pattern in AI research: using large language models as general-purpose computation substrates. While inefficient compared to purpose-built software, these experiments reveal the flexibility of transformer architectures and their ability to learn complex deterministic systems from examples.
The conformance tests Opus identified proved critical for correctness. Emulating a CPU requires precise behavior across thousands of instructions and addressing modes - any deviation breaks compatibility with existing software. By incorporating established test suites, the project ensured the learned emulator matched real hardware behavior rather than approximating it.
Source: simonwillison.net
Related Tips
Updating llm-anthropic for Anthropic SDK 1.0.0
This guide explains how to update the llm-anthropic plugin to work with version 1.0.0 of the Anthropic SDK, covering breaking changes and migration steps for
Prompt Caching: Reuse Context, Cut LLM Costs 90%
Prompt caching reduces LLM API costs by up to 90% by storing and reusing repeated context across multiple requests, eliminating redundant processing and
AI "Vibe Coding" Transforms Game Development in 2026
Game developers in 2026 are using AI vibe coding tools that transform natural language descriptions and creative prompts into functional game code,