5.2.11 · HinglishDeep & Advanced RL

Soft Actor-Critic (SAC)

1,449 words7 min readRead in English

5.2.11 · AI-ML › Deep & Advanced RL


SAC kyun exist karta hai?

Classic policy-gradient methods (jaise DDPG, TD3) mein do chronic pains hain:

  1. Brittle exploration — ek deterministic policy bahut jaldi ek hi action par collapse ho jaati hai aur explore karna band kar deti hai.
  2. Sample inefficiency vs stability trade-off — on-policy methods (PPO) stable hote hain par data waste karte hain; off-policy methods (DDPG) data reuse karte hain par unstable hote hain.

Objective kya hai? (Maximum-entropy RL)

Kyunki appear hota hai, hum entropy ko reward ke andar fold kar sakte hain ek soft reward define karke. Baaki sab is augmented reward ke saath Bellman equations re-derive karke follow hota hai.


HOW: scratch se soft Bellman equations derive karna

Step 1 — Soft value. Soft state value define karo as expected return-plus-entropy from : Yeh step kyun? Extra term exactly entropy contribution hai () jo se bahar nikala gaya hai. Toh value = expected Q plus policy kitni random hai.

Step 2 — Soft Q Bellman backup. Q-value = immediate reward + discounted next soft value: Yeh step kyun? Standard Bellman recursion, lekin already saare future steps ka entropy bonus carry karta hai. Toh future exploration bake in hai.

Step 3 — Optimal policy kya hai? Entropy term ke saath solve karo. ka maximizer subject to being a distribution Boltzmann (softmax) policy hai:

Figure — Soft Actor-Critic (SAC)

Teen learned pieces (training)

SAC seekhta hai: do Q-networks (+ unke targets), aur ek stochastic policy .


Worked example 1 — soft target compute karna

Maano , , next action deta hai , , , .

  • . Kyun? Pessimistic estimate overestimation se bachata hai.
  • Entropy bonus . Kyun? Zyada random policy → higher next value.
  • .
  • .

Worked example 2 — temperature ka effect

Do actions ke saath. Boltzmann policy .

  • : weights . Kyun? Mild preference, phir bhi explore karta hai.
  • : weights . Kyun? Chota ⇒ near-greedy.
  • : weights . Kyun? Bada ⇒ near-uniform, max exploration.
Recall Feynman: ek 12-saal ke bacche ko explain karo

Socho ek robot candy tak pahunchna seekh raha hai. Agar woh sirf candy ki parwah kare, toh woh EK raasta dhundh leta hai aur hamesha wahi chalta hai — chahe kal wahan wall aa jaaye. SAC robot ko thoda bonus deta hai alag raaste try karne ke liye ("surprising raho!"). Toh woh kuch achhe options khule rakhta hai aur stuck nahi hota. Knob decide karta hai ki adventurous hone ka kitna bonus milega. Do "judges" (do Q-networks) har move score karte hain aur hum hamesha zyada strict judge par trust karte hain taaki robot overconfident na ho.


Forecast-then-Verify

Answers: (1) deterministic/greedy — reward-only RL. (2) se overestimation counter karne ke liye. (3) off-policy: yeh replay data reuse karta hai, isliye PPO ke comparison mein bahut kam environment samples chahiye.


Flashcards

SAC kya objective maximize karta hai?
Expected return plus policy entropy: .
Temperature kya hai?
Woh coefficient jo reward aur entropy (exploration) ke beech trade-off karta hai; chota → greedy, bada → uniform.
Optimal soft policy form derive karo.
maximize karne par milta hai (Boltzmann).
Soft state value likho.
.
Soft Q target likho.
, .
Do Q-networks ka min kyun lete hain?
Overestimation bias reduce karne ke liye (clipped double-Q, TD3 ki tarah).
Actor loss mein reparameterization trick kyun?
Sampled action ke through backpropagate karne ke liye; .
Tanh log-prob correction kya hai?
.
auto-tune kaise hota hai?
minimize karo target entropy ke saath.
SAC on-policy hai ya off-policy?
Off-policy; replay buffer use karta hai, isliye sample-efficient hai.
SAC kaun-kaun se networks train karta hai?
Do Q-critics (+targets) aur ek stochastic actor; value net optional hai.
Actor loss expression?
.

Connections

  • Soft Q-Learning — same policy wala value-based ancestor.
  • TD3 — twin-Q / clipped double-Q trick ka source.
  • DDPG — deterministic off-policy actor-critic jise SAC improve karta hai.
  • Maximum Entropy RL — objective ke peeche ka framework.
  • Reparameterization Trick — low-variance stochastic actor gradients.
  • Bellman Equation — soft version yahan derive kiya gaya.
  • PPO — on-policy contrast; zyada stable par kam sample-efficient.
  • Entropy (Information Theory) — randomness ka measure.

Concept Map

motivates

part of

part of

maximizes

reward plus

scaled by

folded into

re-derives

defines

gives

maximized by

off-policy

DDPG TD3 problems

Soft Actor-Critic

Brittle exploration

Sample efficiency vs stability

Max-entropy objective

Policy entropy H

Temperature alpha

Soft reward

Soft Bellman equations

Soft value V

Soft Q backup

Boltzmann softmax policy

Self-annealing exploration