1. Differentiate and multiply/divide by
πθ(τ):
∇θJ=Eτ[∇θlogπθ(τ)R(τ)], via the log-derivative trick
∇θlogπθ(a∣s)=πθ(a∣s)∇θπθ(a∣s) (turning a gradient of probabilities into the gradient of their logs, keeping the estimator unbiased);
2. Factor the trajectory
πθ(τ)=μ(s0)∏tπθ(at∣st)P(st+1∣st,at) and take the log: the dynamics terms
μ,P do not depend on
θ and cancel, leaving
∑t∇θlogπθ(at∣st) — which is why no model is needed;
3. By causality, action
at affects only future returns, so replace the full return with reward-to-go
Gt=∑k≥tγk−trk (lower variance), giving the REINFORCE update
θ←θ+η∑t∇θlogπθ(at∣st)Gt.