Variance Reduction in Actor Critic Methods (ACM)
Eric Benhamou

TL;DR
This paper provides a theoretical analysis of Actor Critic Methods, showing they are control variate estimators and introducing a new variance-reduced formulation for Advantage Actor Critic methods.
Contribution
It proves the optimality of Q and A2C methods as control variate estimators using the projection theorem, and derives a new, lower-variance A2C formulation.
Findings
Q and A2C are optimal control variate estimators in L^2 norm.
The new A2C formulation has lower variance than traditional methods.
Theoretical justification for the strong performance of A2C methods.
Abstract
After presenting Actor Critic Methods (ACM), we show ACM are control variate estimators. Using the projection theorem, we prove that the Q and Advantage Actor Critic (A2C) methods are optimal in the sense of the norm for the control variate estimators spanned by functions conditioned by the current state and action. This straightforward application of Pythagoras theorem provides a theoretical justification of the strong performance of QAC and AAC most often referred to as A2C methods in deep policy gradient methods. This enables us to derive a new formulation for Advantage Actor Critic methods that has lower variance and improves the traditional A2C method.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
MethodsA2C
Variance Reduction in Actor Critic Methods (ACM)
Eric Benhamou {eric.benhamou@}{dauphine.fr}/{aisquareconnect.com} A.I Square Connect, Lamsade PSL
Abstract
After presenting Actor Critic Methods (ACM), we show ACM are control variate estimators. Using the projection theorem, we prove that the Q and Advantage Actor Critic (A2C) methods are optimal in the sense of the norm for the control variate estimators spanned by functions conditioned by the current state and action. This straightforward application of Pythagoras theorem provides a theoretical justification of the strong performance of QAC and AAC most often referred to as A2C methods in deep policy gradient methods. This enables us to derive a new formulation for Advantage Actor Critic methods that has lower variance and improves the traditional A2C method.
keywords: Actor critic method, Variance reduction, Projection, Deep RL.
1 Introduction
Recently ACM have emerged as the state of the art methods in Deep Reinforcement Learning (DRL) problems, Jaderberg et al., (2016) or Espeholt et al., (2018). The introduction of Deep Reinforcement Learning methods have enabled to enlarge the scope of RL to a wide variety of domains through trial and error learning: atari games Mnih et al., (2016) Go : Silver et al., (2016), image recognition Zoph et al., (2017), physics tasks, including classic problems such as cartpole swing-up, dexterous manipulation, legged locomotion and car driving Lillicrap et al., (2015), traffic signal control Mannion et al., 2016a , electricity generator scheduling Mannion et al., 2016b , water resource management Mason et al., (2016), controlling robots in real environments Levine et al., (2016) and other transport problem Talpaert et al., (2019) and control and manipulation tasks for robotics Barth-Maron et al., (2018); Horgan et al., (2018).
Advantage Actor Critic (A2C) and Asynchronous Advantage Actor Critic (A3C) methods Mnih et al., (2016) have been originally derived from the REINFORCE algorithm Williams, (1992). Sutton et al., (1999) has derived in full generality the policy gradient descent method while Mnih et al., (2016) (respectively Babaeizadeh et al., (2017)) have introduced the deep learning approach as well as capacity to distribute computations across CPUs (respectively GPUs). Currently, Deep Advantage Actor Critic methods achieve state of the art performance in Deep RL. The efficiency of these techniques has been mostly verified from an experimental point of view with multiple experiments on test-beds environment such Open AI gym and Atari games. However, theoretical considerations have been lacking sofar to express why these methods outperform other DRL methods. In this paper, we try precisely to answer this challenging question and to provide a theoretical justification for the efficiency of Advantage Actor Critic methods. After presenting the key motivation for A2C methods and in particular the concept of baseline, we prove that there exist optimal baselines according to the norm. We explain the concept of variance reduction and relate Q and Advantage Actor Critic methods to conditional expectations that can be interpreted as projection in the norm of the initial logathmic gradient in REINFORCE.
2 Related Work
Presenting and comparing ACM has been the subject of multiple papers such as Grondman et al., (2012), but also recent papers like Jaderberg et al., (2016) Lillicrap et al., (2015); Zoph et al., (2017); Barth-Maron et al., (2018); Horgan et al., (2018) or Espeholt et al., (2018). Actor critic are examined from a baseline point of view and the stream of quoted papers above aims at proving mostly the convergence of these methods seen as a enhancement of REINFORCE.
Another variety of research has been to find efficient optimization from a GPU and CPU perspective as in Mnih et al., (2016), Babaeizadeh et al., (2017) and lately Espeholt et al., (2018). Mnih et al., (2016) have implied an asynchronous version of the A2C algorithm, having a set of actors that learns from a set of critics. Computation workload is spread against multiple CPUs allowing efficient computation parallelism. Babaeizadeh et al., (2017) have made further progress by spreading computation across multiple GPUs leveraging the fact that the learning process in actor critic method can be split in a few highly parallel tasks that can be efficiently done with GPUs. Espeholt et al., (2018) have designed a new algorithm entitled V trace for learners to be able to learn asynchronously from different workers.
However, the core of the idea of Actor Critic method, namely a variance reduction technique has not been very well examined and quite overlooked. This paper aims at precisely showing the real importance of variance reduction in these methods to emphasize the logic behind these methods and provides new techniques. This extends the work of Greensmith_2002 that only consider one dimensional control variates. We show that we can do multi dimensional control variates. Our work also extends the work of Schulman et al., (2016) that provides a generalized advantage estimation using trust region optimization procedure for both the policy and the value function, which are represented by neural networks.
3 Background
We consider the standard reinforcement learning framework. A learning agent interacts with an envi-ronment to decide rational or optimal actions and receives in returns rewards. These rewards are not necessarily only positive. These rewards act as a feedback for finding the best action. Using the established formalism of Markov decision process, we assume that there exists a discrete time stochastic control process represented by a 4-tuple defined by , , where is the set of states, the set of actions, the transition probability that action in state at time will lead to state and finally, the immediate reward received after state and action .
The requirement of a Markovian state is not a strong constraint as we can stack observations to enforce that the Markov property is satisfyed.
Following Mnih et al., (2016) or Jaderberg et al., (2016), we introduce the concept of observations and pile them to coin states. In this setting, the agent perceives at time an observation along with a reward . The agent decides an action . The agent’s state is a function of its experience until time , . This setup guarantees that states are Markovian. In practice, we do not keep track of the full history but only a limited set of historical experiences. The -step return at time is defined as the discounted sum of rewards, , where is the discounted factor.
The value function is the expected return from state , , when actions are selected accorded to a policy . The action-value function is the expected return following action from state . The goal of the agent is to find a policy that maximizes the value function.
4 Variance Reduction
When states and or actions are in high dimensions, we parametrize our policy by parameters denoted . Typically these parameters are the ones of the parameters of a deep network (the weight of all layers of our deep network). The intuition of ACM is to leverage a policy gradient descent with a reduced variance. Let us show this precisely. Recall that the policy gradient is given by the policy logarithmic gradient weighted by the sum of future discounted rewards (see Williams, (1992) and Sutton et al., (1999))
[TABLE]
where represents a trajectory, the sum of future discounted rewards, and the discount factor. Hence, equation (1) shows that we update the policy deep network parameters through Monte Carlo updates computed as an expectation. We should stop for a while on this expectation as this is a critical part in the update. If the estimation of this expectation is not very accurate because of a large variance of our estimator provided by the standard empirical mean, we would incur high variability in our gradient update, hence a slow converging gradient policy method. It therefore makes a lot of sense to see if we could find another expression of our policy gradient with lower variance. This approach of finding a modified expression inside the expectation that has the same expected value but a lower variance is referred to as variance reduction Hammersley, (1964). A typical method variance reduction method is to use control variate(s) (see for instance Ross, (2002)). A lower variance in the gradient will produce less noisy gradient and cause less unstable learning leading to a policy distribution skewing to the optimal direction more rapidly.
4.1 Control Variate
To present control variate, let us make thing quite general. Suppose we try to estimate a quantity defined as an expectation of an estimator and suppose we know another statistic (or estimator) such that we not only know its expectation , but also its correlation with our initial estimator denoted by . We can build an unbiased and better estimator of as follows. We compute the ’control variate’ estimator of by subtracting a zero expectation term: for . We have the following control variate proposition
Proposition 4.1**.**
Optimal Control Variate - The control variate estimator is unbiased for any value of . Among all possible values of , the optimal one (in the sense that it produces the estimator with minimum variance) is given by
[TABLE]
The corresponding control variate estimator is given by and has a variance given by
[TABLE]
Hence the best control variate estimators are obtained for highly positively correlated () or negatively correlated () control variates
Proof.
Refer to Appendix section 7.1 ∎
Intuitively, the more correlated (positively or negatively) the estimators and , the better we can exploit the knowledge of our control variate zero expectation estimator to reduce the variance of our initial estimator . If we stop for a minute, this is quite trivial. For our control variates, we know the true expectation. If by any chance our estimator is very correlated (positively or negatively) to our control variates, we can exploit this knowledge to correct our estimator.
As a matter of fact, through control variate, we exploit information about the errors in estimates of known quantities () to reduce the error of an estimate of an unknown quantity (). We can also analyze the optimal control variate weight as a regression coefficient of our unknown estimator over the space of linear combination of the zero expectation estimator . Hence control variate consists in just focusing on the orthogonal part of our unknown estimator against the space of linear combination of the zero expectation estimator . If by any chance our unknown estimator is highly correlated to the control variate, this orthogonal part is close to zero and we achieve a much lower variance estimator.
In practice, in deep RL, we know neither the correlation between the two estimators nor the variances of our two estimators: or . Hence, instead of being able to define strictly a control variate estimator, we create a pseudo control variate estimator given by
[TABLE]
provided . The latter formulation takes a control variate coefficient of , which implicitly assumes that . We will use this setting to interpret various Actor Critic (AD) methods as control variate estimators for standard AC method for policy gradients. This is summarized by the proposition below:
Proposition 4.2**.**
Actor Critic Methods - The following estimators of the policy gradient are unbiased and can be analyzed as control variate estimators of REINFORCE policy gradient estimator given by :
- •
* (Q-AC)*
- •
* (A-AC)*
- •
* (TD-AC)*
where the Advantage function (A) is defined as
[TABLE]
and the Temporal Difference function (TD) as
[TABLE]
Proof.
Refer to Appendix section 7.2 ∎
Traditionally, methods for solving Reinforcement Learning (RL) are either categorized as policy method if they aim to find the optimal policy or as value methods if they aim to find the optimal ’Q’ function. Somehow, Q-AC and AAC methods aim to find the optimal policy thanks to gradient ascent computation but use in their gradient ascent term a ’Q’ function, making these methods a mix between policy and value methods. This is summarized by figure 1.
4.2 Conditional expectation, projection and optimality
Sofar, we have revisited AC methods as control variates. There is however a strong connection with conditional expectation and projection. Let us make the link. But let us first recall a basic property of conditional expectation that states that the conditional expectation with respect to a sub -algebra of a stochastic variable , measurable on a probability space , is the best prediction of the sub-space spanned by this sub -algebra:
Proposition 4.3**.**
Conditional expectation and Pythagoras - Let be a probability space, a random variable on that probability space square integrable and is a sub -algebra of , then we have that
- •
* is orthogonal to any element of where is the space of random variable on the sub -algebra that are square integrable.*
- •
* is the best prediction in the sense that minimizes its variance with : among any element .*
Proof.
Refer to Appendix section 7.3 ∎
Combining proposition 4.1, 4.2 and 4.3 enables us comparing the various ACM from a variance point of view. It is worth looking at the intuition of the function involved in the different ACM. TD-AC relies on the Temporal Difference which is the projection of the cumulated discounted rewards on the sub -algebra generated by the knowledge of the state while Q-AC relies on the action value ’Q’ function, which is its projection on the sub -algebra generated by the knowledge of the state and the A-AC on the advantage function which is the difference between the action value ’Q’ function and the value function which is of the cumulated discounted rewards on the sub -algebra generated by the knowledge of the state . Intuitively, as the various sub algebras are bigger (in the sense that each one is contained by the next one), the corresponding AC methods should become more effective, meaning TD-AC should be improved by Q-AC that should in turn be improved by the A-AC method. This is the subject of proposition 4.4
Proposition 4.4**.**
AC methods Comparison - From a variance point of view, TD-AC is less efficient than A-AC, and REINFORCE is less efficient than Q-AC.
Proof.
Refer to Appendix section 7.4 ∎
5 Towards new AC methods
In order to create new AC methods, it is useful to notice a property of the policy gradient computation that provides additional control variates.
Proposition 5.1**.**
If a function is such that when integrating with respect to the policy , it does not depend on the parameter , which means that , then its gradient policy term is null:
[TABLE]
Proof.
Refer to Appendix section 7.5 ∎
Remark 5.1**.**
In particular if the function writes as a function of only: and if is stationary in the sense that , than its policy gradient term is equal to zero:
[TABLE]
Typical stationary functions are the state value function and the constant function:
Equipped with these additional control variates, it is useful to examine multi dimensional control variates estimators that is the subject of the following proposition
Proposition 5.2**.**
Multi Dimensional Control Variates Estimators - Let us have a collection of random variables for which we know the expectation (for any ). Let us denote by
[TABLE]
the vector of control variates, a -dimensional real vector and build the multi dimensional control variates estimator as follows:
[TABLE]
As in the one dimensional case, the control variate estimator is unbiased for any value of . Assuming that is non singular, among all the possible values of , the optimal one (in the sense that it produces the estimator with minimum variance) is given by
[TABLE]
The corresponding control variate estimator is given by and has a variance given by
[TABLE]
Proof.
Refer to Appendix section 7.6 ∎
Equations (6) and (7) are just generalization of the one dimensional case. The condition that is non singular means that we have control variates that are independent in the sense that none of them is a linear combination of some of the other control variates. This condition is important as to use multi dimensional control variates we really need to find control variates that operate in another dimension space.
6 Conclusion
In this paper, we have revisited AC methods. We have shown that these methods can be interpreted as control variate estimators of REINFORCE. We have also proved using the property of conditional expectation, that the Q and Advantage Actor Critic are optimal control variate estimators. We have invented a new method that combines optimally the general advantage function to establish a new Actor Critic method that is optimal from a control variate point of view.
7 Appendix
7.1 Proof of proposition 4.1
We have
[TABLE]
since . This proves that the control variate estimator is unbiased for any value of . The variance of this estimator is easy to compute and is given by:
[TABLE]
that is a second order parabola function of that is minimum for
[TABLE]
Its minimum value is given by
[TABLE]
that is closed to zero for highly positively correlated () or negatively correlated () control variates. ∎
7.2 Proof of proposition 4.2
Let us tackle one by one the various estimators given in proposition 4.2.
The **Q Actor Critic (Q-AC) **estimator is given by . It writes also as
[TABLE]
which shows that it is a control variate estimator (as explained in equation (2)) provided we prove that
[TABLE]
The equation (8) is trivially verified as one of the definitions of the state action value function (often referred to as the ’Q’ function) is the following:
[TABLE]
The law of total expectation states that if is a random variable and any random variable on the same probability space, then or in other words , which concludes the proof for the Q Actor Critic (Q-AC) method with and .
As for the Advantage Actor Critic (A-AC) method, the same reasoning shows that it suffices to prove that
[TABLE]
to show that this is also a control variate method. Recall that the advantage function is given by . Using the result previously proved for the Q AC method (equation (8)), it suffices to prove that
[TABLE]
But this is a straight consequence of the more general proposition 5.1 and its remark 5.1.
Finally, let us prove that the TD Actor Critic (TD-AC) method is also a control variate. Recall that the Temporal Difference term is given by
[TABLE]
Using equation (9), it suffices to prove that
[TABLE]
This is again a straightforward application of the law of total expectation as
[TABLE]
while
[TABLE]
Hence we can apply the law of total expectation with and . This concludes the proof. ∎
7.3 Proof of proposition 4.3
Let us first prove that for any , we have
[TABLE]
This is straight application of the law of total expectation (also referred to as the law of iterated expectation or also the tower property) as follows
[TABLE]
which proves the orthogonality.
For , we have
[TABLE]
which concludes the proof that the squared norm of for any element of is lower bounded by the squared norm of ∎
7.4 Proof of proposition 4.4
As explained in the proposition 4.1, the variance of the control variate is due to the residuals computed as the initial estimator minus the control variate. The control variate is the orthogonal projection of the initial estimator on the linear subspace spanned by the control variate. The proposition 4.3 shows that within the possible sub the conditional expectation is the orthogonal projection and is the best estimator. Recall that the Temporal difference writes as
[TABLE]
Recall also that the value function is a conditional expectation
[TABLE]
while the state action value ’Q’ function is also a conditional expectation but with respect to :
[TABLE]
Last but not least, Advantage function writes as
[TABLE]
From equations (11), (13) and (14), we can deduce that A AC has lower variance than TD AC as the corresponding sub -algebra obtained by conditioning with respect to , used for A-AC, contains the one obtained by conditioning with respect to and used for TD-AC.
As ’Q’ function is a conditional expectation of the future discounted rewards, Q-AC should perform better (have a lower variance) than just REINFORCE.
7.5 Proof of proposition 5.1
Proof.
: Recall that the logarithmic gradient writes as
[TABLE]
Assuming smooth functions such that we can interchange expectation (integration) and gradient (derivation), we have the following:
[TABLE]
which concludes the proof∎
7.6 Proof of proposition 5.2
We can provide multiple proofs and interpretation of this result.
proof 1 Let us use traditional variation calculus. It is immediate that for any value it is unbiased as the additional term has a null expectation: . We can compute the variance of the control variate estimator , given by
[TABLE]
Assuming the covariance matrix is non singular, our minimum variance problem lies in finding the minimum of a defined parabolla, hence its minimum is given by first order optimality (see Boyd and Vandenberghe, (2004) A.13)
[TABLE]
with the minimum given by:
[TABLE]
proof 2 Another way to demonstrate this result is to look at the space of all square integrable random variables defined on the same probability space as equiped with the canonical inner product and the implied Hilbertian norm for any . Let be the linear compact and closed space subspace spanned by any linear combination of : such that for some . Using the fact that the expectation of does not depend on , the variance minimum in can be cast as a minimum distance problem of with . This is because
[TABLE]
This is nice property as the minimum distance problem can be solved with the Hilbert space projection theorem that states that the closest point of to is given by its orthogonal projection . This orthogonal projection is characterized uniquely by
[TABLE]
which writes as . Hence for any , we have , which implies or equivalently
[TABLE]
leading to the following solution:
[TABLE]
proof 3 Let us show how we can decouple the problem into one dimensional control variate problems using diagonalization. We are looking for the minimum variance control variate spanned by our initial control variates basis . Obviously, we can use any equivalent basis. In particular, if we use Gram Schmidt orthogonalization, we can ensure that the components of our control variate basis are orthogonal for the implied inner product. If some of the component are non independent we can retrieve the corresponding control variate vectors to ensure they are all independent. The orthogonality of the components of our control variate basis ensures that the covariance matrix is symmetric and non negative definitive. Hence, because of the Takagi’s factorization, there exists a diagonal matrix with non negative diagonal terms and an unitary matrix such that . Let define . We have , so that the components of are orthogonal with variance given by diagonal terms for . Because of the equivalence of basis, our optimization problem decouples as it can be reformulated as follows:
[TABLE]
which is equivalent to for any , where is the coordinate of the random variable in the basis implied by that is spanned by the orthorgonal vectors that is fill with zero except for coordinate equal to . These decoupled and independent optimization problems are now just one dimensional control variate optimization problem whose solution are
[TABLE]
so that the solution is given by
[TABLE]
Noticing that the term is the term of the , this can be rewritten as
[TABLE]
leading to the following solution:
[TABLE]
which concludes the third proof. ∎
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1Babaeizadeh et al., (2017) Babaeizadeh, M., Frosio, I., Tyree, S., Clemons, J., and Kautz, J. (2017). Reinforcement learning thorugh asynchronous advantage actor-critic on a gpu. In ICLR .
- 2Barth-Maron et al., (2018) Barth-Maron, G., Hoffman, M. W., Budden, D., Dabney, W., Horgan, D., TB, D., Muldal, A., Heess, N., and Lillicrap, T. (2018). Distributional policy gradients. In International Conference on Learning Representations .
- 3Boyd and Vandenberghe, (2004) Boyd, S. and Vandenberghe, L. (2004). Convex Optimization . Cambridge University Press.
- 4Espeholt et al., (2018) Espeholt, L., Soyer, H., Munos, R., Simonyan, K., Mnih, V., Ward, T., Doron, Y., Firoiu, V., Harley, T., Dunning, I., Legg, S., and Kavukcuoglu, K. (2018). IMPALA: Scalable distributed deep-RL with importance weighted actor-learner architectures. In Dy, J. and Krause, A., editors, Proceedings of the 35th International Conference on Machine Learning , volume 80 of Proceedings of Machine Learning Research , pages 1407–1416, Stockholmsmässan, Stockholm Sweden.
- 5Grondman et al., (2012) Grondman, I., Busoniu, L., Lopes, G. A. D., and Babuska, R. (2012). A survey of actor-critic reinforcement learning: Standard and natural policy gradients. Trans. Sys. Man Cyber Part C , 42(6):1291–1307.
- 6Hammersley, (1964) Hammersley, J. M., D. C. H. (1964). Monte Carlo Methods . John Wiley & Sons, New York.
- 7Horgan et al., (2018) Horgan, D., Quan, J., Budden, D., Barth-Maron, G., Hessel, M., van Hasselt, H., and Silver, D. (2018). Distributed prioritized experience replay. In International Conference on Learning Representations .
- 8Jaderberg et al., (2016) Jaderberg, M., Mnih, V., Czarnecki, W. M., Schaul, T., Leibo, J. Z., Silver, D., and Kavukcuoglu, K. (2016). Reinforcement learning with unsupervised auxiliary tasks. Co RR , abs/1611.05397.
