Continuous actions: DDPG, TD3 and SAC
When the action is a number - a steering angle, a dose, a price - you can't take a max over actions. DDPG climbs a critic with a deterministic actor; TD3 fixes its overestimation; SAC adds entropy and a stochastic actor.
What runs in CodeSplash
- DRL008Deep deterministic policy gradient (DDPG) Explained here
- DRL009Twin delayed DDPG (TD3) Explained here
- DRL010Soft actor–critic (SAC) Explained here
You will be able to
- Explain why DQN's max over actions fails for continuous actions
- Compute DDPG's critic target and actor objective
- Name TD3's three changes and the problem each addresses
- Write SAC's soft target and explain what the temperature α does
No max over a continuum
ReadDQN's target takes over a handful of actions. With an action that is a real number, or a vector of them, that max is an optimization problem at every step. Continuous-control methods train an actor that outputs the action directly and a critic that judges it, both off-policy from a replay buffer.
These methods are explained here: the Policy learning studio's environments have a few discrete actions, where DQN and PPO fit.
DDPG
ReadDDPGDeep deterministic policy gradient (DDPG)Continuous-action actor–critic: the actor outputs one action and climbs the critic's Q; replay and target networks keep it stable. uses a deterministic actor . The critic regresses on a target built with the target actor and critic:
The actor climbs the critic: it maximizes , so its loss is . In the reference's example, targets are 2.98 and −0.2 (the second step is terminal), the critic loss 1.140 and the actor loss −1.1. Exploration comes from noise added to the actor's action.
TD3: three fixes
ReadDDPG's actor exploits any spot where the critic overrates an action, and the critic's targets inherit the error. TD3Twin delayed DDPG (TD3)DDPG with two critics (take the smaller target), noise on the target action, and fewer actor updates than critic updates. adds:
- Clipped double Q: two critics, and the target uses the smaller of their values.
- Target policy smoothing: clipped noise on the target action, so the target averages over a small neighborhood.
- Delayed actor updates: the actor and target networks update less often than the critics.
In the reference's example, noisy target actions are clipped back into range at 1 and −1, and the targets use the smaller critic: 3.475 and 1.98.
SAC: reward plus entropy
ReadSoft actor–criticSoft actor–critic (SAC)Actor–critic that maximizes reward plus policy entropy, with twin critics and a stochastic actor; α sets the entropy weight. maximizes reward plus the policy's entropy, weighted by a temperature α. Its actor is stochastic, and its target uses twin critics and subtracts α times the next action's log-probability:
The entropy term rewards keeping options open. In the reference's example the soft targets are 2.921 and, at a terminal step, 0; the actor loss is −1.58. Many implementations tune α automatically toward a target entropy.
Predict: one critic or two
PredictPredict first
TD3's target takes the smaller of two critics' values. What does that do to the targets?
Reveal
It counters upward bias, at the risk of some underestimation. The min of two noisy estimates leans low, which is safer for an actor that hunts for overrated actions than leaning high.
What runs here
ReadCheck: continuous control
CheckpointCheck yourself
How is DDPG's actor trained?
Show the answer
Answer: a
The actor's loss is −Q(s, μ(s)); its gradient flows from the critic into the actor's weights.
Check yourself
A non-terminal transition has reward 1. The target critic values the target actor's next action at 2, and γ = 0.9. What is DDPG's critic target?
Show the answer
Answer: 2.8
y = 1 + 0.9 × 2 = 2.8. At a terminal step the target would be 1.
Check yourself
Which set lists TD3's changes to DDPG?
Show the answer
Answer: a
The second set belongs to Rainbow, the third to SAC, the fourth to PPO.
Check yourself
TD3: reward 0.5, γ = 0.9, the two target critics give 2.5 and 2.1. What is the target?
Show the answer
Answer: 2.39
y = 0.5 + 0.9 × min(2.5, 2.1) = 0.5 + 0.9 × 2.1 = 0.5 + 1.89 = 2.39.
Check yourself
In SAC, what happens as the temperature α grows?
Show the answer
Answer: a
α weighs entropy against reward. Large α favors spread-out actions; α near 0 recovers a reward-only objective.
Check yourself
What does SAC's target subtract from the smaller critic value?
Show the answer
Answer: a
Subtracting α·log π adds the entropy bonus to the bootstrapped value: rare (low log-probability) actions earn more.
Recap
Recap- Continuous actions rule out a max over actions; an actor proposes, a critic judges.
- DDPG: deterministic actor climbing the critic, with target networks and replay.
- TD3: twin critics (take the min), smoothed target actions, delayed actor updates.
- SAC: stochastic actor, reward plus α-weighted entropy, twin critics.
Concepts in this lesson