Equivalence Between Policy Gradients and Soft Q-Learning

John Schulman, Xi Chen, Pieter Abbeel

Introduction

Policy gradient methods (PG) and QQ-learning (QL) methods perform updates that are qualitatively similar. In both cases, if the return following an action ata_{t} is high, then that action is reinforced: in policy gradient methods, the probability π(at ∣ st)\pi(a_{t}\>|\>s_{t}) is increased; whereas in QQ-learning methods, the QQ-value Q(st,at)Q(s_{t},a_{t}) is increased. The connection becomes closer when we add entropy regularization to these algorithms. With an entropy cost added to the returns, the optimal policy has the form π(a ∣ s)∝exp⁡(Q(s,a))\pi(a\>|\>s)\propto\exp(Q(s,a)); hence policy gradient methods solve for the optimal QQ-function, up to an additive constant (Ziebart (2010)). O’Donoghue et al. (2016) also discuss the connection between the fixed points and updates of PG and QL methods, though the discussion of fixed points is restricted to the tabular setting, and the discussion comparing updates is informal and shows an approximate equivalence. Going beyond past work, this paper shows that under appropriate conditions, the gradient of the loss function used in nn-step QQ-learning is equal to the gradient of the loss used in an nn-step policy gradient method, including a squared-error term on the value function. Altogether, the update matches what is typically done in “actor-critic” policy gradient methods such as A3C, which explains why Mnih et al. (2016) obtained qualitatively similar results from policy gradients and nn-step QQ-learning.

Section 2 uses the bandit setting to provide the reader with a simplified version of our main calculation. (The main calculation applies to the MDP setting.) Section 3 discusses the entropy-regularized formulation of RL, which is not original to this work, but is included for the reader’s convenience. Section 4 shows that the soft QQ-learning loss gradient can be interpreted as a policy gradient term plus a baseline-error-gradient term, corresponding to policy gradient instantiations such as A3C (Mnih et al., 2016). Section 5 draws a connection between QL methods that use batch updates or replay-buffers, and natural policy gradient methods.

Some previous work on entropy regularized reinforcement learning (e.g., O’Donoghue et al. (2016); Nachum et al. (2017)) uses entropy bonuses, whereas we use a penalty on Kullback-Leibler (KL) divergence, which is a bit more general. However, in the text, we often refer to “entropy” terms; this refers to “relative entropy”, i.e., the KL divergence.

Bandit Setting

where π‾\overline{\pi} is some “reference” policy, τ\tau is a “temperature” parameter, and DKL⁡D_{\operatorname{KL}} is the Kullback-Leibler divergence. Note that the temperature τ\tau can be eliminated by rescaling the rewards. However, we will leave it so that our calculations are checkable through dimensional analysis, and to make the temperature-dependence more explicit.

First, let us calculate the policy π\pi that maximizes η\eta. We claim that η(π)\eta(\pi) is maximized by πrˉB\pi^{\mathcal{B}}_{\bar{r}}, defined as

To derive this, consider the KL divergence between π\pi and πrˉB\pi^{\mathcal{B}}_{\bar{r}}:

The preceding calculation gives us the optimal policy when rˉ\bar{r} is known, but in the entropy-regularized bandit problem, it is initially unknown, and the agent learns about it by sampling. There are two approaches for solving the entropy-regularized bandit problem:

A direct, policy-based approach, where we incrementally update the agent’s policy π\pi based on stochastic gradient ascent on η\eta.

An indirect, value-based approach, where we learn an action-value function qθq_{\theta} that estimates and approximates rˉ\bar{r}, and we define π\pi based on our current estimate of qθq_{\theta}.

For the policy-based approach, we can obtain unbiased estimates the gradient of η\eta. For a parameterized policy πθ\pi_{\theta}, the gradient is given by

We can obtain an unbiased gradient estimate using a single sample (a,r)(a,r).

In the indirect, value-based approach approach, it is natural to use a squared-error loss:

Taking the gradient of this loss, with respect to the parameters of qθq_{\theta}, we get

Soon, we will calculate the relationship between this loss gradient and the policy gradient from Equation 7.

In the indirect, value-based approach, a natural choice for policy π\pi is the one that would be optimal if qθ=rˉq_{\theta}=\bar{r}. Let’s denote this policy, called the Boltzmann policy, by πqθB\pi^{\mathcal{B}}_{q_{\theta}}, where

It will be convenient to introduce a bit of notation for the normalizing factor; namely, we define the scalar

