TAI BUI
Back to curriculum
BuildPython

RL for Games — AlphaZero, MuZero, and the LLM-Reasoning Era

1992: TD-Gammon beat human champions at backgammon with pure TD. 2016: AlphaGo beat Lee Sedol. 2017: AlphaZero mastered chess, shogi, and Go from scratch. 2024: DeepSeek-R1 showed the same recipe works on reasoning, with GRPO standing in for PPO. Every breakthrough in this phase got tested on a game first.

TIME: ~120 minutesPREREQUISITES: Phase 9 · 05 (DQN), Phase 9 · 08 (PPO), Phase 9 · 09 (RLHF), Phase 9 · 10 (MARL)

Learning Objectives

  • Explain the self-play + search + policy-improvement loop that AlphaZero, MuZero, and GRPO all share, and state what changes across the three: known rules and MCTS, learned latent dynamics, and no search at all.
  • Walk through AlphaZero's policy-value network, PUCT selection, and self-play loss, then explain how MuZero's learned dynamics model (h, g, f) removes the need for known rules.
  • Derive GRPO's group-relative advantage from a batch of sampled completions, and give the three DeepSeekMath reasons it replaces PPO's critic for reasoning tasks.
  • Trace DeepSeek-R1's four-stage pipeline from R1-Zero's raw GRPO run to the full cold-start-SFT-then-RL recipe, and explain why distilling a strong RL teacher beats training RL from scratch at a smaller model's scale.

The Problem

Games have everything RL wants. Clean reward (win or loss). Infinite episodes, since self-play just resets. Perfect simulation, because the game is the simulator. Discrete or small continuous action spaces. Multi-agent structure that forces adversarial robustness.

Games are also where every major RL breakthrough got tested first. TD-Gammon (backgammon, 1992). Atari-DQN (2013). AlphaGo (2016). AlphaZero (2017). OpenAI Five (Dota 2, 2019). AlphaStar (StarCraft II, 2019). MuZero (learned model, 2019). AlphaTensor (matrix multiplication, 2022). AlphaDev (sorting algorithms, 2023). DeepSeek-R1 (math reasoning, 2025), the newest proof that game-RL techniques carry over to text.

This capstone surveys three landmark architectures, AlphaZero, MuZero, and GRPO, through one lens: self-play + search + policy improvement. Each generalizes the one before it. GRPO in particular is AlphaZero's recipe applied to LLM reasoning, with tokens standing in for actions and mathematical verification standing in for the win signal.

Warm-up0/3
1. In a two-player zero-sum game such as chess, if one player wins and receives +1, what does the loser receive?Warm-up
A chessboard marked game over by checkmate, beside two player cards: Player 1 (White) won and gets reward +1, Player 2 (Black) lost and has reward shown as a question mark.
2. In policy-gradient methods, what is the main job of subtracting a baseline from the returns?Warm-up
The update rule (G_t minus b) times grad log pi with b named as the baseline, above four trajectories with returns 100, 104, 101 and 103, each with a blank slot for G minus b.
3. You take a list of numbers, subtract the list's mean, then divide by the list's standard deviation. What do the results have?Warm-up
Two lists, 1 to 5 and 100 to 500, each with its mean (3 and 300) and standard deviation (1.41 and 141.42), and the operation subtract the mean then divide by the standard deviation with unknown results.
Check: The Problem0/1
1. Which single lens does the lesson use to connect AlphaZero, MuZero, and GRPO?Explain
Three cards for AlphaZero (chess, shogi, Go; rules known; tree search), MuZero (Go, chess, shogi, Atari; rules not given; tree search) and GRPO (math, code, reasoning; an LLM; no tree search), under a bracket pointing to a blank box for what they share.

The Concept

AlphaZero ↔ MuZero ↔ GRPO: same loop, different environments

The unifying loop.

while True:
    trajectory = self_play(current_policy, search)     # play game against self
    policy_target = search.improved_policy(trajectory) # search improves raw policy
    policy_net.update(policy_target, value_target)     # supervised on search output

