Target Networks

DQN learns by bootstrapping: it updates one prediction using another prediction. The online network predicts Q(st,at;θ)Q(s_t,a_t;\theta), and the target includes a future value estimate for st+1s_{t+1}.

If the same network supplies both sides, the target changes every time the network learns. The agent is then chasing a target that moves because of its own last update.

DQN stabilizes this by keeping two networks. The online network, Q(s,a;θ)Q(s,a;\theta), is updated by gradient descent. The target network, Q(s,a;θ−)Q(s,a;\theta^-), is copied from the online network only every CC steps.

  • Online network: Q(s,a;θ)Q(s,a;\theta)
  • Target network: Q(s,a;θ−)Q(s,a;\theta^-)
  • Copy step: periodically update θ−←θ\theta^-\leftarrow\theta

The target network appears in the Bellman target:

yt=rt+1+γmax⁡a′Q(st+1,a′;θ−)y_t = r_{t+1} + \gamma \max_{a'} Q(s_{t+1},a';\theta^-)

Only the prediction Q(st,at;θ)Q(s_t,a_t;\theta) is directly trained on the current gradient step. The target network creates a slower reference point for the future-value estimate.

Equation walkthrough

Theta moves quickly; theta-minus moves slowly

Click the pieces to see why DQN separates the trained network from the network used inside the target.

=+·
is trained towardwith occasional

Target-network estimate

slower reference point

The target network supplies the future-value estimate. Because theta-minus is copied only occasionally, the target is less jumpy.

Terms

Target networks stabilize bootstrapping by slowing down the future-value term inside yt.

Target networks

The target network makes the Bellman target less jumpy

Move through training steps. Compare the target you would get from the online network with the target DQN actually uses from the copied network.

yt=rt+1+γmaxa′Q(st+1, a′; θ−)

If target used online Q

1.64

1.00 + 0.90 x 0.71

DQN target uses theta-

1.36

1.00 + 0.90 x 0.40

Online next Q

0.71

Target next Q

0.40

Copy event

no

At step 2, the online estimate is 0.71. The copied target estimate is 0.40, so the Bellman target DQN trains against is 1.36. No copy happens here, so theta- stays fixed while the online network keeps moving.
Checkpoint

In standard DQN, why is θ−\theta^- used inside the target yty_t?