Then the Boltzmann policy can be written as

Hence, vθv_{\theta} is an estimate of η(πqθB)\eta(\pi^{\mathcal{B}}_{q_{\theta}}), plugging in qθq_{\theta} for rˉ\bar{r}.

Now we shall show the connection between the gradient of the squared-error loss (Equation 9) and the policy gradient (Equation 7). Rearranging Equation 12, we can write qθq_{\theta} in terms of vθv_{\theta} and the Boltzmann policy πqθB\pi^{\mathcal{B}}_{q_{\theta}}:

Let’s substitute this expression for qθq_{\theta} into the squared-error loss gradient (Equation 9).

Note that we have not yet decided on a sampling distribution π\pi. Henceforth, we’ll assume actions were sampled by π=πqθB\pi=\pi^{\mathcal{B}}_{q_{\theta}}. Also, note the derivative of the KL-divergence:

Continuing from Equation 17 but setting π=πqθB\pi=\pi^{\mathcal{B}}_{q_{\theta}},

Soon we will derive an equivalent interpretation of QQ-function regression in the MDP setting, where we are approximating the state-value function Qπ,γQ^{\pi,\gamma}. However, we first need to introduce an entropy-regularized version of the reinforcement learning problem.

Entropy-Regularized Reinforcement Learning

We are obliged to alter our definitions of value functions to include the new KL penalty terms. We shall define the state-value function as the expected return:

Note that this QQ-function does not include the first KL penalty term, which does not depend on the action a0a_{0}. This definition makes some later expressions simpler, and it leads to the following relationship between QπQ_{\pi} and VπV_{\pi}:

which follows from matching terms in the sums in Equations 24 and 25.

2 Boltzmann Policy

In standard reinforcement learning, the “greedy policy” for QQ is defined as [GQ](s)=arg max⁡aQ(s,a)[\mathcal{G}Q](s)=\operatorname*{arg\,max}_{a}Q(s,a). With entropy regularization, we need to alter our notion of a greedy policy, as the optimal policy is stochastic. Since QπQ_{\pi} omits the first entropy term, it is natural to define the following stochastic policy, which is called the Boltzmann policy, and is analogous to the greedy policy:

where the second equation is analogous to Equation 2 from the bandit setting.

Also analogously to the bandit setting, it is natural to define VQV_{Q} (a function of QQ) as

Under this definition, it also holds that

in analogy with Equation 13. Hence, VQ(s)V_{Q}(s) can be interpreted as an estimate of the expected entropy-augmented return, under the Boltzmann policy πQB\pi^{\mathcal{B}}_{Q}.

Another way to interpret the Boltzmann policy is as the exponentiated advantage function. Defining the advantage function as AQ(s,a)=Q(s,a)−VQ(s)A_{Q}(s,a)=Q(s,a)-V_{Q}(s), Equation 30 implies that πQB(a ∣ s)π‾(a ∣ s)=exp⁡(AQ(s,a)/τ)\frac{\pi^{\mathcal{B}}_{Q}(a\>|\>s)}{\overline{\pi}(a\>|\>s)}=\exp(A_{Q}(s,a)/\tau).

3 Fixed-Policy Backup Operators

The Tπ\mathcal{T}_{\pi} operators (for QQ and VV) in standard reinforcement learning correspond to computing the expected return with a one-step lookahead: they take the expectation over one step of dynamics, and then fall back on the value function at the next timestep. We can easily generalize these operators to the entropy-regularized setting. We define

Repeatedly applying the Tπ\mathcal{T}_{\pi} operator (\mathcal{T}_{\pi}^{n}V=\underbrace{\mathcal{T}_{\pi}(\mathcal{T}_{\pi}(\dots\mathcal{T}_{\pi}}_{\text{ntimes}}(V)))) corresponds to computing the expected return with a multi-step lookahead. That is, repeatedly expanding the definition of Tπ\mathcal{T}_{\pi}, we obtain

As a sanity check, note that in both equations, the left-hand side and right-hand side correspond to estimates of the total discounted return ∑t=0∞γt(rt−τKL⁡t)\sum_{t=0}^{\infty}\gamma^{t}(r_{t}-\tau\operatorname{KL}_{t}).

The right-hand side of these backup formulas can be rewritten using “Bellman error” terms δt\delta_{t}. To rewrite the state-value (VV) backup, define

4 Boltzmann Backups