AlphaZero (2017). Silver et al. Given a game (chess, shogi, Go) with known rules:

  • Policy-value network: one tower f_θ(s) → (p, v). p is a prior over legal moves. v is the expected game outcome.
  • Monte Carlo Tree Search (MCTS): at each move, expand a tree of possible continuations, using (p, v) as the prior and the bootstrap. Select nodes by UCB (PUCT): a* = argmax Q(s, a) + c · p(a|s) · √N(s) / (1 + N(s, a)).
  • Self-play: play games agent-vs-agent. At move t, the MCTS visit distribution π_t becomes the policy training target.
  • Loss: L = (v - z)² - π · log p + c · ||θ||². z is the game outcome (+1 / 0 / -1).

Zero human knowledge. Zero handcrafted heuristics. One recipe that mastered chess, shogi, and Go after a few tens of millions of self-play games each.

MuZero (2019). Schrittwieser et al. Drops the requirement that the rules are known.

  • Instead of a fixed environment, learn a latent dynamics model (h, g, f):
    • h(s): encode observation to latent state.
    • g(s_latent, a): predict next latent state + reward.
    • f(s_latent): predict policy prior + value.
  • MCTS runs in the learned latent space. Same search, same training loop.
  • Works on Go, chess, shogi, and Atari too: one algorithm, no rule knowledge required.

Stochastic MuZero (2022). Adds stochastic dynamics and chance nodes, extending the recipe to backgammon-class games.

Muesli, Gumbel MuZero (2022-2024). Improve sample efficiency and deterministic search.

GRPO (2024-2025). The DeepSeek-R1 recipe. Same AlphaZero-shaped loop, applied to language-model reasoning:

  • "Game": answer a math, coding, or reasoning problem. "Win" means the verifier (a test case passes, a numerical answer matches) returns 1.

  • Policy: the LLM. Actions: tokens. State: prompt plus response-so-far.

  • No critic (no PPO-style V_φ). Instead, for each prompt, sample G completions from the policy and compute a reward for each. The group-relative advantage A_i = (r_i - mean_r) / std_r is the signal for a REINFORCE-style update.

  • A KL penalty to the reference policy prevents drift, the same way RLHF does.

  • Full loss:

    L_GRPO(θ) = -E_{q, {o_i}} [ (1/G) Σ_i A_i · log π_θ(o_i | q) ] + β · KL(π_θ || π_ref)

No reward model, no critic, no MCTS. A group-relative baseline replaces all three, and it matches or exceeds PPO-RLHF quality on reasoning benchmarks at a fraction of the compute.

The R1 recipe in full. DeepSeek-R1 (DeepSeek 2025) is really two models in one paper:

  • R1-Zero. Start from the DeepSeek-V3 base model with no SFT. Apply GRPO directly with two reward components: an accuracy reward (rule-based: did the final answer parse to the correct number, did the code pass unit tests) and a format reward (did the completion wrap its chain-of-thought in <think>…</think> tags). Over thousands of steps, average response length grows from roughly 100 to roughly 10,000 tokens while math benchmark scores climb to near-o1-preview levels. The model learns to reason from scratch. The catch: its chains of thought are often unreadable, mix languages, and have no stylistic polish.
  • R1. Fixes R1-Zero's readability problem with a four-stage pipeline:
    1. Cold-start SFT. Collect a few thousand long-CoT demonstrations with clean formatting and supervised-finetune the base model on them. This gives a readable starting point.
    2. Reasoning-oriented GRPO. Apply GRPO with the accuracy and format rewards, plus a language-consistency reward that stops the model from code-switching.
    3. Rejection sampling + SFT round 2. Sample around 600K reasoning trajectories from the RL checkpoint, keep only the ones with correct final answers and readable CoT, and combine those with about 200K non-reasoning SFT examples (writing, QA, self-cognition). Fine-tune the base again.
    4. Full-spectrum GRPO. One more RL round covering both reasoning (rule-based rewards) and general alignment (helpfulness and harmlessness preference-based rewards).

