Visual walkthrough — Target networks
Everything below is built from scratch. If you have never seen a Q-value, a gradient, or the letter , start at Step 1 and don't skip.
Step 1 — What is , really? A number pinned to a picture
WHAT. We have an agent (a little robot) sitting in a state — think "which square of a grid I'm standing on". From that square it can take an action — "go left", "go right". A number called is our guess of how good it is to take action from state , counting all future reward.
WHY this number. To act well the robot must compare actions. If and , "right" looks better. That single number is the whole basis of the decision.
PICTURE. Look at the figure: three squares (states), and from the middle square two arrows for two actions. Each arrow carries its number. The taller the bar, the more promising the action.

Step 2 — Where should point? The Bellman target
WHAT. After taking , the robot gets an immediate reward (a small payout) and lands in a next state . From the best it can do is the largest over next actions, written . The Bellman rule says a correct must satisfy:
WHY these pieces. is what you actually earned this step. But good moves also set up good futures, so we add the best value reachable next. (a number between and , e.g. ) shrinks future reward a little — a dollar tomorrow is worth slightly less than a dollar today. We use because the robot will later act greedily, so we assume the best next move.
PICTURE. The figure shows the "one-step lookahead": current square → reward arrow → next square → the tallest next-action bar. Stack them and you get , the number should equal.

Step 3 — Turning "should equal" into a loss to minimise
WHAT. Right now (our prediction) probably does not equal (our target). The gap between them is the error. To measure it fairly (positive or negative gaps both count) we square it:
WHY squared. Squaring makes the error always positive and punishes big misses more than small ones. The bottom of this bowl-shaped curve is where prediction = target. Training means rolling downhill.
WHY this tool (gradient). To roll downhill we need the gradient — the arrow pointing in the direction should move to increase . We step the opposite way to decrease it. This is the only tool that tells us which way to nudge thousands of knobs at once.
PICTURE. The figure draws as a parabola in the prediction value: the target sits at the bottom; today's prediction sits up the wall; the arrow shows the downhill nudge.

Step 4 — The trap: the target moves when you shoot
WHAT. Here is the subtle disaster. The target is — it is built from the same knobs as the prediction. So when a gradient step changes to lower 's error, it also changes — the target itself shifts.
WHY it hurts. You aim, you shoot, and the bullseye slides — often in the same direction, because both sit on the shared knobs. The error may refuse to shrink; the update is not guaranteed to contract the gap. Combined with bootstrapping and off-policy data (the "Deadly Triad"), this can oscillate or diverge.
PICTURE. The figure animates the tail-chase: the archer (prediction) steps toward the target, but an arrow shows the target being dragged along by the very same step. The gap barely closes.

Step 5 — The fix: a second, frozen set of knobs
WHAT. Keep two copies of the network:
- Online network — the learner, nudged every step.
- Target network — a lagged copy, used only to build the target.
The target now reads:
and we do not let gradients pass through — we treat it as a plain constant. So:
WHY it works. Because is built from frozen , it does not move when we nudge . The bullseye is nailed down. Locally the problem becomes ordinary supervised regression toward a fixed label — and that is stable.
PICTURE. Two boxes: the online box glowing (updating), the target box greyed/frozen. A dashed one-way arrow shows feeding the target , and a red "no-gradient" barrier blocking backflow into .

Step 6 — Two ways to refresh the frozen copy
WHAT. A permanently frozen would learn nothing new. So we refresh it, but slowly. Two recipes:
Hard update (periodic copy) — original DQN: Snap the copy over every steps; freeze in between.
Soft update (Polyak averaging) — DDPG / TD3 / SAC: Every step, drag a hair's-breadth toward .
WHY two shapes. Hard update is dead simple (a big jump now and then). Soft update spreads the same motion across every step, so never jumps — it glides. Both keep the target slow.
PICTURE. The figure plots the online knob wandering (jagged plum line) and, over it, the two target behaviours: the hard copy as a staircase that jumps every steps, the soft copy as a smooth lagging curve (an exponential moving average).

Step 7 — Why soft update is an exponential memory
WHAT. Unroll the soft rule assuming barely changes. After steps, an old target value keeps weight , which shrinks toward zero. So remembers roughly the last values of .
WHY it matters. With , the target has an effective memory of about steps — the online net can jitter step-to-step while the target sees only a smoothed average. That smoothing is the stability. Two limits sanity-check it:
- : the sum collapses to just — target = online, no target network at all (back to Step 4's trap).
- : nothing ever updates — the target is frozen forever.
PICTURE. The figure draws the decaying weights as shrinking bars — recent counts a lot, old fades — with marked as the "memory length".

Step 8 — Edge cases you must never miss
WHAT. Two boundary situations change the formula:
-
Terminal state. If ends the episode, there is no future, so the target drops its bootstrap term entirely:
-
Double DQN correction. The plain tends to overestimate (it always grabs the luckiest noisy value). Double DQN splits the job: the online net chooses the action, the target net scores it:
WHY. Forgetting the terminal mask injects imaginary future reward — a classic silent bug. And plain bias and target-instability are different diseases; the target network cures instability, Double DQN cures overestimation. They stack.
PICTURE. The figure splits into two panels: left, a terminal square with a "wall" so no next-value flows (); right, the Double-DQN handoff — online net's finger points at an action, target net stamps its value on it.

Worked numbers (matching the parent)
The one-picture summary
Everything compresses into this: a fast online loop learning against a slow, frozen target that is only occasionally (hard) or gently (soft) refreshed — the archer hitting a still bullseye.

Recall Feynman: the whole walkthrough in plain words
We taught a robot to score its moves with a number . The "right" score comes from the Bellman rule: cash now plus the best value later. But that right answer is computed from the same brain we're training — so every time we adjust the brain, the answer we're chasing also shifts. It's archery where your own shot drags the target. Solution: keep a second, older copy of the brain that we don't touch, and let it define the target. Now the bullseye holds still, so practice actually improves aim — ordinary regression, nice and stable. Every so often we copy the fresh brain into the old one (a big snap = hard update, or a tiny nudge every step = soft update). Tiny nudges give the old brain a long, smoothed memory, so the target glides instead of jumping. Two special cases: at the end of an episode there's no future, so the target is just the cash (); and if we want to stop the from being an over-optimist, we let the new brain pick the move and the old brain grade it (Double DQN). Freeze, regress, no backflow, then gently copy — FRO-ZEN.
Connections
- Deep Q-Networks (DQN) — home of the hard target update.
- Experience Replay — the other DQN stabiliser.
- Bellman Equation — supplies the target we freeze.
- Double DQN — the overestimation fix stacked on top.
- DDPG / TD3 / SAC — use soft (Polyak) target updates.
- Deadly Triad — the instability target nets tame.
- Two-Timescale Stochastic Approximation — the convergence theory.