Log inStart free
LESSON 17.09 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Baselines and variance reduction

Watch a baseline steady REINFORCE's noisy gradient without moving its average.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 17.09 · POLICY GRADIENT BAYEPISODE 1 · 25 STEPS · G₀ 22.22
01
Stage 1 of 6 · Returns
Episode 1 lasts 25 steps. Every return is positive, so REINFORCE raises every push it took.
Explain it simply

This is the first episode from the REINFORCE lesson. Each blue bar is the return from that step on. Every reward is plus 1, so every bar is above zero. Each push gets pushed up, and only the bar heights tell the good pushes from the bad ones.

25 return bars over the steps of episode 1, all above zero, with a push tick under each step.

pushes, turn speedbaselinegradient partsreturns, lengths
episode 125 steps, w = 0, p(right) = 0.50 at every step−1001020push: up = right, down = lefteach step's part of the turn speed estimatet 0t 5t 10t 15t 20turn speed estimate, b = 0none21.96episode 125 steps, w = 0, p(right) = 0.50 at every step−1001020push: up = right, down = lefteach step's part of the turn speed estimatet 0t 5t 10t 15t 20turn speed estimate, b = 0none21.96
Toy: the 17.C2 cart-pole, 100-step cap, seed 1708
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
Gt=∑k=tT−1γ k−trkorG0 at every step\sy{G}{out}{G_t} = \sum_{k=t}^{T-1} \gamma^{\,k-t} r_k \quad\text{or}\quad \sy{G}{out}{G_0}\ \text{at every step}
G0=22.22,G24=1.00,γ=0.99G_0 = 22.22,\quad G_{24} = 1.00,\quad \gamma = 0.99

A step's return adds the discounted rewards from that step on.

Common mix-ups

MYTHSubtracting a baseline changes where the gradient points on average.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With returns from step t, what happens to each spread at 16 episodes per update instead of 4?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.