The result matches o1 on AIME and MATH-500 at open weights and is small enough to distill. The same paper also releases six distilled dense models (Qwen-1.5B through Llama-70B), trained by SFT on R1's reasoning traces with no RL at the student at all. Distillation from a strong RL teacher consistently beats RL from scratch at the student's scale.

Why GRPO instead of PPO for reasoning. The DeepSeekMath paper (Feb 2024) gives three reasons. First, there is no value network to train, which halves memory. Second, the group baseline naturally handles the sparse end-of-trajectory reward that reasoning tasks produce. Third, per-prompt normalization makes advantages comparable across problems of wildly different difficulty, something PPO's single critic can't do.

Search-free vs search-based. Games have split into two camps:

  • Perfect-information games with long horizons (Go, chess) are still search-based. AlphaZero and MuZero dominate.
  • LLM reasoning has no MCTS in production yet: GRPO runs on full rollouts, with best-of-N spending the inference compute instead. Process reward models (PRMs) hint that step-level search is on its way back.
Check: The Concept0/24
1. What is Monte Carlo Tree Search (MCTS) in AlphaZero?Define
A search tree from root s0 with 16 visits and three child moves a1, a2, a3 with network priors p of 0.5, 0.3 and 0.2 and visit counts 9, 4 and 2, and two grandchildren under a1 with visit counts 6 and 2.
2. What is AlphaZero?Define
A card for AlphaZero (Silver et al., 2017): games chess, shogi and Go, rules known, no human game data, no handcrafted heuristics, beside a diagram of a position s going into one network f theta that outputs p, a prior over legal moves, and v, an expected game outcome.
3. What is MuZero?Define
MuZero's three functions: h turns an observation o_t into latent state s0, g takes a latent state and an action to the next latent state s1 then s2, and f maps each latent state to a policy prior and value.
4. What is GRPO (Group Relative Policy Optimization)?Define
A prompt q: What is 7 + 5 with a verifier that checks for 12, a policy sampling four completions (12, 11, 12, 14) that get rewards 1, 0, 1, 0, and a box for a reference policy.
Illustrative prompt and samples.
5. What does PUCT do in AlphaZero's search?Define
The PUCT formula with c = 1 and parent visits N(s) = 16, above three child cards: a1 with Q 0.2, p 0.5, N 3; a2 with Q 0.4, p 0.3, N 12; a3 with Q 0.1, p 0.2, N 1, each with score unknown.
Illustrative values.
6. What is self-play?Define
A training log of three games: games 1 and 2 have network theta 7 playing both White and Black with results +1 and -1 for White, game 3 has network theta 7 as White against an earlier checkpoint theta 5 as Black.
7. What is league play?Define
A current agent being trained, next to an opponent pool of two frozen past agents v12 and v31 and two exploiters E1 and E2 trained to beat the current agent.
8. What is a verifier reward?Define
Four checks: a math answer of 42 against the expected 42 with reward 1, a math answer of 41 with reward 0, an add function returning a + b that passes both unit tests with reward 1, and one returning a * b that fails add(2, 3) with reward 0.
Test results come from running the functions.
9. What is a process reward (PRM)?Define
A four-step reasoning trace for solving 3x + 2 = 11 ending in the final answer 3, each of the four steps and the final answer with an empty dashed slot labelled score ?.
Illustrative trace.
10. Applying the game-RL recipe to reasoning, what does DeepSeek-R1 use in place of PPO?Define
Two cards: PPO-based RLHF with a policy network, a critic V phi, a reward model and a KL penalty, and DeepSeek-R1 (2025) on math and code reasoning with a reward from a checker, a KL penalty, and the update rule used instead of PPO shown as a question mark.
11. In AlphaZero's PUCT selection formula a* = argmax Q(s,a) + c·p(a|s)·√N(s)/(1+N(s,a)), what does the p(a|s) term come from?Define
The PUCT formula with the p(a|s) term outlined, above a node s with three child moves a1, a2, a3, each with a blank slot p(a|s) = ?, and a legend for N(s), N(s,a) and c.
12. What is AlphaZero's training loss?Define
One self-play training example: three moves with network priors 0.40, 0.40, 0.20, MCTS visit counts 8, 5, 3 and visit shares 0.5, 0.3125, 0.1875, plus network value v = 0.20 and game outcome z = +1, with the loss left as a question mark.
Illustrative numbers.
13. What two reward components does R1-Zero use?Define
DeepSeek-V3 base model going into GRPO applied directly with no SFT to give R1-Zero, a sample completion that works 3x + 2 = 11 and ends with final answer 3, and two blank slots for reward component 1 and reward component 2.
Illustrative completion, layout simplified.
14. What are the four stages of the full R1 pipeline?Define
Four boxes in order, Stage 1 to Stage 4, described only by data and rewards: a few thousand long-CoT demos; GRPO with accuracy, format and language-consistency rewards; about 600K kept trajectories plus about 200K non-reasoning examples to fine-tune the base again; one more RL round with rule-based reasoning rewards and preference-based helpfulness and harmlessness rewards.
15. What is the key structural difference the lesson gives between AlphaZero and MuZero?Explain
A comparison table of AlphaZero and MuZero listing paper (Silver et al. vs Schrittwieser et al.), year (2017 vs 2019), games, training data (self-play for both) and search (MCTS for both), with a final row for the key structural difference left blank.
16. How does GRPO compute the advantage for each sampled completion?Explain
A table for one prompt with G = 4 sampled completions: o_1 has reward 1, o_2 to o_4 have reward 0, and the advantage column is unknown.
17. Which of these is one of the DeepSeekMath reasons GRPO is preferred over PPO for reasoning tasks?Explain
Two cards, PPO and GRPO, each listing a policy network and a KL penalty to the reference policy, and each with an unknown slot for other trained networks.
18. What did DeepSeek find about distilling a strong RL teacher's reasoning traces into smaller models versus running RL directly on those smaller models?Explain
Route 1: an R1 teacher trained with RL passes reasoning traces to a small student trained by SFT with no RL, giving a score shown as a question mark. Route 2: the same small student trained with RL from scratch, also with a score question mark.
19. What do Stochastic MuZero, Muesli, and Gumbel MuZero add to MuZero?Explain
A timeline with MuZero (2019), Stochastic MuZero (2022), Muesli (2022-2024) and Gumbel MuZero (2022-2024), the last three each with a blank adds slot.
20. How does game and reasoning RL split between search-based and search-free methods?Explain
Three domain cards: Go and chess (perfect information, long horizon, rules known) and LLM math reasoning (actions are tokens, reward from a verifier, full-response rollouts), each with a blank slot for whether search is in use.
21. In PUCT, a child has Q(s,a) = 0.2, p(a|s) = 0.5, c = 1, the parent has N(s) = 16 and the child has N(s,a) = 3. What is its score?Apply
The PUCT formula above five boxes giving Q(s,a) = 0.2, p(a|s) = 0.5, c = 1, N(s) = 16 and N(s,a) = 3, and a blank box for the score.
22. You train an R1-Zero-style model: pure GRPO on a base model with no SFT. Over training, response length climbs from about 100 tokens toward 10,000 and math scores rise too, but the chain-of-thought reads like a jumble of two languages. Is this a sign the run is broken?Analyze
Two cards for an R1-Zero style run, response length rising from about 100 to about 10,000 tokens and math scores rising toward o1-preview level, above a sample chain of thought that mixes English and French.
The chain of thought is typed to show mixed languages.
23. You have a strong RL-trained reasoning model and a small compute budget, and you need a small model that reasons well. Which approach fits?Design
A strong RL-trained reasoning model labelled Teacher beside a small model with a small compute budget labelled Student, with the need for a small model that reasons well.
24. You want search-based RL on a game whose rules and simulator are not available, only observations. Which design fits?Design
An agent sending actions a_t to an environment whose rules and simulator are not available and receiving observations o_t and rewards r_t, with the goal of search-based RL that plans ahead with a tree search.

