L(θ)=E(s,a,r,s′)∼D[(r+γmaxa′Qθ−(s′,a′)−Qθ(s,a))2]
\nDerivation:
1. The Bellman optimality equation gives the TD target
y=r+γmaxa′Qθ−(s′,a′): the
target network θ− (hard copy every
C steps or Polyak averaging
θ−←τθ+(1−τ)θ−) freezes the target so bootstrapping becomes regression onto a constant, removing oscillations;
2. Differentiating w.r.t.
θ:
∇θL=−2E[(y−Qθ(s,a))∇θQθ(s,a)] — the target
y does not backpropagate;
3.
Experience replay D stores
(s,a,r,s′) and samples uniformly, breaking the strong temporal correlation of consecutive samples and enabling reuse and stable batch training;
4.
Double DQN corrects overestimation: the
max operator is positively biased since
E[maxXi]≥maxE[Xi] (max is convex; Jensen), and noise + bootstrapping compounds the error — overestimated actions get chosen again. Double DQN decouples
action selection from evaluation:
y=r+γQθ−(s′,argmaxa′Qθ(s′,a′)) — the online network picks the action, the target network scores it, substantially reducing the bias.