We can define another set of backup operators corresponding to the Boltzmann policy, π(a ∣ s)∝π‾(a ∣ s)exp⁡(Q(s,a)/τ)\pi(a\>|\>s)\propto\overline{\pi}(a\>|\>s)\exp(Q(s,a)/\tau). We define the following Boltzmann backup operator:

where the simplification from (∗)(\ast) to (∗∗)(\ast\ast) follows from the same calculation that we performed in the bandit setting (Equations 11 and 13).

The nn-step operator Tπn\mathcal{T}_{\pi}^{n} for QQ-functions also simplifies in the case that we are executing the Boltzmann policy. Starting with the equation for TπnQ\mathcal{T}_{\pi}^{n}Q (Equation 35) and setting π=πQB\pi=\pi^{\mathcal{B}}_{Q}, and then using Equation 31 to rewrite the expected QQ-function terms in terms of VQV_{Q}, we obtain

From now on, let’s denote this nn-step backup operator by TπB,n\mathcal{T}_{\pi^{\mathcal{B}},n}. (Note TπQB,n≠TnQT_{\pi^{\mathcal{B}}_{Q},n}\neq\mathcal{T}^{n}Q, even though TπQB,1Q=TQ\mathcal{T}_{\pi^{\mathcal{B}}_{Q},1}Q=\mathcal{T}Q, because TπQB\mathcal{T}_{\pi^{\mathcal{B}}_{Q}} depends on QQ.)

One can similarly define the TD(λ\lambda) version of this backup operator

One can straightforwardly verify by comparing terms that it satisfies

5 Soft Q𝑄Q-Learning

The Boltzmann backup operators defined in the preceding section can be used to define practical variants of QQ-learning that can be used with nonlinear function approximation. These methods, which optimize the entropy-augmented return, will be called soft QQ-learning. Following Mnih et al. (2015), modern implementations of QQ-learning, and nn-step QQ-learning (see Mnih et al. (2016)) update the QQ-function incrementally to compute the backup against a fixed target QQ-function, which we’ll call Q‾\underline{Q}. In the interval between each target network update, the algorithm is approximately performing the backup operation Q←TQ‾Q\leftarrow\mathcal{T}\underline{Q} (11-step) or Q←TπQ‾B,nQ‾Q\leftarrow\mathcal{T}_{\pi^{\mathcal{B}}_{\underline{Q}},n}\underline{Q} (nn-step). To perform this approximate minimization, the algorithms minimize the least squares loss

In one-step QQ-learning (Equation 45), yty_{t} is an unbiased estimator of [TQ](st,at)[\mathcal{T}Q](s_{t},a_{t}), regardless of what behavior policy was used to collect the data. In nn-step QQ-learning (Equation 46), for n>1n>1, yty_{t} is only an unbiased estimator of [TπQ‾B,nQ‾](st,at)[\mathcal{T}_{\pi^{\mathcal{B}}_{\underline{Q}},n}\underline{Q}](s_{t},a_{t}) if actions at,at+1,…,at+d−1a_{t},a_{t+1},\dots,a_{t+d-1} are sampled using πQ‾B\pi^{\mathcal{B}}_{\underline{Q}}.

6 Policy Gradients

Entropy regularization is often used in policy gradient algorithms, with gradient estimators of the form

However, these are not proper estimators of the entropy-augmented return ∑t(rt−τKL⁡t)\sum_{t}(r_{t}-\tau\operatorname{KL}_{t}), since they don’t account for how actions affect entropy at future timesteps. Intuitively, one can think of the KL terms as a cost for “mental effort”. Equation 48 only accounts for the instantaneous effect of actions on mental effort, not delayed effects.

To compute proper gradient estimators, we need to include the entropy terms in the return. We will define the discounted policy gradient in the following two equivalent ways—first, in terms of the empirical return; second, in terms of the value functions VπV_{\pi} and QπQ_{\pi}:

In the special case of a finite-horizon problem—i.e., rt=KL⁡t=0r_{t}=\operatorname{KL}_{t}=0 for all t≥Tt\geq T—the undiscounted (γ=1\gamma=1) return is finite, and it is meaningful to compute its gradient. In this case, g1(πθ)g_{1}(\pi_{\theta}) equals the undiscounted policy gradient:

Since g1(πθ)g_{1}(\pi_{\theta}) computes the gradient of the entropy-regularized return, one interpretation of gγ(πθ)g_{\gamma}(\pi_{\theta}) is that it is an approximation of the undiscounted policy gradient g1(πθ)g_{1}(\pi_{\theta}), but that it allows for lower-variance gradient estimators by ignoring some long-term dependencies. A different interpretation of gγ(π)g_{\gamma}(\pi) is that it gives a gradient flow such that π∗=πQ∗B\pi^{\ast}=\pi^{\mathcal{B}}_{Q_{*}} is the (possibly unique) fixed point.