Build It

The code in code/main.py implements GRPO in miniature: a bandit with multiple groups of samples. The algorithm is the same one used on an LLM, just with a simpler policy and environment. It teaches the loss and the group-relative advantage, which is the real 2025 innovation.

Step 1: a tiny verifier environment

python
QUESTIONS = [
    {"prompt": "q1", "correct": 3},
    {"prompt": "q2", "correct": 1},
]
 
def verify(prompt_idx, answer_token):
    return 1.0 if answer_token == QUESTIONS[prompt_idx]["correct"] else 0.0

In real GRPO the verifier runs unit tests or checks math equality.

Step 2: policy: softmax over K answer tokens per prompt

python
def policy_probs(theta, p_idx):
    return softmax(theta[p_idx])

Equivalent to the final-layer output of an LLM conditioned on a prompt.

Step 3: group sampling and group-relative advantage

python
def grpo_step(theta, p_idx, G=8, beta=0.01, lr=0.1, rng=None):
    probs = policy_probs(theta, p_idx)
    samples = [sample(probs, rng) for _ in range(G)]
    rewards = [verify(p_idx, s) for s in samples]
    mean_r = sum(rewards) / G
    std_r = stddev(rewards) + 1e-8
    advs = [(r - mean_r) / std_r for r in rewards]
 
    for a, A in zip(samples, advs):
        grad = onehot(a) - probs
        for i in range(len(probs)):
            theta[p_idx][i] += lr * A * grad[i]
    # KL penalty: pull theta toward reference
    for i in range(len(probs)):
        theta[p_idx][i] -= beta * (theta[p_idx][i] - reference[p_idx][i])

