Tip Of AI
Discover AI tools
nesformer is an experimental open source project that compiles the Nintendo Entertainment System 6502 CPU into the weights of a Qwen3.5 language model. Instead of training the model on game data, a compiler converts the CPU circuit into model weights so the model can generate the CPU execution log one token at a time. The project includes a host program that reads the generated log, handles controller input, sends frame interrupts, and draws the game screen. A check command compares model output with a reference 6502 emulator and stops when the first token differs. The project uses Python, NumPy, SciPy, numba, Pillow, and the Transformers library. It contains 466647616 parameters, but only 9340331 are nonzero. The compressed weights are about 3.3 MB and expand to approximately 933 MB. Testing on a four core computer without a GPU produced about 1719 tokens per second. Running 120 frames of Thwaite took 102 seconds, compared with about 2 seconds on a real NES. The project is limited to games using cartridges without mapper chips and requires Python 3.11 or later. It is released under the MIT license.