Before this lesson: returns, Vπ,Qπ and the advantage
(lesson 01); Monte Carlo returns
(lesson 04); the score-function gradient
estimator (calculus 12); the chain rule
(calculus 04); softmax
(foundations 05); stochastic gradient ascent
(optimization 05).
Time: about 75 minutes, plus the notebook.
Value-based methods (lesson 05 and
lesson 06) need a max over actions. That is
hard when the actions are continuous (the torques of a robot arm) or very many (all next tokens of a
language model). Policy gradients work in both cases, they can learn stochastic policies, and they
need no derivative of the reward: the reward can come from a simulator, a game result, a unit test or a
human rating.
Actor-critic methods and PPO (lesson 08 and
lesson 09) are REINFORCE plus a learned baseline
and a better estimate of the advantage.
RL for language models. RLHF with PPO, and the critic-free methods RLOO and GRPO, all start from
the score-function gradient of this lesson. They differ in the baseline.
AlphaGo trained its policy network by self-play with a policy gradient (Silver et al., 2016).
Neural architecture search (Zoph and Le, 2017) and sequence-level training of captioning models
(self-critical sequence training, Rennie et al., 2017) use REINFORCE with a baseline.
A parameterized policyπθ(a∣s) gives a probability for every action, and it is
differentiable in the parameters θ. Two families cover most uses.
Softmax policy (discrete actions). A function hθ(s,a) gives a score, called a logit or a
preference, to every action. The policy is the softmax of the logits:
πθ(a∣s)=∑bexphθ(s,b)exphθ(s,a).
In the tabular case hθ(s,a)=θ(s,a): one number per state–action pair. With features,
hθ(s,a)=θ⊤x(s,a); in deep RL, a network outputs the logits.
Gaussian policy (continuous actions). A function μθ(s) gives the mean action, and the
action is a∼N(μθ(s),σ2). The standard deviation σ is fixed, or it is a
learned parameter (usually through logσ, so that σ>0).
The objective is the expected return from the start, J(θ). We do gradient ascent:
θ←θ+η∇J, with a learning rate η and an estimate
∇J of the gradient.
Take one state and K actions with fixed rewards ra (a bandit, lesson 03).
The objective is the expected reward
J(θ)=a∑πθ(a)ra.
Its gradient is ∇J=∑a∇πθ(a)ra. This sum is not an expectation, so we
cannot estimate it from samples of a. The log-derivative trick fixes this. Since
∇logπ=∇π/π, we have ∇π=π∇logπ, and
∇J=a∑πθ(a)∇logπθ(a)ra=Ea∼πθ[∇logπθ(a)ra].
Now the gradient is an expectation over actions from the policy itself. Sample a∼πθ, look
at the reward, and ∇logπθ(a)ra is an unbiased estimate of ∇J. We never
need to know how r depends on a.
The vector ∇θlogπθ(a) is the score of action a. It is the direction in
parameter space that makes a more likely, fastest. The reward says how much we want that.
The softmax score. For π=softmax(θ), write
logπa=θa−log∑beθb. Differentiate with respect to θi:
the first term gives ∂θa/∂θi=1 if i=a and 0 otherwise;
the second term gives eθi/∑beθb=πi;
so ∂logπa/∂θi=1[i=a]−πi, that is,
∇θlogπθ(a)=ea−π,
the one-hot vector of a minus the probability vector. It raises the logit of a and lowers every logit
in proportion to its probability. Its entries add up to 0.
Interactive figure: loading…
Drag the logits θ1,θ2,θ3, then press Sample. The bars are the policy
π and the rewardsr=(1,0,2). The plane shows gradient
vectors (all of them have entries that add up to 0, so they lie in a plane). Each
orange pointga=(ra−b)(ea−π) is one possible REINFORCE sample; its
area is its probability πa. The black arrow is the exact gradient ∇J, and the dashed orange
arrow is the mean of your samples. Move the baseline b: the points move, the black arrow does not, and
the variance in the readout changes.
Quick check
A softmax policy over 3 actions has π=(0.5,0.3,0.2). You sample action 2. What is the score ∇θlogπθ(2)?
Why.
The softmax score is ea−π=(0,1,0)−(0.5,0.3,0.2)=(−0.5,0.7,−0.2). It raises the logit of the sampled action and lowers the other logits in proportion to their probabilities. The entries add up to 0. (0,0.7,0) forgets that the other logits also change the normalization.
Read the first one as a picture. A sample a to the right of μ has a positive score: making it more
likely means moving μ to the right. The REINFORCE term σ2a−μr(a) moves μ
toward samples with high reward. If μ=μθ(s) is the output of a network, the chain rule
gives ∇θlogπ=σ2a−μ∇θμθ(s), and autodiff does this for you.
Interactive figure: loading…
Press "Sample 20 actions". The aqua curve is the reward r(a), and the
orange area is the policy N(μ,σ2). Each orange dot is a sampled action
on the reward curve. Under the axis, each violet arrow is that sample's push on
μ,σ2a−μ(r(a)−b). Then press "Gradient step" a few times and watch μ climb
to the peak. Turn on the baseline b=J(μ,σ): the arrows change a lot, their mean does not.
Quick check
A Gaussian policy has μ=1 and σ=0.5. You sample a=1.5 and get reward r=3. What is this sample's REINFORCE term for μ (no baseline)?
Why.
The score is (a−μ)/σ2=0.5/0.25=2, and the term is 2⋅3=6. It is positive, so this sample pushes μ to the right, toward the action that earned the reward. A common slip is to divide by σ instead of σ2, which gives 3.
An episode, or trajectory, is τ=(s0,a0,r0,s1,a1,r1,…), where rt is the reward
after (st,at) (Sutton and Barto write Rt+1; see lesson 01).
Under the policy πθ its probability is
pθ(τ)=p0(s0)t∏πθ(at∣st)P(st+1∣st,at),
with the start-state distribution p0. The objective is the expected discounted return from the start:
J(θ)=Eτ∼pθ[t≥0∑γtrt]=s∑p0(s)Vπθ(s).
Two more objects:
the reward-to-go (the return from step t),Gt=∑k≥tγk−trk;
the discounted state visitationdπ(s)=∑t≥0γtPr(st=s). It is not normalized:
it adds up to E[∑tγt], not to 1. The normalized version is (1−γ)dπ when γ<1
and episodes never end.
Assumptions. Finite state and action sets, bounded rewards, and πθ(a∣s) differentiable
in θ. To keep the proof short, every episode ends after at most H steps (H may be huge); then
all sums are finite, and we may exchange ∇ and ∑. A limit argument extends the result to
episodes of unbounded length when γ<1 or when the episode ends with probability 1 and has a finite expected length.
Only the middle sum depends on θ, so ∇logpθ(τ)=∑t∇logπθ(at∣st).
No model of P is needed. Together with step 2:
∇J=E[∑t∇logπθ(at∣st)∑kγkrk].
4. Causality. Take a pair k<t: the reward rk came before the action at. Condition on the
history ht=(s0,a0,r0,…,st). Given ht, the reward rk is fixed, and
So E[∇logπθ(at∣st)rk]=E[rkE[∇logπθ(at∣st)∣ht]]=0.
Drop all these pairs. What remains for step t is ∑k≥tγkrk=γtGt:
∇J=E[t∑γt∇logπθ(at∣st)Gt].
5. Replace Gt by Qπ. Condition on ht and at. By the Markov property,
E[Gt∣ht,at]=Qπ(st,at), and the score is fixed given ht,at. The tower rule gives the first form of the theorem.
6. The visitation form. Write the expectation at step t as a sum over st=s and at=a:E[γt∇logπ(at∣st)Qπ(st,at)]=γt∑sPr(st=s)∑aπ(a∣s)∇logπ(a∣s)Qπ(s,a).
Use π∇logπ=∇π and sum over t:∑tγtPr(st=s)=dπ(s).■
The surprising part: changing θ also changes which states the agent visits, but the gradient
has no term ∇dπ. All of that effect is inside Qπ. This is why the gradient can be
estimated from episodes without a model.
Interactive figure: loading…
Click a step t. The top row shows the actions at of one episode, the second row the
rewards. The bracket shows which rewards multiply the score
of the selected step. In the "full return" mode all rewards count; in the "reward-to-go" mode the
rewards before t are dropped (step 4 of the proof: their term has mean 0). In this toy problem every
step is an independent coin with π(a=1)=p and reward rt=at. The chart shows the exact
variance of the three estimators. Their means are all equal.
Quick check
Which of these does REINFORCE need to compute its gradient estimate from one episode?
Why.
In logpθ(τ) the transition terms do not depend on θ, so they vanish from the gradient (step 3). The reward enters only as a number that weights the score, so it need not be differentiable. And the theorem has no ∇dπ term: the effect of θ on the visited states is already inside Qπ.
Replace the expectation in step 4 by one sampled episode. This is REINFORCE (Williams, 1992).
The factor γt. It comes from the proof and is needed for an unbiased gradient of the
discounted objective. Most implementations drop it and use ∑t(Gt−b(st))∇logπθ(at∣st).
Then late steps count as much as early ones. This update is not the gradient of J; Nota and Thomas
(2020) show that it is in general not the gradient of any function. It still works well in practice,
and it is closer to what we usually want: good behaviour in every state, not only near the start.
So Gt−b(st) can replace Gt at every step: condition on st as in step 4 of the proof, and the
extra term has mean 0. Only the variance changes.
Why the variance falls. Suppose every return is about −50±2. Without a baseline, every sampled
action gets the weight ≈−50: each update pushes the sampled actions down with a big weight, and
only the small differences between episodes tell good from bad. The noise in "which action happened to be
sampled" is multiplied by 50. Subtract b≈−50, and the weights become ≈±2: an action is
pushed up if it did better than usual and down if it did worse.
The natural choice is b(s)=Vπ(s). Then Gt−Vπ(st) is an estimate of the
advantageAπ(st,at)=Qπ(st,at)−Vπ(st): how much better the action was than the
policy's average in that state. Given the state, the advantage has mean 0. Learning Vπ with a second
model gives the actor-critic methods of lesson 08.
A baseline must not depend on the action. With b(s,a) the lemma fails:
∑a∇π(a∣s)b(s,a) is in general not 0, and the estimate is biased. (Methods that use
action-dependent control variates add a correction term to remove this bias.)
Quick check
You use the baseline b(st,at)=Q(st,at), a learned estimate of the action value, in REINFORCE. What happens?
Why.
The lemma uses ∑a∇π(a∣s)b(s)=b(s)∇∑aπ(a∣s)=0. This works only because b can move outside the sum over actions. With b(s,a) it cannot, and ∑a∇π(a∣s)b(s,a)=0 in general. Here the term would even cancel most of the signal: Gt−Q(st,at) has mean about 0 for every action.
The variance-optimal constant baseline
Take the one-step problem with score sa=∇logπ(a) and a constant baseline b. The total
variance of g^=(ra−b)sa is E[(ra−b)2∥sa∥2]−∥∇J∥2, because the mean
does not depend on b. Set the derivative in b to zero: −2E[(ra−b)∥sa∥2]=0, so
b∗=E[∥sa∥2]E[∥sa∥2ra].
It is a weighted average of the rewards, with weights ∥sa∥2. It equals J=E[ra] when every
action has a score of the same length (as in the worked example below), and it differs from J in
general. In practice b(s)≈Vπ(s) is used: it is close to optimal and easy to learn. The
"best constant b" button in the first figure computes b∗.
The softmax score in state s′ only involves the row θ(s′,⋅):∂logπ(a′∣s′)/∂θ(s,a)=1[s′=s](1[a′=a]−π(a∣s)).
Insert this in the visitation form, written with ∇π=π∇logπ:∂J/∂θ(s,a)=dπ(s)∑a′π(a′∣s)(1[a′=a]−π(a∣s))Qπ(s,a′).
The sum is π(a∣s)Qπ(s,a)−π(a∣s)∑a′π(a′∣s)Qπ(s,a′)=π(a∣s)(Qπ(s,a)−Vπ(s)).■
Read the three factors: how often (and how early) we visit s; how likely a is now; how much better a
is than the average action in s. Two consequences. The gradient of row s adds up to 0 (the
advantages, weighted by π, add up to 0). And when π(a∣s) is almost 0, the gradient for a good
action a is almost 0 too: a softmax policy that is nearly deterministic in the wrong direction escapes
very slowly (Mei et al., 2020). The notebook checks this formula against finite differences.
Policy gradients can make the policy deterministic too early, before it has explored. A common fix adds
the entropyH(π(⋅∣s))=−∑aπ(a∣s)logπ(a∣s)
(information theory 01) of the visited states to the
objective, with a small weight ce. For a softmax, ∂H/∂θa=−πa(logπa+H):
it raises the logits of rare actions and lowers those of frequent ones. A2C uses this bonus, and SAC makes
entropy part of the objective itself (lesson 08).
Why the best policy can be stochastic: the short corridor #
In an MDP where the agent sees the state, some optimal policy is deterministic
(lesson 01). With function approximation the agent
may not be able to tell states apart, and then this is no longer true. The short corridor (Sutton and
Barto, Example 13.1) shows it.
Three cells S, X, Y and a goal G on the right; the reward is −1 per step, γ=1.
In S and Y, "right" moves right and "left" moves left (left in S stays in S).
In X the actions are switched: "right" moves to S and "left" moves to Y.
All three cells have the same features, so the policy is the same in every cell: right with probability p.
"Always right" goes S → X → S → … and never ends. "Always left" stays in S forever. Both have value −∞.
A stochastic policy reaches the goal. Write the Bellman equations for the three cells
(lesson 01):
The first gives VS=VX−1/p. Put it into the second: (1−p)VX=−2+(1−p)VY, so VX=VY−2/(1−p).
Put that into the third: VY=−1+(1−p)VY−2, so pVY=−3 and VY=−3/p.
Back-substitute: VX=−3/p−2/(1−p) and
J(p)=VS=−p4−1−p2=p(1−p)2p−4.
Set J′(p)=0:2p(1−p)−(2p−4)(1−2p)=0 simplifies to p2−4p+2=0, so p∗=2−2≈0.586
(the other root is larger than 1). The value is J(p∗)=−(6+42)≈−11.66.
A greedy method over action values cannot represent this policy, but a policy-gradient method finds it.
Interactive figure: loading…
Predict the best p, then press "Run 100 episodes" a few times. The cells show the corridor;
X has switched actions. The first chart is J(p); the
aqua line marks p∗≈0.586. Each dot is the current policy of one REINFORCE
run, and the second chart shows p over episodes: orange runs use no baseline,
blue runs use a learned constant baseline. All runs start at p=0.1. Raise the step size
to see the runs without a baseline become unstable first.
Answers to section 1. (1) No. A constant is a state-independent baseline (with b=−100), so its
term has mean 0. The variance changes: here it grows, because every score is multiplied by a larger
number. (2) No. The transition terms vanish from ∇logpθ(τ) (step 3). We need only the
sampled rewards and the scores of the sampled actions. (3) No. Both deterministic policies never reach the
goal; the best policy goes right with probability 2−2≈0.586.
One step, three actions.θ=(0,0,0), so π=(1/3,1/3,1/3); the rewards are r=(1,0,2).
Step 1: the objective and the exact gradient.J=31(1+0+2)=1. From the corollary with one
state (d=1,A=r−J):∂J/∂θa=πa(ra−J), so
∇J=31(1−1,0−1,2−1)=(0,−31,31).
Step 2: the REINFORCE samples without a baseline. The sample for action a is ra(ea−π), drawn with probability 31:
action
ea−π
ra
sample ga
∥ga∥2
1
(32,−31,−31)
1
(32,−31,−31)
96
2
(−31,32,−31)
0
(0,0,0)
0
3
(−31,−31,32)
2
(−32,−32,34)
924
Mean: 31[(32,−31,−31)+(0,0,0)+(−32,−32,34)]=31(0,−1,1)=(0,−31,31) ✓.
The total variance (the sum of the variances of the three entries) is
E∥g∥2−∥∇J∥2=31⋅930−92=910−92=98.
Step 3: with the baseline b=J=1. The samples become (ra−1)(ea−π):
action
ra−1
sample ga
∥ga∥2
1
0
(0,0,0)
0
2
−1
(31,−32,31)
96
3
1
(−31,−31,32)
96
Mean: 31(0,−1,1), the same ✓. Total variance: 31⋅912−92=94−92=92.
The baseline removed 75% of the variance. Here every action has ∥ea−π∥2=32, so the
variance-optimal constant b∗ of the deeper box equals J=1.
Step 4: one gradient step. With η=1,θ←(0,−31,31), so
π≈(0.321,0.230,0.448) and J≈0.321+2⋅0.448=1.218. The best action (reward 2)
gained probability, and the worst lost it.
The short corridor. From section 3, J(0.5)=0.251−4=−12,J(0.1)=0.09−3.8≈−42.2,
and the best value is J(2−2)≈−11.66. A run that starts at p=0.1 must climb a steep
slope first; near p∗ the curve is flat, so the noise of the estimates matters most there.
NumPy checks the one-step example: the exact gradient against finite differences, and the mean and
variance of the REINFORCE samples with and without a baseline.
importnumpyasnpdefsoftmax(z):e=np.exp(z-z.max())returne/e.sum()r=np.array([1.0,0.0,2.0])theta=np.zeros(3)pi=softmax(theta)J=pi@rgrad=pi*(r-J)# exact gradient of J = sum_a pi_a r_aprint(grad.round(4))# [ 0. -0.3333 0.3333]# check with central finite differencesfd=np.array([(softmax(theta+1e-6*e)@r-softmax(theta-1e-6*e)@r)/2e-6foreinnp.eye(3)])print(np.allclose(fd,grad))# True# REINFORCE samples g_a = (r_a - b)(e_a - pi): exact mean and total varianceforbin(0.0,1.0):g=np.array([(r[a]-b)*(np.eye(3)[a]-pi)forainrange(3)])mean=pi@gvar=pi@(g**2).sum(axis=1)-mean@meanprint(b,mean.round(4),round(var,4))# 0.0 [ 0. -0.3333 0.3333] 0.8889# 1.0 [ 0. -0.3333 0.3333] 0.2222# short corridor: J(p) has its maximum at p* = 2 - sqrt(2)p=np.linspace(0.01,0.99,9801)J_p=(2*p-4)/(p*(1-p))print(p[J_p.argmax()].round(4),J_p.max().round(2))# 0.5858 -11.66
In PyTorch the same REINFORCE loss is one line:
loss = -(gamma_t * (G - b).detach() * dist.log_prob(actions)).sum(), where dist is a
Categorical(logits=...) or Normal(mu, sigma) distribution.
Language models. A language model is a softmax policy over tokens. RLHF fine-tunes it with PPO
(a policy gradient with a learned critic and a trust region); RLOO and GRPO use REINFORCE with a baseline
built from other samples for the same prompt (lesson 09).
Robotics and control. Gaussian policies over joint torques, trained with PPO or SAC
(lesson 08) in simulators such as MuJoCo.
Games. AlphaGo's policy network was improved by self-play with a policy gradient before it was
used in tree search (lesson 10).
Non-differentiable objectives. Whenever a sampled discrete choice is scored by a black box:
neural architecture search (a controller samples architectures, the reward is validation accuracy),
caption and translation models trained on BLEU or CIDEr (self-critical training uses the greedy output's
score as the baseline).
ML for science. Molecule generators that sample a molecule token by token and are fine-tuned with
RL toward a property predictor (for example REINVENT, Olivecrona et al., 2017), and chip floor-planning
with a policy network trained by PPO (Mirhoseini et al., 2021).
Wrong sign. Optimizers minimize. The loss is −∑t(Gt−b)logπθ(at∣st); without the
minus sign you make good actions less likely.
Gradient through the weight.Gt−b(st) is a number in the policy loss. If b comes from a
network, detach it, or the policy loss also trains the baseline in a wrong way.
Action-dependent baseline.b(s,a) adds bias. Only functions of the state (or constants) are safe.
Using the full return for every step. It is unbiased, but rewards before t only add noise. Use the reward-to-go.
The log-probability of the wrong action. The score must be of the action that was actually sampled
and executed, from the policy that sampled it. Recomputing it after the update, or with a different
policy, is a different estimator (lesson 09 handles the ratio πθ/πold).
Reward timing. Here rt follows (st,at). With Sutton and Barto's Rt+1, the reward-to-go
is Gt=Rt+1+γRt+2+…; mixing the two conventions shifts every return by one step.
"A baseline changes the result." It changes only the variance. If an algorithm improves when you
add a baseline, it is because the updates are less noisy, not because the target moved.
Why do the transition probabilities not appear in the policy gradient?Answerlogpθ(τ) is a sum of logp0(s0), the log-policy terms and the log-transition terms. Only the log-policy terms depend on θ, so the gradient of the other terms is 0.
Prove that a state-dependent baseline adds no bias.AnswerCondition on st. Then Eat[∇logπ(at∣st)b(st)]=b(st)∑aπ(a∣st)∇logπ(a∣st)=b(st)∇∑aπ(a∣st)=b(st)∇1=0. The tower rule gives 0 for the unconditional expectation too.
A softmax policy over 2 actions has logits (0,ln3). Give π and the score of action 1.Answerπ=(1,3)/4=(0.25,0.75). The score of action 1 is e1−π=(0.75,−0.75).
Give ∂J/∂θ(s,a) for a tabular softmax policy and explain each factor.Answerdπ(s)π(a∣s)Aπ(s,a): how much (discounted) time the policy spends in s, how likely a is there, and how much better a is than the average action in s.
Why can a stochastic policy beat every deterministic policy in the short corridor, although lesson 01
says that an optimal deterministic policy always exists?AnswerLesson 01 assumes that the policy can depend on the true state. In the corridor all cells look the same to the agent, so the policy must use the same action probabilities in every cell. Among such policies, randomness is the only way to sometimes go right and sometimes go left. The best one has p=2−2.
A batch of returns is (10,12,8,10). Which constant baseline would you subtract, and why is it safe?AnswerAbout their mean, 10 (a running average or a learned V(s) in practice). A constant does not depend on the action, so its term has mean 0; it removes the large common part of the returns, so the weights become (0,2,−2,0) and the variance falls. (Using the mean of the same batch adds a tiny bias; leave-one-out means avoid it, see lesson 09.)
Recall cardsAnswer in your head first, then reveal. Add the cards to your review deck to see them again just before you would forget.
What is the log-derivative trick?
∇θpθ(x)=pθ(x)∇θlogpθ(x), so ∇Epθ[f]=Epθ[f∇logpθ]: a gradient becomes an expectation you can sample.
State the policy gradient theorem (expectation form).
∇θJ=Eτ[∑tγt∇θlogπθ(at∣st)Qπ(st,at)].
Why does the policy gradient need no model of the transitions?
logpθ(τ) is a sum, and the terms logP(st+1∣st,at) do not depend on θ, so their gradient is 0.
Write the REINFORCE estimate from one episode, with a baseline.
g^=∑tγt(Gt−b(st))∇θlogπθ(at∣st), with the reward-to-go Gt=∑k≥tγk−trk.
Why does a baseline b(s) add no bias?
Ea∼π[∇logπ(a∣s)b(s)]=b(s)∇∑aπ(a∣s)=b(s)∇1=0.
What is the score ∇θlogπ(a) of a softmax policy?
ea−π: the one-hot vector of a minus the probability vector.
What is the score of a Gaussian policy N(μ,σ2) with respect to μ?
(a−μ)/σ2.
Give the exact gradient of a tabular softmax policy.
∂J/∂θ(s,a)=dπ(s)π(a∣s)Aπ(s,a), with dπ(s)=∑tγtPr(st=s).
Define the advantage, and give its mean under the policy.
Aπ(s,a)=Qπ(s,a)−Vπ(s);∑aπ(a∣s)Aπ(s,a)=0.
Three actions, uniform policy, rewards (1,0,2). Total variance of the REINFORCE sample with b=0 and with b=1?
"Derive the policy gradient." — Likelihood ratio on trajectories; the dynamics drop out of
∇logpθ(τ); causality gives the reward-to-go; conditioning gives Qπ.
"Why subtract a baseline? Can it depend on the action?" — Variance. It is unbiased because the score
has mean 0 in every state. An action-dependent baseline is biased unless you add a correction term.
"Why use policy gradients instead of Q-learning?" — Continuous or huge action spaces, stochastic
policies (partial observability, games), and smooth changes of the policy. The cost: high variance, on-policy
data (low sample efficiency), and only a local optimum.
"What does REINFORCE do in a language model?" — Sample a response, score it, and raise the
log-probability of its tokens in proportion to (score − baseline).
"Is the usual discounted policy gradient really a gradient?" — Without the γt factor, no
(Nota and Thomas, 2020); it still works well in practice.
A clear derivation of the policy gradient theorem and REINFORCE, with good pictures.
Open on YouTube · the player loads from youtube-nocookie.com when you press play
The intuition first: why policy gradients, what the score does, and why the estimates are noisy.
Open on YouTube · the player loads from youtube-nocookie.com when you press play
The likelihood-ratio derivation, baselines and the step from REINFORCE to actor-critic.
Open on YouTube · the player loads from youtube-nocookie.com when you press play
Softmax and Gaussian policies, the policy gradient theorem, REINFORCE and actor-critic.
Open on YouTube · the player loads from youtube-nocookie.com when you press play
Sutton and Barto, Reinforcement Learning: An Introduction,
2nd edition, free PDF: §13.1–13.4 (policy approximation, the short corridor, the policy gradient
theorem, REINFORCE and baselines).