The group-relative advantage is 2024's DeepSeek trick: no critic needed. The baseline is just the group mean, and normalization uses the group standard deviation.

Step 4: compare to REINFORCE baseline (value-free)

Same setup, same compute, but plain REINFORCE this time. GRPO converges faster and lands more stably.

Step 5: observe entropy and KL

Same diagnostics as RLHF: mean KL to reference, policy entropy, reward-over-time. Once these stabilize, training is done.

Check: Build It0/4
1. In the Build It code, what does verify(prompt_idx, answer_token) return?Apply
The Build It environment: QUESTIONS with q1 correct answer 3 and q2 correct answer 1, and the verify function, above three calls verify(0, 3), verify(0, 2) and verify(1, 1) with unknown results.
2. In grpo_step, all G = 8 sampled answers for a prompt are wrong, so every reward is 0.0. What advantage does each sample get?Apply
The mean, variance, std and advantage lines of grpo_step with G = 8, and a step where all eight rewards are 0.0 with advs unknown.
Lines as in main.py; the lesson snippet writes std_r = stddev(rewards) + 1e-8.
3. In grpo_step with G = 8, exactly one sample is correct (reward 1.0) and seven are wrong (reward 0.0). Which advantages result?Apply
The advantage line of grpo_step with G = 8 and rewards [1.0, 0.0 x7], above eight sample boxes o1 to o8, o1 with reward 1 and the rest 0, each with an unknown advantage slot.
4. In grpo_step the KL line runs theta[i] -= beta * (theta[i] - reference[i]). With theta[i] = 2.0, reference[i] = 1.0 and beta = 0.01, what is theta[i] afterwards, ignoring the gradient part?Apply
The KL line theta -= beta * (theta - reference) above a number line with the reference at 1.0 and theta[i] at 2.0, and beta = 0.01 with the new theta[i] shown as a question mark.
Line as in the lesson snippet; main.py pulls with beta * (probs - probs_ref) instead.

