← TinyGPT · docs · devlog · roadmap · speedup
source: docs/prds/game-rl-environment-poc.md · view on GitHub ↗

Game-as-RL-environment PoC

Makes actionable the parked blueprint in docs/learn/rl-multi-agent-roadmap.md. Trigger condition is now met: the distillation thread closed and a from-scratch MLX GRPO loop exists and is validated (GSM8K + tool-calling — see tool-calling-frontier-parity.md §5).

Why now (and why this, not more single-turn RL)

Goal (PoC scope — deliberately one behavior)

Show one distilled small model, as one NPC’s brain, measurably improve at one in-game behavior via GRPO, trained entirely on the Mac.

RL ingredientIn the PoC
Policya distilled small local model (the cost-compression lever), LoRA
Environmentthe game world (one scenario)
Rewarda measurable in-game outcome (goal reached / interaction won) — clean ⇒ RLVR

Design

  1. Trajectory recorder (game side): log per turn (observation → action → outcome → reward). This is the roadmap’s “B22 recorder.” Define the observation serialization + the reward signal for the one chosen behavior.
  2. Reward = a verifiable in-game outcome (binary or graded), so it’s RLVR — the tractable kind. Avoid LLM-judge rewards for the PoC.
  3. GRPO trainer: reuse the validated loop (group-normalized advantage, KL-to-ref, grad-accumulation — the same structure as our tool-calling GRPO). Generalize it to take an (env.reset, env.step, reward) interface instead of the BFCL prompt set. Skeleton: scripts/archive/game_rl_poc.py (this PR).
  4. Loop: sample K rollouts of the NPC acting in the scenario → reward each → group-normalize → policy-gradient on the LoRA → repeat. Watch the behavior’s success rate trend up.

Acceptance criteria

Risks / notes

Relationship to the other PRs