GemmaJev gives an agent fast judgment with a small model. The idea comes from Jev, TypeSafe’s System One model: instead of generating text, the model scores the few actions a game offers and returns a probability for each. GemmaJev builds that interface on Gemma 3 270M and plays two games from NanoJev, Doom and a maze. It is the companion code for my DevFest Surabaya 2026 talk.
How it works
- One sequence per candidate. Each possible action gets its own input: the game state, the question and that one answer. A small scoring head on Gemma’s last token gives one score per candidate, and softmax turns the scores into probabilities.
- Bounded answers. The model can only pick from the actions the code offers, so it cannot invent an action.
- Training with Tunix. A custom candidate loss plugs into Tunix’s supervised trainer, and every checkpoint is restored and checked for identical scores.
- The model judges, the code remembers. In the maze, Gemma picks the direction at each junction while ordinary code keeps the map, rules out walls and backtracks.
Results
| Validation | Before training | After training |
|---|---|---|
| Maze direction, 196 questions | 23.0% | 70.4% |
| Doom action, 201 questions | 39.3% | 90.0% |
Before training, the model gives the same answer to every question. After training, the agent reaches the exit in three 50×50 mazes in 226, 131 and 200 moves, and the Doom agent hits its target with one shot. On an M2 Max with MLX, one movement question takes about 35 ms.