As in the standard MDP setting, one can define approximations to gγg_{\gamma} that use a value function to truncate the returns for variance reduction. These approximations can take the form of nn-step methods (Mnih et al. (2016)) or TD(λ\lambda)-like methods (Schulman et al. (2015b)), though we will focus on nn-step returns here. Based on the definition of gγg_{\gamma} above, the natural choice of variance-reduced estimator is

where δt\delta_{t} was defined in Equation 36.

The state-value function VV we use in the above formulas should approximate the entropy augmented return ∑t=0∞γt(rt−τKL⁡t)\sum_{t=0}^{\infty}\gamma^{t}(r_{t}-\tau\operatorname{KL}_{t}). We can fit VV iteratively by approximating the nn-step backup V←TπnVV\leftarrow\mathcal{T}_{\pi}^{n}V, by minimizing a squared-error loss

Soft Q𝑄Q-learning Gradient Equals Policy Gradient

This section shows that the gradient of the squared-error loss from soft QQ-learning (Section 3.5) equals the policy gradient (in the family of policy gradients described in Section 3.6) plus the gradient of a squared-error term for fitting the value function. We will not make any assumption about the parameterization of the QQ-function, but we define VθV_{\theta} and πθ\pi_{\theta} as the following functions of the parameterized QQ-function QθQ_{\theta}:

Here, πθ\pi_{\theta} is the Boltzmann policy for QθQ_{\theta}, and VθV_{\theta} is the normalizing factor we described above. From these definitions, it follows that the QQ-function can be written as

We will substitute this expression into the squared-error loss function. First, for convenience, let us define Δt=∑d=0n−1γdδt+d\Delta_{t}=\sum_{d=0}^{n-1}\gamma^{d}\delta_{t+d}.

Now, let’s consider the gradient of the nn-step soft QQ-learning objective:

Note that the equivalent policy gradient method multiplies the policy gradient by a factor of τ\tau, relative to the value function error. Effectively, the value function error has a coefficient of τ−1\tau^{-1}, which is larger than what is typically used in practice (Mnih et al. (2016)). We will analyze this choice of coefficient in the experiments.

Soft Q𝑄Q-learning and Natural Policy Gradients

The previous section gave a first-order view on the equivalence between policy gradients and soft QQ-learning; this section gives a second-order, coordinate-free view. As previous work has pointed out, the natural gradient is the solution to a regression problem; here we will explore the relation between that problem and the nonlinear regression in soft QQ-learning.

Now let us interpret the least-squares problem in Equation 66. Ψw\bm{\Psi}\mathbf{w} is the vector whose ttht^{\text{th}} row is ∇θlog⁡πθ(a ∣ s)⋅w\nabla_{\theta}\log\pi_{\theta}(a\>|\>s)\cdot\mathbf{w}. According to the definition of the gradient, if we perform a parameter update with θ−θold=ϵw\theta-\theta_{\text{old}}=\epsilon\mathbf{w}, the change in log⁡πθ(a ∣ s)\log\pi_{\theta}(a\>|\>s) is as follows, to first order in ϵ\epsilon:

Thus, we can interpret the least squares problem (Equation 66) as solving

That is, we are adjusting each log-probility log⁡πθold(at ∣ st)\log\pi_{\theta_{\text{old}}}(a_{t}\>|\>s_{t}) by the advantage function Δt\Delta_{t}, scaled by ϵ\epsilon.

In entropy-regularized reinforcement learning, we have an additional term for the gradient of the KL-divergence:

Now let’s consider QQ-learning. Let’s assume that the value function is unchanged by optimization, so Vθ=VθoldV_{\theta}=V_{\theta_{\text{old}}}. (Otherwise, the equivalence will not hold, since the value function will try to explain the measured advantage Δ\Delta, shrinking the advantage update.)

Evidently, we are regressing log⁡πθ(at ∣ st)\log\pi_{\theta}(a_{t}\>|\>s_{t}) towards log⁡πθold(at ∣ st)+Δt/τ+KL⁡[πθold,π‾](st)\log\pi_{\theta_{\text{old}}}(a_{t}\>|\>s_{t})+\Delta_{t}/\tau+\operatorname{KL}[\pi_{\theta_{\text{old}}},\overline{\pi}](s_{t}). This loss is not equivalent to the natural policy gradient loss that we obtained above.

