Foundations to Frontier
Tests

Exploration: curiosity and intrinsic motivation

When rewards are rare, an agent must find them before it can learn from them. Intrinsic motivation gives the agent its own reward for novelty: visit counts, the error of a predictor trained on random targets (RND), or the error of a model predicting the consequences of its actions (curiosity). This page builds all three in a reward-free maze and shows the noisy-TV problem: a source of pure randomness that traps prediction-error curiosity forever while count-based and RND bonuses wear off.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Rewarding yourself for finding something new

A child in a new house opens every door, not because anyone pays them, but because unexplored rooms are interesting. Once a room is familiar, it loses its pull. Curious agents work the same way: they reward themselves for reaching unfamiliar situations, which drives them across the whole environment, where they may stumble on the real reward. The danger is a distraction that is always surprising, like a television showing random static: it never becomes familiar, so a naive curious agent may stare at it forever.

Reinforcement learning lab
S
T
G
A start room joined to a long corridor ending at G; there is no reward at all. The agent knows the map and, each step, plans with value iteration (γ = 0.9) on an intrinsic reward, then takes the best action. Intrinsic reward: 1/√(N + 1) for arriving in a state visited N times. T is a noisy TV: stepping on it shows one of 20 random channels, and any action returns to the start. Shading: visits over 1000 steps. Cells covered: 139 of 140; G first reached at step 130; steps spent watching the TV: 33. A random walk stays near the start; novelty bonuses sweep the corridor. A forward model can never predict a random channel, so its error, and the agent’s fascination, never fade; count and RND bonuses depend only on the state seen, so they wear off.
Why engineers care

Intrinsic motivation helped agents solve hard-exploration Atari games such as Montezuma’s Revenge, and novelty-seeking is used for unsupervised skill discovery in robotics.

📝 Quick check (Level 0)
0/3 answered
  1. 1. Intrinsic reward rewards the agent for…
  2. 2. A familiar place should become…
  3. 3. The noisy TV distracts because it is…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Sparse reward: almost every transition gives zero reward, so undirected exploration (random actions, ε-greedy) rarely finds the reward in large environments.
  • Intrinsic reward: a bonus b(s, a, s′) added to (or replacing) the environment’s reward to drive exploration.
  • Count-based bonus: β/√N(s), large for rarely visited states. Pseudo-counts derive N from a density model when states cannot be counted (Bellemare et al. 2016).
  • Random network distillation (RND, Burda et al. 2019): a fixed random network f maps states to embeddings; a predictor g is trained to match it on visited states; the bonus is ‖g(s) − f(s)‖², small where the agent has been.
  • Curiosity from prediction error (ICM, Pathak et al. 2017): the bonus is the error of a forward model predicting the next state (in a learned feature space) from the current state and action.
  • Noisy-TV problem: where outcomes are truly random, prediction error never falls, so prediction-error curiosity keeps returning to them.
  • Reward-free exploration: explore with intrinsic reward alone, to cover the environment or learn skills before any task is given.
📝 Quick check (Level 1)
0/3 answered
  1. 1. RND's bonus is…
  2. 2. ICM's bonus is…
  3. 3. Pseudo-counts come from…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

Exploring a maze without reward

Exercise 1.

  • A 140-cell maze: a 6 × 6 start room joined by a single corridor to a far cell G. Nothing gives reward.
  • The agent knows the map and plans: each step, value iteration (γ = 0.9, 10 sweeps warm-started from the last plan) on the expected intrinsic reward, then the greedy action. A random-action agent is the baseline.
  • Bonuses: count 1/√(N(s′) + 1); RND, the squared error of a per-state predictor moving 20% towards a fixed random 8-number embedding of s′ on each visit; forward curiosity, the squared error of a per-(s, a) model of s′’s embedding.
  • Measured: the step at which G is first reached and the number of cells visited.

Practice.

  • Use RND or count-based bonuses for hard-exploration problems: they are simple and robust; normalise the intrinsic reward and use a separate value head for it.
  • Combine episodic and lifelong novelty: NGU and Agent57 add a within-episode novelty bonus from nearest neighbours in an embedding memory.
  • Beware stochasticity: use bonuses that depend only on the observed state (RND, counts), or learn features that ignore what the agent cannot control (ICM’s inverse model).
  • Go-Explore keeps an archive of reached states and returns to promising ones before exploring further, which solved Montezuma’s Revenge.
  • Reward-free pretraining: maximise state-visitation entropy (APT) or skill diversity (DIAYN), then fine-tune on the task.
def plan_step(Q, R, ns, gamma=0.9, iters=10):
    # R[s, a]: expected intrinsic reward of the move; ns[s, a]: next state
    for _ in range(iters):
        Q = R + gamma * Q.max(1)[ns]
    return Q

# after each real step to s2:
pred[s2] += 0.2 * (emb[s2] - pred[s2])           # RND predictor
bonus_rnd = ((emb[s2] - pred[s2]) ** 2).mean()
fwd[s, a] += 0.2 * (emb[s2] - fwd[s, a])         # forward model
bonus_fwd = ((emb[s2] - fwd[s, a]) ** 2).mean()
🐍 Exercise 1: directed exploration with intrinsic reward
Explore the maze without reward using random actions, a count bonus, an RND bonus and forward-prediction curiosity, and compare how fast each covers it and reaches the far cell.
📝 Quick check (Level 2)
0/3 answered
  1. 1. A practical tip for intrinsic rewards is to…
  2. 2. Go-Explore's key idea is…
  3. 3. NGU adds a bonus that is…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Why undirected exploration fails. A random walk spreads like diffusion: to travel a corridor of length L it needs on the order of L² steps, and every return to a large room resets it. In the exercise maze a random walk stayed within about 40 cells for 500 steps. Directed exploration, which plans towards the least-known states, crosses the corridor in roughly L steps.

