SAC

PPO and TRPO optimize for expected return, but a policy that chases return too aggressively can get overconfident and stop exploring. Soft Actor-Critic, or SAC, changes the learning problem: the agent is rewarded not only for high return, but also for keeping its action distribution usefully stochastic.

SAC adds an entropy term to the objective. Entropy encourages diverse actions, so exploration becomes part of what the agent is trying to optimize instead of something bolted on from outside.

Objective function

J(π)=Est,at∼π[r(st,at)+αH(π(⋅∣st))]J(\pi)=\mathbb E_{s_t,a_t\sim\pi}[r(s_t,a_t)+\alpha H(\pi(\cdot\mid s_t))]

Here H(π)H(\pi) is the entropy of the policy, and α\alpha controls the exploration-exploitation tradeoff. High α\alpha means the agent values exploration more. Low α\alpha lets the policy become greedier and more deterministic.

Equation walkthrough

SAC rewards return and useful randomness

Click each term to see how SAC modifies the usual expected-return objective.

=[+]

Policy entropy

how many options stay alive

Entropy is high when the policy spreads probability across multiple actions instead of collapsing onto one choice.

Terms

The new ingredient is αH(π): exploration is part of the objective, not an afterthought.

Entropy lab

Alpha decides how much SAC values exploration

Move alpha to see the same action values become either greedy or deliberately stochastic.

0.60
greediermore stochastic
leftQ 1.6
policy
18%
stayQ 0.9
policy
6%
rightQ 2.4
policy
68%
scanQ 1.2
policy
9%

entropy

69%

top action prob

68%

data mood

mixed

High α values exploration more. Low α lets the policy become greedier and more deterministic.

The critic in SAC learns a soft Bellman function:

Qπ(st,at)=r(st,at)+γEst+1∼P,at+1∼π[Qπ(st+1,at+1)−αlog⁡π(at+1∣st+1)]Q^\pi(s_t,a_t)=r(s_t,a_t)+\gamma\mathbb E_{s_{t+1}\sim P,a_{t+1}\sim\pi}[Q^\pi(s_{t+1},a_{t+1})-\alpha\log\pi(a_{t+1}\mid s_{t+1})]

Subtracting αlog⁡π\alpha\log\pi encourages policies that keep options open. Instead of maximizing just return, the critic values return minus overconfidence. This soft backup averages over possible future actions, which tends to create smoother value landscapes and easier optimization.

Equation walkthrough

The soft Bellman backup values uncertainty

Click through the backup to see why SAC critic targets are smoother than max-only targets.

=+
[]

Entropy bonus

penalize overconfidence

Because log probabilities are negative, this term rewards policies that keep options open. The critic values return minus overconfidence.

Terms

Soft means the next-step value averages over sampled actions and includes -αlogπ, so uncertainty is part of the value estimate.

SAC is still an actor-critic method, but the moving pieces are richer:

Actor policy: outputs stochastic actions.

Critic 1 and Critic 2: estimate soft Q-values. Double critics reduce overestimation.

Target networks: provide stable learning targets.

Replay buffer: stores past experiences for off-policy updates.

SAC system map

SAC learns from stochastic actions and remembered experience

Click a component to see its role in the actor-critic system.

Replay buffer

(s, a, r, s')

Stores past experience, which lets SAC learn off-policy from remembered transitions collected by older policies.

PPO learns from what it just did. SAC learns from what it remembers.

Instead of fixing α\alpha, SAC can learn it automatically. The goal is to keep entropy near a target level HtargetH_{target}.

Temperature loss

L(α)=Eat∼πt[−α(log⁡πt(at∣st)+Htarget)]L(\alpha)=\mathbb E_{a_t\sim\pi_t}[-\alpha(\log\pi_t(a_t\mid s_t)+H_{target})]

If the agent is too predictable, α\alpha increases, pushing the policy toward more exploration. If the agent is too random, α\alpha decreases, allowing more exploitation.

Equation walkthrough

SAC can learn alpha automatically

The temperature loss nudges alpha so policy entropy stays near a target level.

=[(+)]

Adjustable temperature

exploration pressure

Increasing alpha makes future policy updates care more about entropy; decreasing alpha lets reward dominate.

Terms

too predictable
below targetabove target
If the agent is too predictable, SAC raises alpha so entropy becomes more valuable.
The policy is too predictable, so alpha should increase and push future updates toward more exploration.

PPO learns from what it just did. SAC learns from what it remembers.

PPO is on-policy: it assumes the trajectories were generated by the current policy. SAC is off-policy: it can safely learn from past policies' experiences stored in a replay buffer.

On-policy vs off-policy

PPO learns from now; SAC learns from memory

Switch algorithms to see which experience remains useful for updates.

fresh rollout
100%
yesterday
78%
older policy
54%

policy type

off-policy

data reuse

high

exploration

persistent

SAC is off-policy, so replayed transitions can still train the actor and critics.
Property PPO SAC
Type On-policy Off-policy
Objective Clipped surrogate Soft Q plus entropy
Exploration Limited by current rollout behavior Persistent and entropy-driven
Data reuse Low High
Typical use RLHF, NLP, games Robotics, continuous control
Exploration control Usually fixed or externally scheduled Can be learned with adaptive α\alpha

What does soft mean?

Soft means we do not assume the agent always takes the single best action. Instead, we average over good actions and reward uncertainty. The policy is expected to act well on average, while still preserving randomness where it is useful.

Hard vs soft RL

Click an aspect to compare the two assumptions

Choose a row label, then compare what that idea means under deterministic hard RL versus stochastic SAC-style soft RL.

Aspects

Deterministic / hard RL

Deterministic or nearly deterministic

Stochastic / soft RL

Stochastic by design

Policy type

Hard RL often tries to collapse onto a best action. SAC keeps a probability distribution alive as part of the policy.

Soft means SAC does not assume the agent always takes the single best action; it learns values under a stochastic policy.
Checkpoint

What is the main role of the entropy term in SAC?