TL;DR QwenGameBoy is a playful experiment. Building on Divyansh Agrawal's Qwenputer, I compiled the Game Boy's SM83 processor into 176 neural-network layers and put them in one routed model file beside an unchanged Qwen3.5-0.8B. In a guided task, Qwen chose the buttons that walked the player one tile to the right. Those layers also ran Pokémon Red from the cartridge's entry point to the title screen and, in a separate run, played a complete rival battle turn checked against SameBoy. Two copies of the model file also exchanged bytes over a link cable.
It is very slow, and speed isn't the point. I wanted to see how much of the machinery we usually build around a model could live inside its weights. The processor now lives there; Python still draws the screen and handles timers, input and the cable.
Qwen moves the player
I asked Qwen to walk one step to the right in Pokémon Red. It read the screen as text and returned six RIGHT actions, choosing how many frames to hold each one. The compiled processor ran 478,581 checked instructions across 32 frames, and the player moved from x = 3 to x = 4.

This is the language model and the compiled processor working together: Qwen makes a choice, the processor runs it, and the next screen goes back to Qwen. The earlier small-program example is in the appendix.
A processor inside the model file
Qwenputer showed how to compile a working processor into transformer layers. I wanted to push that idea to Game Boy workloads. The Game Boy's processor, the SM83, becomes 176 layers. A compiler calculates their weights directly from a description of the chip. Arithmetic in those layers implements logic, and tables of numbers hold memory.
The model file contains both that processor and unchanged Qwen3.5-0.8B. A custom loader routes work to the appropriate layers. Qwen handles language; the compiled processor executes the game. Python draws the screen, handles timers and relays the cable. In the movement run above, Qwen reads the screen as text and chooses buttons. The appendix records the setup.
The five steps in words
- Qwen reads the screen as text and writes
{"buttons": ["RIGHT"], "frames": 1}. - The runner checks the reply, sets the Game Boy's button input to RIGHT (the value
$EE) and wakes the processor. - The compiled CPU runs the program's instructions, each one a short burst of tokens, and writes the data for the screen.
- The runner draws the frame from that data.
- The runner boils the frame down to 18 lines of digits, and that text goes back to Qwen.
merged.py; green = the runner (Python). The dot shows order, not timing.Title screen and a rival battle
The compiled processor ran Pokémon Red from the cartridge entry point to this title screen.
A separate run, starting from a prepared battle state, played a complete turn of the first rival battle: 1,272 frames and 13,520,814 instructions checked against SameBoy.
That comparison caught a sound-register bug in the surrounding hardware code. After fixing it, the whole battle turn matched. It was a useful test of whether the compiled processor could handle the game, and of whether I had built the rest of the console correctly.

Two model files talk over a link cable
I loaded the combined model file twice and connected the two Game Boy processors through the link cable interface. One side sent $5A and the other sent $3C. After eight clock edges, each had received and stored the other's byte. All 788 instructions were checked against an independent processor.

The coloured bits show where each byte came from. The processors execute the transfer code in their compiled layers; Python relays the cable signals between them.
Linking two games with compiled processors
The next run connected two compiled processors running Pokémon Red from prepared saves. They exchanged 36 bytes each and entered the Trade Center. Here is that link session, followed by the trade and evolution sequence in the reference emulator.*

*The compiled pair ran 21.8 million checked instructions in total. The rest of this clip continues in the reference emulator, not the compiled layers: the full compiled replay was left unfinished because of compute time. Recording details.
How slow it is
The Qwen-controlled walk took about 116 minutes. Qwen's six decisions add up to about 15 seconds of that run. A real Game Boy draws about 60 frames a second. Even with exact results cached and reused, running the processor this way is expensive.
A GPU was not an automatic fix. In a separate, single-frame homebrew comparison on an AWS g6.xlarge, the NVIDIA L4 took 197 seconds and the same machine's AMD EPYC CPU took 19 seconds. Both executed the standalone compiled processor and checked its output; neither was running the Qwen gameplay loop.
The same homebrew frame on the CPU and GPU of one AWS g6.xlarge. Execution time includes checking; setup is excluded. The scale is logarithmic.
These are measurements of an experimental implementation, not a limit on future GPU versions. Setup, timing scope and runtime details are in the appendix.
What I take from this
I built this to see how far a model file can be stretched. A Game Boy processor now runs as layers beside Qwen, and I can check its output instruction by instruction against the hardware behaviour I expect.
We usually give a model tools by building a harness around it. Here, one of those tools sits in the weights, while Python still handles the screen, timers, input and cable. I want to keep exploring which parts belong in the model file and which belong in the harness, and I'd like to hear where you would draw that line.
Appendix
Implementation details, supporting tests and the provenance of the animations.
Implementation and checks
The combined file holds unchanged Qwen3.5-0.8B weights and a separately compiled SM83 processor. A custom loader routes language tokens to Qwen and CPU tokens to the compiled layers. Python handles the display, timers, buttons and cable. The cartridge is loaded into the processor's memory; it is not part of Qwen's learned weights.
The runtime can reuse exact cached results of the compiled layers, so not every instruction needs a fresh pass through them. The title run uses no button input; the battle uses scripted input. The Qwen-controlled Pokémon movement run starts from a prepared bedroom state and records six model decisions, 32 frames and 478,581 checked instructions. The battle run is separate: its 1,272 frames and 13,520,814 instructions were checked against SameBoy. The title run starts at cartridge entry, skipping the console boot program, and establishes the final title frame, not every intermediate frame. The repository's verification guide records the checks and their scope.
The earlier fixed-button movement run
This separate prepared-state run held RIGHT for eight frames and then released it for eighteen. It took 79 minutes. Qwen was loaded but did not choose the inputs.

