Unit 5 of 12 · about 5 hours · derive, implement
Maximum-entropy RL, Soft Actor-Critic and temperature tuning
Deterministic actors explore only through added noise. SAC folds exploration into the objective with entropy, then tunes its own temperature instead of asking you to guess it.
You'll be able to
- Derive the maximum-entropy objective and its soft Bellman backup with the temperature weight.
- Explain automatic temperature tuning as a dual update against a target entropy.
- Implement or audit a compact SAC loop and compare it with TD3 under matched samples and tuning.
Covers
Read
In this order, only the parts listed
0 of 4 done
- SAC Algorithms and Applications: max-entropy objective and auto-tuningSoft Actor-Critic Algorithms and Applications
arXiv:1812.05905v2 Section 3: maximum-entropy objective with temperature ; Section 4: soft Bellman backup and soft policy iteration; Section 5: entropy-constrained formulation with the dual update for and Algorithm 1; Sections 6 to 7: fixed versus automatically tuned temperature runs
- CS224R Lecture 05: practical SAC against PPOStanford CS224R Spring 2026 - Off-Policy and Goal-Conditioned RL
Lecture 05 Off-Policy Actor Critic: practical SAC algorithm, replay-buffer data efficiency against PPO stability and tuning, and the PPO versus SAC table including Markov reliance
- Hands-on Modern RL 9.2 SAC part: max-entropy vocabularyHands-on Modern RL - DDPG, TD3, SAC and Intrinsic Motivation
Sections Maximum-Entropy RL through Advantages of SAC: max-entropy objective, soft Bellman backup, Gaussian reparameterization, automatic temperature tuning with target entropy -|A|, and the DDPG/TD3/SAC table (page read 2026-10-14)
Vocabulary only. The temperature code sketch uses a confusing sign convention, so implement the dual update from the paper Section 5. Treat the table and curves as author reports.
- Berkeley CS 285 HW3: SAC with entropy bonus and auto-tuningBerkeley CS 185/285 Deep Reinforcement Learning (Spring 2026) - Exploration and Off-Policy Actor-Critic
HW3 Section 3: SAC in
src/agents/sac_agent.pywithsrc/scripts/run_sac.pyandexperiments/sac/configs; Section 3.3 entropy bonus with the entropy sanity check near ; Section 3.4 reparameterized actor with theInvertedPendulum-v4return close to 1000; Section 3.5 auto-tuned temperature against the Section 3.4 fixed runThe handout writes the temperature as until Section 3.5 introduces the dual variable .
Focus on
- The objective adds entropy: , and recovers the standard return objective.
- The soft backup replaces the hard max with a soft maximum over actions, which keeps several good actions probable instead of collapsing to one.
- Auto-tuning solves a constrained problem: keep expected entropy above while maximizing return, with as the dual variable and as default.
- SAC wins on sample efficiency through replay and pays in tuning and stability: CS224R states the trade against PPO explicitly, including heavier Markov reliance.
Common mistakes · 3
- Citing the first SAC paper for temperature tuning. The 2018 version uses fixed temperature; automatic tuning arrives in the 2019 applications version Section 5, which the pool points at.
- Reading entropy as pure exploration noise. It regularizes the objective and smooths Q, so removing it changes the optimum, not just the samples.
- Expecting auto-tuning to beat a tuned fixed temperature. HW3 notes the HalfCheetah default is already well tuned, so the win is robustness on new tasks, not a higher score there.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.What does the temperature weight, and what happens at near zero?Answer
The entropy term against reward. Near zero the objective recovers standard expected return and the policy can collapse to a single action.
2.A two-action policy is uniform with reward 1 and . What augmented reward does SAC optimize?Answer
About 1.0693, since entropy ln 2 is about 0.693 and 1 + 0.1 times 0.693 is 1.0693.
3.Entropy keeps falling below target during training. Which way should move and why?Answer
Up. is the dual variable on the entropy constraint, so low entropy raises to price randomness back in.
4.SAC beats PPO on samples but PPO is picked for a new robot task. What justifies that choice?Answer
Stability and tuning cost. SAC is more sample efficient but harder to tune and leans harder on the Markov assumption; PPO trades samples for plug-and-play stability.
Practice
- Berkeley CS 285 HW3: SAC sanity and auto-temperature on InvertedPendulum-v4
HW3 Sections 3.3 to 3.5:
sanity_invertedpendulum.yamlthensanity_invertedpendulum_autotune.yaml; optional HalfCheetah fixed versus autotune withhalfcheetah.yamlandhalfcheetah_autotune.yaml; handout https://rail.eecs.berkeley.edu/deeprlcourse/static/homeworks/hw3.pdfPort to Gymnasium or pin
numpy<2with WandB disabled. InvertedPendulum sanity fits CPU or one small GPU and should return close to 1000 within the configs' 50000 steps; HalfCheetah needs hours on a GPU, so treat it as optional.
You're done when
You derive the max-entropy update and temperature dual by hand, and your InvertedPendulum runs show the sanity return with fixed and auto-tuned temperatures logged.
Only when you can do this without notes.
Leads to
- Environment, wrapper and version identity, action repeat and normalizationContinuous control needs normalized actions and recorded wrappers before any ranking.
- Matched interaction and compute budgets, tuning budgets and final-evaluation isolationCompare SAC with PPO or TD3 under matched samples, compute and tuning.
Notes
Resources · 4 for this unit, 10 more in the section
- Berkeley CS 185/285 Deep Reinforcement Learning (Spring 2026) - Exploration and Off-Policy Actor-CriticUC Berkeley · primary
Slides are public at https://rail.eecs.berkeley.edu/deeprlcourse/static/slides/lec-N.pdf; current videos are not, and the public Fall 2023 playlist numbers lectures differently. Study Lecture 19 (exploration) and Lecture 23 (advanced exploration), and the SAC part of Homework 3 (
src/agents/sac_agent.pyon InvertedPendulum and Hopper; HalfCheetah needs hours on a GPU). The homework pinsgym==0.25.2, which fails on NumPy 2, so port it to Gymnasium (terminatedandtruncated) or pinnumpy<2in its own environment, and turn off its forced WandB logging. - Stanford CS224R Spring 2026 - Off-Policy and Goal-Conditioned RLStanford University · required
Study Lecture 05 (off-policy actor-critic) and Lecture 12 (multi-task and goal-conditioned RL) and their DDPG and HER readings. Implement one goal relabeling test on a small task.
- Soft Actor-Critic Algorithms and ApplicationsBerkeley AI Research · required
Read the maximum-entropy objective, the soft policy iteration and the actor and critic targets, then the automatic temperature adjustment (this version adds it; the first SAC paper used a fixed temperature). Implement or audit a compact SAC path and compare sample efficiency and wall time with PPO under a matched protocol.
- Hands-on Modern RL - DDPG, TD3, SAC and Intrinsic MotivationWalking Labs · support
Use the DDPG and TD3 and SAC pages for vocabulary and the intrinsic-motivation page for concepts only. Its displayed TD3 target omits the terminal mask (the code has it), its SAC chart is author-reported, and its multi-agent demo does not learn; do not use those as practice. Pin commit 9231bab of walkinglabs/hands-on-modern-rl; its
code/chapterNNfolders do not follow the site chapter numbers.
Also in this section
- Stanford CS234 Winter 2026 - Bandits and ExplorationStanford University · required
Study Lectures 9 to 12 (bandits, optimism and upper confidence bounds, exploration in MDPs). Rebuild one exploration comparison with matched information, interaction, update and tuning budgets.
- Addressing Function Approximation Error in Actor-Critic Methods (TD3)Fujimoto, van Hoof and Meger (ICML 2018) · required
Read the overestimation analysis for actor-critic methods, clipped double Q-learning, delayed policy updates and target policy smoothing. Ablate one of the three changes on a small continuous task with matched seeds.
- Hindsight Experience ReplayAndrychowicz et al. (NeurIPS 2017) · required
Read the goal-conditioned setup and the relabeling strategies (final, future, episode). Implement relabeling on a sparse-reward bit-flipping or goal task and test that relabeled transitions carry the substituted goal and its recomputed reward.
- Exploration by Random Network DistillationBurda et al. (ICLR 2019) · support
Read the prediction-error bonus, the separate intrinsic and extrinsic value heads and the non-episodic intrinsic return. Use it to explain why a novelty bonus depends on the representation and how it can reward noise.
- Unifying Count-Based Exploration and Intrinsic MotivationBellemare et al. (NeurIPS 2016) · support
Read the pseudocount derivation from a density model and the exploration bonus built on it. Compare a tabular count bonus with its pseudocount form on a small grid.
- Deep Reinforcement Learning at the Edge of the Statistical PrecipiceDeepMind and Google Research · required
Study the failure of common point estimates and small-seed comparisons. Report interval estimates, aggregate-score sensitivity and performance profiles with the underlying per-run data retained.
- What Matters in On-Policy Reinforcement Learning? A Large-Scale Empirical StudyAndrychowicz et al. (2020) · support
Read the experimental protocol and the recommendations on normalization, initialization and hyperparameter sensitivity. Use it to set a tuning budget that is the same for every method you compare.
- rliableGoogle Research · support
Use the official repository to compute interquartile means, stratified bootstrap intervals and performance profiles for the track experiments. Verify the input run and task axes and keep plots reproducible from raw run records; check the pandas version it needs in your environment.
- Gymnasium documentation: API, time limits, vector envs and wrappersFarama Foundation · reference
Use the Env API page for the reset and step contract, the handling-time-limits tutorial for termination versus truncation bootstrapping, the vector env pages for SyncVectorEnv and AsyncVectorEnv autoreset modes, and the wrappers table for RecordEpisodeStatistics, ClipAction, NormalizeObservation and TimeLimit.
- Stable-Baselines3 RL Tips and TricksStable-Baselines3 · reference
Use How to evaluate an RL algorithm for separate test envs, EvalCallback and deterministic eval; Which algorithm should I use for the discrete/continuous/goal picker and HER pointer; the custom-environment section for Markov, normalization and TimeLimit handling; and the seed-variance and RL-zoo tuning advice. Treat SOTA and speedup claims as pointers, not targets.