Skip to content

Deep reinforcement learning and decision models · Method reference · DRL002 · Algorithm

Double DQN

Reduce action-value overestimation by separating the network that chooses the bootstrap action from the network that evaluates it. Double DQN modifies a DQN target; it is not simply the use of any two networks.

Runs in CodeSplash Component demo, not a trained model CodeSplash's run and the reference's record

In CodeSplash

A CodeSplash method runs this entry in Python and R. Set it up from the method's page.

Do it in CodeSplash Run it on your own data, in Python or R.

Availability
Runs in CodeSplash
Code example
Component demo, not a trained model
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
Verified in Python and R through decide.offline_rl, decide.rl_dqn. The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Reduce action-value overestimation by separating the network that chooses the bootstrap action from the network that evaluates it. Double DQN modifies a DQN target; it is not simply the use of any two networks.

Question / hypotheses

Can value targets become less optimistic when action selection and evaluation use different estimators? This is an algorithmic bias-control objective; evaluate resulting return and value error rather than treating it as a classical significance test.

Architecture / computational structure

Retain the online Q-network, replay buffer, and delayed target network of DQN. At the next state, the online network selects an argmax action and the target network evaluates only that selected action. The encoder and output-head architecture can remain unchanged.

Assumptions

The task has a manageable discrete action set and replay provides relevant transitions. The two networks are related through updates, so their errors are not independent; the method reduces a source of optimism without guaranteeing unbiased values or stable learning.

Formula / computational definition

a∗=arg⁡max⁡aQθ(s′,a)a^*=\arg\max_aQ_\theta(s^\prime,a) and y=r+γ(1−d)Qθ−(s′,a∗)y=r+\gamma(1-d)Q_{\theta^-}(s^\prime,a^*). Minimize a TD loss between Qθ(s,a)Q_\theta(s,a) and the detached target. The online/target assignment matters; taking a minimum across two critics is a different construction.

Parameters and notation

Learned weights belong to the online Q-network, with a delayed copy for evaluation. Hyperparameters largely match DQN: learning rate, discount, replay and target synchronization, exploration, batch size, and loss choice. Argmax tie-breaking is an implementation convention worth fixing for reproducibility.

Fitting, fine-tuning, and adaptation

A DQN checkpoint can initialize Double DQN after defining the new target rule and synchronizing target weights. For domain transfer, adapt the encoder/head and refresh obsolete replay as needed. Preserve independent evaluation episodes and do not attribute every transfer gain to the double estimator alone.

How to use and calibrate

Compare against DQN at matched environment interactions, architectures, replay settings, and seeds. Measure both return and estimated-value bias on tasks where rollout-based value estimates are available. Record target-update settings because they influence how distinct selection and evaluation errors become.

Example application

Improve value estimation in a discrete navigation or game task. The example deliberately makes online and target argmax actions differ, exposing how Double DQN produces a different target from ordinary target-network maximization.

Interpretation / pitfalls

Watch out

A smaller estimated Q-value is not by itself better; overcorrection can cause underestimation. Target-network sharing does not create independent statistical samples. Action-selection bugs that maximize the target network again silently revert to standard DQN.

Python and R code examples

Scope: computational component described in the application subsection; not a complete estimator, neural trainer, or environment loop. Dependencies/validation: Python with NumPy executed successfully; base R not executed. Targets and supplied network outputs are ordinary arrays here, so this does not validate automatic-differentiation boundaries.

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Component demo, not a trained model — computational component described in the application subsection; not a complete estimator, neural trainer, or environment loop. · needs numpy

import numpy as np
online_next=np.array([[3.,1.],[.2,.8]])
target_next=np.array([[1.,4.],[2.,.5]])
selected=online_next.argmax(axis=1)
double_target=np.array([1.,0.])+.9*target_next[np.arange(2),selected]
dqn_target=np.array([1.,0.])+.9*target_next.max(axis=1)
assert np.any(double_target!=dqn_target); print(double_target,dqn_target)
R

Component demo, not a trained model — computational component described in the application subsection; not a complete estimator, neural trainer, or environment loop.

online_next <- matrix(c(3,1,.2,.8),2,byrow=TRUE)
target_next <- matrix(c(1,4,2,.5),2,byrow=TRUE)
selected <- max.col(online_next,ties.method="first")
double_target <- c(1,0)+.9*target_next[cbind(1:2,selected)]
dqn_target <- c(1,0)+.9*apply(target_next,1,max)
stopifnot(any(double_target!=dqn_target)); print(double_target); print(dqn_target)

Sources

From the CodeSplash reference, entry DRL002.