A 260,000-parameter transformer generates English on a stock Game Boy Color. Our contribution was making it 10.09× faster without changing a single generated character.
Game Boy ColorSharp SM83GBCassemblyretro computing
A byte-level transformer running on the Game Boy Color’s Sharp SM83 at 4.19 MHz. The original port is maddiedreese/gbc-transformer; our work is the optimisation stack on top of it.
476,200 frames down to 47,200 for 16 generated tokens — 10.09× — with byte-identical output, cross-verified on two independent emulators.
None. Not a slow one — none at all. Every multiply is a routine.
The largest single win came from an assembly kernel that repurposes the stack pointer as a data pointer, so pop bc fetches two bytes per instruction. Interrupts are disabled around it, because the stack pointer is not where the hardware expects it to be. That is also the part of this project most likely to behave differently on a real console with a live display controller, and it has not been tested on one.
An earlier version of our writeup reported ternary weights as 53.6% faster than int8 on the Game Boy. That figure was an N64 measurement that had been misattributed. No Game Boy ternary kernel was ever built, so there is no Game Boy ternary speed measurement at all.
The 10.09× above is an int8-to-int8 optimisation stack and is unaffected. We found the error by trying to reproduce our own number and discovering there was nothing to reproduce.
github.com/Scottcjn/gbc-transformer The full measurements
Part of a five-console series from Elyan Labs. See also: NES · Sega Genesis · Super Nintendo · Nintendo 64 · Game Boy Color · the full measurements, including the conclusions we had to retract.