We can recover the natural policy gradient by instead solving a damped version of the QQ-function regression problem. Define Q^tϵ=(1−ϵ)Qθold(st,at)+ϵQ^t\hat{Q}^{\epsilon}_{t}=(1-\epsilon)Q_{\theta_{\text{old}}}(s_{t},a_{t})+\epsilon\hat{Q}_{t}, i.e., we are interpolating between the old value and the backed-up value.

which exactly matches the expression in the least squares problem in Equation 71, corresponding to entropy-regularized natural policy gradient. Hence, the “damped” QQ-learning update corresponds to a natural gradient step.

Experiments

To complement our theoretical analyses, we designed experiments to study the following questions:

Though one-step entropy bonuses are used in PG methods for neural network policies (Williams (1992); Mnih et al. (2016)), how do the entropy-regularized RL versions of policy gradients and QQ-learning described in Section 3 perform on challenging RL benchmark problems? How does the “proper” entropy-regularized policy gradient method (with entropy in the returns) compare to the naive one (with one-step entropy bonus)? (Section 6.1)

How do the entropy-regularized versions of QQ-learning (with logsumexp) compare to the standard DQN of Mnih et al. (2015)? (Section 6.2)

The equivalence between PG and soft QQ-learning is established in expectation, however, the actual gradient estimators are slightly different due to sampling. Furthermore, soft QQ-learning is equivalent to PG with a particular penalty coefficient on the value function error. Does the equivalence hold under practical conditions? (Section 6.3)

Here we investigated whether there is an empirical effect of including entropy terms when computing returns, as described in Section 3. In this section, we compare the naive and proper policy gradient estimators:

In the experiments on Atari, we take π‾\overline{\pi} to be the uniform distribution, which gives a standard entropy bonus up to a constant.

We start with a well-tuned (synchronous, deterministic) version of A3C (Mnih et al. (2016)), henceforth called A2C (advantage actor critic), to optimize the entropy-regularized return. We use the parameter τ=0.01\tau=0.01 and train for 320320 million frames. We did not tune any hyperparameters for the “proper” algorithm—we used the same hyperparameters that had been tuned for the “naive” algorithm.

As shown in Figure 1, the “proper” version yields performance that is the same or possibly greater than the “naive” version. Hence, besides being attractive theoretically, the entropy-regularized formulation could lead to practical performance gains.

2 DQN on Atari: Standard vs Soft

Here we investigated whether soft QQ-learning (which optimizes the entropy-augmented return) performs differently from standard “hard” QQ-learning on Atari. We made a one-line change to a DQN implementation:

The difference between the entropy bonus and KL penalty (against uniform) is simply a constant, however, this constant made a big difference in the experiments, since a positive constant added to the reward encourages longer episodes. Note that we use the same epsilon-greedy exploration in all conditions; the only difference is the backup equation used for computing yty_{t} and defining the loss function.

The results of two runs on each game are shown in Figure 2. The entropy-bonus version with τ=0.1\tau=0.1 seems to perform a bit better than standard DQN, however, the KL-bonus version performs worse, so the benefit may be due to the effect of adding a small constant to the reward. We have also shown the results for 55-step QQ-learning, where the algorithm is otherwise the same. The performance is better on Pong and QQ-bert but worse on other games—this is the same pattern of performance found with nn-step policy gradients. (E.g., see the A2C results in the preceding section.)

3 Entropy Regularized PG vs Online Q𝑄Q-Learning on Atari

Next we investigate if the equivalence between soft QQ-learning and PG is relevant in practice—we showed above that the gradients are the same in expectation, but their variance might be different, causing different learning dynamics. For these experiments, we modified the gradient update rule used in A2C while making no changes to any algorithmic component, i.e. parallel rollouts, updating parameters every 55 steps, etc. The QQ-function was represented as: Qθ(s,a)=Vθ(s)+τlog⁡πθ(a ∣ s)Q_{\theta}(s,a)=V_{\theta}(s)+\tau\log\pi_{\theta}(a\>|\>s), which can be seen as a form of dueling architecture with τlog⁡πθ(a ∣ s)\tau\log\pi_{\theta}(a\>|\>s) being the “advantage stream” (Wang et al. (2015)). Vθ,πθV_{\theta},\pi_{\theta} are parametrized as the same neural network as A2C, where convolutional layers and the first fully connected layer are shared. πθ(a ∣ s)\pi_{\theta}(a\>|\>s) is used as behavior policy.

