๐ŸŽฎ Reinforcement Learning ยท Lecture 11 of 21

Improving DQN: Double, Dueling, Prioritised Replay and Rainbow

A series of improvements fixed DQN's weaknesses: overestimation, inefficient replay, poor value decomposition and myopic returns. We study each idea and how Rainbow combined six of them.

DQN opened deep RL, but it had clear weaknesses. Over the following years, researchers proposed a series of targeted improvements, each addressing a specific problem. In 2018, Hessel et al. combined six of them into Rainbow, which substantially outperformed each component alone on the Atari benchmark. Studying these ideas teaches you how to diagnose and fix learning algorithms.

1. Double DQN: fixing overestimation#

The target $\max_{a'}Q(s', a'; \theta^-)$ uses the same values to select and evaluate the best action. With noisy estimates, the max picks up positive noise โ€” maximisation bias โ€” and values are systematically overestimated. Van Hasselt, Guez and Silver (2016) decoupled selection and evaluation:

$$ y = r + \gamma\,Q\Big(s',\; \arg\max_{a'}Q(s', a'; \theta);\; \theta^-\Big) $$

The online network selects the action; the target network evaluates it. A one-line change that reduces overestimation and improves scores on many games.

python
import torch

def double_dqn_target(q_online, q_target, r, s_next, done, gamma=0.99):
    with torch.no_grad():
        best = q_online(s_next).argmax(1, keepdim=True)          # select with online net
        next_q = q_target(s_next).gather(1, best).squeeze(1)     # evaluate with target net
        return r + gamma * (1 - done) * next_q

2. Prioritised experience replay#

Uniform sampling wastes updates on transitions the network already predicts well. Schaul et al. (2016) sample transitions with probability proportional to their TD error:

$$ P(i) = \frac{p_i^\alpha}{\sum_kp_k^\alpha}, \qquad p_i = |\delta_i| + \epsilon $$

Non-uniform sampling biases the gradient, so updates are corrected with importance-sampling weights $w_i = (N\cdot P(i))^{-\beta}$, with $\beta$ annealed to 1. A sum-tree data structure makes sampling efficient. Prioritisation speeds learning considerably.

3. Dueling networks#

Wang et al. (2016) observed that in many states the choice of action barely matters (nothing is happening), while the state's value does. The dueling architecture splits the network into two streams โ€” a state value $V(s)$ and advantages $A(s, a)$ โ€” combined as

$$ Q(s, a) = V(s) + \left(A(s, a) - \frac{1}{|\mathcal{A}|}\sum_{a'}A(s, a')\right) $$

Subtracting the mean advantage makes the decomposition identifiable. The value stream learns from every update, improving policy evaluation when many actions are similar.

4. Multi-step returns#

Use n-step targets $\sum_{k=0}^{n-1}\gamma^kr_{t+k+1} + \gamma^n\max_{a'}Q(s_{t+n}, a')$ to propagate rewards faster (typically $n = 3$). Rainbow's ablations found multi-step returns among the most important components.

5. Distributional RL (C51)#

Instead of predicting only the expected return, Bellemare, Dabney and Munos (2017) predicted the full distribution of returns, represented as probabilities over 51 fixed "atoms" (hence C51), trained with a distributional Bellman operator and a cross-entropy/KL loss after projecting the target distribution onto the atoms. Learning distributions gave richer training signals and better performance, even when acting only on the mean. Follow-ups (QR-DQN, IQN) represent distributions with quantiles. Distributional RL also supports risk-sensitive decisions.

6. Noisy networks for exploration#

ฮต-greedy explores the same way in every state. NoisyNets (Fortunato et al., 2018) add learned, parameterised noise to network weights:

$$ y = (\boldsymbol{\mu}^w + \boldsymbol{\sigma}^w\odot\boldsymbol{\epsilon}^w)\mathbf{x} + \boldsymbol{\mu}^b + \boldsymbol{\sigma}^b\odot\boldsymbol{\epsilon}^b $$

The network learns how much to explore and can reduce noise where it is confident โ€” state-dependent exploration.

Rainbow#

Combining Double Q-learning, prioritised replay, dueling networks, multi-step returns, distributional RL and noisy nets, Rainbow achieved much better median human-normalised performance than DQN and reached DQN's final performance with a fraction of the frames. Ablations showed prioritised replay and multi-step returns mattered most, followed by distributional learning.

ComponentProblem addressed
Double DQNOverestimation from max
Prioritised replayInefficient uniform sampling
DuelingPoor value/advantage separation
Multi-stepSlow reward propagation
Distributional (C51)Losing information by predicting only the mean
Noisy netsNaive state-independent exploration

Beyond Rainbow#

Distributed agents (Ape-X, R2D2 with recurrent networks and many parallel actors), exploration bonuses (e.g. Random Network Distillation made progress on Montezuma's Revenge), and Agent57 (2020), the first agent to outperform the human baseline on all 57 Atari games, using adaptive exploration strategies. Model-based agents such as MuZero and later world-model agents pushed sample efficiency further.

JA
Written by

Janin A Apurba

B.Sc. in CSE, AUST ยท Advanced ICT Officer, CNRS-UNHCR. Teaching AI, ML and Deep Learning to the next generation of engineers and researchers.

Keep learning

Related lectures

๐ŸŽฎ Reinforcement Learning

Deep Q-Networks (DQN): Human-Level Atari from Pixels

In 2013โ€“2015 DeepMind's DQN learned to play dozens of Atari games from raw pixels with one algorithm. We dissect the Q-network, experience replay, target networks and preprocessing, and implement DQN for CartPole.

Advancedโฑ 5 min#230
๐ŸŽฎ Reinforcement Learning

Policy Gradient Methods: REINFORCE and the Policy Gradient Theorem

Instead of learning values and acting greedily, policy gradient methods optimise the policy directly. We derive the policy gradient theorem and REINFORCE, reduce variance with baselines, and implement it on CartPole.

Advancedโฑ 5 min#232
๐ŸŽฎ Reinforcement Learning

Function Approximation in RL: From Tables to Neural Networks

Tabular methods cannot scale to large or continuous state spaces. We replace tables with parameterised functions, derive semi-gradient TD, discuss linear features and tile coding, and understand the deadly triad that makes deep RL unstable.

Advancedโฑ 4 min#229