TL;DR
- Tunix's agentic RL pipeline supports multi-turn, tool-using LLM agents on Cloud TPUs with modular components for environments, tools, agents, and trajectory collection
- Gemma 4 E2B trained with agentic GRPO reached 95% win rate on Plane Strike (a board game on a 6x6 grid) versus 9.4% out of the box, reducing average game length from 22 to 16 strikes
- The training approach uses asynchronous vllm rollouts, prefix caching, and token-level GSPO loss to handle variable-length multi-turn conversations efficiently
- Complete code is available on GitHub with configuration examples for training on v6e-8 single hosts
- Model
- Gemma 4 E2B in thinking mode
- Hardware
- Cloud TPU v6e-8
- Training steps
- 100
What happened
Google published a tutorial on Tunix, its framework for training LLM agents with reinforcement learning on Cloud TPUs. The post demonstrates multi-turn agentic reinforcement learning—where agents reason over partial observations, call tools, receive feedback, and adapt across multiple steps. Previous Tunix posts covered single-turn supervised fine-tuning and single-turn GRPO; this extends to realistic multi-turn agent scenarios.
The Plane Strike benchmark
The tutorial uses Plane Strike, a board game played on a 6×6 grid where a hidden 8-cell plane is placed in one of four orientations. Each turn, the agent observes the board (marked with . for untried cells, X for hits, O for misses), reasons through candidate placements, and calls a strike tool to target one cell. The game ends when all 8 plane cells are hit or after 23 strikes. Out of the box, Gemma 4 E2B won only 9.4% of held-out games, averaging 22.44 strikes. After 100 steps of agentic GRPO training with Tunix, the win rate reached 95% while the average game length dropped to approximately 16 strikes.
How the pipeline works
The tutorial breaks the agentic RL pipeline into four modular components: a task environment that subclasses BaseTaskEnv to implement PlaneStrikeEnv; tool and chat template definitions that declare Gemma 4's native tool schemas in the system prompt and handle tool calling within turns; a conversation agent that translates environment observations into model messages; and trajectory collection plus the GRPO learner that runs rollouts and optimization.
Gemma 4 tool schemas use native tokens like <|tool_call>call:strike{cell:"..."}<tool_call|> and <|tool_response>, allowing the model to pause and wait for tool responses before continuing. The framework includes a Gemma4ToolChatTemplateParser that appends tool declarations to the system prompt and renders tool messages as in-turn responses.
For efficiency on a single Cloud TPU v6e-8 host, the training configuration enables asynchronous rollouts via vllm-tpu and prefix caching to cache the growing multi-turn conversation history. The GRPO learner is configured with loss_algo="gspo-token", advantage_estimator="rloo", and exact_token_continuity=True to preserve token IDs across multi-turn rollouts without retokenization drift. The actor, reference model, and rollout workers share the 8 TPU chips.
python train_planestrike.py \
--run_dir runs/grpo_6x6_tool_thinking_100 \
--learning_rate 2e-6 \
--lr_end 2e-7Training dynamics and results
Over 100 training steps (8 boards with 8 games per step), the agent learned both reliable tool calling and spatial deduction. Tool calling compliance converged first: the tool call rate quickly reached approximately 100%, invalid actions dropped to nearly 0%, and repeated strikes fell from 0.55 to 0.15. The win rate climbed from approximately 0.20 on initial training rollouts (9.4% on held-out evaluation boards) to 0.95. The source notes that because all strikes in a game currently share a single trajectory-level reward, further improvements could be achieved with finer per-turn credit assignment.
What to do next
The complete code is available in the planestrike-gemma4-rl GitHub repository. Developers can reference the train_planestrike.py launch command and configuration to train their own agentic models. The Tunix documentation covers the abstractions for multi-turn, tool-using agentic RL, and the vllm-tpu integration handles asynchronous rollout generation on Cloud TPUs.
Source
Google Developers Bloghttps://developers.googleblog.com/multi-turn-agentic-reinforcement-learning-with-tunix-and-gemma-4-on-google-tpus/AI-assisted, verified against the source. This post was drafted with AI from the primary source linked above and checked automatically against it. For anything you depend on, read the original.
- #reinforcementlearning
- #llmagents
- #googletpu
- #gemma
- #tooluse