Exercises — Target networks
Before symbols fly, one reminder of the cast (every symbol earned):
L1 — Recognition
Exercise 1.1
State the TD target used with a target network, and say which network's weights appear inside it.
Recall Solution
What we want: just recall the formula. The weights inside are — the target (frozen) network, not the online . That is the whole point: the label must not shift when we nudge .
Exercise 1.2
True or false: "Gradient descent flows through during a DQN update." Justify in one line.
Recall Solution
False. We treat as a constant. The gradient is and (which contains ) is held fixed — no derivative is taken w.r.t. .
Exercise 1.3
Name the two ways to update and write each rule.
Recall Solution
- Hard update: every steps.
- Soft update (Polyak): with .
L2 — Application
Exercise 2.1
Given , , and the target network outputs over three actions. Compute .
Recall Solution
Step 1 — pick the max (WHY): the Bellman backup uses the best future action value, so we take . We use the frozen net so the label won't drift while we fit. Step 2 — discount and add reward:
Exercise 2.2
Continuing 2.1, the online net currently outputs . Compute the TD error and say which way moves under gradient descent.
Recall Solution
TD error . Since the error is positive, the target is above the prediction, so gradient descent increases toward . Crucially does not change this step (it depends only on ).
Exercise 2.3
Soft update with , online weight , target weight . Compute the new .
Recall Solution
It creeps only toward — the target moves slower ().
Exercise 2.4
is terminal. With , , and the same , compute .
Recall Solution
WHY: a terminal state has no successor, so the Bellman backup drops the future term entirely. The frozen net is not even queried.
L3 — Analysis
Exercise 3.1
In the soft update, show that after steps (holding constant at value ) the weight the old target carried decays as . Then find how many steps it takes for that memory to fall to when .
Recall Solution
Step 1 — unroll (WHAT & WHY): starting from and holding fixed, Applying the same rule again: By induction the coefficient on is — an exponential moving average. This is why we call the soft update an EMA. Step 2 — half-life: solve with : So the target "half-forgets" its old value after about steps. Effective memory steps — same order of magnitude.
Exercise 3.2
Explain, in terms of a moving goal-post, why sharing between target and prediction can prevent the TD error from shrinking. Reference the figure.

Recall Solution
The picture: the black dashed line is the ideal fixed target; the red curve is which also rises as rises because it shares . When you push the prediction up to close the gap, the target slides up too — you are chasing a goal-post you yourself pushed forward. The vertical red gap need not shrink. Formally: the coupled update is Because , the map need not be a contraction (a step need not bring you closer to the fixed point). Freezing at makes locally → ordinary supervised regression → stable.
Exercise 3.3
Hard update with period . Just after a copy at step , is the online net's target guaranteed constant until ? What quantity in could still differ between two updates?
Recall Solution
Yes for the network weights: is literally unchanged for steps, so the function is fixed. But can still differ across updates because also depends on the transition sampled from Experience Replay. Different mini-batch samples → different → different . Stability means the labeling function is frozen, not that every label is the same number.
L4 — Synthesis
Exercise 4.1
Write the Double DQN target and, with , , online outputs and target outputs , compute . Compare it to the plain target-network value .
Recall Solution
Double DQN target (WHY): the online net selects the action, the target net evaluates it — this decouples selection from evaluation to cut over-estimation: Step 1 — select with online: of is action index (the ). Step 2 — evaluate with target: target net's value at that action is . Compare plain: plain target net uses of the target outputs , giving Double DQN's : it refuses to reward the target net's own optimistic pick, reducing overestimation. See Double DQN.
Exercise 4.2
For DDPG/TD3/SAC we use soft updates. Suppose two independent weights track online values from targets with . Compute the new vector.
Recall Solution
Apply componentwise :
- Component 1: .
- Component 2: . These continuous-control algorithms (DDPG, TD3, SAC) prefer this smooth creep over abrupt copies.
L5 — Mastery
Exercise 5.1
The two-timescale story requires the online learning rate and the target rate (or ) to satisfy a ratio going to zero. State the condition and explain, in one sentence each, what breaks at the two extremes and .
Recall Solution
Condition: the target must move on a slower timescale, i.e. (target rate online rate). Then Two-Timescale Stochastic Approximation guarantees the fast online net effectively sees a quasi-static target and converges.
- : = always → no target network → we are back to chasing our own tail (the Deadly Triad bites: bootstrapping + off-policy + approximation → oscillation/divergence).
- : is frozen forever → the online net regresses to a target that never improves → learning stalls at a stale value.
Exercise 5.2
Design task. You observe divergence in a DQN. You suspect the effective target memory () is too short relative to the online net's learning speed. Currently . You want to triple the effective memory. What new do you set, and what is the new half-life (steps to forget half)?
Recall Solution
Step 1 — effective memory: memory . Current steps. Tripling → steps → set . Step 2 — half-life at new : So the new target half-forgets after steps, roughly slower than before (old half-life steps).
Exercise 5.3
Prove/derive. Show that a soft update with rate applied every step is, in expected drift, comparable to a hard update every steps when . Reference the figure.

Recall Solution
The picture: the red staircase is the hard update (jumps of full size every steps); the black smooth curve is the soft EMA (tiny steps every step). Both reach the online value over a comparable horizon. Argument: hold constant at a new value ; the old target value is . Under soft updates the gap to after steps is Setting and using for small : after soft steps roughly of the gap is closed — the target has "mostly caught up" over exactly the horizon , which is precisely when a hard update would have copied it fully. Hence the timescales match at .
Connections
- Deep Q-Networks (DQN) — home of the hard-update target net.
- Double DQN — Exercise 4.1's decoupled selection/evaluation.
- Experience Replay — supplies the varying behind Exercise 3.3.
- Bellman Equation — the backup being frozen.
- DDPG / TD3 / SAC — soft-update users (Exercise 4.2).
- Deadly Triad — what target nets tame (Exercises 3.2, 5.1).
- Two-Timescale Stochastic Approximation — theory for Exercise 5.1.