Pitfalls

  • Reward hacking via verifier gaming. GRPO inherits RLHF's risk. If the verifier is wrong or exploitable, the LLM finds the exploit, so robust verifiers (multiple test cases, formal proofs) matter.
  • Group size too small. Variance of the group baseline goes like 1/√G. Below G = 4 the advantage signal is noisy. The standard choice is G = 8 to 64.
  • Length bias. LLM completions of different lengths have different log-probabilities. Normalize by token count, use sequence-level log-prob, or truncate to a max length.
  • Pure self-play cycles. AlphaZero-style training can get stuck in dominance loops on general-sum games. Diverse opponent pools (league play, Lesson 10) mitigate it.
  • Search-policy mismatch. AlphaZero trains the policy to mimic search output. If the policy net is too small to represent the search's distribution, training stalls.
  • Compute floor. MuZero and AlphaZero need massive compute. A single ablation often runs hundreds of GPU-hours. Miniature demos exist (AlphaZero on Connect Four, for instance) for learning the shape of the algorithm.
  • Verifier coverage. Unit tests that pass for a buggy solution reinforce the bug. Design verifiers that catch edge cases.
Check: Pitfalls0/5
1. What is the recommended fix for the length-bias pitfall in GRPO?Explain
Two bars for completions of different length, A with 12 tokens and B with 120 tokens, each at log-prob -0.5 per token, so the sums of token log-probs are -6 for A and -60 for B.
Illustrative values.
2. Your GRPO run samples only G=2 completions per prompt, and the advantage signal is so noisy the policy barely moves. What does the lesson's pitfalls section say is going on?Analyze
All four outcomes of a group of two completions when each is right with probability 0.25: both wrong (56.2 percent, advantages 0 and 0), first right (18.8 percent, +1 and -1), second right (18.8 percent, -1 and +1), both right (6.2 percent, advantages 0 and 0).
Lesson main.py starts uniform over 4 answer tokens.
3. Your GRPO-trained coding model starts passing its unit-test verifier on every problem, but a manual review shows most 'solutions' just hardcode the expected output instead of solving the task. What does the lesson's pitfalls section say is happening?Analyze
A verifier with one unit test, assert solve(3) == 9, for the task square the input; a model solution def solve(x): return 9; and a training log with 200 of 200 problems passing and mean reward 1.0.
Task and tests are illustrative. The solution passes its test when run.
4. AlphaZero-style self-play on a general-sum game keeps cycling: the agent beats strategy A, then loses to an old strategy B, and repeats. What should change?Analyze
Four training iterations of a self-play agent: beats strategy A, loses to old strategy B, beats A, loses to old B, repeating.
5. MCTS with the network plays far stronger than the raw policy head alone, and training on the visit distribution stalls at a high loss. Which pitfall fits?Analyze
A schematic line chart of the policy loss on MCTS visit targets falling then flattening at a high value over training steps, beside two boxes: MCTS with the network plays far stronger, the raw policy head alone plays much weaker.
Curve is a schematic of the stem, not measured.

Use It

The 2026 game-RL landscape, by domain:

DomainDominant method
Two-player zero-sum board games (Go, chess, shogi)AlphaZero / MuZero / KataGo
Imperfect info card games (poker)CFR + deep learning (DeepStack, Libratus, Pluribus)
Atari / pixel gamesMuesli / MuZero / IMPALA-PPO
Large multiplayer strategy (Dota, StarCraft)PPO + self-play + league (OpenAI Five, AlphaStar)
LLM math/code reasoningGRPO (DeepSeek-R1, Qwen-RL, open replications)
LLM alignmentDPO / RLHF-PPO (not GRPO; verifier is preference not verifiable)
RoboticsPPO + DR (not game-RL, but uses same policy-gradient tools)
Combinatorial problemsAlphaZero variants (AlphaTensor, AlphaDev)

The recipe (self-play, search-augmented improvement, policy distillation) spans text, pixels, and physical control. GRPO is the youngest instance. More are coming.

Check: Use It0/2
1. Which method does the lesson's Use It table list as dominant for imperfect-information card games like poker?Define
Part of the lesson's Use It table with five domains: board games, imperfect info card games (poker), Atari and pixel games, large multiplayer strategy and LLM math or code reasoning, with the method for the poker row shown as a question mark.
2. You need an agent for heads-up poker, where each player's cards are hidden. Which design fits the lesson's guidance?Design
A heads-up poker table: you hold Ah Kd with 100 big blinds, the opponent's cards are hidden as ?? ?? with 100 big blinds, and a note that each player sees only their own cards.
Stack sizes are illustrative.

