A coin at the exit — and silence everywhere else
Reinforcement learning has one feedback channel: reward. Put the only reward at the exit and every step before it is silence — the agent literally cannot tell a good move from a bad one, so random wandering is the best it can do. Drop the walker, then grow the maze and watch the step counter explode.
The walker is brainless on purpose: with zero signal anywhere except the coin, uniform random exploration is genuinely all a fresh agent has. Gold haze = how often each square was visited.
The first win changes everything — watch value trickle backward
Now give the walker a brain: Q-learning. Every step it updates a map of “how good is this square”. The catch: updates can only move value around — and until the coin is touched once, there is no value to move. Train it and watch the map stay pitch black… then catch the moment of the first success.
Real tabular Q-learning running live (α 0.6, γ 0.92, ε 0.25). Gold glow = learned value of each square; white dots = the last episode's path. Before the first success every update is 0 ← 0 + 0.
Breadcrumbs — shaping turns silence into a slope
Reward shaping pays small bonuses for progress — here, a bonus whenever the agent gets closer to the exit (true distance, computed by BFS). Below, two identical brains race on the same maze: one on pure sparse reward, one with breadcrumbs. The chart shows steps-to-coin per episode for both.
Shaping here is potential-based: r' = r + 0.5·(γ·φ(s′) − φ(s)) with φ = closeness to the goal. That exact form is the provably safe one — remember it for the next episode.
The trap you built yourself — when shaping teaches the wrong lesson
Shaping is a loaded gun. Here the designer placed a +0.5 “hint” bonus on a tile halfway to the coin — payable every time the agent steps onto it. The coin at the end pays +5. Train with the naive hint and watch what the agent actually learns; then train with the same hint expressed the safe, potential-based way.
γ = 0.95, 120-step episodes. Camping on the hint earns ≈0.5 again and again; the +5 coin, discounted over the walk to reach it, is worth less. The agent does the math you didn't.
Curiosity — get paid for novelty (and the noisy-TV trap)
Instead of hand-placed hints, curiosity pays a universal bonus: reward for states you haven't seen much. Compare a random walker with a curious one (it prefers its least-visited neighbour) hunting a sparse coin in the far corner. Then switch on the noisy TV — a screen that always looks new — and watch curiosity's own failure mode.
Count-based novelty stands in for curiosity bonuses (ICM / RND). The TV cell's visit count is treated as permanently zero — like a screen of static, it never stops being “novel”.