TL;DR
Teaching AI to play video games strictly by looking at the screen and pressing keys—just like a human—is notoriously difficult because of split-second timing requirements and sparse "win/loss" feedback. This paper introduces APPRENTICE, a three-stage framework that uses simple, rule-based "cheat scripts" during training to act as both initial demonstrators and real-time driving instructors. The result? A compact 4B-parameter vision-language model (VLM) that crushes massive 397B+ models across nine fast-paced browser games, needing zero access to internal game code at test time.
What Problem Does This Paper Address?
Video games are the ultimate sandbox for embodied AI: visually dynamic, fast-paced, and unforgiving. Ideally, we want a generalist visual agent that takes raw screenshots and outputs native keyboard-and-mouse commands.
Right now, both standard training paths hit a wall:
- Offline Imitation Learning (cloning demonstrations): Getting clean training data is expensive because current giant VLMs are terrible at fast-paced games. Even with good data, 93% of gameplay is just passive waiting (doing nothing while running toward a gap), and verbose chain-of-thought reasoning drowns out the tiny, crucial action tokens (like
tap w). Worse, the moment the agent drifts into an unfamiliar situation at test time, errors compound and it crashes—a classic problem known as exposure bias. - Online Reinforcement Learning (trial and error): Letting the agent play and learn from final outcomes fails over long horizons. If you die at step 400 in Temple Run, which exact 50-millisecond frame at step 227 caused it? Terminal rewards are too sparse to tell.
Methods
The authors’ core realization is simple: during training, browser games expose their internal states (object coordinates, speeds) via APIs. You can easily write lightweight, heuristic scripts—programmatic experts—that play the game well. APPRENTICE uses these scripts across three stages (built on a Qwen3.5-4B base model):
- Data Synthesis: Programmatic experts play the games (paused every 50 ms) to generate high-success trajectories. Offline, a large VLM (Qwen3.5-397B-A17B) watches the recorded frames and annotates each step with a rationale and a concise goal.
- Action-Focused Supervised Fine-Tuning (SFT): To cold-start the agent without drowning out the actions:
- Action-First Prediction: The model is trained to output
<act>, then<rationale>, then<goal>. At test time, decoding stops right after</act>—giving the training benefits of reasoning with zero inference latency! - Intra-step Field Rebalancing (IFR): Instead of averaging loss across all tokens (where actions are just 1.4% of tokens), the loss weights the action, rationale, and goal fields equally.
- Temporal Step Reweighting: Passive "no-op" waiting steps are down-weighted exponentially the further they are from an active keypress, floored at a small minimum weight so the agent still learns when to wait.
- Expert-Guided On-Policy Learning: Now the agent takes the wheel in short rollouts. Whenever it visits a new state, the programmatic expert is queried in the background to provide dense, step-by-step feedback via two losses: On-Policy Imitation (nudge toward the expert's exact move) and Expert-Rewarded Policy Optimization (ERPO) (sample multiple candidate moves, score them against the expert, and do a group-relative RL update). Crucially, both are scaled by a simulation-based Step-Criticality Measure: the system simulates making a mistake at that exact frame to see how many steps of error the game tolerates before death. Unforgiving frames get massive learning weights; safe frames get relaxed supervision.
Datasets
The authors adopt the GameWorld benchmark environment, selecting 9 browser games spanning four genres (Pac-Man, Doodle Jump, Orchard Match-3, Chrome Dino, Cubefield, Edge Surf, NS-Shaft, Run 3, and Temple Run 2), with 5 tasks of increasing difficulty per game (45 tasks total). Using their programmatic experts, they synthesized a training dataset ($\mathcal{D}_E$) of 1,125 verified trajectories containing 598.7K annotated steps. Evaluation is conducted online using strictly disjoint random seeds.
Key Insights and Ideas
- Think after you act: Predicting the action before the rationale boosted success rates from 23.1% (action-only) and 33.1% (reason-first) up to 43.3% in SFT. Forcing the network's hidden representations to align with future explanations sharpens action grounding, and truncating generation at
</act>makes live gameplay fast. - Waiting near edges matters; waiting in open fields doesn't: Randomly dropping 93% of waiting steps ruins timing. Decaying their loss weight based on temporal distance to an active keypress outperformed random dropping by 31.4% in success rate—because the frames just before a jump teach crucial visual timing cues.
- Short-term memory is enough for physics: Ablating history length $K \in \{0, 1, 2, 4, 8\}$ revealed that $K=1$ (just one previous frame-action pair) is the sweet spot. One prior frame captures velocity and motion; 8 frames just bloat context and hurt accuracy.
- Not all mistakes are equal: Removing the simulation-based criticality weight ($\kappa_t$) dropped final success rates by 17.2%. Knowing when precision matters prevents the policy from overfitting to arbitrary expert habits in safe zones.
Key Results
Across 45 tasks in 9 games, the 4B-parameter APPRENTICE agent achieves an overall 57.8% Success Rate (SR), 81.3% Progress Rate (PR), and 75.6% Task Coverage (TC).
- It beats the strongest massive VLM baseline, Qwen3.5-397B-A17B (18.1% SR), by +39.7% SR, +38.6% PR, and +40.0% TC (and similarly trounces DeepSeek-V4.1-Flash, GLM-5.3, and Kimi-K2.6).
- On reflex-heavy games like Chrome Dino and Cubefield, where giant VLMs score $\le$ 5.0% SR, APPRENTICE hits 90.0% and 82.5% SR.
- Data synthesis with programmatic experts yielded a 93.0% rollout success rate (vs. 16.0% for a VLM agent) at 2.5$\times$ lower token cost.
- Qualitatively, in games like NS-Shaft, while the SFT-only model falls off conveyor belts passively onto spikes, the full on-policy trained agent mid-air steers onto safe ledges—recovering from states rarely seen in clean expert demos.
Limitations and Future Work
- Training requires internal game APIs: While the final agent plays purely from pixels and device states at test time, building the programmatic experts requires reading internal game memory during training. Future work could use code-generating LLMs to write these heuristic experts automatically.
- Deterministic experts limit creativity: Imitating rule-based scripts can narrow behavioral diversity (partially mitigated here via random seeds and relaxed weights on non-critical steps).
- Unseen games: Exploring zero-shot generalization to entirely new games outside the training suite remains an open next step.
Summary updated