EXPERIMENT REPORT / REINFORCEMENT LEARNING · OCT–DEC 2025
Can curiosity make
a better agent?
PPO vs. PPO+RND on pixel-based Minesweeper (6×6 board, 6 mines), with invalid-action masking and shaped rewards.
- PPO+RND win rate at ~100k steps
- 5.0%
- Plain PPO’s best, at ~800k steps
- 3.2%
- fewer steps to beat PPO’s best
- 8×
- evaluation seeds × 10k steps
- 2
Goal: learn to solve 6×6 Minesweeper with 6 mines from raw pixels using PPO, and measure the impact of Random Network Distillation (RND) as an intrinsic exploration bonus.
Result: across matched evaluations, PPO+RND achieved higher win rates and better average rewards than PPO-only at comparable or fewer environment steps. RND improved early sample-efficiency and kept its lead at ~1.1M steps.
ENVIRONMENT
Environment and observation.
- Task: Minesweeper, 6×6 board with 6 mines.
- Observation: RGB frames rendered with pygame (no window), shape H×W×3, values in [0, 255].
- Actions: discrete, one reveal action per cell.
- Invalid-action mask: already-revealed cells are masked out of the policy logits at decision time.
- Shaped rewards: +1 for a safe cell, −10 for a mine, +50 (plus an efficiency bonus) on a win, −2 for an invalid action, and small information bonuses for helpful reveals.
ALGORITHMS
Two agents, one difference.
- PPO (baseline): CNN encoder → policy logits and a single value head; clipped objective, GAE, entropy bonus, value loss, and gradient clipping, with invalid-action masking on the logits.
- PPO+RND: adds an RND module (frozen target CNN, trainable predictor CNN) on the next observation; the intrinsic reward is proportional to the prediction error. The actor-critic has two value heads (Vext, Vint) trained on their respective returns, and the policy advantage is the sum of the normalized extrinsic and intrinsic advantages.
Training setup
- PPO:
rollout_len=128,epochs=4,minibatch_size=512,learning_rate=2.5e-4,clip_coef=0.2,ent_coef=0.003–0.01,vf_coef=0.5,max_grad_norm=0.5. - RND: intrinsic coefficient 0.1 → 0.02 (optional linear decay), predictor Adam
lr=2.5e-4, running mean/std normalization of the intrinsic error. - Determinism: seeds set for Python, NumPy, and PyTorch; the visual pipeline is deterministic at inference.
Evaluation protocol
- Every checkpoint is evaluated for a fixed number of steps with the same environment settings and masks:
eval_steps=10_000,seeds=2,cell_size=20. - win_rate = wins / episodes; avg_reward = mean per-episode reward.
RESULTS
Latest evaluation.
PPO-only checkpoints
| Steps | Win rate | Avg. reward |
|---|---|---|
| ~400k | 0.012 | −1.10 |
| ~800k | 0.032 | 1.16 |
| ~1.0M | 0.017 | −0.55 |
PPO+RND checkpoints
| Steps | Win rate | Avg. reward |
|---|---|---|
| ~100k | 0.050 | 3.17 |
| ~800k | 0.043 | 2.45 |
| ~1.1M | 0.049 | 3.26 |
Best checkpoint per agent in bold. RND reaches a win rate of ≈0.05 at 100k steps; PPO-only peaks at ≈0.032 at 800k. At ~1.1M steps, RND still leads (0.049 vs. PPO’s best of 0.032 in this run).
ANALYSIS
What the numbers say.
- Sample-efficiency: the intrinsic signal accelerates exploration, yielding higher win rates earlier.
- Stability: RND keeps a consistent lead at higher step counts, while PPO-only improves more slowly and less consistently.
- Win rate over reward: the shaped reward is noisy, so win rate is the primary metric on this sparse, combinatorial puzzle.
Qualitative behavior
RND policies open larger zero-regions early and use the mask to avoid futile clicks; PPO-only learns similar behavior later.
Next runs
- PPO-only: extend by 300k–500k steps and anneal
ent_coef → 0.001andlearning_rate → 1e-4. - PPO+RND: extend by 200k–400k steps with intrinsic-coefficient and entropy decay.
Limitations and future work
- Absolute win rates are still low, and two evaluation seeds make them noisy: PPO-only fell from 0.032 to 0.017 between 800k and 1.0M steps.
- Pixel-only observations force the agent to learn game logic implicitly; structured features or hybrid inputs may improve sample-efficiency.
- Minesweeper’s stochasticity and sparse terminal rewards remain challenging; a curriculum (for example 5×5 → 6×6) is promising.
- More baselines (Distributional DQN, IMPALA, other curiosity variants) would put RND’s gains in context.
REPRODUCE
Run it yourself.
- Train (optional):
ppo_rnd_minesweeper_colab.ipynbfor PPO+RND andppo_only_minesweeper_colab.ipynbfor the baseline. Both also run locally. - Compare:
compare_ppo_vs_rnd_colab.ipynbscans theppo_only_minesweeper/andppo_rnd_minesweeper/checkpoint folders, evaluates them with shared settings, and plots win rate against steps. - Watch a rollout:
make_rollout_gif.pyexports short clips of a trained agent.
Keep reading
The theory behind this experiment: policy-gradient methods, PPO’s clipped objective, and the Bellman equations that value functions are built on.