Rainbow: six fixes to DQN, and how to tell which mattered
Rainbow combines double targets, dueling heads, prioritized replay, n-step returns, distributional values and noisy networks. Learn what each part does, project a return distribution onto fixed atoms, and read an ablation honestly.
What runs in CodeSplash
- DRL004Rainbow DQN Explained here
- Online policy learning with a deep Q-network (DQN) Experimental
You will be able to
- Name Rainbow's six components and the problem each addresses
- Project a shifted return distribution back onto fixed atoms
- Explain the bias prioritized replay introduces and how it is corrected
- Read an ablation table without over-generalizing it
Six parts
ReadRainbowRainbow DQNDQN with six additions combined: double targets, dueling heads, prioritized replay, n-step returns, distributional values, noisy nets. put six DQN extensions into one agent:
| Part | What it fixes |
|---|---|
| Double Q targets | Overestimation from the max |
| Dueling head | Learning state values when actions barely matter |
| Prioritized replayPrioritized experience replayReplay transitions with large TD errors more often, with importance weights to correct the bias that introduces. | Replaying informative transitions more often |
| n-step returnsn-step returnSum n real rewards before bootstrapping from a value estimate: less bias than one step, more variance. | Slow propagation of rewards through one-step targets |
| Distributional valuesDistributional RL (C51)Learn the whole distribution of returns on fixed atoms instead of only its mean; the Bellman target is projected back onto the atoms. | Learning only the mean of an uncertain return |
| Noisy networks | Exploration by random actions alone |
CodeSplash's DQN has the first two; the rest are explained here.
Distributions on fixed atoms
ReadDistributional RL learns the probability of each return value on a fixed grid of atoms . The Bellman target shifts and shrinks the next state's distribution, , which no longer lands on the grid. Each shifted atom's probability is split between its two neighboring grid points, in proportion to how close it lands.
In the reference's example, three atoms at −1, 0 and 1 are shifted and projected back; the result is 0.1, 0.4 and 0.5, still summing to one. The network is trained with the cross-entropy to that projection, here 1.030.
Priorities need a correction
ReadPrioritized replay samples transitions with probability rising with their TD error. That speeds learning, but the gradient no longer averages over the buffer as it should: high-error transitions are over-represented. Importance weights, inversely related to each transition's sampling probability, scale its update back, usually more strongly as training goes on.
n-step returns add real rewards before bootstrapping: rewards travel back faster, at the cost of more variance and of mixing in the old behavior's actions.
Reading the ablation
ReadRainbow's paper removed one part at a time. On its benchmark, dropping prioritized replay or n-step returns hurt most, and dropping the dueling head or double targets hurt little.
Treat that as a result about that benchmark, those settings and that budget. Parts interact: double targets may matter less once distributional values change the target. A different task or a tuned baseline can reorder the list. And a gain measured on a handful of seeds needs an interval before anyone ranks it.
Predict: removing a part
PredictPredict first
Rainbow's ablation found the dueling head added little. You're building an agent for a new task. Should you drop the dueling head?
Reveal
You can't tell without testing. Ablations rank parts for one benchmark and budget; interactions change on another task. Compare with and without it on your task, over several seeds.
What runs here
ReadCheck: Rainbow
CheckpointCheck yourself
A shifted atom lands at 0.25 on a grid with points at 0 and 1. How is its probability p split?
Show the answer
Answer: a
The split is linear in distance: the closer neighbor gets the larger share, and the total stays p.
Check yourself
Why does prioritized replay need importance weights?
Show the answer
Answer: a
Without the correction, the network fits the high-error transitions more than the data distribution warrants.
Check yourself
Which of Rainbow's parts are options of CodeSplash's decide.rl_dqn?
Show the answer
Answer: a
The other four are explained here; the Policy learning studio's small environments rarely need them.
Check yourself
What do n-step returns trade?
Show the answer
Answer: a
Each extra real reward adds noise but relies less on a possibly wrong value estimate.
Recap
Recap- Rainbow combines double targets, dueling heads, prioritized replay, n-step returns, distributional values and noisy nets.
- Distributional RL projects shifted returns back onto fixed atoms and trains with cross-entropy.
- Prioritized replay needs importance weights to undo its sampling bias.
- An ablation ranks parts for one benchmark and budget; test on your own task with several seeds.
Concepts in this lesson