Counts and their generalisations. With bonus 1/√N, an action’s optimistic value shrinks as its outcome becomes familiar, which underlies PAC guarantees for algorithms such as MBIE-EB (Strehl and Littman 2008). RND gives a count-like bonus for any input: a per-state predictor’s error after n visits shrinks geometrically, and a neural predictor generalises, so similar states share familiarity.

The noisy TV. If the next state is random with distribution p, the best forward model predicts its mean, and the expected squared error stays at the variance of the outcome’s embedding, however long it trains. Prediction error mixes epistemic uncertainty (reducible by data) with aleatoric uncertainty (irreducible). Count and RND bonuses depend only on the state actually reached, so each random outcome becomes familiar in turn; prediction-error curiosity rewards irreducible noise forever.

Exploration as information gain. A principled alternative rewards the reduction in uncertainty about the environment, such as Bayesian information gain (VIME), or the disagreement of an ensemble of models (Pathak et al. 2019), both of which vanish where outcomes are merely random.

📝 Quick check (Level 3)
0/3 answered
  1. 1. A random walk needs about how many steps to cross a corridor of length L?
  2. 2. The noisy TV traps forward-model curiosity because its error is…
  3. 3. Ensemble disagreement avoids the noisy TV because it measures…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

How quickly do random actions, count bonuses, RND and forward-prediction curiosity cover a maze without reward, and what happens when a noisy TV is added?

History.

  • J. Schmidhuber (1991) proposed curiosity as a reward for improving a world model; A. Strehl and M. Littman (2008) analysed count-based bonuses (MBIE-EB).
  • M. Bellemare and colleagues (2016) introduced pseudo-counts from density models and made progress on Montezuma’s Revenge.
  • D. Pathak, P. Agrawal, A. Efros and T. Darrell (2017) introduced the intrinsic curiosity module (ICM); Y. Burda and colleagues (2019) ran large-scale curiosity studies and described the noisy-TV problem.
  • Y. Burda, H. Edwards, A. Storkey and O. Klimov (2019) introduced random network distillation.
  • A. Ecoffet and colleagues (2021) introduced Go-Explore; A. Badia and colleagues (2020) introduced NGU and Agent57.

Exercise 2.

  • Three runs of each method on the maze (2,000 steps) and on the maze with a noisy TV next to the start (4,000 steps): stepping on the TV shows one of 20 random channels, and any action from a channel returns to the start.
  • Measured: runs reaching G, the mean step of first reaching it, cells visited after 250 and 500 steps, and the share of the last 1,000 steps spent on TV channels.

Seed 0:

maze method runs reaching G mean first step cells after 250 cells after 500 TV share, last 1,000 steps
no TV random 1 of 3 1,960 36.7 40.3 –
no TV count 3 of 3 134.7 138.7 140.0 –
no TV RND 3 of 3 237.0 124.7 140.0 –
no TV forward 3 of 3 221.7 101.7 129.3 –
noisy TV random 0 of 3 – 34.0 39.3 0.009
noisy TV count 3 of 3 108.0 138.3 139.0 0.040
noisy TV RND 3 of 3 216.0 127.3 138.3 0.123
noisy TV forward 2 of 3 640.0 53.3 110.7 0.323
  • Directed exploration beat random actions by an order of magnitude: the random agent covered about 40 cells in 500 steps and reached G in 1 of 9 maze runs over three seeds, while every bonus agent covered the maze; the count bonus reached G in 95 to 136 steps on average.
  • Forward-model curiosity explored more slowly even without the TV (mean first visit 222 to 1,078 steps across seeds), because it values untried actions, including bumping into walls, as much as unvisited cells.
  • The noisy TV captured forward curiosity: it spent 0.32 to 0.33 of the last 1,000 steps on TV channels on all seeds, which is the whole loop start → TV → channel → start; count and RND agents spent 0.04 and 0.11 to 0.14. RND needed longer than counts because each of the 20 channels has to become familiar separately.
  • Exercise 1: one run each without the TV: random reached G at step 1,961; count at 144; RND at 438; forward at 707.
🐍 Exercise 2 (research): how quickly do random actions, count bonuses, RND and forward-prediction curiosity cover a maze without reward, and what happens when a noisy TV is added?
Compare random actions, count bonuses, RND and forward-prediction curiosity on a reward-free maze, with and without a noisy TV, measuring coverage, time to reach the far cell and time spent on the TV.

Exploration in practice

  • Atari and games: RND, NGU, Agent57 and Go-Explore solved hard-exploration games where ε-greedy agents score nothing.
  • Robotics: reward-free pretraining (APT, DIAYN skills) and curiosity-driven play collect diverse data before a task is specified.
  • Language models: exploration is a live problem in RL for reasoning; sampling diverse solutions and rewarding novelty are active research areas.
  • Model-based exploration: ensembles of world models (topic L5-1) direct the agent to where they disagree.

References

  1. Y. Burda, H. Edwards, A. Storkey and O. Klimov (2019). “Exploration by random network distillation.” ICLR.
  2. D. Pathak, P. Agrawal, A. Efros and T. Darrell (2017). “Curiosity-driven exploration by self-supervised prediction.” ICML.
  3. M. Bellemare, S. Srinivasan, G. Ostrovski, T. Schaul, D. Saxton and R. Munos (2016). “Unifying count-based exploration and intrinsic motivation.” NeurIPS.
  4. Y. Burda, H. Edwards, D. Pathak, A. Storkey, T. Darrell and A. Efros (2019). “Large-scale study of curiosity-driven learning.” ICLR.
  5. A. Ecoffet, J. Huizinga, J. Lehman, K. Stanley and J. Clune (2021). “First return, then explore.” Nature.