Ship It

Save as outputs/skill-game-rl-designer.md:

markdown
---
name: game-rl-designer
description: Design a game-RL or reasoning-RL training pipeline (AlphaZero / MuZero / GRPO) for a given domain.
version: 1.0.0
phase: 9
lesson: 12
tags: [rl, alphazero, muzero, grpo, self-play]
---
 
Given a target (perfect-info game / imperfect-info / Atari / LLM reasoning / combinatorial), output:
 
1. Environment fit. Known rules? Markov? Stochastic? Multi-agent? Informs AlphaZero vs MuZero vs GRPO.
2. Search strategy. MCTS (PUCT with learned prior), Gumbel-sampled, best-of-N, or none.
3. Self-play plan. Symmetric self-play / league / offline data / verifier-generated.
4. Target signal. Game outcome / verifier reward / preference / learned model. Include robustness plan.
5. Diagnostics. Win rate vs baseline, ELO curve, verifier pass rate, KL to reference.
 
Refuse AlphaZero on imperfect-info games (route to CFR). Refuse GRPO without a trusted verifier. Refuse any game-RL pipeline without a fixed baseline opponent set (self-play ELO is uncalibrated otherwise).
Check: Ship It0/1
1. What does the Ship It skill spec refuse to do regarding AlphaZero and imperfect-info games?Define
The Ship It skill spec file with its five output items listed and three Refuse lines whose endings are hidden: Refuse AlphaZero on, Refuse GRPO without, and Refuse any game-RL pipeline without.
Endings of the three Refuse lines are hidden.
Author's Note

The first time I read the GRPO paper I assumed "no critic" was marketing gloss. REINFORCE with a group-mean baseline is textbook variance reduction, and DeepSeek never claimed otherwise. What actually convinced me was building the bandit in code/main.py and watching group size change the outcome directly: at G = 2 the policy thrashes, at G = 8 it locks onto the right answer within a few hundred steps. GRPO isn't a new idea wearing a new name. It's an old idea, drop the critic and normalize within a group, that happens to be cheap and stable enough to run at the scale a frontier lab needs for RL on reasoning. That's also why it took until 2024 and not 2017 to matter: nobody needed to skip the critic on Go, since AlphaZero already got a value network almost for free out of self-play. LLM rollouts don't offer that shortcut.

Exercises

  1. Easy. Implement the GRPO bandit in code/main.py. Train on 2 prompts × 4 answer tokens each. Converge in < 1,000 updates with G=8.
  2. Medium. Plug in PPO (clipped) and vanilla REINFORCE. Compare sample efficiency and reward variance to GRPO on the same bandit.
  3. Hard. Extend to a length-2 "reasoning chain": the agent emits two tokens and the verifier rewards the pair. Measure how GRPO handles the credit assignment across two-step sequences. (Hint: compute group advantage per full sequence, propagate to both token positions.)

Key Terms

TermWhat people sayWhat it actually means
MCTS"Tree search with learned net"Monte Carlo Tree Search; UCB1/PUCT selection with learned (p, v) priors.
AlphaZero"Self-play + MCTS"Policy-value net trained to match MCTS visits and game outcome.
MuZero"Learned-model AlphaZero"Same loop but in latent space via learned dynamics.
GRPO"Critic-free PPO"Group Relative Policy Optimization; REINFORCE with group-mean baseline + KL.
PUCT"AlphaZero's UCB"Q + c · p · √N / (1 + N_a): balances value estimate with prior.
Self-play"Agent vs past self"Standard for zero-sum; symmetric training signal.
League play"Population-based self-play"Past + current + exploiters sampled as opponents.
Verifier reward"Verifiable RL"Reward comes from a deterministic checker (tests pass, answer matches).
Process reward"PRM"Scores each reasoning step, not just the final answer.

Further Reading

Code

Ships With