Paper commentary
Soft Actor-Critic: Off-Policy Maximum Entropy Deep Reinforcement Learning with a Stochastic Actor
- Problem Off-policy reuse of past experience is hard to combine with stable learning, and DDPG, the usual off-policy actor-critic for continuous control, is brittle and hard to scale.
- Method Soft actor-critic trains a stochastic policy to maximize expected return plus policy entropy, using a soft value network, two soft Q-functions, a target value network, a replay buffer and a reparameterized policy update.
- Results On the Humanoid (rllab) task, stochastic SAC showed much lower variability across five seeds than a deterministic variant. On Ant-v1, evaluating with the mean action gave higher return than stochastic evaluation.
Why off-policy actor-critic methods are hard to make stable
Model-free deep RL has solved hard games and control problems, but two obstacles keep it from routine use in real-world settings: poor sample efficiency and sensitivity to hyperparameters. On-policy methods such as TRPO, PPO and A3C need fresh samples for every gradient step, so their data cost grows quickly as tasks become more complex. DDPG is the common off-policy choice in these settings, yet its deterministic actor and Q-function interact in ways that make it hard to stabilize and sensitive to hyperparameters, which limits its use on high-dimensional tasks.
Maximum entropy objective and its motivation
The maximum entropy framework keeps the usual reward term but adds an entropy bonus for the policy at every visited state, so the objective is \[ J(\pi)=\sum_{t=0}^{T}\mathbb{E}_{(s_t,a_t)\sim\rho_\pi}\left[r(s_t,a_t)+\alpha\,\mathcal{H}(\pi(\cdot\,|\,s_t))\right] \] The authors give three reasons for the extra term: the policy explores more widely without committing to clearly poor actions, it can keep several near-optimal modes, and it spreads probability over actions that look equally attractive.
Earlier maximum entropy methods mostly worked through soft Q-learning, which needs approximate inference in continuous action spaces. The method here instead uses an actor-critic in which the Q-function is evaluated for the current policy and the policy is updated off-policy.
Soft policy iteration as the theoretical basis
Soft policy evaluation repeatedly applies a modified Bellman backup, in which the reward plus the discounted expected soft value of the next state gives the new soft Q-value: \(T^\pi Q(s_t,a_t)=r(s_t,a_t)+\gamma\,\mathbb{E}_{s_{t+1}\sim p}[V(s_{t+1})]\), where \(V(s_t)=\mathbb{E}_{a_t\sim\pi}[Q(s_t,a_t)-\log\pi(a_t|s_t)]\). In the improvement step the policy moves toward the exponential of the current soft Q-function.
To keep the policy inside a tractable set \(\Pi\), the update is the information projection \(\pi_{\text{new}}=\arg\min_{\pi'\in\Pi} D_{KL}(\pi'(\cdot|s_t)\,\|\,\exp(Q^{\pi_{\text{old}}}(s_t,\cdot))/Z^{\pi_{\text{old}}}(s_t))\), with the partition function \(Z\) depending only on the state. The projected policy never has a lower soft Q-value than the old one for any state-action pair, and repeating evaluation and improvement converges to a policy whose soft Q-value is at least that of any other policy in the set, under a finite action set.
The authors note that this exact procedure is only practical in the tabular case.
From soft policy iteration to the SAC update rules
SAC replaces exact evaluation and improvement with three parameterized networks, a soft value function \(V_\psi\), a soft Q-function \(Q_\theta\) and a tractable policy \(\pi_\phi\), each updated by stochastic gradient steps after every batch of data. The soft value network is trained on states from a replay buffer to match the expected soft Q-value minus the log-probability of actions drawn from the current policy, which gives the squared residual loss and a gradient that uses actions sampled from the current policy rather than from the buffer.
Each soft Q-function is trained to minimize a squared soft Bellman residual against the reward plus the discounted target value at the next state. The target uses a target value network whose weights are an exponential moving average of the value network weights. The policy is trained to minimize a KL objective against the exponential of the Q-function.
Because the Q-function is a differentiable neural network, the authors write the action as a transformation of input noise, \(a_t=f_\phi(\epsilon_t;s_t)\), so the gradient flows through the Q-function. The authors state this lowers the variance of the gradient estimate compared with the likelihood ratio estimator. Two soft Q-functions are trained independently, and the minimum of the two is used in the value and policy gradients to reduce positive bias.
A single Q-function could learn the 21-dimensional Humanoid, but the authors found two Q-functions significantly speed up training, especially on harder tasks. Each environment step adds one transition to the replay buffer, followed by one or more gradient steps on batches sampled from that buffer, so the updates rely only on off-policy data.
Comparison with DDPG, PPO, soft Q-learning and TD3
The comparison covers Hopper-v1, Walker2d-v1, HalfCheetah-v1, Ant-v1 and Humanoid-v1 from the OpenAI gym suite, plus the Humanoid task from rllab with 21 action dimensions. Each algorithm is run with five random seeds, and an evaluation rollout is performed every 1000 environment steps. The curves show the mean over seeds, and the shaded region gives the minimum and maximum return.
Compared with DDPG, PPO and TD3, SAC performs comparably on the easier tasks and is ahead on the harder ones, in both learning speed and final return. DDPG makes no progress on Ant-v1, Humanoid-v1 and the rllab Humanoid, and the authors note that prior work reports the same failure. PPO learns more slowly than SAC, which the authors link to the large batch sizes PPO needs for stable learning on high-dimensional tasks.
Soft Q-learning learns all tasks, but more slowly than SAC and with worse asymptotic performance. The authors also say SAC's reported numbers compare favorably with results published for other methods, but those prior-work numbers were not produced under the same experiment, so they are not part of the controlled comparison.
Stochastic versus deterministic policies
The authors compare SAC with a deterministic variant that drops entropy maximization, closely resembles DDPG, keeps two Q-functions, uses hard target updates and fixed rather than learned exploration noise. On the Humanoid (rllab) benchmark, five individual runs of each variant were compared across random seeds. The stochastic SAC runs are much more consistent across seeds, while the deterministic variant shows very high variability.
The authors attribute this to the entropy term, which keeps the policy variance from collapsing early and makes the value function favor high-entropy regions.
Evaluation mode, reward scale and target smoothing
Because SAC learns a stochastic policy, the authors evaluate the mean of the policy distribution as the approximate maximum a posteriori action. On Ant-v1, this deterministic evaluation can yield higher return than stochastic evaluation. Training curves report the sum of rewards, which differs from the entropy-regularized objective that SAC and the other maximum entropy methods optimize.
Reward scale acts as the inverse of the temperature, so it controls how stochastic the policy becomes. On Ant-v1 the scales 1, 3, 10, 30 and 100 were tried. Small scales make the policy nearly uniform and fail to exploit the reward, while large scales make it nearly deterministic early and lead to poor local minima. The target smoothing coefficient \(\tau\) sets how fast the target value network follows the value network.
Large \(\tau\) causes instability and small \(\tau\) slows training. The authors found a wide range of suitable values and used 0.005 on all tasks. A hard-update variant copies the value network weights into the target every 1000 gradient steps; the authors found this variant benefits from more than one gradient step between environment steps, which increases computation.
Limitations
The reward scale has to be tuned for each task, since the optimal value varies between environments. The reported comparisons use five seeds per method and the Ant-v1 sensitivity analyses are on one task, so the stability and hyperparameter results are not shown across all benchmark tasks in the main text. The variant with hard target updates needs more than one gradient step per environment step to do well, which raises computational cost.
The authors point out that the training curves measure rewards rather than the entropy-regularized objective, so they do not directly measure the quantity SAC optimizes. In prior soft Q-learning, convergence depends on how well the sampler approximates the posterior. The authors' policy-improvement proof does not depend on this approximation for any policy parameterization.
Paper info
- Authors
- Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, Sergey Levine
- Venue
- arXiv · Preprint
- First published
- 2018-1-4
- Added
- 2026-10-20
- Updated
- 2018-8-8
- Version
- v2
- arXiv
- 1801.01290
- Category
- cs.LG · cs.AI · stat.ML
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, Sergey Levine (2018). Soft Actor-Critic: Off-Policy Maximum Entropy Deep Reinforcement Learning with a Stochastic Actor. arXiv:1801.01290v2. https://arxiv.org/abs/1801.01290v2
BibTeX
@misc{haarnoja2018soft,
title = {{Soft Actor-Critic: Off-Policy Maximum Entropy Deep Reinforcement Learning with a Stochastic Actor}},
author = {Tuomas Haarnoja and Aurick Zhou and Pieter Abbeel and Sergey Levine},
year = {2018},
eprint = {1801.01290},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1801.01290v2}
}