Rainbow: Six Improvements to DQN
Double, dueling, prioritized, multi-step, distributional and noisy, and what each one buys.
Rainbow put six separately published fixes to DQN into one agent, then removed them one at a time to see which mattered. This lesson writes each component as an equation and shows how they fuse into a single loss, proves the two facts the target-side fixes rest on (a small optimism per backup grows by the effective horizon; uncorrected multi-step targets converge to the value of a different control problem), explains why a dueling head must be centered and how factorized noise keeps noisy layers cheap, and reads the ablations closely: what they show, what they cannot, and what a cheaper replication changed.
What you’ll learn
- Write the target, loss or architecture of each of Rainbow's six components, and how Rainbow fuses them into one multi-step, double, distributional loss with KL priorities.
- Prove that a backup optimistic by everywhere moves the fixed point up by at least , and characterize the fixed point of uncorrected -step Q-learning targets.
- Explain what centering identifies in a dueling head, and count the noise variables of factorized and independent noisy layers.
- Interpret Rainbow's ablations and their small-scale replication, separating findings that held up from ones tied to one combination and budget.
Six components, one loss
Rainbow (Hessel et al., 2018) starts from DQN, with online parameters and a target network , and adds six extensions: five published between 2016 and 2018, and multi-step targets, an old idea (Sutton, 1988) that A3C had recently used with deep networks:
| Component | What it computes | In Rainbow |
|---|---|---|
| Double Q-learning (van Hasselt et al., 2016) | , scored by the target network at | Inside the distributional target |
| Prioritized replay (Schaul et al., 2016) | , update weights | Proportional; ; from 0.4 to 1 |
| Dueling head (Wang et al., 2016) | Per atom, before the softmax | |
| Multi-step targets (Sutton, 1988) | ||
| Distributional (C51) (Bellemare et al., 2017) | Probabilities on atoms evenly spaced on | 51 atoms on |
| Noisy layers (Fortunato et al., 2018) | Every linear layer; -greedy switched off |
Four of the six fuse into one loss. The target distribution takes the target network's distribution at , for the action the online network prefers, shrinks its atoms by and shifts them by the truncated return :
The settings, identical across all 57 games: learning starts after 80,000 frames (prioritized replay made it safe to start earlier than DQN's 200,000); Adam with step size , a quarter of DQN's, and ; the target network is refreshed every 32,000 frames; noisy layers start at ; (3 and 5 both did well early, 3 best at the end); with KL priorities, performance was robust to . A full run of 200 million frames took about 10 days on one GPU.
Rainbow prioritizes replay by each transition's KL loss rather than by its absolute TD error. Why?
- The KL loss is cheaper to compute
- With KL priorities no importance-sampling correction is needed
- It makes replay closer to on-policy
- The distributional agent minimizes the KL loss, so it prioritizes by that loss (a TD error of the mean values could be computed, but it is not what the agent minimizes); the authors also suggest the KL is more robust when returns are random
Show the answer
D. The distributional agent minimizes the KL loss, so it prioritizes by that loss (a TD error of the mean values could be computed, but it is not what the agent minimizes); the authors also suggest the KL is more robust when returns are random
Prioritized replay replays transitions in proportion to a power of how badly they are currently fitted, and for a distributional agent the natural measure is the loss it minimizes. Hessel et al. suggest that KL priorities may be more robust in stochastic environments, because the loss can keep decreasing even when returns are not deterministic. They kept the importance weights, with annealed from 0.4 to 1.
What the target fixes: double estimates and multi-step returns
Double Q-learning exists because the max in the target is optimistic (Maximization Bias & Double Q-Learning). Why should a small optimism matter? Because bootstrapping compounds it, by a factor set by the effective horizon.
Let , finite for a finite MDP, so . is monotone and shifts constants by , , hence
Apply the optimism of at its fixed point:
Taking the minimum over gives , that is . For , which is a -contraction, is a fixed point exactly when , and the fixed point is unique.
Thrun and Schwartz's estimate: with 18 equally good actions whose estimates carry independent errors uniform on , each backup is optimistic by about . With , if every backup carried this bias, how far above would the fixed point sit?
Show the answer
8.9
, and , on a scale where no clipped Atari return exceeds . The model is crude: real errors are neither uniform nor independent nor fresh at every backup. It shows why a bias too small to notice in one backup becomes large in the values when is near 1.
Rainbow's ablation (last step) found little aggregate effect of double Q-learning, and the authors' explanation is this mechanism in reverse. C51's support ends at , so values cannot run away upward; true clipped returns often exceeded 10, and the agent without double Q-learning underestimated. Their caveat: with a wider support, double Q-learning may matter again.
Multi-step targets are the other target-side change, and in Rainbow they are uncorrected: the intermediate actions come from the replayed behavior , older -greedy or noisy policies, not from the greedy policy being learned, and no importance ratio compensates. With the behavior fixed, the expected target is the operator , where is the Bellman evaluation operator of .
Each and is a -contraction in , so their -fold composition contracts by , and Banach's theorem gives a unique fixed point . Unrolling :
This is the Bellman optimality equation of a problem whose "steps" are blocks of real steps: the agent picks the first action of each block and the rest. That gives the interpretation. For the inequality: pointwise (an average is at most a max), and both are monotone, so
If is greedy with respect to then , so is the fixed point.
So uncorrected -step targets are biased toward the behavior, and downward, the opposite sign from the max's bias; how the two biases trade off inside a deep agent is rarely measured. What -step targets buy is speed: reward propagates steps per update, and the bootstrapped estimate is weighted by rather than . Unbiased alternatives cut traces with importance ratios (Off-Policy Traces: Tree Backup & Retrace), and in Experience Replay in Depth uncorrected -step returns turn out to be what lets larger replay buffers help.
What the network fixes: dueling heads and noisy layers
In many states the choice of action barely matters: what matters is the state. A dueling head (Wang et al., 2016) gives the network a stream for the state's value and one for the actions' advantages , so that every update at , whatever the action, moves the shared . Adding the two streams naively is ambiguous: gives the same for any per-state constant , so nothing pins down what learns.
Proof. Average the mean-centered equation over : the two advantage terms cancel, leaving , and subtracting gives the second identity. For the max version, evaluate at , where and also maximizes . So the mean-centered is an action-average, not or : "off-target by a constant", in Wang et al.'s words. They chose it anyway because it trained more stably: its advantages need only track the mean, instead of compensating whenever the best action's advantage changes. In a corridor task with 5, 10 and 20 actions (the extra ones no-ops), plain and dueling networks learned equally fast with 5 actions, and the dueling network faster with more.
Noisy layers (Fortunato et al., 2018) replace each weight by a learned mean plus a learned scale times fresh noise, so exploration comes from perturbing the network's own preferences, and gradient descent tunes how much perturbation each part of the network keeps; the network can learn to ignore the noise in some states sooner than in others. Rainbow acts greedily (). Independent noise needs a Gaussian sample per weight and per bias, for a layer with inputs and outputs. Factorized noise draws samples for the inputs and for the outputs and sets and with : only samples. Means start uniform on and scales at with .
Think first DQN's largest layer maps inputs to units. How many Gaussian samples does one noise draw need with independent noise, and with factorized noise? What happens to the number of learnable parameters?
Independent: . Factorized: , about 440 times fewer. Either way the learnable parameters double, a mean and a scale for every weight and bias, from 1,606,144 to 3,212,288 in this layer. That cost is why the data-efficient agent BBF later dropped noisy layers: in its larger network they multiplied the computation per forward pass by 2.5 and the memory by 1.6, with no significant effect on its performance (Plasticity Loss & Scaling Deep RL).
Reading the ablations
Hessel et al. removed one component at a time from the full agent and compared median human-normalized scores over 57 games, through 200 million frames:
- Prioritized replay and multi-step learning mattered most. Removing either caused a large drop in median score and hurt early learning; removing multi-step learning also hurt final performance. Both helped almost uniformly: the full agent beat both ablations on 53 of the 57 games.
- Distributional learning came next. For the first 40 million frames removing it made no difference; afterwards the agent lagged, mostly on games where it was already near or above human level.
- Noisy layers helped in aggregate, but removing them gave small gains on some games while causing large drops on several others.
- Dueling showed no significant aggregate effect and double Q-learning only a limited one, each helping some games and hurting others.
| Agent | No-op starts | Human starts |
|---|---|---|
| DQN | 79% | 68% |
| Double DQN | 117% | 110% |
| Prioritized Double DQN | 140% | 128% |
| Dueling Double DQN | 151% | 117% |
| Noisy DQN | 118% | 102% |
| Distributional DQN (C51) | 164% | 125% |
| Rainbow | 223% | 153% |
What an ablation of this kind cannot show: the importance of a component in general. It measures each component's contribution inside one combination, at one budget, with hyperparameters tuned for the full agent, through a median over games that hides effects of opposite sign. The double Q-learning result is the clearest example: its effect may have been masked by C51's bounded support. The authors themselves frame the findings "in the context of this specific combination".
Obando-Ceron and Castro (2021) reran the additions to DQN and the removals from Rainbow on four classic-control tasks (CartPole, Acrobot, LunarLander, MountainCar) and five MinAtar games, cheap enough for many seeds and sweeps. They agree that the components' effects vary by environment and that combining all of them gave the best overall agent. They differ on distributional learning: added alone to DQN it sometimes hurt (Acrobot, Freeway), and removing it from Rainbow sometimes helped (MountainCar, Seaquest). They also tested a piece of folk wisdom: with the Adam optimizer, the squared loss beat the Huber loss on all their small environments, and across the 60 Atari games they tested, Adam with the squared loss beat DQN's RMSProp with the Huber loss "overwhelmingly". With RMSProp, the Huber loss did better, which may be why DQN adopted it.
Key takeaways
- Rainbow fuses -step returns (), double Q-learning (online network chooses, target network evaluates) and C51 (KL to the projected target on 51 atoms in ) into one loss, prioritizes by that loss, and adds a per-atom dueling head and noisy linear layers.
- A backup optimistic by everywhere has a fixed point at least above : bootstrapping multiplies a small per-backup bias by the effective horizon.
- Uncorrected -step targets are a -contraction toward the optimal value of a problem where the behavior picks the intermediate actions, a value at most .
- Mean-centering makes the dueling split identifiable ( is the action-average of ) without changing the greedy action; factorized noise needs Gaussian samples per layer instead of , though noisy layers still double the parameters.
- In Rainbow's ablation, prioritization and multi-step returns mattered most, distributional learning mattered late, and dueling and double Q-learning had little aggregate effect, all within one combination and budget; a small-scale replication agreed on the combination but found that distributional learning can hurt on its own.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
Uncorrected -step targets, with intermediate actions from a fixed -greedy behavior, converge in expectation (tabular, exact updates) to what?
- , because the max at step corrects the earlier actions
- The optimal value of a problem in which every -th action is chosen greedily and the others by the behavior, which is at most
- , the action-value of the behavior policy
- Nothing: the expected update is not a contraction, so it may not converge
Show the answer
B. The optimal value of a problem in which every -th action is chosen greedily and the others by the behavior, which is at most
The expected backup is , a -contraction whose fixed point values the behavior's intermediate actions. Since averaging under never exceeds maximizing, the fixed point lies below , approaching it as the behavior approaches greedy.
Why does a backup that is optimistic by everywhere produce a fixed point at least above , rather than just ?
- Each backup passes on times the bias already in its inputs and adds anew:
- Because the max is taken over about actions
- Because the target network is refreshed every updates
- Because the variance of returns grows like
Show the answer
A. Each backup passes on times the bias already in its inputs and adds anew:
The proof's inequality is exactly this geometric series: the bias inherited from the next state's value, discounted once, plus the new optimism. The factor is the effective horizon, 100 at .
Which conclusion do Rainbow's ablations support best?
- Double Q-learning is unnecessary in deep RL
- Every component improved the score on every game
- Within this combination and budget, prioritized replay and multi-step returns mattered most, while dueling and double Q-learning had little aggregate effect
- Distributional learning was the most important component from the start of training
Show the answer
C. Within this combination and budget, prioritized replay and multi-step returns mattered most, while dueling and double Q-learning had little aggregate effect
That is what removing one component at a time from the full agent measured, through a median over 57 games at 200 million frames. It does not rank the components in general: their effects interact, as when C51's bounded support counteracts the overestimation that double Q-learning targets.
A mean-centered dueling head represents some exactly. What does its value stream equal?
- for the behavior policy
- Nothing in particular: the split between and is arbitrary
- The average of over the actions
Show the answer
D. The average of over the actions
Averaging over cancels the advantage terms, leaving . Centering is what makes the split identifiable; its choice of center decides what means.
Further reading
- M. Hessel, J. Modayil, H. van Hasselt, T. Schaul, G. Ostrovski, W. Dabney, D. Horgan, B. Piot, M. Azar & D. Silver, "Rainbow: Combining improvements in deep reinforcement learning", AAAI (2018).
- Z. Wang, T. Schaul, M. Hessel, H. van Hasselt, M. Lanctot & N. de Freitas, "Dueling network architectures for deep reinforcement learning", ICML (2016).
- M. Fortunato et al., "Noisy networks for exploration", ICLR (2018).
- J. S. Obando-Ceron & P. S. Castro, "Revisiting Rainbow: Promoting more insightful and inclusive deep reinforcement learning research", ICML (2021).