NewsCrawler.org

An NES CPU, RAM and ROM compiled into the weights of a Qwen3.5 model

nesformer runs an NES's 6502[1] CPU — the core of its 2A03 chip — together with its 2 KB of work RAM and a cartridge's program ROM inside a standard Qwen3_5ForCausalLM checkpoint of about 1 GB. Nobody trained these weights: a compiler computed every one, reusing the approach of Qwenputer by Divyansh Agrawal, which compiled a CHIP-8 and then a RISC-V CPU into Qwen3.5-4B. When a game runs, the model predicts the CPU's execution log one token at a time, while a small host program draws the picture, reads the controller and fires the vblank[2] interrupt. The memory trick is that each Gated DeltaNet[3] head keeps a 128 × 128 state matrix: with the gate held open and a one-hot key, an update overwrites exactly one row and a one-hot query reads it back, so every row is a memory cell holding the cartridge, RAM and registers.

The reference CPU matches nestest's golden log for 3,348 instructions and the py65 emulator on 5.7 million instructions of game code, and every frame of the bundled test games matches a conventional 6502 emulator exactly. The default engine, compiled with numba, runs at about 1,650 tokens/s on one CPU core; the plain numpy engine does about 210 and stock transformers about 10, while a real NES would need about 700,000 tokens per second. A skip that fast-forwards past the idle loops where games wait for vblank cuts the token count by 2.6× to 4.2×, yet nesformer still runs 150–290× slower than the real console: 600 frames, or 10 seconds of NES time, take around 25 minutes. Most instructions take a single token, and real game code averages 1.1–1.3 tokens per instruction.

Only NROM[4] cartridges (iNES mapper 0) work — such as Super Mario Bros., Donkey Kong or Excitebike — because the model reads the ROM from a fixed 32 KB table and cannot yet follow the bank-switching chips, mappers like MMC1 or MMC3, that swap which part of the ROM the CPU sees. Unofficial opcodes emit HALT.

Read the original github.comDiscussion

Discussion

Commenters are struck that the CPU, RAM and ROM all live inside the weights, and several say the project illustrates how much more compute LLMs need than ordinary programs, given the 150–290× slowdown versus real hardware. One commenter says Opus 5.5 built the working weights and code with only two prompts, while another asks what the point is if digital logic can always be reduced to weights. Others float compiling a small VM with a shell and tools like sed and grep into model weights, and one wonders what stochastic decoding at temperature above zero would do to the games.

Sources

  • github.com

    Show HN: A working Nintendo in ~1GB of Qwen weights

    144 comments

  • KRGeekNews KO

    Show HN: 약 1GB의 Qwen 가중치 안에서 작동하는 Nintendo

    2 points1 comment

Published: First seen: Читать по-русски

Open as a page