Intuition The ONE core idea
To teach a network good "move-scores," we ask it to match a target that is built from its own current guesses — like aiming at a bullseye that jerks every time you shoot. A target network is a slow-moving frozen copy of the network that holds the bullseye still long enough to actually hit it.
This page assumes you know nothing . Before you read the parent note we will earn every symbol it throws at you — s , a , r , γ , Q , θ , max , ∇ , τ — one at a time, each tied to a picture.
Reinforcement learning is about an agent (a decision-maker) living in an environment . At each moment it sees where it is, does something, and gets a numeric score. That is all.
s
s = a snapshot of the situation the agent is in right now. Plain words: "everything the agent can see at this instant."
Picture: a single square on a board game, or a single frame of a video game.
Why the topic needs it: every value the network predicts is about a particular state . Without s there is nothing to score.
a
a = a choice the agent can make from the current state (move left, jump, fire...).
Picture: an arrow leaving the current square toward a possible next square.
Why: the network scores actions , so a is half of every question we ask it.
r
r = a single number the environment hands back right after an action: how good that immediate step was (points gained, + 1 for winning, − 1 for dying).
Picture: a little green + 1 coin popping up when you make a move.
Why: rewards are the ground truth — the only honest signal telling us what "good" means.
s ′
s ′ (read "s-prime") = the state you land in after doing action a in state s . The apostrophe just means "the next one."
Picture: the square the arrow points to .
Why: to judge an action we must peek at where it takes us — that peek is what causes all the trouble later.
Look at the figure: state s (blue), an action-arrow a (orange) carrying a reward r (green coin), landing in next state s ′ (blue). This four-piece unit ( s , a , r , s ′ ) is called a transition — the atom of everything below.
We do not just want the immediate reward — a move that scores + 1 now but leads to disaster is bad. We want the total future score . Two symbols make that precise.
Definition The discount factor
γ
γ (Greek "gamma") is a number between 0 and 1 that shrinks future rewards. A reward k steps away is multiplied by γ k .
Picture: a row of coins fading to grey the further into the future they are — near coins bright, distant coins dim.
Why this tool and not another? We need a way to say "future matters, but less than now" AND to keep the sum finite. Multiplying by a fraction each step does both: γ = 0.9 means a reward 10 steps away counts as only 0. 9 10 ≈ 0.35 of its face value. A plain sum would blow up to infinity; a hard cutoff would be arbitrary. Geometric shrinking is the natural, smooth answer.
Definition The action-value
Q ( s , a )
Q ( s , a ) = "how much total (discounted) future reward do I expect if I take action a in state s , then play well afterwards?" The letter Q stands for Q uality.
Picture: a number floating over each outgoing arrow — the arrow's "worth."
Why: if we know Q for every action, choosing is trivial — pick the arrow with the biggest number. Learning Q is the whole game.
Definition The greedy max:
max a ′ Q ( s ′ , a ′ )
Read "the largest Q -value over all possible next-actions a ′ available in state s ′ ." The symbol max just means "take the biggest of these numbers." Here a ′ ranges over the actions available in the next state .
Picture: in s ′ several arrows leave, each with a number; max circles the highest one.
Why this tool? After landing in s ′ we assume we will play well — and playing well means taking the best action. "Best" = biggest Q = max . That is exactly what "then play well afterwards" translates into.
Here is the elegant trick (the Bellman Equation , covered fully there): the value of now equals the reward now plus the discounted value of the best next step .
Intuition Why this is the seed of all trouble
Look at y : it contains Q . So the target we want to hit is made out of the same scores we are trying to learn . Adjust the scores → the target moves. This "chasing your own tail" is precisely what the target network exists to cure. Every symbol below exists to describe and fix this loop.
For tiny games we could store Q ( s , a ) in a spreadsheet. Real games have billions of states, so we use a neural network to approximate Q — a function with tunable knobs.
Definition The parameters
θ
θ (Greek "theta") = the big bag of tunable numbers (weights) inside the network. Writing Q ( s , a ; θ ) means "the network's score for ( s , a ) , using the current knob settings θ ."
Picture: a control panel full of dials; turning the dials changes every output number.
Why the notation: we must be able to say which knob-setting produced a value — because the fix (target networks) uses two different settings at once .
Definition The frozen copy
θ −
θ − (read "theta-minus") = a saved, older snapshot of the knobs, kept aside and updated only slowly. The minus is just a label meaning "the lagged one."
Picture: a photograph of the control panel taken a while ago, taped next to the live panel.
Why: if the target is computed from this frozen photo, it holds still while the live panel learns — the bullseye stops jerking.
The figure shows the two panels: the live online network θ (updated every step, orange) and the frozen target network θ − (blue). Targets are computed from the blue panel.
L ( θ )
L ( θ ) = how wrong the network is , as one number. We use the squared error : ( y − Q ( s , a ; θ ) ) 2 — the gap between what we aimed for (y ) and what we said (Q ), squared.
Picture: a vertical red bar between the target dot and the prediction dot; its length-squared is the loss.
Why squared? Squaring makes every error positive (so over- and under-shoots don't cancel), punishes big mistakes more, and gives a smooth bowl-shaped landscape that is easy to roll downhill on.
∇ θ
∇ θ L (the "nabla" or gradient) = the arrow pointing in the direction that increases L fastest , one component per knob. We step the opposite way to shrink L .
Picture: standing on a hillside of loss; ∇ points straight uphill, so we walk downhill.
Why this tool? With millions of knobs we cannot try settings one-by-one. The gradient tells us, for every knob at once, which way to nudge it — the only scalable way to learn.
Definition The learning rate
α
α (Greek "alpha") = step size : how far we move down the gradient each update.
Picture: the length of one footstep down the loss hill.
Why: too big and we leap past the bottom; too small and we crawl. Its relative size versus how fast θ − moves is the heart of the two-timescale argument in the parent note.
Common mistake The subtle point the whole topic hinges on
When the target uses the same θ as the prediction, the gradient ∇ θ L should account for the target moving too — and that feedback is what causes oscillation and divergence . By computing the target from frozen θ − , we pretend the target is a constant : no gradient flows through θ − . The loss becomes ordinary "match this fixed number" regression, which is stable.
Definition The Polyak factor
τ
τ (Greek "tau"), with 0 < τ ≪ 1 , controls how fast the frozen photo is refreshed: θ − ← τ θ + ( 1 − τ ) θ − . (≪ means "much less than.")
Picture: each step, the blue frozen panel takes one tiny step (τ of the way) toward the live orange panel.
Why: it lets the target drift smoothly instead of jumping. τ → 0 = frozen forever; τ → 1 = "always copy" (no target network at all). Small τ ≈ 0.005 means the target has a memory of about 1/ τ = 200 steps.
Worked example Sanity-check the soft update
τ = 0.01 , live θ = 10 , frozen θ − = 4 :
θ new − = 0.01 ( 10 ) + 0.99 ( 4 ) = 0.1 + 3.96 = 4.06
The frozen value crept only 0.06 toward the live value — about 100 × slower. That slowness is the stability.
Greedy max over next actions
Gradient nabla and step alpha
Test yourself — reveal only after answering.
What does a transition ( s , a , r , s ′ ) mean in plain words? From situation s , took choice a , got score r , landed in situation s ′ .
Why multiply future rewards by γ each step? To value the future less than now AND keep the total finite; a reward k steps away counts γ k of its face value.
What does Q ( s , a ) predict? The total discounted future reward from taking a in s and then playing well.
What does max a ′ Q ( s ′ , a ′ ) compute and why is it there? The best next-action value in s ′ ; it encodes the assumption that we play optimally after landing.
What is θ , and what is θ − ? θ = the live tunable knobs of the online network; θ − = a slowly-updated frozen snapshot used only to build targets.
Why square the error in the loss L ? Makes errors positive, penalises big mistakes more, and gives a smooth bowl to descend.
What does the gradient ∇ θ L tell us? The direction (per knob) that increases loss fastest; we step opposite to shrink it.
Does gradient flow through θ − ? No — it is treated as a constant, so the target is a fixed label.
What does τ control in the soft update? Tracking speed; small τ = slow drift (memory ∼ 1/ τ ), τ → 1 = always copy, τ → 0 = frozen forever.
Why does using the same θ for target and prediction cause trouble? The target y contains Q ( ⋅ ; θ ) , so updating θ moves the target you aim at — a feedback loop that can oscillate or diverge.
Hinglish version of the parent
Bellman Equation — supplies the self-referential target y .
Deep Q-Networks (DQN) — where these symbols all come together.
Experience Replay — the sibling stabiliser.
Double DQN — reuses θ and θ − for a different fix.
DDPG / TD3 / SAC — soft-update (τ ) users.
Deadly Triad — the divergence this all fights.
Two-Timescale Stochastic Approximation — the theory behind slow θ − .