The earlier small-program button test
Qwen presses a button
The whole loop, with Qwen choosing the button, has run on a 58-byte test program written for the project. The program waits for a button, then draws one striped 8 × 8 block, one cell further right if the button was RIGHT. Qwen was given the blank screen as 18 lines of digits and the task press only RIGHT for one frame
, and it answered RIGHT. The runner pressed the button, the compiled processor ran 2,991 instructions, and the new frame went back to Qwen as text. Its first line reads 01000000000000000000: the block, in the second cell.

This is a guided test: Qwen was told which button to press. The point was to follow its choice through the compiled processor to the screen and back. At every check, Qwen's output was identical to the unmodified model's. This earlier test is separate from the later Qwen-controlled Pokémon movement run shown above.
An earlier recorded battle frame
The sound-register bug the battle run found
The strict comparison found a real fault on its first run, which stopped at frame 398: the game had read a sound register, and the runner handed back the last byte written to it, where a real Game Boy answers with ones in the bits that cannot be read. The compiled arithmetic was right and the hardware model around it was wrong. With the fix, the run completed the whole turn.
Benchmark details and remaining work
The GPU comparison
One original homebrew frame on the same AWS g6.xlarge host (NVIDIA L4 GPU, AMD EPYC CPU): 2,985 checked instructions and 23,040 matching pixels. This standalone-processor comparison is separate from the combined Qwen/gameplay runs.
| Backend | Setup | Execution |
|---|---|---|
| NVIDIA L4 GPU prototype | 35.768 s | 197.119 s |
| AMD EPYC CPU | 8.348 s | 19.210 s |
One frame per backend, including independent checking; setup is separate. These are not frame-rate estimates or a repeated variance study. The GPU prototype was not integrated into full-memory cartridges or the merged Qwen run. Runtime optimizations reuse exact numeric results where valid; the performance notes explain the machinery.
What it does not do yet
The console's own boot program, full sound output, other cartridges and anything near real-time speed are still open. Rendering, timers, input and the cable remain host code around the compiled processor.
About the animations
All GIFs are retimed. The Qwen-controlled Pokémon animation uses its own recorded frames and model responses; it is separate from the earlier scripted step GIF. No independent pixel-by-pixel comparison is asserted for the Qwen-controlled run. The fixed-button step in Appendix A shows recorded output. The battle clip uses emulator replay frames with fingerprints matching the compiled run. The adjacent grids explain processor state; their highlighting is illustrative, not recorded layer activity. The appendix button-choice GIF shows the earlier small test program; the cable GIF shows the actual byte exchange, separate from the Pokémon trade animation.
The trade animation combines two sources. Its blue section reconstructs the first 1,040 compiled frames per machine using matching reference-frame fingerprints (981 matches for A and 1,000 for B; intervening unmatched frames hold the previous picture). The amber section continues through the trade and evolution in the reference emulator. The retained compiled report covers 21,828,289 checked instructions in total, 36 bytes each way and entry to the Trade Center, not the later exchange. The unmatched images are not presented as verified output; their cause was not established. Those compiled processors ran on an Apple M5 MacBook Pro CPU, not the GPU, from prepared saves with scripted buttons. No Qwen decisions are claimed for this run. The independent combined-file byte exchange is the separate cable animation above.
Sources & credits
Built on Divyansh Agrawal's Qwenputer and its MIT-licensed compiler machinery. Qwen3.5-0.8B weights are unchanged and licensed under Apache-2.0. Implementation and reproduction instructions are in the QwenGameBoy repository.
Research & trademark notice
This independent project is presented for research and educational discussion. Game Boy, Pokémon, Qwen and related names, logos and game imagery belong to their respective rights holders. Their use here identifies the games and technologies discussed; it does not imply affiliation, sponsorship or endorsement by Nintendo, The Pokémon Company, Game Freak or the Qwen team. The repository's code licence does not grant rights to third-party games, assets, trademarks or model weights.
The cover is an illustration; the gameplay images are identified above. This article was developed with Claude Opus, Claude Fable and Codex.