Intuition The one core idea
A normal agent chases the single best action and freezes there; SAC pays the agent a bonus for staying a little bit random , so it keeps exploring and never gets stuck betting everything on one guess. Everything else — the "soft" values, the two critics, the temperature knob — is just the bookkeeping needed to reward reward-plus-randomness at every step.
This page assumes you have seen nothing . We will name every letter and squiggle the Soft Actor-Critic (SAC) note throws at you, draw the picture behind it, and say why the topic can't live without it. Read top to bottom — each item is a brick for the next.
Before any math, picture the game being played.
Definition The four everyday words
State s — everything the agent currently sees about the world (robot's joint angles, ball position). Picture: a snapshot photo of the situation.
Action a — the move the agent chooses right now (a torque, a steering angle). Picture: the arrow the agent pushes on the world.
Reward r ( s , a ) — a single number the world hands back saying "that move was worth this much." Picture: points on a scoreboard.
Next state s ′ — the snapshot after the action lands. The prime mark ′ just means "the next one."
Intuition Why we need these
Every RL method — from DDPG to PPO — is a recipe for turning states into good actions. SAC is no exception; it just adds a twist to how good is measured. You cannot read one line of the topic without s , a , r , s ′ .
The action lives in a set called the action space A . Its size dim ( A ) = how many numbers the agent controls (a 6-joint arm ⇒ dim ( A ) = 6 ). Remember this number — the temperature tuner uses it.
A deterministic agent has a rule "in state s , do action a " — a single arrow. SAC instead uses a stochastic policy : a whole probability cloud over actions.
π ( a ∣ s )
π ( a ∣ s ) = the probability (really, probability density ) that the agent picks action a when in state s . Read the bar ∣ as the word "given" : "chance of a , given we are in s ."
Picture: a bell-shaped hill sitting over the action axis. Tall where the action is likely, flat where it is unlikely.
It always sums (integrates) to 1: ∫ π ( a ∣ s ) d a = 1 . The whole hill has area one — a genuine probability.
Intuition Why a cloud and not an arrow?
A single arrow, once wrong, is wrong forever. A cloud lets the agent sample — sometimes the best action, sometimes a neighbour. That built-in wiggling is exploration, and it is the heart of SAC. Compare this with TD3 /DDPG , which use an arrow plus hand-added noise; SAC bakes the randomness into π itself.
The subscript π ϕ means "a policy whose shape is controlled by tunable numbers ϕ " (the weights of a neural network). Training = nudging ϕ so the cloud sits over good actions.
The letters log π ( a ∣ s ) appear everywhere in SAC. Let's earn them.
log x is
log x (natural log) answers: "e raised to what power gives x ?" Here e ≈ 2.718 is a fixed constant. So log ( e ) = 1 , log ( 1 ) = 0 , and for a small probability like 0.01 , log ( 0.01 ) ≈ − 4.6 — a big negative number.
Intuition Why log, and why this tool specifically?
Probabilities are tiny and multiply awkwardly. We want a "surprise meter": common events → small surprise, rare events → large surprise. The quantity − log π ( a ∣ s ) does exactly that:
If π = 1 (certain), surprise = − log 1 = 0 . No surprise.
If π is tiny, − log π is large. Big surprise.
So − log π ( a ∣ s ) = "how surprised am I that I chose this action?" That single quantity is the seed of entropy in the next section.
Now average that surprise over all the actions the policy might take.
Intuition The picture of entropy
A sharp spike (one action almost certain) → surprise nearly 0 → low entropy .
A flat spread (many actions equally likely) → lots of surprise → high entropy .
Entropy is a single knob-reading for "how undecided is the policy." SAC pays the agent for keeping this high. See Entropy (Information Theory) and Maximum Entropy RL for the deeper story.
The agent cares not just about this reward but the whole future stream. Two bookkeepers track that.
Definition The two value functions
State value V ( s ) — "starting from state s and playing my policy forever, how much total (discounted) reward-plus-bonus do I expect?" Picture: a temperature reading on each state — hot = good place to be.
Action value Q ( s , a ) — same, but "I commit to action a first, then follow my policy." Picture: a heat reading on each (state, action) pair.
Definition Discount factor
γ
γ (gamma) is a number between 0 and 1 (often 0.99 ) that shrinks future rewards : a reward n steps away counts as γ n times its value. Picture each future point through a slightly foggy lens — the farther away, the dimmer. Why needed? Without it, "total future reward" could add up to infinity and never settle.
The soft versions used by SAC just glue the entropy bonus onto V :
V ( s ) = E a ∼ π [ Q ( s , a ) − α log π ( a ∣ s ) ]
The extra − α log π is precisely the entropy term H from §4 pulled inside the average. That is why SAC's values are called soft .
α
α (alpha) is a positive number multiplying the entropy bonus. It sets how much the agent is paid for randomness.
α → 0 : entropy ignored ⇒ agent goes greedy/deterministic (ordinary reward-only RL).
α → ∞ : reward ignored ⇒ agent goes uniform (pure random exploration).
In between: a graceful mix.
Intuition Why call it "temperature"?
Borrowed from physics: hot systems jiggle everywhere (high α , spread-out policy), cold systems freeze into one state (low α , spiked policy). The Boltzmann policy π ∗ ∝ exp ( Q / α ) that SAC derives is literally the physics formula for how particles distribute at temperature α . Related tool: Soft Q-Learning .
Real actuators saturate: a torque can't be infinite. SAC keeps actions inside [ − 1 , 1 ] with the tanh function.
tanh ( u )
tanh is an S-shaped curve that takes any number u and squashes it into ( − 1 , 1 ) : big positive u → + 1 , big negative u → − 1 , tanh ( 0 ) = 0 . Picture a ramp that flattens at both ends.
ϵ and the reparameterization trick
To sample a random action we draw a plain Gaussian noise ϵ ∼ N ( 0 , I ) (a standard bell curve, one per action dimension) and build:
a = tanh ( μ ϕ ( s ) + σ ϕ ( s ) ⊙ ϵ )
μ ϕ ( s ) = the network's chosen center, σ ϕ ( s ) = its chosen spread.
⊙ = elementwise multiply (component by component).
Why do this? So the randomness lives in ϵ (which has no tunable parts), letting gradients flow through the sample into ϕ . That is the Reparameterization Trick .
Common mistake The squash changes the density
Because a = tanh ( u ) bends the axis, log π ( a ) is not just the Gaussian log-density. You must subtract a correction ∑ i log ( 1 − tanh 2 ( u i )) . Skip it and your entropy — hence your α -tuning — is silently wrong.
entropy H is average surprise
soft values and soft Bellman
tanh squash and epsilon noise
Say each answer out loud before revealing — if any stalls, reread that section.
What does s ′ (with the prime) mean? The next state, the snapshot right after the action lands.
What is π ( a ∣ s ) in plain words? The probability (density) of choosing action a given state s — a cloud over actions, not one arrow.
Read the bar ∣ aloud. "given" — the thing after it is the condition we assume.
What is − log π ( a ∣ s ) measuring? The "surprise" of that action — near 0 for likely actions, large for rare ones.
What is entropy H ( π ( ⋅ ∣ s )) ? The average surprise, E a ∼ π [ − log π ] — how spread-out / random the policy is.
Spike-shaped policy vs flat policy: which has higher entropy? The flat one (many actions equally likely) has higher entropy.
What does E a ∼ π [ ⋅ ] compute? The weighted average of the bracketed quantity over actions drawn from π .
Difference between V ( s ) and Q ( s , a ) ? V scores a state; Q scores a state after committing to a specific action first.
Why is γ needed and what range is it in? To shrink far-future rewards so totals stay finite; 0 ≤ γ < 1 , usually 0.99.
What does the temperature α trade off? Reward vs entropy — small α ⇒ greedy, large α ⇒ uniform exploration.
Why squash actions with tanh ? To keep actions bounded in ( − 1 , 1 ) like real actuators.
What does the reparameterization trick let us do? Move randomness into fixed noise ϵ so gradients flow through the sampled action into ϕ .
What correction does tanh force on log π ? Subtract ∑ i log ( 1 − tanh 2 ( u i )) for the change of variables.