{'fraction_non_alphanumeric': 0.04776170504151331, 'fraction_numerical': 0.01583497389369169, 'mean_word_length': 4.07250624118094, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
On the Convergence and Optimality of Policy Gradient for Markov Coherent Risk

In order to model risk aversion in reinforcement learning, an emerging line of research adapts familiar algorithms to optimize coherent risk functionals, a class that includes conditional value-at-risk (CVaR). Because optimizing the coherent risk is difficult in Markov decision processes, recent work tends to focus on the Markov coherent risk (MCR), a time-consistent surrogate. While, policy gradient (PG) updates have been derived for this objective, it remains unclear (i) whether PG finds a global optimum for MCR; (ii) how to estimate the gradient in a tractable manner. In this paper, we demonstrate that, in general, MCR objectives (unlike the expected return) are not gradient dominated and that stationary points are not, in general, guaranteed to be globally optimal. Moreover, we present a tight upper bound on the suboptimality of the learned policy, characterizing its dependence on the nonlinearity of the objective and the degree of risk aversion. Addressing (ii), we propose a practical implementation of PG that uses state distribution reweighting to overcome previous limitations. Through experiments, we demonstrate that when the optimality gap is small, PG can learn risk-sensitive policies. However, we find that instances with large suboptimality gaps are abundant and easy to construct, outlining an important challenge for future research.


Introduction
As reinforcement learning (RL) has emerged as a prospective technology in consequential and safety-critical domains, a burgeoning body of research seeks to optimize objectives that incorporate notions of risk sensitivity [Garcıa and Fernández, 2015], e.g., reducing variance or mitigating the worst case returns. In particular, coherent risk functionals [Artzner et al., 1999] satisfy several natural and desirable properties, subsuming the expected return, conditional value-at-risk (CVaR), mean upper semideviation, and spectral risk functionals [Acerbi, 2002]. However, when directly addressing the coherent risk in Markov decision process (MDPs), owing to time inconsistency, it can be difficult to construct dynamic programming formulations or to derive the corresponding Bellman operators. Thus many researchers instead focus on the Markov coherent risk (MCR), a time-consistent surrogate [Ruszczyński andShapiro, 2006, Tamar et al., 2015a].
While recent papers derive policy gradient (PG) updates for MCR [Tamar et al., 2015a], PG for this objective has not been proven to enjoy the same guarantees of global convergence as it has for the expected return [Agarwal et al., 2019, Bhandari andRusso, 2019]. Moreover, while folk wisdom suggests that it should converge to a stationary point of the MCR, this local convergence viewpoint leaves open the critical question of how far this point can be from the global optimum.
In this paper, we analyze the global convergence of PG algorithms for optimizing the MCR, which, to the best of our knowledge, is the first investigation into its theoretical convergence. First, we prove that the MCR is not gradient dominated and thus, in general, PG may not converge to a global optimum (Section 5). We upper bound the suboptimality of the policy using a scalar notion of first-order stationarity plus necessary problem-dependent residuals reflecting the nonlinearity and risk sensitivity of the objective. Moreover, we design MDP problem instances that illustrate how these residuals are inevitable, and thus that our upper bound is tight. Next, we show that projected gradient descent of the MCR objective converges in O(1/ √ T ) iterations to a policy with suboptimality gap quantified by the same residuals (Section 5.3). We later show that the mentioned suboptimality gap vanishes under the expected return, which is an MCR objective, recovering the convergence results of Agarwal et al. [2019].
On the practical side, we provide methods to estimate the gradient of the MCR, a task that proves difficult because it involves an expectation over a reweighted state distribution of the underlying MDP (Theorem 4.1). The weights are determined by the solution to the maximization problem in the MCR Bellman operator (Section 4.1), unique to the coherent risk functional and dependent on the current policy. In Tamar et al. [2015a], the authors make the strong assumption that the agent can sample from the reweighted distribution of the underlying MDP, which rarely holds in online settings. To relax this assumption, in the second part of our paper, we leverage recent advances in off-policy evaluation to propose an algorithm using state distribution correction [Liu et al., 2018] to tractably estimate the gradient, which can then be plugged into any policy gradient algorithm. This permits, to our knowledge, the first evaluations of PG optimization of MCR in MDPs. In our experiments (Section 7), we integrate this method into an actor-critic algorithm to demonstrate its effectiveness in optimizing MCR in a stochastic version of the Cliffwalk environment [Sutton and Barto, 2018].

Related Work
Risk functionals, including exponential utility [Fei et al., 2020], the mean-variance risk functional [Di Castro et al., 2012, Prashanth andGhavamzadeh, 2013], the conditional value-at-risk (CVaR) [Tamar et al., 2015b, Chow andGhavamzadeh, 2014] and cumulative prospect risks [Prashanth et al., 2016] are increasingly studied in the RL literature. They have been explored empirically for a number of Atari games [Bellemare et al., 2017], and in the context of such diverse applications as autonomous driving [Mavrin et al., 2019] and healthcare [Keramati et al., 2019]. Many (but not all) of these risk functionals are subsumed under the class of coherent risks [Shapiro et al., 2009], which satisfy several desirable theoretical properties (Section 3).
In the MDP setting, researchers have considered the dynamic coherent risk [Chow and Ghavamzadeh, 2014], which applies the coherent risk functional directly on the (random) return over entire trajectories and the MCR objective [Tamar et al., 2015a], which applies it in a nested manner at each timestep. Pflug and Pichler [2016] shows that the two formulations are generally not equal except for the expected return and max-risk due to a property called time consistency. Time consistent risk measures satisfy the property that if a policy is risk-optimal for T timesteps onward, it is also risk-optimal for t timesteps onward, where t ≤ T . Leveraging time consistency, one can rewrite MCR objectives in dynamic programming form using a Bellman operator, as derived by Ruszczyński and Shapiro [2006] and studied in the PG setting by Tamar et al. [2015a]. By contrast, for the dynamic coherent risk, the Bellman optimality operator has been derived only for CVaR [Chow et al., 2015]. Even for CVaR, the dynamic coherent risk is difficult to work with, requiring that we augment the state space with the continuous CVaR level α (CVaR α (Z) gives the expected value of the lower α-quantile of the random variable Z), and learn the optimal value for all CVaR levels. The MCR upper bounds the dynamic coherent risk, and though not always explicitly named, has seen wide usage in RL literature [Tamar et al., 2015b, Bellemare et al., 2017.
In the primary work on PG for MCR objectives, Tamar et al. [2015a] studies the general class of coherent risk functionals, introducing a (statistically) consistent sampling-based estimate of the policy gradient. However, they do not investigate convergence of the PG algorithm to local or global optima. Further, while they present an actor-critic algorithm for optimizing the MCR, they make strong sampling assumptions.
Our work makes advances on both of these fronts. Inspired by Agarwal et al. [2019], Azizzadenesheli et al. [2018], Bhandari and Russo [2019], who demonstrate the global optimality and convergence rate of PG for the expected return, our convergence analysis characterizes the suboptimality of PG for MCR. Our proposed policy gradient algorithm is inspired by the algorithm presented in Tamar
Importantly, coherent risk functionals can be uniquely expressed using the following dual representation: Theorem 3.1. [Shapiro et al., 2009, Theorem 6.4] A risk functional ρ : Z → R is coherent if and only if there exists a convex bounded and closed set of feasible duals U depending on P , such that where the risk envelope U(P ) = {ξ ∈ dom(ρ * ) : ω∈Ω ξ(ω)dP (ω) = 1, ξ ≥ 0} and dom(ρ * ) is the domain of the Fenchel conjugate of ρ.
Because the set of subdifferentials is always a convex and compact set, following Tamar et al.
[2015a], we write U using the general form below, which includes additional assumptions on smoothness: Assumption 3.2 (General Form of Risk Envelope). The risk envelope U(P ) from Theorem 3.1 can be written as where E, I denote a set of equality and inequality constraints, respectively. Each constraint g e is affine in ξ, each constraint f i is convex in ξ, and there exists a strictly feasible point ξ. Further, for any given ξ, both g e (ξ, P ) and f i (ξ, P ) are twice differentiable in P and there exists M > 0 such that for all e ∈ E and i ∈ I, Assumption 3.2 is satisfied by the CVaR, mean semideviation, and spectral risk functionals, and implies that the risk envelope U is known in explicit form. The dual representation in Theorem 3.1 indicates that coherent risk measures can be seen as the eifjcctrdujltgunddiuvvjvffvldfukdnueiejjrtik worst-case expectation of Z over probability distributions reweighted by ξ, which must be chosen from the set of measures in the risk envelope U [Chow et al., 2015].

Problem Setting
In this paper, we focus on the infinite horizon discounted Markov Decision Process (MDP) setting. An MDP is a tuple M = (S, A, C, P, γ, s 0 ), where S is the state space, A is the action space, C : S → [0, 1] is the cost function, P (·|s, a) is the transition kernel, γ ∈ [0, 1) is the discount factor, and s 0 ∈ S is the starting state. A stationary Markov policy π θ : S → ∆(A) parameterized by θ ∈ R d maps each state s ∈ S to a probability measure over actions A, where ∆(·) denotes the probability simplex.
Given an MDP M and policy π θ , consider a filtration F = {F t } t≥0 such that the observations sequence (s 0 , a 0 , c 0 , . . . , s t , a t , c t ) is F t -measurable. Let C(s t ) be the F t -measurable random cost at time t. In this paper, we consider the Markov coherent risk (MCR) objective defined over {C(s t )} t≥0 .
Definition 1 (Markov Coherent Risk Objective). Given a sequence of random costs {C(s t )} t≥0 , the Markov coherent risk objective is defined as The MCR is a nested discounted sum of the risk functional ρ applied at each timestep to the randomness of the cost C(s t ) given the previous state s t−1 , which arises from the stochastic policy π θ and transitions of the MDP. We are interested in solving the following optimization problem, which seeks the parameter θ that minimizes the MCR (3), using policy gradient methods.

Value Function and Gradient
The risk-sensitive value function for an MDP M under the policy π θ is defined as V θ (s) = ρ θ (s where U is the risk envelope defined in Theorem 3.1 and P θ (s |s) := a∈A π θ (a|s)P (s |s, a). Under Assumption 3.2, the value function can be re-written as where L θ,s is the corresponding Lagrangian For each state s ∈ S, let (ξ θ,s , λ P θ,s , λ E θ,s , λ I θ,s ) denote a saddle point of (5), which is guaranteed to exist under Assumption 3.2. The gradient of the value ∇ θ V θ (s 0 ) = ∇ θ ρ θ (s 0 ) is calculated using the saddle points (ξ θ,s , λ P θ,s , λ E θ,s , λ I θ,s ), and was derived in Tamar et al. [2015a]. We restate this theorem below with proof in Appendix A.
where E ξ θ,s refers to expectation with respect to trajectories generated by a Markov chain with transition probabilities P θ (·|s)ξ θ,s (·), and Notation We now introduce some notation key to our analysis of policy gradient in the following sections. First, define the infinite discounted state visitation distribution under a policy π θ and the starting state s 0 to be d π θ (s) := (1 − γ) ∞ t=0 γ t P π θ (s t = s|s 0 ), where P π θ (s t = s|s 0 ) is the probability that s t = s after executing π θ starting from state s 0 . We adopt the shorthand for these terms as d θ and P θ , respectively, and d * and P * for the optimal policy π * . Without loss of generality, we assume that that the starting state is deterministic and thus remove s 0 from our notation to avoid clutter. We next define the MDP transitions induced by π θ and reweighted by {ξ s } s∈S to be P ξ θ . Under this reweighting, the transitions are given by P ξ θ (s |s) := P θ (s |s)ξ s (s ). The state visitation distribution under these reweighted transitions is d ξ θ (s) := (1 − γ) ∞ t=0 γ t P ξ θ (s t = s|s 0 ).

Global Optimality
In this section, we investigate the global optimality and convergence of PG for the MCR objective (3) and consider policies directly parameterized by θ ∈ R |S|×|A| , i.e. π θ (a|s) = θ s,a . We begin with an illustrative example demonstrating that risk-sensitive MCR exhibits local minima for even simple problems, which suggests that unlike the expected return, it is not gradient dominated. We formalize this result in Lemma 5.3, which states that the value optimality gap V θ − V * under the MCR is upper bounded by the magnitude of the gradient plus residual terms. As a result, stationary points of the MCR objective are not guaranteed to be global optima. The residuals are a consequence of the fact that, unlike in the expected return, the MCR Bellman operator (4) is nonlinear in the policy π θ due to the maximization over U, which is dependent on π θ . We show that the residuals vanish under the expected return, which is a Markov coherent risk objective, demonstrating that Lemma 5.3 is a generalization of the gradient domination lemma previously developed in Agarwal et al. [2019] for expected return. Moreover, we prove that there exist problem instances for which the gradient domination inequality holds with equality, demonstrating the tightness of our result. Finally, using the gradient domination lemma, we establish the convergence rate of projected gradient descent for the MCR objective.

Motivating Example
Consider a 2-armed bandit problem where the cost of Arm 1 is a Bernoulli random variable which assigns probability 0.8 to receiving cost 1, and the cost of Arm 2 is always 0.5. Suppose we work with a directly parameterized policy, where the probability of playing arm 1 is given by θ and the probability of playing arm 2 is given by 1 − θ. This problem can equivalently be written as a five-state MDP, with transitions given in Figure 1a.
We use the MCR objective with the CVaR α risk functional, and in Figure 1b, plot the optimization landscape for this problem, i.e., the MCR objective over the range of possible policies θ, at different C = 0.5 risk sensitivity levels α. It is clear that, for a range of α < 1 levels, two stationary points exist at the boundary θ = 0 and θ = 1. Which one PG converges to depends on the initial value of θ. Only when CVaR α = 1, which corresponds to the expected return, will the stationary point be unique and globally optimal. This matches previous results [Agarwal et al., 2019] demonstrating that the expected return is gradient dominated. In addition, this counterexample exposes another source of poor convergence and suboptimality in MCR objectives. Because certain coherent risk functionals, such as CVaR α , consider a worst-case reweighted fraction of the cost distribution, they are more vulnerable to vanishing gradients than the expected return. This problem is exacerbated for higher degrees of risk sensitivity, e.g., lower α for CVaR. As can be seen from the α = 0.1 line in Figure 1b, the gradient is zero for a significant fraction of random initializations of θ, while expected value (α = 1) has no such problem.

Gradient Domination
We formalize the intuition of our motivating example using a property called gradient domination. Any stationary point of a gradient dominated function is also globally optimal. Even if a gradient dominated function is highly non-convex, any optimization algorithm that converges to a stationary point will also converge to a global optimum. The expected return has previously been shown to be gradient dominated. We follow the notion of gradient domination introduced by Bhandari and Russo [2019] and formally articulated in Definition 2.
Definition 2 has two important implications. First, when ∇f (θ), θ − θ ≥ 0 for all θ , which occurs when θ is a stationary point, we have min θ ∈Θ f (θ ) ≥ f (θ), implying that θ is globally optimal. Second, for any θ, the optimality gap f (θ) − min θ ∈Θ f (θ ) can be upper bounded by the minimization problem on the right hand side, which is a measure of how far θ is from stationary. We demonstrate through Lemma 5.3 that for MCR although the first statement does not hold, we can still expressively bound the optimality gap with a similar optimization problem.
We first define the two residuals presented in Lemma 5.3, which arise from two sources of nonlinearity in the Markov coherent risk value function: (i) the dependence of the saddle point solutions ξ θ,s and λ θ,s on π θ ; and (ii) in the constraints f i and g e which, depending on the coherent risk measure, may be highly nonlinear in π θ . The first source of nonlinearity contributes to our analysis is the difference between the primal and dual solutions of π θ and π * , which we upper bound by L in Assumption 5.1. The second source of nonlinearity contributes a residual which we upper bound by U in Assumption 5.2. The residual U is related to the difference between the constraint terms in the Lagrangian (5) and their first-order approximation under π θ in the gradient update, and can be interpreted as a measure of how nonlinear the constraints are in the policy π θ .
Assumption 5.2 (Constraint Residual). Given a policy θ and any policy π, where ∆f i = f i (ξ θ , P π ) − f i (ξ θ , P θ ) and ∆g e is defined similarly. Suppose that for all θ and π, We first derive a performance difference lemma for the MCR (Appendix Lemma B.1), which upper bounds the optimality gap using an MCR advantage function. We then use it to establish the gradient domination bound in Lemma 5.3.
Lemma 5.3 demonstrates that it is not sufficient for the gradient of the value to be small for the policy to be nearly optimal. As with previous results for expected return, the ξ θ -reweighted state visitation distribution d ξ θ θ must adequately cover the support of the reweighted state visitation distribution d ξ θ * under the optimal policy. Whenever the fraction d * /d θ ∞ , which is present in the gradient domination bound for the expected return [Agarwal et al., 2019] is finite, the term d ξ θ * /d ξ θ θ ∞ is also finite by definition (the converse is not necessarily true). Further, even if θ is a stationary point, i.e., (π − π θ ) ∇ θ V θ (s 0 ) ≤ 0 for all π, the residuals L (θ, π * ) and U (θ, π * ) can be nonzero and global optimality is not guaranteed. The residuals capture the distance between π θ and an optimal policy π * in terms of the Lagrangian primal and dual variables that are used to calculate the objective function. In general, an optimal policy for a given MDP is not known a priori, but we can upper bound the optimality gap at a stationary point θ using max π L (θ, π) + U (θ, π) ≤ L + U from Assumptions 5.1 and 5.2. The upper bound is problem-dependent and reflects the magnitude of risk aversion of the chosen coherent risk functional, and degree of nonlinearity in the policy arising from the risk envelope U in the Bellman operator (4). The residual L has a larger upper bound when ξ is permitted to be large, e.g., smaller fractions of the cost distribution are given a high weight. The residual U is a measure of the error of a first-order approximation of the constraints f i and g e , and is larger when the constraints are highly nonlinear in π θ . Roughly, the magnitude of L is small when the saddle points of π θ are close to the saddle points of the optimal policy π * , and the residual U is small if the constraints are additionally linear in π θ .
The expected value objective is equivalently formulated as the MCR objective for CVaR with α = 1, and its risk envelope is a singleton of U CVaR 1 (P θ ) = {ξ : ξ = 1}. As a result, ξ θ,s = 1 for all θ, s and the expected value Bellman operator is linear in the policy. Then by definition, the residuals U = L = 0 for expected value, and Lemma 5.3 is a generalization of the gradient domination lemma for expected return, i.e., (Lemma 4.1 in Agarwal et al. [2019]). For CVaR α , we have U = 0 as the inequality constraints 0 ≤ ξ ≤ 1 α are independent of π θ , and L ∝ 1 α . As a result, the upper bound on the optimality gap is larger when α is smaller and the objective is more risk sensitive.
Moreover, Theorem 5.4 guarantees that the bound in Lemma 5.3 is in fact tight. We provide a proof sketch, with formal argument in Appendix B.
Theorem 5.4. There exists an MDP M and π θ such that Proof Sketch. We give an informal argument on the existence of the lower bound and the necessity of the residual terms. Take the CVaR at level α objective for example, and consider a 2-action MDP, where one action always returns a set high cost, and the other action returns a set low cost most of the time and the high cost the rest. It is easy to see that the optimal policy will always choose the latter action. However, there is a large fraction of policies in this MDP where, even if the policy chooses both actions with reasonable probabilities, the highest α-quantile of the return distribution may include only the high cost. Thus, even though the policy may be arbitrarily suboptimal, it will have a gradient of 0. The suboptimality of the policy can be quantified exactly using the residuals terms L (θ, π * ) and U (θ, π * ).
Remark 5.5. Previous studies on the global optimality of PG for the expected return have taken into account two sources of suboptimality: vanishing gradients Agarwal et al. [2019] and closure under policy improvement, which Bhandari and Russo [2019] used as a condition for why some problems with constrained policy classes are gradient dominated and others are not. Our results demonstrate that neither of these is sufficient to explain suboptimality in the case of coherent risk objectives. For the latter, it is clear in our motivating example that the policy class θ ∈ [0, 1] is closed under policy improvement.

Convergence Rates
We consider the convergence rate of projected gradient descent (PGD) on the MCR under direct policy parameterization, where updates take the following for: where Proj ∆(A) S is a projection on the probability simplex ∆(A) S in the Euclidean norm and η is the learning rate. Using the gradient domination lemma, we can provide the following iteration complexity bound on PGD, with proof in Appendix B.3: This guarantee is provided for the best policy over T rounds, as is standard in the nonconvex optimization literature. This lemma demonstrates that gradient descent converges in O(1/ √ T ) iterations, but is upper bounded by the same residuals present in the gradient domination lemma (Lemma 5.3). Even if T → ∞ and the first term vanishes, it is possible for the policy to be suboptimal because the MCR objective is not gradient dominated. This phenomenon is evident in the motivating example of Section 5.1 and the optimization landscape in Figure 1b. However, if U and L are additionally small, which occurs when θ is near π * or the MCR Bellman operator is (close to) linear in the policy, Proposition 5.6 demonstrates that θ is near-optimal as well. Finally, as shown previously, when the Bellman operator is linear in the policy (as is the case for expected value), the residuals vanish and we recover the convergence guarantees for PGD from Agarwal et al. [2019] for expected value.
Coherent risk functionals are not, in general, β-smooth. CVaR, for example, is considered a non-smooth optimization problem [Alexander et al., 2006], and in optimizing this objective, the authors in Tamar et al. [2015b] make the assumptions that ∂ρ θ (Z) ∂θ and ∂λ θ (ω) ∂θ exist and are bounded. Under similar assumptions, we can guarantee β-smoothness of V θ and applicability of the bound in Proposition 5.6 (proof in Appendix B.3): Corollary 5.7. If the gradients of the primal and dual solutions of the MCR value function (4) exist and are bounded everywhere, i.e., and the second derivative of the constraints exist and are bounded, i.e., for all e ∈ E and i ∈ I then there exists β such that the value V θ is β-smooth for starting state s 0 , and Proposition 5.6 holds for V θ .

Gradient Estimation
In our analysis of the global optimality of PG for MCR, we assumed access to the gradient (4.1). In practice however, the gradient is difficult to estimate because it is calculated with respect to an expectation over reweighted transitions P ξ θ θ . Tamar et al. [2015a] propose an actor-critic method for optimizing the MCR, but require the ability to sample from an MDP with reweighted transitions P ξ θ θ , which is often unavailable in practice. Absent such a resource, one naive method for optimizing the MCR is to draw samples from d θ and multiply each sample by its importance weight t−1 j=1 ξ θ,s j−1 (s j ), shown in Algorithm 1.

Algorithm 1: Importance Sampling Gradient Estimation
Input: (6); However, as demonstrated by Liu et al. [2018], importance sampling suffers from variance that is exponential in the time horizon. This especially concerning for smaller CVaR levels α, as the maximum per-step importance weight is 1 α , which can cause the magnitude of the gradient to become intractably large in longer horizons. Instead, we propose a practical method for optimizing the MCR that leverages recent advances in off-policy evaluation and optimization. Moreover, we empirically demonstrate its improved stability and efficacy.

State Distribution Reweighting
Note that, using the stationary state distribution, we can write the gradient in (4.1) as where w ξ θ (s) := d ξ θ θ (s)/d θ (s), which is well-defined because d ξ θ θ is always 0 whenever d θ is 0 by definition. If we can estimate the ratio w ξ θ , then we can calculate the gradient by sampling from the original stationary state distribution d θ . We now state a theorem that can be used to derive the state distribution correction factor w ξ θ , inspired by Theorem 4 of Liu et al. [2018].
where ∆(w; s, a, s ) := w(s)ξ s (s ) − w(s ). Then w(s) equals w ξ (s) := d ξ θ (s)/d θ (s) if and only if L(w, f ) = 0 for any measurable test function f . This theorem suggests a method for estimating the MCR gradient using samples collected from d θ , by first solving the maximization in (4) to obtaining ξ θ , then using it to solve (12) to obtain the state distribution correction w ξ θ . The gradient can then be calculated using a sample-based estimate of (11). In high-dimensional settings, an RKHS kernel can be used for f [Liu et al., 2018]. Now that we have a method for estimating the the policy gradient of the MCR, we can use it with any PG algorithm. In Algorithm 2, we propose an actor-critic algorithm for optimizing the MCR. In episode k, we draw trajectories using policy π θ k and use them to calculate the solutions ( ξ k , λ k ) to the min-max Lagrangian problem in (5). We then derive the state distribution corrections w k from (12) using ξ k and calculate the gradient according to Theorem 4.1. The state distribution corrections w and Lagrangian variables ξ, λ can also be learned using neural networks (see discussion in Appendix C.4).

Algorithm 2: State Distribution Correction Actor-Critic
Input: Risk envelope U, learning rate η, MDP M.
Solve the maximization problem in Eq. (4) to obtain ξ k , λ P k , λ E k , λ I k for all (s, s ); Solve the optimization problem in Eq. (12) to obtain w k for all s; Compute h k (s, a) in (6);

Convergence Result
We provide a convergence result for Algorithm 2 to a stationary point of the MCR objective. First, we state the following assumption for our convergence guarantee: Assumption 6.2. For all state-action pairs (s, a) and θ ∈ Θ, suppose that . the MCR is L-Lipschitz and β-smooth (see Corollary 5.7) We have previously discussed the validity of Assumption 4 in Corollary 5.7, and Assumption 3 was previously made in Liu et al. [2020]. Assumption 1 can be achieved by an appropriate policy parameterization, such as through a linear or differentiable neural network function approximation with softmax output. Assumption 2 follows from the boundedness of V θ , an assumption common in the literature, and boundedness of the Lagrangian solutions (ξ θ , λ) present in the calculation of h θ (6). Boundedness of ξ is guaranteed by the constraints in U. The MCR objective with CVaR α satisfies Assumption 2, for example, because |ξ θ | ≤ 1 α by definition, λ P θ is bounded whenever the value is bounded because it is any (1 − α) quantile of the distribution of returns, and the remainder of the terms in h θ are 0. Following this, for Algorithm 2, we can make the following convergence guarantee to a stationary point, with proof in Appendix C.2. Theorem 6.3. Suppose Algorithm 2 at episode k and parameters θ k is provided with critic estimates V k , Lagrangian variable estimates ξ k and λ k , and distribution ratio estimates w k satisfying E s∼d (w θ k (s) − w k (s)) 2 ≤ 2 w,k and E s∼d (h θ k (s, a) − h θ k (s, a)) 2 ≤ 2 h,k for all episodes k. Then if Assumption 6.2 is satisfied, Theorem 6.3 demonstrates that when Assumptions 6.2 hold, the average gradient magnitude over the K episodes is upper bounded by three terms. The first two terms vanish as K → ∞, but the third does not. However, since the third term is in terms of h and w estimation errors, given estimators h and w with small average error h,k , w,k across the episodes, the third term vanishes as K → ∞ as well. Under such conditions, Theorem 6.3 shows that Algorithm 2 will converge to an approximate stationary point. Estimators for h and w with small average error can be achieved with a reasonable online critic and w, ξ, λ learning algorithms. For CVaR α , C max ∝ 1 α due to the presence of ξ in the calculation of h θ (6), implying that with higher risk sensitivity, convergence to stationary points occurs more slowly.

Experiments
In this section, we examine the empirical efficacy of Algorithm 2 with two primary questions in mind: • Does the state distribution correction reduce the variance of PG on MCR in MDPs?
• Does increasing the risk envelope set U lead to more risk-sensitive behavior?
Baseline and Implementation.
To answer these questions, we optimize the MCR with the CVaR α objective at different levels α, where smaller α corresponds to higher risk aversion. To optimize this objective, we run Algorithm 2 and compare its performance against importance sampling baselines (Algorithm 1). For both, we use a softmax tabular policy and tabular critic. Full implementation details and a function approximation version of this algorithm are provided in Appendix C.3.

Simulation Domain.
We compare the algorithms on the classic 4 × 12 tabular Cliffwalk environment, where the agent needs to travel from a start to a goal state while incurring as little cost as possible. Each action incurs 1 cost, but the shortest path lies next to a cliff and entering the cliff corresponds to a cost of 100. Because the classic Cliffwalk environment is deterministic, we also compare our algorithms on a stochastic version, where the row of cells above the cliff is "slippery", and induce a transition from these cells into the cliff with probability p. Although our algorithm is intended for an infinite-horizon MDP, the horizon is fixed to a maximum of 500 timesteps for computational feasibility.

Results.
Figure 2a displays the learned policies for different CVaR levels α in the deterministic and stochastic environments. Interestingly, the α = 0.25 policy finds a conservative policy and takes a longer path in both deterministic and stochastic Cliffwalk, even though the optimal policy in the deterministic environment is to take the shortest path for all α levels. In the stochastic cliffwalk, the α = 1 policy learns to take the greedy path but risks falling into the cliff, resulting in failure to consistently succeed at the task. We display the learned state distribution correction and its discussion in Appendix C.3. In both environments, the gradient of the naive importance sampling method diverged, and learning a policy was not possible in either case. In our experiments, a policy in only a truncated Cliffwalk of size 2 × 4 was learnable via importance sampling.

Discussion
In this paper, we answered several open questions concerning PG for coherent risk functionals. First, we demonstrated that MCR objectives are not in general gradient dominated, giving tight upper bounds on the suboptimality of the learned policy. Second, we proposed an algorithm based on stationary state distribution reweighting to relax stringent assumptions of previous work and tractably estimate the MCR gradient. We demonstrated that our algorithm is guaranteed to converge to stationary points, and demonstrated the stability and efficacy of our algorithm on the CliffWalk environment, in which importance sampling cannot learn policies due to exploding gradient magnitudes.
While coherent risk objectives are often used in practice, our results highlight the challenges of obtaining global optimality guarantees for the final policy. One important direction of future work lies in improving these convergence results through better characterization of the residual terms over the learning process, and expanding it to other PG algorithms and settings. Further, the lower bound in Theorem 5.4 indicates that poorly conditioned starting states or initial policies also cause convergence to suboptimal policies. In the future, we will investigate how different exploration strategies, such using a combination of expected value and coherent risk, may help to mitigate this issue both in theory and practice.
Using the envelope theorem [Milgrom and Segal, 2002], The derivative of the Lagrangian evaluated at the saddle point (ξ θ , λ P θ , λ E θ , λ I θ ) is: dg e (ξ θ,s , P θ ) dp(s ) a ∇ θ π θ (a|s)P (s |s, a) Then we have dg e (ξ θ,s , P θ ) dp(s ) with h θ (s, a) as defined in (6). Unfolding the recursion, this gives us and unfolding the recursion further gives the result.

B.1 Proof of Lemma 5.3
We first establish the performance difference lemma (Lemma B.1) for MCR, which upper bounds the optimality gap using an advantage function. This lemma holds for all policies, not only the directly parameterized policies we consider in Section 5. where Proof. For organizational purposes, we denote f π,s := i∈I λ I * ,s (i)f i (ξ π,s , P π ) and f * ,s := i∈I λ I * ,s (i)f i (ξ π,s , P * ), g π,s := e∈E λ E * ,s (e)g e (ξ π,s , P π ) and g * ,s := e∈E λ E * ,s (e)g e (ξ π,s , P * ).
Proof of Lemma 5.3. We now give a proof for the gradient domination lemma for directly parameterized policies, and going forward we interchangeably refer to the policy as π and θ. From the performance difference lemma B.1, we have Using the fact that a π θ (a|s)A θ (s, a) = 0, Since a (π(a|s) − π (a|s))u θ (s) = 0 for any two policies π, π = s d ξ θ * (s) a π θ (a|s) − π * (a|s) t θ (s, a) + γb θ,s Under direct parameterization where θ s,a = π θ (a|s), the gradient from Theorem (4.1) is Due to the nonlinearity in the objective, while t θ contains λ * ,s , h θ is defined using λ θ,s . Further, h θ involves the derivatives of the terms in b θ,s . Rearranging the previous inequality, where the second to last line uses the residual definitions (8) and (9) Consider the MDP of Figure 3. The MDP has the following transitions: P (s 2 |s 0 , a 1 ) = 1 P (s 1 |s 0 , a 2 ) = 0.9 P (s 2 |s 0 , a 2 ) = 0.1 P (s T |s 1 ) = P (s T |s 2 ) = 1 and the following costs: C(s 0 ) = 0, C(s 1 ) = 0, C(s 2 ) = 1, C(s T ) = 0 There are 4 states, with s T being absorptive, and only 2 actions. The policy π θ affects only the transitions from the starting state s 0 to either of the next states s 1 or s 2 . Note that this MDP follows the same dynamics as a binomial 2-armed bandit, where arm 1 always returns cost 1 and arm 2 returns a cost of 0 90% of the time and 10% of the time returns cost 1. Suppose we work with direct parameterization, where π θ (a 1 |s) = θ a 1 ,s and π θ (a 2 , s) = 1 − θ a 2 ,s . We limit our consideration to θ a 1 ,s 0 = θ and θ a 2 ,s 0 = 1 − θ to avoid overparameterizing our policy, as the policy does not affect the cost accrued after s 0 . Let us consider α = 0.5, the expectation over the highest 50% of the distribution of the total discounted returns. We will show that there exists θ in this MDP such that the gradient domination bound in Lemma 5.3 is tight, thus giving Theorem 5.4. We can deterministically calculate the Markov coherent risk value of states s 1 , s 2 using the definition (4): Optimal Policy θ * : The optimal policy in the setting is θ = 0, which always takes action a 2 .
Policy θ: Set θ = 4 9 . The value of the initial state V MC can then be calculated using (4). The maximization problem can be solved by either using the analytical solution to the CVaR risk envelope or by convex programming solver, which gives us the primal solution ξ s 0 and dual solution λ s 0 for θ * and θ, which are shown in the table below: The optimality gap is V θ (s 0 ) − V * (s 0 ) = 0.8γ We will show that the bound in Theorem 5.3 is tight for θ, and proceed by determining the terms on the RHS of the bound. First, we calculate the gradient ∇ θ V θ (s 0 ) using Theorem 4.1. Under direct parameterization in our MDP, we have that ∂V θ (s 0 ) dθ s 0 ,a = h θ (s 0 , a).
The last residual term satisfies U = 0 because the constraint expressions f i are independent of θ.

B.3 Proof of Proposition 5.6
First, we restate Proposition B.1 from Agarwal et al. [2019], built upon results from Ghadimi and Lan [2016], without proof, which we will later use in the proof of our theorem.
Proposition B.2 (Proposition B.1 from Agarwal et al. [2019]). Let V θ (s 0 ) be β-smooth in θ and the update rule is θ Proof of Proposition 5.6. Let Let θ t , V t respectively be the parameter and value parameterized by θ t at time t. Using our assumption that V θ (s 0 ) is β-smooth, and from Beck [2017] we have that for step size η = 1 β , after T steps of PGD, Then using the gradient domination lemma (Lemma 5.3) and the fact that ηβ = 1, where the last line uses Assumptions 5.1 and 5.2 and the fact that V 0 (s 0 ) − V * (s 0 ) ≤ 1 1−γ .

Lemma B.3 (Smoothness of V θ for Direct Parameterization).
If the gradients of the primal and dual solutions of the Markov coherent risk value function (4) exist and are bounded everywhere, that is dξ θ dθ ∞ ≤ c and dλ θ dθ ∞ ≤ c and the second derivative of the constraints exist and are bounded, that is for all e ∈ E and i ∈ I d 2 g e (ξ, P ) dP 2 ≤ M and d 2 f i (ξ, P ) dP 2 ≤ M then there exists β such that the value V θ is β-smooth for starting state s 0 , that is Proof. Let π α := π θ+αu where u is a unit vector in R d , and let V α denote the value function under policy π α . Note that our value function is and ∀s ∈ S, let (ξ α,s , λ P α,s , λ E α,s , λ I α,s ) denote the saddle points of the Lagrangian L α,s under policy π α .We will prove that the second derivative d 2 Vα d 2 α is bounded above by the smoothness parameter β. Let P (α) ∈ R |S|×|S| be the state-state transition matrix under π α [ P (α)] s→s = a π α (a|s)P (s |s, a) Further, define the ξ α -reweighted transition to be [ P ξ (α)] s→s = [ P (α)ξ α ] s→s = ξ α,s (s ) a π α (a|s)P (s |s, a).

For notation simplicity, let
Under our assumptions, we have that 1.
a dπα(a|s) dα α=0 dα ∞ ≤ C 6 for all dual solutions λ α 7. dyα dα ∞ ≤ C 7 as a consequence of 6. and the assumption that the second derivative of the constraints is bounded.
We have that for an arbitrary vector x that We can write V α (s 0 ) as where C ∈ R |S| is a vector whose s-th entry is the cost of state s. Using the envelope theorem, Writing this in matrix form and substituting in our previous expression for V α , we get Next, we take the second derivative using the chain rule: . By using power series expansion of matrix inverse, we can write M (α) as This implies that M (α) ≥ 0 componentwise and each row of M (α) sums to 1 1−γ , that is M (α)1 = 1 1−γ 1. This implies max Note that by Assumption 3.2, y α is upper bounded by |E| + |I| M C 4 , Under direct parameterization, C 1 ≤ |A| and C 2 = 0. The result follows using β as the smoothness parameter.
C Proofs for Section 6 C.1 Proof of Theorem 6.1 Proof of Theorem 6.1. Define the starting state distribution as d 0 (s) = 1[s = s 0 ]. Then given reweighting {ξ s } s∈S : S → R and transitions P θ induced by policy π θ , we establish the relation for any γ ∈ (0, 1] that Using the same lines of reasoning, for γ ∈ (0, 1] With this, d θ can be seen as the invariant distribution of an induced Markov chain which follows P θ with probability γ and restarts from the initial state s 0 with probability 1 − γ. Similarly, d ξ θ can be seen as the invariant distribution of an induced Markov chain which follows P θ ξ with probability γ and restarts from the initial state s 0 with probability 1 − γ. Multiplying both sides of (15) by f (s ) and summing over s , we have that Similarly, where the last line uses the definition w ξ (s) := d ξ θ (s)/d θ (s). The relation in (16) is equivalent to Then using w(s)f (s) for f (s), Plugging (19) into (12), Thus when L(w, f ) = 0, (20) is equivalent to (16), which means that w(s) = w ξ (s).
C.2 Proof of Theorem 6.3 First, we state and prove an upper bound on the magnitude of gradients using the bias and variance of a gradient oracle in Theorem C.1. Suppose we have a function f : R d → R which is differentiable, L-Lipschitz, and β-smooth, with an infimum at f * . Suppose have access to a noisy gradient oracle which returns a vector ∇ θ f (x) ∈ R d given a query point x. The vector is said to be σ, B-accurate for parameters σ, B ≥ 0 if for all x ∈ R d , the quantity δ( Then we have the following guarantee for convergence to a stationary point under stochastic gradient descent with the update x ← x − η ∇ θ f (x): Theorem C.1. Suppose f is differentiable, L-Lipschitz, and β-smooth, and the approximate gradient oracle satisfies (21) with parameters (σ k , B k ) for all iterations k. Then after K iterations, stochastic gradient descent with initial point x 1 and stepsize η = 1 Additionally, suppose there exists constants B, σ such that B k ≤ B and σ k ≤ σ for all k. Then Proof. Since f is β-smooth, we have where the second step follows from definition of ∇f (x) and the third step uses the definition of δ(x).
Taking the expectations of both sides and using the properties of (21), Then summing over iterations k = 1, ...K, Using the fact that f (x K+1 ) ≥ f * and rearranging, Kβ . Plugging these inequalities in, giving the first statement in the theorem. To achieve the second, use the upper bound B ≥ B k and σ ≥ σ k for all k: Plugging the bias and variance into Theorem C.1 gives the result.

C.3 Experiment Details
Hyperparameters We use a separate neural network for the policy and critic, both optimized using the Adam optimizer. For solving the optimization problems (5) and (12), we use CVXPY [Diamond andBoyd, 2016, Agrawal et al., 2018]. For our experiments, we used the hyperparameters in Table 1. Learned State Distribution Correction.

Hyperparameters
The learned state distribution correction w(s) for the α = 0.25 policy in the stochastic Cliffwalk from Figure 2 is shown in Figure 4 for each of the 4 × 12 Cliffwalk states. Initially, high state correction weights are given to states with high ξ weights ( Figure 5). After training converges to the deterministic policy within 5K episodes, the agent takes only a single path along the topmost squares of the Cliffwalk. As a result, each of the states along this path has equal weight w(s) = 1/(length of path), and the interior states that the policy does not travel to have w(s) = 0.
Learned Lagrangian Variables. The ξ s (s ) for the α = 0.25 policy in the stochastic Cliffwalk from Figure 2 is shown in Figure 5 for each of the 4 × 12 Cliffwalk states. For the start state (bottom left grid), initially ξ s 0 (s cliff ) corresponding to walking right and falling into the cliff is high. After the policy learns a deterministic path around 3-4K episodes, the ξ s (s ) corresponding to the deterministic transition s such that P θ (s |s) = 1 for each s must also be 1 due to the constraint that E P θ [ξ] = 1. For s where P θ (s |s) = 0, the ξ s (s ) are free variables and do not affect the value.

C.4 Function Approximation for w, ξ, λ
Finally, in Algorithm 3 we present a method for learning w, ξ, λ in the function approximation setting, such as large or continuous state spaces, where the use of convex solvers may become difficult. In such cases, w and ξ, λ can be learned using neural networks for a total of five networks-the actor, critic, w, ξ, and λ. For CVaR α , for example, only λ P needs to be learned since the constraint that ξ ∈ [0, 1 α ] can naturally be implemented by using a Softmax activation in the final layer of the ξ network, and multiplying the output by 1 α . The λ P network controls the constraint that E P θ [ξ] = 1.
The w network seeks to minimize L(w, f ) in Theorem 6.1, an algorithm for which is given in Algorithm 2 of Liu et al. [2018]. In practice, for discrete state spaces the delta kernel can be used  for f , and in continuous state spaces an RBF kernel with radius set to be the median of distances between states in the batch can be used for f [Liu et al., 2020]. The ξ, λ networks seek to maximize and minimize the MCR objective (4.1), respectively. The gradients of the MCR objective with respect to ξ and λ are given in Lemma C.2. We recommend that a higher learning rate is using for the λ network and a lower learning rate is used for the ξ network. The Lagrangian can be cast as a two-player zero sum game with a bilinear term between ξ and λ, and min-max gradient descent for such objectives has been proven to converge only with finite timescale separation [Fiez and Ratliff, 2020]. We do not include experiments as it is beyond the scope of our paper, but hope that algorithms such as Algorithm 3 can serve as a basis for future work in scaling coherent risk policy gradient algorithms to larger or continuous state spaces.