pi-mon choice model (0.8B, q4_0 GGUF)

This model plays Pokemon Red through pi-mon, on the CPU of a Raspberry Pi 5. It is a LoRA fine-tune of Qwen/Qwen3.5-0.8B, merged and quantized to q4_0 for llama.cpp.

The model does not see the screen and does not press buttons. At each decision point pi-mon describes the game in a few lines of text, and the model answers with one high-level choice and a short reason. pi-mon checks the choice, carries it out in the emulator, and reports what happened. How pi-mon works explains the loop.

Files

File Size SHA-256
pi-mon-choice-q4_0.gguf 501,452,384 bytes b42040a8e4e4ede7c0042764d675e8a87fdc38aaad036c9bdf8eea94aa633790

pi-mon fetch-model downloads this file and checks the hash. This is training round 12 (r12).

Prompt format

pi-mon writes the prompt. The current format is v7, and the model expects exactly that format. Other formats or hand-written prompts give poor answers. The system message is one fixed line:

You play Pokemon Red. Read the state and pick one choice. Answer as CHOICE: <choice> then REASON: <short reason>.

These two examples come from the r12 test set. An overworld decision:

MAP PEWTER_CITY 11,16 facing S
GOAL Defeat Brock (Boulder Badge) | route PEWTER_CITY>PEWTER_GYM
BADGES 0 | SCENE overworld
PARTY 1 Rattata L8 23/23 ; 2 Charmander L12 32/32
EXITS ROUTE_3 E ; ROUTE_2 S ; MUSEUM_1F 14,7 ; MUSEUM_1F 19,5 ; PEWTER_GYM 16,17 ; PEWTER_MART 23,17 ; PEWTER_NIDORAN_HOUSE 29,13 ; PEWTER_POKECENTER 13,25 ; PEWTER_SPEECH_HOUSE 7,29
NEAR SIGN 11,17 ; COOLTRAINER_F 8,15 ; SIGN 15,9 ; SIGN 14,25
CENTER visited | respawn PEWTER_CITY
LAST SWITCH 2 ; FIGHT 3 ; WALK 11,16

CHOICE: GO PEWTER_GYM 16,17
REASON: Heading to Pewter Gym 16,17.

A battle decision:

MAP PEWTER_GYM 4,2 facing N
GOAL Defeat Brock (Boulder Badge)
BADGES 0 | SCENE battle menu
PARTY 1 Charmeleon L17 44/49 ; 2 Rattata L12 30/30
ENEMY Geodude L12 69% trainer
MOVES 1 Scratch pp16 WEAK ~15% ; 2 Growl pp40 ; 3 Ember pp15 WEAK ~46% ; 4 Leer pp30
MATCH foe ROCK GROUND | 1* x.5 L17 ; 2 x.5 L12
LAST PRESS U U ; PRESS U U ; FIGHT 3

CHOICE: FIGHT 3
REASON: Charmeleon uses Ember on Geodude. Not very effective.

pi-mon serves the model with llama-server -c 4096, samples at temperature 0, turns thinking off (chat_template_kwargs: {"enable_thinking": false}), and passes a GBNF grammar with every request. The grammar allows only the choices that exist at that spot, so the answer always parses.

Results

All runs below are on Pokemon Red (UE) with pi-mon's harness: grammar, precheck, watchdog, and checkpoint reloads. No other model and no scripted player makes decisions during play. The harness answers only when no model answer passes the precheck in 4 tries, and then it walks in place or presses B. A "new game" starts from the save that pi-mon bootstrap makes: a scripted intro player names the player, picks Squirtle, and delivers Oak's Parcel. The evals start from the same point with each starter.

  • A full game on a Raspberry Pi 5. A run from a new game reached the Hall of Fame 21 h 44 min after it started, with Squirtle. The previous round, r11, played the first 6 h 20 min, up to Silph Co. r12 played the rest, through Giovanni, the last badges, Victory Road, and the Elite Four.
  • Fresh-start evals. r12 started a new game with each of the 3 starters. All 3 runs reached 8 badges: Charmander in 3,907 decisions, Bulbasaur in 3,949, and Squirtle in 5,184.
  • Late-game evals. From a save in front of the Elite Four, r12 reached the Hall of Fame in 403 decisions. From a save in Victory Road, it reached the Hall of Fame in 2,223 decisions.

Limitations

  • The model plays only through pi-mon. It knows pi-mon's choice vocabulary and prompt format, and nothing else.
  • It plays only Pokemon Red (UE). pi-mon checks the ROM's SHA-1 and refuses every other version.
  • It is slow by design. A game takes about a day of wall-clock time on a Pi 5.
  • It relies on the harness. Without the grammar, the precheck, and the watchdog's bans and reloads, it repeats failing choices.
  • It loses battles and sometimes loops in one place for hours. Victory Road and long dungeons are the hardest parts.
  • The reasons are short and sometimes wrong. They are training targets, not explanations of the model's computation.

Training

LoRA SFT on Qwen/Qwen3.5-0.8B, over 12 rounds. The r12 set has 40,000 training examples. Scripted players wrote the examples by playing the game in the same choice format. The training code and data are not released.

No game content

This repository holds model weights only. It includes no ROM, no game art, no sprites, no music, and no save states. pi-mon needs your own legally dumped Pokemon Red (UE) ROM and checks its SHA-1. pi-mon and this model are an unofficial fan project and are not affiliated with Nintendo, Game Freak, Creatures Inc., or The Pokemon Company.

License

Apache License 2.0, the license of the base model, Qwen3.5-0.8B by the Qwen team, Alibaba Cloud. pi-mon's code is MIT.

Downloads last month
66
GGUF
Model size
0.8B params
Architecture
qwen35
Hardware compatibility
Log In to add your hardware

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for campavao/pi-mon

Finetuned
(942)
this model