A2C can be seen as optimizing a combination of a policy surrogate loss and a value function loss, weighted by hyperparameter cc:

In normal A2C, we have found c=0.5c=0.5 to be a robust setting that works across multiple environments. On the other hand, our theory suggests that if we use this QQ-function parametrization, soft QQ-learning has the same expected gradient as entropy-regularized A2C with a specific weighting c=1τc=\frac{1}{\tau}. Hence, for the usual entropy bonus coefficient setting τ=0.01\tau=0.01, soft QQ-learning is implicitly weighting value function loss a lot more than usual A2C setup (c=100c=100 versus c=0.5c=0.5). We have found that such emphasis on value function (c=100c=100) results in unstable learning for both soft QQ-learning and entropy-regularized A2C. Therefore, to make QQ-learning exactly match known good hyperparameters used in A2C, we scale gradients that go into advantage stream by 1γ\frac{1}{\gamma} and scale gradients that go into value function stream by c=0.5c=0.5.

With the same default A2C hyperparameters, learning curves of PG and QL are almost identical in most games (Figure 3), which indicates that the learning dynamics of both update rules are essentially the same even when the gradients are approximated with a small number of samples. Notably, the QQ-learning method here demonstrates stable learning without the use of target network or ϵ\epsilon schedule.

Related Work

Three recent papers have drawn the connection between policy-based methods and value-based methods, which becomes close with entropy regularization.

O’Donoghue et al. (2016) begin with a similar motivation as the current paper: that a possible explanation for QQ-learning and SARSA is that their updates are similar to policy gradient updates. They decompose the QQ-function into a policy part and a value part, inspired by dueling QQ-networks (Wang et al. (2015)):

Nachum et al. (2017) also discuss the entropy-regularized reinforcement learning setting, and develop an off-policy method that applies in this setting. Their argument (modified to use our notation and KL penalty instead of entropy bonus) is as follows. The advantage function Aπ(s,a)=Qπ(s,a)−Vπ(s)A_{\pi}(s,a)=Q_{\pi}(s,a)-V_{\pi}(s) lets us define a multi-step consistency equation, which holds even if the actions were sampled from a different (suboptimal) policy. In the setting of deterministic dynamics, Qπ(st,at)=rt+γVπ(st+1)Q_{\pi}(s_{t},a_{t})=r_{t}+\gamma V_{\pi}(s_{t+1}), hence

If π\pi is the optimal policy (for the discounted, entropy-augmented return), then it is the Boltzmann policy for QπQ_{\pi}, thus

This expression for the advantage can be substituted into Equation 88, giving the consistency equation

which holds when π\pi is optimal. The authors define a squared error objective formed from by taking LHS - RHS in Equation 90, and jointly minimize it with respect to the parameters of π\pi and VV. The resulting algorithm is a kind of Bellman residual minimization—it optimizes with respect to the future target values, rather than treating them as fixed Scherrer (2010).

Haarnoja et al. (2017) work in the same setting of soft QQ-learning as the current paper, and they are concerned with tasks with high-dimensional action spaces, where we would like to learn stochastic policies that are multi-modal, and we would like to use QQ-functions for which there is no closed-form way of sampling from the Boltzmann distribution π(a ∣ s)∝π‾(a ∣ s)exp⁡(Q(s,a)/τ)\pi(a\>|\>s)\propto\overline{\pi}(a\>|\>s)\exp(Q(s,a)/\tau). Hence, they use a method called Stein Variational Gradient Descent to derive a procedure that jointly updates the QQ-function and a policy π\pi, which approximately samples from the Boltzmann distribution—this resembles variational inference, where one makes use of an approximate posterior distribution.

Conclusion

We study the connection between two of the leading families of RL algorithms used with deep neural networks. In a framework of entropy-regularized RL we show that soft QQ-learning is equivalent to a policy gradient method (with value function fitting) in terms of expected gradients (first-order view). In addition, we also analyze how a damped QQ-learning method can be interpreted as implementing natural policy gradient (second-order view). Empirically, we show that the entropy regularized formulation considered in our theoretical analysis works in practice on the Atari RL benchmark, and that the equivalence holds in a practically relevant regime.

Acknowledgements

We would like to thank Matthieu Geist for pointing out an error in the first version of this manuscript, Chao Gao for pointing out several errors in the second version, and colleagues at OpenAI for insightful discussions.

References