When reward is a needle in a haystack, random flailing never finds it. The fix is to make the agent want to see new things — a self-made bonus for novelty and surprise that turns curiosity into a reward signal.
Every reinforcement-learning method you have met so far — Q-learning, policy gradients, actor-critic — shares one quiet assumption: that the agent sees reward often enough to learn from it. Take that away and the whole machinery stalls. This lecture is about what to do when reward is almost never there.
The poster child is the Atari game Montezuma's Revenge. To score a single point you must climb down a ladder, jump a gap, dodge a skull, cross a room, and grab a key — dozens of precise actions in a row. The reward for the key arrives only after that exact sequence. This is a hard-exploration, sparse-reward task: the reward signal is a single needle buried in an enormous haystack of states.
Now recall how Q-learning explores: ε-greedy. Most of the time it takes its best-known action; with probability ε it takes a uniformly random action. That is fine when reward is dense — a few random pokes will bump into a payoff. But ask ε-greedy to find the key in Montezuma's Revenge by chance and the arithmetic is hopeless: the probability of randomly stringing together the dozens of right actions is astronomically small. The agent flails near the start, never sees reward, and so never learns anything to be greedy about. It is stuck.
Humans do this without thinking. A toddler on a playground gets no points, no score, no win condition — yet she relentlessly pokes, climbs, drops, and tastes everything in reach. Psychologists call this intrinsic motivation or curiosity. The agent in this lecture is going to be given the same drive, mathematically.
A robot starts top-left; the only reward (teal) sits in a far corner, reachable only through a narrow corridor. Press Run. The warm agent is ε-greedy — with no reward signal yet, it has nothing to be greedy about and just rattles around near home. The teal agent gets a bonus for entering new cells; watch it fan outward and reach the corner. The heat shows where each has been.
Notice what the novelty bonus buys: direction. ε-greedy spreads its random steps evenly and so diffuses outward only as a slow random walk — on average it takes an enormous number of steps to wander down a long corridor. The novelty-seeking agent actively pushes toward the parts of the world it has seen least, so it sweeps the map and finds the goal in a fraction of the time.
Before we tackle full RL, the lecture sharpens our intuition on the simplest possible exploration problem: the multi-armed bandit. There are several slot-machine arms; each pays a random reward with some unknown average. You want to pull the best one as often as possible — but you do not know which is best until you have tried them. Pull only the arm that looks best so far and you might lock onto a lucky-looking dud forever; pull arms at random and you waste pulls on losers. This is exploration vs exploitation in its purest form.
The bandit world hands us the master principle of this entire field: optimism in the face of uncertainty (OFU). When you are unsure how good an option is, assume it might be great and try it. If it really is great, wonderful. If it is not, you learn that quickly and stop wasting pulls on it. Either way, uncertainty gets resolved.
The classic algorithm built on OFU is the Upper Confidence Bound (UCB). For each arm it keeps not just an estimate of the mean payoff but also a measure of how uncertain that estimate is. It then picks the arm with the highest optimistic estimate — the mean plus a bonus for uncertainty:
An arm you have pulled many times has a small uncertainty bonus — you already know it well. An arm you have barely tried has a large bonus, so UCB is drawn to it even if its current estimate looks mediocre. The bonus is exactly “how much could I still be wrong about this?”
So why not just run UCB on a robot? Because UCB needs to count how often it has tried each action, and there are only a handful of arms. In a full sequential task the “arm” you are uncertain about is the state you might visit, and there are astronomically many of those. The next chapters are the story of carrying the bonus-for-uncertainty idea from a few arms to an unboundedly large state space.
Here is the most literal way to turn “reward novelty” into a number. Keep a tally: N(s) = how many times the agent has visited state s. A state it has never seen has N(s) = 0; a corridor it has walked a hundred times has N(s) = 100. Now add an exploration bonus to the real reward that is large when the count is small and shrinks as the count grows. The standard choice, straight from UCB, is one over the square root of the count:
Read every symbol. rextrinsic is the real reward from the environment — for Montezuma, almost always zero. The second term is the intrinsic exploration bonus. N(s) is the visit count of the state. β (beta) is a knob setting how strongly the agent cares about novelty versus real reward. The fraction 1⁄√N(s) is the heart of it: a brand-new state pays a big bonus, the second visit pays less, and after many visits the bonus is nearly nothing.
Then we do nothing exotic: feed rtotal to ordinary Q-learning. The agent learns to seek high total reward, which early on means seeking unvisited states — precisely the directed exploration the random ε-greedy walk could never produce. As states fill in, the bonus everywhere decays toward zero and the agent is left chasing only the real reward it has by then discovered.
Suppose β = 1. The first time the agent enters a state, N becomes 1 and the bonus is 1⁄√1 = 1.00. On the 4th visit, N = 4 and the bonus is 1⁄√4 = 0.50. On the 100th visit, N = 100 and the bonus is 1⁄√100 = 0.10. The pull toward this state has quietly faded by a factor of ten — exactly the “I've seen enough of this” behavior we want.
A count-based agent wanders a gridworld with no extrinsic reward at all — only the 1⁄√N bonus. Each cell's warm glow is its current bonus (bright = unvisited, dim = familiar); the dot is the agent. Press Run and watch the glow burn down behind it as it methodically covers the whole map — no corner is left dark. Slide β to change how hard novelty pulls.
Let's encode that bonus ourselves and verify two facts: it is largest for the least-visited state, and an agent that follows it covers far more of the world than a greedy agent that ignores novelty.
Chapter 2's count works beautifully in a tiny gridworld, where the same cell really is visited again and again. Now make the state an image — the Atari screen. The state is hundreds of pixels. You will essentially never observe the exact same screen twice. Every frame is a tiny bit different: a flickering animation, a sprite one pixel over, a score digit ticking up. So the literal count N(s) is 1 for every state forever, the bonus never decays, and counting is useless.
This is the same wall the whole field keeps hitting: methods that work on a finite table fall apart in a high-dimensional, continuous world. We need a notion of count that says “I have seen states like this many times,” even if not this exact one.
The idea is the pseudo-count. Instead of tallying exact states, train a density model — call its estimated probability of a state p(s). A state you have seen a lot looks probable (high p); a genuinely novel state looks improbable (low p). You can then back out a fictitious count from how that probability changes after one more observation of s. The intuition is clean: if seeing s once barely nudges its estimated probability, the model has already seen plenty like it, so the pseudo-count is high; if one observation noticeably raises p(s), the state was surprising and rare, so the pseudo-count is low.
You then drop that pseudo-count, call it N̂(s), straight into the same bonus from Chapter 2:
This is exactly what gave the first big breakthrough on Montezuma's Revenge: a count-based bonus driven by a learned density model, scoring far above anything ε-greedy could reach. The lesson is general — when you can't count exact states, count their probability instead.
Pseudo-counts answer “how often have I seen this?” Curiosity answers a different, more human question: “how surprised am I by what just happened?” A toddler is not counting screens — she is building a little model of how the world responds to her pokes, and she is drawn to whatever her model gets wrong.
Pathak and colleagues (2017) made this precise with one conjecture and one definition. The conjecture: exploring with no external goal, just to understand the world, makes the agent generalize better. The definition is the engine of the lecture:
Here is the machinery in plain terms. We keep a forward dynamics model f — a small network with parameters that we will call θ (theta). It takes the current state st and the action at and outputs a guess for the next state, ŝt+1. We train it by gradient descent to make that guess match the next state the world actually produced, minimizing the squared error between guess and reality. The leftover error — how wrong the guess was — is handed back to the agent as the intrinsic reward:
The double bars mean “length of the difference vector” (the gap between predicted and real next state); the superscript two means we square it. Read it as: the bigger the surprise, the bigger the reward. As the agent revisits a region and the forward model learns it, the error there falls, the curiosity reward there fades, and the agent moves on to fresh, still-unpredictable territory. The bonus self-extinguishes — just like the count bonus did.
Notice this gives us the same balance the bandit chapter promised: the total reward the agent maximizes is the real reward plus the curiosity reward, rextrinsic + rintrinsic. The intrinsic term drives exploration early; the extrinsic term takes over once real reward is found. It is OFU again — optimism, now expressed as “go where you're most wrong.”
A forward model is learning to predict the next state across a 1-D world of locations. The warm bars are the current prediction error (the curiosity reward) at each location. Press Visit a region to send the agent there a few times; watch the model learn that region and its surprise bar collapse — the agent will then be pulled toward whatever is still tall.
This is a beautiful idea, and it works — an agent driven by curiosity alone, with the game's score switched off entirely, taught itself to play a good chunk of Super Mario Bros and to walk sensibly down corridors in a 3-D maze. But it hides a flaw that, if you predict in the wrong space, sinks the whole thing. That flaw is the subject of the next chapter.
Curiosity says “reward what you can't predict.” Read that sentence again, slowly, and you'll spot the bug. Some things are unpredictable not because they are new and worth exploring, but because they are random — and random things stay unpredictable forever.
Schmidhuber's famous thought experiment makes it vivid. Put a television in the agent's world that displays pure white noise — static, a fresh random pattern every frame. Ask a forward model to predict the next frame of static. It cannot, ever, no matter how long it trains, because the static carries no information about its own future. So the prediction error stays pegged high, the curiosity reward stays maximal, and a naive curiosity agent will sit in front of the noisy TV forever, mesmerized, collecting infinite intrinsic reward while learning nothing and going nowhere.
Why does this matter so much for robots specifically? Because the physical world is drenched in irreducible noise: camera sensor grain, shadows from things you don't control, swaying leaves, other agents moving unpredictably, the random chatter of actuators. If your exploration bonus is “raw prediction error of the next sensor reading,” the robot will be paid to stare at whatever is noisiest — the equivalent of a robot vacuum hypnotized by a flickering light.
Five regions of the world. Four are ordinary (their next state is learnable); one is a noisy TV (its next state is pure random static). The warm bars are raw next-state prediction error. Press Train everywhere repeatedly: the ordinary bars collapse as the model learns them, but the noisy-TV bar stays pegged high forever — so a raw-curiosity agent gets stuck there.
So the curiosity idea is sound but the space you predict in is wrong. Predicting raw pixels (or raw sensor readings) makes you a slave to every random pixel. The fix is to predict in a space that throws the noise away and keeps only what the agent can actually control or affect. Two different answers to “which space?” make up the rest of the lecture: ICM learns such a space; RND sidesteps the problem with a clever trick. We take them in turn.
The Intrinsic Curiosity Module (ICM) fixes the noisy-TV problem with one decisive move: don't predict the next state in pixel space — predict it in a learned feature space that only encodes what the agent can affect. Get that feature space right and random static simply isn't represented, so it can't generate reward.
But here is the catch: how do you train a feature encoder to keep “what the agent controls” and discard “random stuff the agent can't touch” — without anyone hand-labeling which is which? ICM's answer is genuinely clever, and it is the whole reason ICM works. It uses a second, helper model: an inverse dynamics model.
The inverse model is trained on a self-supervised task: given the features of the current state and the features of the next state, predict which action the agent took to get from one to the other. Think about what that forces the features to learn.
Now the forward model from Chapter 4 runs in feature space instead of pixel space. Writing φ(s) (phi) for the feature encoding of state s, ICM predicts the next state's features from the current features and the action, and uses that error as curiosity:
The same forward-model-error idea as before — but because it lives in a space scrubbed of uncontrollable noise, the noisy TV produces no error and no reward. The agent is curious about the parts of the world it can act on, and indifferent to the static. That is exactly the curiosity we wanted.
ICM beats the noisy TV by carefully learning the right feature space. Random Network Distillation (RND) takes a startlingly different route: it sidesteps dynamics prediction entirely and asks a much simpler question — have I seen a state like this before? — with a trick so clean it is almost a magic act.
RND uses two networks that both map a state to a feature vector:
The novelty signal — the intrinsic reward — is the error between the two networks on the current state:
Now watch why this is a novelty detector. The target's output on a state is a fixed number. On states the agent has visited many times, the predictor has had many chances to match that number, so its error there is tiny — familiar. On a state the agent has never seen, the predictor has never been trained there, so it produces some untrained guess that is far from the target — large error = novel. As the agent revisits a state, the predictor trains down its error there, and the bonus fades. Familiarity is “the predictor has caught up to the target here.”
RND is the method that finally cracked Montezuma's Revenge — the first to beat average human performance on it without demonstrations or access to the game's internal state. And it is dead simple: a fixed random network, a trained copy of it, and the gap between them. No dynamics model, no inverse model, no density estimator. Novelty, distilled.
Let's build the novelty signal and confirm its defining property: the error drops as a state is seen more often.
Chapter 5 showed raw curiosity hypnotized by static. Chapter 7 claimed RND escapes that trap. This chapter pins down exactly why — because the difference comes down to a single question: does your novelty signal depend on predicting the future, or only on recognizing the present?
Line the two up on the same noisy TV:
| Raw curiosity (forward model) | RND | |
|---|---|---|
| What it predicts | the next state from this state + action | a fixed function of this state |
| On a random-static screen | next frame is unpredictable → error stays high forever | target output for this screen is fixed → predictor can learn it |
| Does the bonus decay? | No — trapped at the TV | Yes — once the predictor has seen enough static |
| Source of error | irreducible randomness of the future | only unfamiliarity of the present |
The crux is in the last row. Raw curiosity's error has a floor it can never get below: the part of the next state that is genuinely random. No amount of training removes it, so the reward never dies. RND has no such floor — the target is a deterministic function of the current state, so given enough exposure the predictor can drive the error all the way to zero, even on noise. RND's error measures only one thing: how often have I been trained on inputs like this? That is novelty, full stop, uncontaminated by the unpredictability of the future.
Let's make the contrast undeniable: on the very same stochastic state, RND novelty must fall as the state is revisited, while the raw next-state prediction error must stay high.
Counting, curiosity, and RND are all intrinsic rewards — rewards the agent manufactures for itself rather than receiving from the environment. The lecture organizes the whole zoo of such rewards into three families, by the question each one answers. Knowing the taxonomy keeps you from confusing methods that look similar but optimize different things.
| Flavor | The question it asks | Examples |
|---|---|---|
| Knowledge-based | How surprising / unpredictable is this? How much did I learn about the world? | Curiosity (ICM), prediction-error bonuses |
| Competence-based | What distinct skills can I reliably perform? | Empowerment, skill discovery (DIAYN) |
| Data-based | How much of the state space have I covered? | State-entropy / coverage bonuses, RND (a coverage proxy) |
The knowledge-based family is Chapters 4–6: reward surprise, measured as prediction error. The data-based family is Chapters 2, 3, and 7: reward visiting under-covered states — literally counts, pseudo-counts, or RND as a stand-in for “how much have I covered.” The middle family is new and worth a paragraph.
Empowerment / skill discovery asks the agent not “what's new?” but “what can I reliably cause?” A method like DIAYN (“Diversity Is All You Need”) hands the policy a random latent code z, has it roll out a trajectory, then tries to recover z back from that trajectory. The reward is high when different codes produce distinctly different, recognizable behaviors — so the agent is paid to discover a diverse repertoire of skills, each one a controllable, distinguishable way of behaving, all without any task reward.
You arrived stuck — a sparse-reward task that ε-greedy could never crack. You leave with a toolbox of ways to manufacture a reward for novelty and surprise, and a sharp understanding of the one failure mode (the noisy TV) that separates the naive methods from the ones that work. Here is the whole lecture on a page.
| Method | Intrinsic reward | Beats the noisy TV? | Works on images? |
|---|---|---|---|
| ε-greedy | none (random actions) | n/a | fails on sparse reward |
| UCB / optimism | uncertainty bonus on actions | n/a | too few “arms” |
| Count-based | β · 1⁄√N(s) | yes (counts are exact) | No — never repeats a state |
| Pseudo-counts | β · 1⁄√N̂(s) via density model | yes | Yes |
| Curiosity (raw) | next-state prediction error | No — trapped | Yes, but fragile |
| ICM | prediction error in a learned feature space | Yes — ignores uncontrollable noise | Yes |
| RND | error vs a fixed random target network | Yes — deterministic target is learnable | Yes (cracked Montezuma) |
“Reward the agent for being surprised — but never by random static.”