-maximize expected reward while maximizing entropy = acting as randomly as possible
- assigns meaningful probabilities to a wider range of actions, prevents collapsing to local maxima or near-optimal behaviors early in training
-on-policy RL must be online, with new trajectories collected for each gradient step / policy iteration
- off-policy RL reuses past experiences
Critic ($`Q_{\theta}(s, a)`$)
-soft Q-value: expected discounted reward plus an entropy bonus
-off-policy: train from transitions (s,a,r,s′) sampled from a replay buffer -use two Q-networks (clipped double-Q) and take their minimum to reduce overestimation bias
- online critic is updated directly with Adam + LR from current weights
- target critic is updated using Polyak averaging from its corresponding online critic after each step
θˉi←ρθˉi+(1−ρ)θi,ρ≈1 Soft Bellman target
For a sampled next action a′∼πϕ(⋅∣s′):
y=r+γ[mini=1,2Qθˉi(s′,a′)−αlogπϕ(a′∣s′)]
-Qθˉi are target critics -−αlogπϕ(a′∣s′) is the entropy bonus: unlikely actions contribute more to the target - α = temperature
Critic loss and gradient
Fit each critic with squared Bellman error:
JQ(θi)=E(s,a,r,s′)∼D[21(Qθi(s,a)−y)2]
Taking the gradient gives:
∇θiJQ=ED[(Qθi(s,a)−y)∇θiQθi(s,a)]
-treat y as a constant when differentiating; gradients do not flow through the target critics or the next action -minimize this loss for both critics
Actor (policy) objective
The policy should choose actions that have high value while remaining stochastic. Equivalently, minimize:
Jπ(ϕ)=Es∼D,a∼πϕ[αlogπϕ(a∣s)−mini=1,2Qθi(s,a)]
-this is the negative of maximizing Q(s,a)−αlogπ(a∣s) -the first term rewards entropy; the second term favors actions with high critic value
-use the online critics Qθi for this actor update. The Polyak-averaged target critics Qθˉi are used only in the next-state Bellman target above, which stabilizes critic learning Actor gradient
Use the reparameterization a=fϕ(ϵ;s), with ϵ sampled from fixed noise. The gradient is:
∇ϕJπ=Es,ϵ[∇ϕ(αlogπϕ(fϕ(ϵ;s)∣s)−miniQθi(s,fϕ(ϵ;s)))]
-gradients pass through the sampled action into the actor, but the critic parameters remain fixed during the actor update
-this directly moves the actor toward actions that are both high-value and sufficiently diverse
Temperature α
-controls the exploration/exploitation tradeoff (entropy weight)