A CMDP-WITHIN-ONLINE FRAMEWORK FOR META-SAFE REINFORCEMENT LEARNING

Abstract

Meta-reinforcement learning has widely been used as a learning-to-learn framework to solve unseen tasks with limited experience. However, the aspect of constraint violations has not been adequately addressed in the existing works, making their application restricted in real-world settings. In this paper, we study the problem of meta-safe reinforcement learning (Meta-SRL) through the CMDP-within-online framework to establish the first provable guarantees in this important setting. We obtain task-averaged regret bounds for the reward maximization (optimality gap) and constraint violations using gradient-based meta-learning and show that the taskaveraged optimality gap and constraint satisfaction improve with task-similarity in a static environment or task-relatedness in a dynamic environment. Several technical challenges arise when making this framework practical. To this end, we propose a meta-algorithm that performs inexact online learning on the upper bounds of within-task optimality gap and constraint violations estimated by offpolicy stationary distribution corrections. Furthermore, we enable the learning rates to be adapted for every task and extend our approach to settings with a competing dynamically changing oracle. Finally, experiments are conducted to demonstrate the effectiveness of our approach.

1. INTRODUCTION

The field of meta-reinforcement learning (meta-RL) has recently evolved as one of the promising directions that enables reinforcement learning (RL) agents to learn quickly in dynamically changing environments (Finn et al., 2017; Mitchell et al., 2021; Zintgraf et al., 2021) . Many real-world applications, nevertheless, have safety constraints that should rarely be violated, which existing works do not fully address. Safe RL problems are often modeled as constrained Markov decision processes (CMDPs) , where the agent aims to maximize the value function while satisfying given constraints on the trajectory (Altman, 1999) . However, unlike meta-learning, CMDP algorithms are not designed to generalize efficiently over unseen tasks (Paternain et al., 2022; Ding et al., 2021a; Ding & Lavaei, 2022) In this paper, we study how meta-learning can be principally designed to help safe RL algorithms adapt quickly while satisfying safety constraints. There are several unique challenges involved in meta-learning for the CMDP settings. First, multiple losses are incurred at each time step, i.e., reward and constraints, which are typically nonconvex and coupled through dynamics. Hence, adapting existing theories developed for stylized settings such as online convex optimization (Hazan et al., 2016) is not straightforward. Second, it is unrealistic to assume the computation of a globally optimal policy for CMDPs (unlike online learning (Hazan et al., 2016) ). Thus, classical online learning algorithms that assume exact or unbiased estimator of the loss function do not apply (Khodak et al., 2019) . Overall, there is an interplay among nonconvexity, the stochastic nature of the optimization problem, as well as algorithm and generalization considerations, posing significant complexity to leverage inter-task dependency (Denevi et al., 2019) . To this end, we propose a provably low-regret online learning framework that extends the current meta-learning algorithms to safe RL settings. Our main contributions are as follows: 1. Inexact CMDP-within-online framework: We propose a novel CMDP-within-online framework where the within-task is CMDP, and the meta-learner aims to learn the meta-initialization and learning rate. In our framework, the meta-learner only requires the inexact optimal policies for each within-task CMDP and the approximate state visitation distributions estimated using collected offline trajectories to construct the upper bounds on the suboptimality gap and constraint violations. An upper bound on these estimation errors is established in Theorem 3.1. 2. Task-averaged regret in terms of empirical task-similarity: We show that the task-averaged regrets for optimality gap (TAOG) and constraint violations (TACV) (Def. 1) diminish with respect to both the number of steps in the within-task algorithm M and the number of tasks T . Specifically, task-averaged regret of O 1 √ M E T √ T + D * 2 holds , where E T is the total inexactness in online learning and D * is the empirical task-similarity (Theorem 3.2). 3. Adapting to a dynamic environment: We adapt the learning rates for each task to environments that entail dynamically changing meta-initialization policies. An improved rate of O 1 M 3/4 √ T E T + E T T + V 2 ψ for TAOG and TACV are shown, where Vψ is the empirical task-relatedness with respect to a sequence of changing comparator policies {ψ * t } T t=1 (Corollary 1). Incorporating all these components makes our Meta-safe RL (Meta-SRL) approach highly practical and theoretically appealing for potential adaption to different RL settings. Furthermore, we remark on some key technical contributions that support the above developments, which may be of independent interest: 1) We study the optimization landscape of CMDP (Theorem 3.1) that is algorithmic-agnostic, which differs from the existing work of (Mei et al., 2020) [Lemmas 3 and 15] that is restricted to the setting of policy gradient. This is achieved by developing new techniques based on tame geometry and subgradient flow systems; 2) we provide static and dynamic regret bounds for inexact online gradient descent (see Appendix E), which we leverage to obtain our final theoretical results in Theorems 3.2, 3.3, and Corollary 1. Due to the space restrictions, the related work can be found in Appendix A.

2. CMDP-WITHIN-ONLINE FRAMEWORK

In this section, we introduce the CMDP-within-online framework for the Meta-SRL problems. In this framework, a within-task algorithm (such as CRPO (Xu et al., 2021) ) for some CMDP task t ∈ [T ] is encapsulated in an online learning algorithm (meta-learning algorithm), which decides upon a sequence of initialization policy ϕ t and learning rate α t > 0 for each within-task algorithm. The goal of the meta-learning algorithm is to minimize some notion of task-averaged performance regret to facilitate provably efficient adaptation to a new task.

2.1. CMDP AND THE PRIMAL APPROACH

Model. For each task t ∈ [T ], a CMDP M t is defined by the state space S, the action space A, discount factor γ, initial state distribution over the state-space ρ t , the transition kernel P t (s ′ |s, a) : S × A → S, reward functions c t,0 : S × A → [0, 1] and cost functions c t,i : S × A → [0, 1] for i = 1, ..., p. The actions are chosen according to a stochastic policy π t : S → ∆(A) where ∆(A) is the simplex over the action space. We use ∆(A) |S| to denote the simplex over all states S. The initial policy for task t is denoted as π t,0 . The discounted state visitation distribution of a policy π is defined as ν π t,s0 (s) := (1γ) ∞ m=0 γ m P t (s m = s | π, s 0 ) and we write ν * t (s) := E s0∼ρt ν π * t,s0 (s) as the visitation distribution when the initial state follows ρ t at task t. We denote π * t as an optimal policy for task t and ν * t (s) := E s0∼ρt ν π * t t,s0 (s) is the corresponding state visitation distribution induced by policy π * t when the initial state s 0 is sampled from initial state distribution ρ t at task t. Policy parametrization. We consider the softmax parametrization. For any θ ∈ R |S|×|A| , the corresponding softmax policy π θ is defined as π θ (a | s) := exp(θ(s,a)) a ′ ∈A exp(θ(s,a ′ )) , ∀(s, a) ∈ S × A. We neglect the dependence on θ to alleviate the notational burden. Value function. For task t and a policy π, we define the state-value function as V i t,π (s) = E t [ ∞ m=0 γ m c t,i (s m , a m , s m+1 ) | s 0 = s, π] and the action-value function as Q i t,π (s, a) = E t [ ∞ m=0 γ m c t,i (s m , a m , s m+1 ) | s 0 = s, a 0 = a, π], where m denotes the time steps. Furthermore, the expected total reward/cost functions are J t,i (π) = E ρt V i t,π (s) = E ρt•π Q i t,π (s, a) . CMDP. In each task t, the goal of the agent is to solve the following CMDP problem max π J t,0 (π) s.t. J t,i (π) ≤ d t,i , ∀i = 1, ..., p, where d t,i is a fixed limit on the expected total cost J t,i for task t and constraint i (among a total of p constraints). We denote the optimal solution of 1 for the task t as π * t which can be non-unique. Primal approach. In this work, we focus on the primal approach, CRPO (Xu et al., 2021) , as an exemplary algorithm with guarantees for a single-task CMDP. CRPO is a primal-based online CMDP algorithm, which performs policy optimization (natural gradient ascent on the reward) when constraints are not violated, or constraint minimization (natural gradient descent on the constraint function) for one of the violated constraints. Specifically, with softmax parametrization and carefully chosen parameters, the suboptimality gap and constraint violation for task t are bounded as follows (if the exact action-value function {Q i t,π } p i=0 are available for all π)foot_0 : R 0 = J t,0 (π * t ) -E[J t,0 (π t )] ≤ 2 α t M E s∼ν * t [D KL (π * t |π t,0 )] + 4α t c 2 max |S||A| (1 -γ) 3 , R i = E[J t,i (π t )] -d t,i ≤ 2 α t M E s∼ν * t [D KL (π * t |π t,0 )] + 4α t c 2 max |S||A| (1 -γ) 3 , ∀i = 1, ..., p. (2) where πt is the policy returned by running CRPO for M steps with learning rate α t in task t, π * t is the optimal policy, c max is the upper bound on reward/cost function, and D KL (•|•) is the KL divergence.

2.2. META-SRL PROBLEM SETUP

We now consider the lifelong extension of CMDPs in which safe RL tasks arrive one at a time, and t = 1, 2, . . . , T denotes the index for a sequence of online learning problems. In each single task t, the agent must sequentially optimize the policy {π t,i } M i=0 so that the corresponding sub-optimality and the constraint violation, given in 2, decays sub-linearly in M . Beyond the single task, the metalearner should aim to optimize the upper bounds in 2 over the initial policy π t,0 and the learning rate α t so that the task-averaged sub-optimality and constraint violation are expected to improve as the meta-learner solves more tasks. Therefore, we will aim to minimize the task-averaged sub-optimality gap and the task-averaged constraint violation defined as follows: Definition 1. The task-averaged optimality gap (TAOG) R0 and the task-averaged constraintviolation (TACV) Ri of a safe RL algorithm after T tasks are R0 = 1 T T t=1 J t,0 (π * t ) -E[J t,0 (π t )] , Ri = 1 T T t=1 E[J t,i (π t )] -d t,i , ∀i = 1, ..., p, ( ) where πt is the policy returned by running some safe RL algorithm for M time-steps at task t where the expectation is taken with respect to the randomness of the algorithm and environment. We can observe from (2) that the task-averaged regrets can be upper bounded by terms based on the policy initializations {π t,0 } T t=1 and the learning rates {α t } T t=1 . The crux of our idea is to design a meta-algorithm that can sequentially update the initial policy π t,0 and the learning rate of the CRPO algorithm α t by performing online learning on the upper bounds, i.e., we consider the right-hand sides of (2) as the individual loss function. This enables us to bound the dynamic regrets (TAOG and TACV), which are measured against a dynamic sequence of optimal policies {π * t } T t=1 , via the static regret, which is measured against a fixed initial policy ϕ.

2.3. TASK-SIMILARITY

In Meta-SRL, we expect TAOG and TACV to improve with the similarity among the online CMDP tasks. We now discuss the notions of similarity in a static environment; an extension to a dynamic environment is introduced in Sec. 3.2. Given optimal polices {π * t } T t=1 , where π * t ∈ Π * t for every t, the task-similarity can be measured as D *foot_2 = min ϕ∈∆(A) |S| 1 T T t=1 E s∼ν * t [D KL (π * t |ϕ)]. If the optimal policy is not unique, we take the worst case for D * , i.e., a set of policies for which D * 2 is maximum. This notion of task-similarity in the static environment is natural for studying gradient-based metalearning, as it implies that there exists a meta initialization ϕ with respect to which optimal policies for individual tasks are all close together. In particular, when the tasks are all identical, i.e., {π * t } T t=1 are all equal, we have D * 2 = 0. In the practical scenario where only suboptimal policies are accessible, we denote the empirical task-similarity as D * 2 := min ϕ∈∆(A) |S| 1 T T t=1 E s∼νt [D KL (π t |ϕ)], which depends on the suboptimal policies {π t } T t=1 returned by a within-task algorithm. As it is desirable that the meta-initialization policy π t,0 has good exploration properties, we need the initial policy to have full support over S × A. We introduce the following assumption: Assumption 1. The meta-initialization policy π t,0 for any task t lies inside a shrinkage simplex set, i.e., π t,0 (•|s) ∈ ∆A ϱ := {a 1 e 1 + ... + a na e na | na i=0 a i = 1, a i ≥ ϱ ∀i = 1, ..., n a } for all s ∈ S, where e 1 , ..., e na ∈ R na are one-hot vectors for each action (e.g., e 1 is the vector of all 0s except 1 at the first location) and ϱ > 0. In particular, ∆A ϱ lies inside the regular simplex set ∆A (ϱ = 0). Technically, Assumption 1 is a minimal requirement for the CRPO to provide any guarantees in a single task. This can be seen in ( 2): if π t,0 does not have full support over the state/action space, then there may be a state s and an action a where π * t (a|s) > 0 but π t,0 (a|s) = 0, which would make the KL divergence term in (2) infinite. Furthermore, Assumption 1 ensures the following holds for the meta-initialization policy π t,0 for any state s ∈ S with positive constants C π , L g , L π and µ π : (1) |D KL (π * t (•|s)|π t,0 (•|s))|, |D KL (π t (•|s)|π t,0 (•|s))| ≤ C π ; (2) D KL (π * t (•|s)|π t,0 (•|s)) is L g -Lipschitz and L π -smooth in π t,0 (•|s); (3) D KL (π * t (•|s)|π t,0 (•|s)) is µ π -strongly convex in π t,0 (•|s). We use these conditions in the proof of Lemma 1, Lemma 3, and Theorem 3.2. In this work, we develop algorithms whose TAOG and TACV scale with the task-similarity, which implies that the method will do well if tasks are similar. To understand the CMDP-within-online framework and the impact of task-similarity on the upper bounds of TAOG and TACV for Meta-SRL, we first present a simplified result under the ideal setting where {ν * t } T t=1 and {π * t } T t=1 are available for each task t and the task-similarity D * 2 is known. Lemma 1. Assume {ν * t } T t=1 and {π * t } T t=1 are given after each task and the task-similarity D * 2 is known. For each task t, we run CRPO for M iterations with α = (1-γ) 3 2 √ 2M |S||A| L 2 g (log T +1) µπT + D * 2 . In addition, the initialization {π t,0 } T t=1 are determined by playing Follow-the-Regularized-Leader (FTRL) or online gradient descent (OGD) on the functions E s∼ν * t [D KL (π * t |•)] , for t = 1, . . . , T . 2 Then, it holds that R0 ≤ O 1 √ M log T T + D * 2 , Ri ≤ O 1 √ M log T T + D * 2 ∀i = 1, . . . , p. The above result reveals an interesting benefit brought by including more tasks (the regret decays at a rate of log(T )/T ) with more similarity (i.e., lower D * ), which improves upon single-task guarantee and serves as the initial point of our study. However, there are several limitations. First, if the optimal policies π * t and the induced state distributions ν * t are not revealed after each task, it is not likely that the plug-in estimator {E s∼νt [D KL (π t |•)]} T t=1 with the learned policy πt and estimated visitation distribution νt is an unbiased estimator, ruling out existing analysis for FTRL or OGD in the bandit setting. Besides, while the knowledge of D * used to determine the learning rate can be relaxed (Khodak et al., 2019; Balcan et al., 2019) , the resulting scheme is complex to implement-we expect that the learning rates can be chosen adaptively for different tasks based on losses observed in the past. We aim to address these challenges with a series of developments in the next section. Algorithm 1: Inexact CMDP-within-online framework (exemplified with CRPO (Xu et al., 2021) as the within-task safe RL algorithm) 1: Initialize actor policy π 1,0 and learning rate α 1 2: for task t ∈ [T ] do 3: Run CRPO with initializations for actor policy π t,0 and learning rates α t to obtain a policy πt 4: Estimate the discounted state visitation distribution νt of πt based on trajectory data collected within-task t with DualDICE (Nachum et al., 2019) 5: Run one or multiple steps of OGD on (a) IN IT : f init t (ϕ) = E νt [D KL (π t |ϕ)]. (b) SIM: f sim t (κ) = c t 1 E νt [D KL (πt|πt,0)] κ + κ(c t 2 M + c t 4 √ M ) + c t 3 √ M to obtain π t+1,0 and α t+1 . Here c t 1 = 2, c t 2 = 4c 2 max |S||A| (1-γ) 3 , c t 3 = 3+(1-γ) 2 (1-γ) 2 , and c t 4 = 3cmax (1-γ) 2 . 6: end for 3 PROVABLE GUARANTEES FOR PRACTICAL CMDP-WITHIN-ONLINE FRAMEWORK 3.1 INEXACT CMDP-WITHIN-ONLINE FRAMEWORK One of the key steps to generalize the online-within-online methodology (Balcan et al., 2019) to Meta-SRL is to relax the assumption of accessing the exact upper bounds of within-task performance by designing algorithms to estimate and update their inexact versions. Estimation of upper bounds. Once a CMDP task t is complete, the meta-learner only has access to a suboptimal policy πt and the trajectory dataset D t produced by some safe RL algorithm. Let νt denote the discounted state visitation distribution induced by policy πt . To obtain an estimate νt from D t , recent methods often rely on estimating discounted state visitation distribution corrections (Liu et al., 2018; Gelada & Bellemare, 2019) . However, the main issues are that D t is collected by multiple behavior policies during the learning period, and depending on how far these behavior policies are from the target policy, the per-step importance ratios involved in these methods may have large variance, which may result in a detrimental effect on stochastic algorithms. In this work, we use a methods from the distribution correction estimation (DICE) family, namely DualDICE (Nachum et al., 2019) , which is agnostic to the number of behavior policies used and does not involve any per-step importance ratios, thus is less likely to be affected by their high variance. In particular, for each stateaction pair (s, a), the method aims to estimate the quantity ω π/Dt (s, a) = d π (s,a) d D t (s,a) , i.e., the likelihood that the target policy π will experience the state-action pair normalized by the probability with which the state-action pair appears in the off-policy data D t . Thereby, we estimate E ν * t [D KL (π * t |π)] with E νt [D KL (π t |π)] by plugging in πt from the within-task CMDP and νt from DualDICE in lieu of the optimal policy π * t and the corresponding discounted state visitation distribution ν * t . Bounding the estimation error. We breakdown the error by sources of origin: E ν * t [D KL (π * t |π)] -E νt [D KL (π t |π)] = E ν * t [D KL (π * t |π)] -E νt [D KL (π * t |π)] (A) ) + E νt [D KL (π * t |π)] -E νt [D KL (π * t |π)] (B) + E νt [D KL (π * t |π)] -E νt [D KL (π t |π)] (C) , where (A) accounts for the mismatch between the discounted state visitation distributions of an optimal policy π * t and a suboptimal one πt , (B) originates from the estimation error of DualDICE, and (C) is due to the difference between π * t and πt measured according to πt . To bound (A), we need to control the distance between ν * t and νt , which can be bounded by the distance between the inducing policy parameters as long as they are Lipschitz continuous (Xu et al., 2020, Lemma 3) . In addition, the bound on (C) also depends on the distance between policies. Controlling the distance between a policy to an optimal policy based on the suboptimality gap requires the optimization to have some curvatures around the optima (e.g., Hölderian growth (Johnstone & Moulin, 2020)). However, to the best of our knowledge, available results are algorithm-dependent PL inequalities for policy gradient (Mei et al., 2020) or quadratic growth with entropy regularization (Ding et al., 2021b) . Given some mild assumptions on the objective/constraint functions and policy parametrization, we can show that a growth condition holds broadly for any CMDP problem. Assumption 2. The functions J t,i (•) for i = 0, 1, ..., p and t ∈ [T ] and parametric policy π θ are definable in some o-minimal structure (Van den Dries & Miller, 1996) . The definition of "o-minimal structure" is given in Appendix F.1. Assumption 2 is mild as practically all functions from real-world applications, including deep neural networks, are definable in some o-minimal structures. For Assumption 2 to hold, a sufficient condition requires that the reward and utility functions belong to the same o-minimal structure. We use Assumption 2 to bound the terms (A) and (C) as definable sets admit the property of Whitney stratification, and any stratifiable function enjoys a nonsmooth Kurdyka-Lojasiewicz inequality, which implies some curvature around the local/global minima. Details on tame geometry and proof of Theorem 3.1 is given in Appendix F. Theorem 3.1 (KL divergence estimation error bound). The following bound holds: |E ν * t [D KL (π * t |π)] -E νt [D KL (π t |π)]| ≤ O h 1 √ M + 1 √ M + √ ϵ opt + ϵ approx (F, H) = ϵ t , where h is a strictly increasing continuous function with the property that h(0) = 0 as specified in Proposition 1, ϵ approx (F, H) and ϵ opt are the approximation error and optimization error of DualDICE, defined in Equation 38and Equation 39, respectively. Remark 1. We define cumulative inexactness E T := T t=1 ϵ t . This quantity decays with M at a rate of O h 1 √ M + 1 √ M up to some approximation and optimization errors ϵ approx and ϵ opt . Moreover, there is a trade-off between ϵ approx and ϵ opt : if the parametrization functions F and H used to solve DualDICE optimization are chosen as neural networks, then ϵ approx can be reduced at the cost of increasing ϵ opt . If we use stochastic gradient descent as an optimization algorithm in DualDICE with K steps, then ϵ opt decays at a rate of O(1/K). Note that h is a definable function used in the Kurdyka-Łojasiewicz (KL) inequality (see, e.g., (Bolte et al., 2007, Thm. 14) ). With the above uniform bound on estimation error, our next step is to develop static regret bounds for the inexact online gradient descent, which are used to furnish the upper bounds on TAOG and TACV of the proposed inexact CMDP-within-online algorithm.  T t=1 f t (π t,0 ) - T t=1 f t (π * 0 ) ≤ O √ T + E T , where E T := T t=1 ϵ t is the cumulative inexactness, and ϵ t is the upper bound from Theorem 3.1. The static regret analyzed above is defined with respect to the optimal initial policy π * 0 in hindsight, not the final learned policy. A static regret with respect to an initial policy provides freedom for the safe RL algorithm to adapt the initial policy based on observations within the task. Once the static regret for the inexact OGD is established, we can obtain the upper bounds on TAOG and TACV for the proposed inexact CMDP-within-online algorithm in terms of the empirical task-similarity D * . Theorem 3.2. For each task t, we run CRPO for M iterations with α = O 1 √ M 1 √ T + E T T + D * 2 and we obtain {ν t } T t=1 and {π t } T t=1 . In addition, the initialization {π t,0 } T t=1 for each task t are determined by playing inexact OGD (Algorithm 2) on E νt [D KL (π t |•)] , for t = 1, . . . , T . Then, the following holds for TAOG (i = 0) and TACV (i = 1, ..., p): Ri ≤ O 1 √ M 1 √ T + E T T + D * 2 ∀i = 0, 1, . . . , p. The benefit of task-similarity is preserved when we perform directly on the plug-in estimator E νt [D KL (π t |•)], though we incur an additional cost on the inexactness E T and the dependence on T is worse compared to Lemma 1. As E T /T diminishes when the learned policy becomes optimal across tasks, e.g., by increasing within-task steps M or if meta-initialization is chosen such that a few steps suffice to reach optimal, we expect the inexactness to have a limited effect on the performance.

3.2. DYNAMIC REGRET AND TASK-RELATEDNESS

In many settings, we have a changing environment, so it is natural to study dynamic regret and compare with a sequence of potentially time-varying initial policies {ψ * t } T t=1 . To measure task-similarity in this case, we define task-relatedness which can be measured by V 2 ψ = 1 T T t=1 E s∼ν * t [D KL (π * t |ψ * t )] . This notion of task-relatedness gives the measure of how far optimal policies are in each task from some time-varying comparator. We denote empirical task-relatedness as V 2 ψ := 1 T T t=1 E s∼νt [D KL (π t |ψ * t )] , which depends on the suboptimal policy returned by the within-task algorithm. To measure the performance of Meta-SRL in dynamic settings, we analyze the dynamic regret bound, i.e., U T := T t=1 f t (ϕ t ) - T t=1 f t (ψ * t ) , where ψ * t ∈ arg min x∈X f t (x) is a sequence of minimizers for each loss, and f t (•) = E s∼ν * t [D KL (π * t |•)] . By exploiting the strong convexity of the loss function (KL divergence in our case), previous studies have shown that the dynamic regret can be upper bounded by the path-length of the comparator sequence, defined as P T := T t=2 ∥ψ * tψ * t-1 ∥, which captures the cumulative difference between successive comparators (Zhao et al., 2020) . The bound can be further improved for strongly convex functions as the minimum of the path-length and the squared path-length, S T := T t=2 ∥ψ * tψ * t-1 ∥ 2 , which can be much smaller than the path-length (Zhang et al., 2017) . We extend these results to the settings of inexact online gradient descent by allowing the learner to query the inexact gradient of the function. is the cumulative square root of inexactness, and ϵ t is the upper bound from Theorem 3.1.

3.3. DYNAMIC REGRET WITH ADAPTIVE LEARNING RATES

It can be observed from the last section that to set the learning rate α t for the within-task algorithm CRPO, knowledge of optimal/suboptimal policies from all T tasks is used. This makes the algorithm less applicable in online settings where tasks are encountered sequentially. Moreover, when the task-environment changes dynamically, a fixed policy initialization ψ may not be the best candidate comparator, where it is natural to study dynamic regret by competing with a potentially time-varying sequence {ψ * t } T t=1 . Also, the tasks may share some common aspects of the optimization landscape, so adapting learning rates based on prior experience may further improve performance. This is the direction we pursue. Recall the regret for suboptimality and constraint violation of the CRPO: U t (π t,0 , α t ) := c t 1 α t E s∼ν * t [D KL (π * t |π t,0 )] + α t (c t 2 M + c t 4 √ M ) + c t 3 √ M , where the constants {c t i } i=1,...,4 are given in Algorithm 1. We assume that α t ∈ Λ := {α t | α t ≥ ζ} for some ζ > 0, where Λ is a convex set. Overall, the goal of the meta-learner is to make a sequence of decisions, collected by x t = {π t,0 ∈ ∆A |S| ϱ , α t ∈ Λ}, such that TAOG and TACV are minimized. To design the adaptive algorithm, we consider the following two parallel sequences of loss functions over initial policy ϕ, f init t (ϕ) = E ν * t [D KL (π * t |ϕ)], and learning rate κ, f sim t (κ) = c t 1 E ν * t [D KL (π * t |π t,0 )] κ + κ(c t 2 M + c t 4 √ M ) + c t 3 √ M f rate t (κ) . (Khodak et al., 2019) , instead of running one online algorithm on U t (π t , α t ), we will run two online algorithms separately for the function sequences f init t and f sim t by taking actions on the initial policy and learning rates, respectively, such that the overall regret can be bounded by an expression that depends on the regrets for each sequence. Let INIT and SIM be two algorithms, such that the actions π t+1,0 := INIT(t) are taken over f init t and the actions α t+1 := SIM(t) are taken over f sim t ; these actions will then be used as policy initialization and learning rates for the next CMDP. We assume the following regret upper bounds for each algorithm: 3  Published L(κ) = U sim T (κ) + U init T ({ψ * t } T t=1 ) κ + E T κ + T t=1 f init t (ψ * t ) κ + f rate t (κ) , and {ψ * t } T t=1 is any comparator sequence. Then, the following bounds on TAOG and TACV hold: Ri ≤ L(κ * ) T , ∀ i = 0, ..., p. Note that the terms U init t=1 , then, the following bounds on TAOG and TACV hold for all i = 0, . . . , p: Ri ≤O   1 √ M   1 √ M T + E T T √ M + 1 M 1/4 √ T min(S T + E T , P T + ẼT ) + E T T + V 2 ψ     . (8) Remark 2. The bounds are improved in terms of M and T due to the adaptive learning rate. Specifically, the bounds diminish at a rate O 1 M 3/4 √ T E T + E T T + V 2 ψ as compared to the previous rate O 1 √ M E T √ T + D * 2 . Note that Vψ is same as D * in the case of a fixed comparator ψ * . Moreover, a practical aspect of our algorithm is that it does not require the knowledge of quantities like S T , P T and E T to decide the value of learning rate α t .

4. EXPERIMENTS

In this section, we show the effectiveness of the proposed Meta-SRL framework and compare it with the following baselines: simple averaging (i.e., initialize with the average of learned policies from past CMDPs), pre-trained (i.e., initialize test task with the suboptimal policy from another CMDP), Follow the Average Leader (FAL), and random initialization strategies. Note that simple averaging takes the average of previous suboptimal policies obtained from random initializations on all CMDP tasks, while FAL does this in an online manner while tasks arrive sequentially. Different CMDPs are 3 While we run the online learning algorithm on the inexact versions of the loss { ft} T t=1 , the dynamic/static regret is the standard one measured using the exact losses: UT = T t=1 ft(ϕt) -T t=1 ft(ψ * t ). generated using a probability distribution over the parameters of CMDPs (e.g., rewards, transition dynamics), similar to the latent CMDP model (Chen et al., 2021a) . We consider the Frozen lake, acrobot, half-Cheetah, and humanoid environments from the OpenAI gym (Brockman et al., 2016) and MuJoco Todorov et al. (2012) under constrained settings. For more details on experimental setups, distribution shift, and extra experiments on Mujoco, please refer to Appendix H. We can observe from Figure 1 that Meta-SRL achieves higher rewards and lower constraint violations more quickly than baseline initializations. The baseline FAL which simply takes the average of previous suboptimal policies, performs poorly. This illustrates the benefit of incorporating stationary distribution correction estimation and adaptive learning rates. Indeed, for Frozen lake, different locations of the hole can result in different stationary distributions-it is more sensible to put higher weights on policies that frequently visit a particular state since it implies that the corresponding strategies can have a substantial impact on the case of low task-similarity conditions. We also observe similar trends for the Acrobot in Figure 2 , where Meta-SRL achieves higher rewards quickly and zero constraint violations as compared to other baseline initializations under low task-relatedness settings. The pre-trained baseline was able to achieve higher rewards but did not achieve constraint satisfaction for both constraints. Under high task-similarity settings, we expected all the methods (except vanilla CRPO) to perform well; however, we noticed that simple averaging does poorly even in this setting, possibly due to adverse interference among different tasks.

5. CONCLUSION AND FUTURE DIRECTIONS

We introduced a novel framework, Meta-SRL, for meta-learning over CMDPs. The proposed framework does not assume access to globally optimal policies from the training tasks, and instead performs online learning over inexact within-task bounds estimated by stationary distribution correction. Moreover, strategies for learning rate adaptation are designed to further exploit task-relatedness. One limitation of the proposed method is that it only considers CRPO as the within-task algorithm; nevertheless, our framework can be potentially adapted to more single-task algorithms by making the dependence of guarantees on initial policy/step sizes explicit. Some potential future directions could be to design Meta-SRL with zero constraint violation (Liu et al., 2021b) , non-stationary environments (Ding & Lavaei, 2022) , and multi-agent settings (De Nijs et al., 2021) .

6. BROADER IMPACT STATEMENTS

There is an increasing need to address fairness as a constraint in learning settings. Existing works that aim to achieve zero-shot generalization without any task-specific adaptation have limited capability to adapt to shifting environments. While online meta-learning is a principled technique to learn good priors over model parameters for fast adaptation in a sequential setting, existing methods often do not address constraints and thus have limited applications in fairness-aware learning. The proposed CMDP-within-online framework can potentially be adapted to reinforcement learning tasks with fairness constraints in a non-stationary environment. In practice, this can provide a strategy that learns priors over policy parameters not only to master the current fairness-aware task but also to become proficient with quick adaptation at learning newly arrived tasks. Our theoretical analysis can be leveraged to provide a sublinear bound on the "task-averaged fairness violation" regret. Similar ideas have been explored by (Zhao et al., 2021) in the supervised learning setting, while we are not aware of any work on the reinforcement learning counterpart. Thus, it can be an extension for future work to explore the extent to which our method can address this important problem.Nevertheless, fairness constraints present a unique challenge for meta-safe RL settings, as fairness constraints should rarely be violated in a real-world setting due to the implicated discrimination or bias. Additional efforts, such as incorporating pessimism Bai et al. (2021) or developing offline methods, may be entailed to reduce fairness violations during initial deployment.

APPENDIX

In this section, we start with a summary of related work in Sec. A followed by a brief recapitulation of the CRPO algorithm in Sec. B. Note that CRPO will be our focus as the exemplary within-task safe RL algorithm. We also introduce notations therein that will be used in later analysis. In Sec. C, we give the pseudo-code of our inexact CMDP-within-online algorithm, with further discussions on key aspects. Sec. D provides the proof for Sec. 2 of the main paper, which focuses on an elementary yet illustrative example of the CMDP-within-online approach. We start by providing a simplified proof to help the reader understand the main approach of CRPO, and then demonstrate the potential improvement by exploiting inter-task-relatedness (Lemma 5). Sec. E contains the key developments in extending online learning approaches, specifically online gradient descent, to the case of inexact loss functions. We start with some preliminaries on ϵ-subgradient (Sec. E.1). Then, we conduct the analysis for static regret (Thm. E.1) and dynamic regret (Thm. E.3). In Sec. F, we provide a detailed analysis of the KL divergence estimation error bound, which contributes to one of our main contributions in understanding the key aspects of the proposed inexact CMDP-within-online framework. Our development leverages the seminal results developed for tame geometry, which we briefly review in Sec. F.1. We also briefly set up the notations and recall basic properties of subgradient flow systems F.2. Through a series of bounds, the final result is obtained in Thm. F.1. We then provide proofs for Sec. 3.3. In Sec. G.1, we first extend the analysis of CRPO to the case of adaptive learning rates. Then, we provide the proof for Thm. 3.3 and Corollary 1 in Sec. G.2. Experimental details are provided in Sec. H. Frequently used notations and constants are listed in Sec.J.

A RELATED WORK

Meta-reinforcement learning: Current state-of-the-art meta-RL includes learning the initial conditions (Finn et al., 2017) , hyperparameters (Jaderberg et al., 2019) , step directions (Li et al., 2017) and stepsizes (Young et al., 2018) , and training recurrent neural networks to embed previous task experience (Duan et al., 2016) (see also (Chen et al., 2021a) for sim-to-real transfer, and Suilen et al. (2022) for the extension to robust MDPs), with recent developments on improving meta-optimization (Rothfuss et al., 2018; Liu et al., 2019; Song et al., 2019) (see (Hospedales et al., 2020) for a review). Recently, (Fallah et al., 2021; Ji et al., 2022) provided theoretical studies on the convergence of model-agnostic meta-RL. However, these works all focus on the unconstrained meta-RL and their local optimality convergence, while our work is the first to obtain provable guarantees for optimality and constraint satisfaction for CMDPs. Online meta-learning/learning-to-learn (LTL). Most initialization-based meta-learning studies focus on the setting with decomposable within-task loss functions that are often convex (Finn et al., 2019; Denevi et al., 2019; Balcan et al., 2019) ; nonconvex within-task settings are studied usually for multi-task representation learning (Balcan et al., 2015; Maurer et al., 2016; Du et al., 2020; Tripuraneni et al., 2020) . Theoretically, our work is inspired by the Average Regret-Upper-Bound Analysis (ARUBA) strategy (Khodak et al., 2019) for obtaining a meta-procedure, which has been recently extended to learning nonconvex piecewise-Lipschitz functions (Balcan et al., 2021) ; the main technical advance in our work is in providing the guarantees for CMDPs, which is challenging due to the interplay between the nonconvexity and stochasticity of the optimization and the complexity of the within-task safe RL algorithms that involve policy update, critic learning, and the proper choice of stepsizes for reward/constraints. Inexact online learning. Online learning with access to inexact loss/gradient information has been studied for stochastic zero-biased noise (Cesa-Bianchi et al., 2011; Yang et al., 2016; Bedi et al., 2018; Dixit et al., 2019) , deterministic error/nonzero-biased stochastic noise (Bedi et al., 2018; Dixit et al., 2019) , and adversarial perturbation (Resler & Mansour, 2019) . Our analysis for static regret uses the formalism of ϵ-subgradient (Jean-Baptiste, 2010, Chap. XI); for dynamic regret, we extend the work (Zhang et al., 2017) to the inexact setting allowing multiple updates per round and provide improved rates than prior results (Bedi et al., 2018; Dixit et al., 2019) . safe RL and CMDP. Direct policy search methods have had substantial empirical successes in solving CMDPs (Borkar, 2005; Uchibe & Doya, 2007; Bhatnagar & Lakshmanan, 2012; Achiam et al., 2017; Chow et al., 2017) (see, e.g., (Garcıa & Fernández, 2015) for a survey of safe RL). Recently, major progress in understanding the theoretical nonasymptotic global convergence behavior of policy-based methods for CMDPs has also been achieved (Chow et al., 2018; Paternain et al., 2022; Efroni et al., 2020; Ding et al., 2021a; Ding & Lavaei, 2022; Ying et al., 2022; Yu et al., 2019; Xu et al., 2021; Chen et al., 2021b; Liu et al., 2021b; a) . However, most of these works only study a single CMDP task and don't seek to make the algorithm perform well on new, potentially related CMDP tasks. In addition, while our work uses the constraint-rectified policy optimization (CRPO) algorithm proposed in (Xu et al., 2021) as a building block, our framework can be potentially adapted to most of the existing RL literature by making the dependence of guarantees on initial policy/step sizes explicit, e.g., safe exploration (Efroni et al., 2020) , regularization (Geist et al., 2019) , off-policy evaluation (Duan et al., 2020; Tennenholtz et al., 2020) , and offline RL under constraints (Le et al., 2019; Wu et al., 2021; Lee et al., 2021; Thomas et al., 2021) .

B CRPO ALGORITHM AND NOTATIONS

We provide some preliminaries and notations for the CRPO algorithm for the sake of completeness. CRPO (Xu et al., 2021 ) is a primal-based CMDP algorithm, which performs policy optimization (natural gradient ascent on the reward) when constraints are not violated, or constraint minimization (natural gradient descent on the constraint function) for the corresponding violated constraint. There are three crucial components in the overall strategy to solve the CMDP problem 1: 1. Policy evaluation: In each step m of task t, for a certain policy π t,m , the action-value functions Q i t,πt,m are estimated for the reward (i = 0) and constraints (i = 1, ..., p). TDlearning is employed for critic evaluation (Bhandari et al., 2018) . 2. Estimation of constraint violation: Once the Q-estimates Qi t,πt,m (s, a) are obtained, then a weighted average is taken to estimate expected constraint violation Jt,i (π t,m ) under a given policy π t,m . 3. Policy optimization: After the constraint estimation, it is checked if the expected constraint violation Ji t,πt,m exceeds the given safety threshold, i.e., if Jt,i (π t,m ) ≤ d t,i + η t for all i = 1, . . . , p. If none of the constraints are violated, then one step of natural policy gradient ascent is performed to maximize the objective. If one or more constraints are violated, then one step of natural policy gradient descent is conducted to minimize one of the unsatisfied constraints. The set of time steps the policy optimization for reward maximization takes place is denoted by N t,0 , and the set of time steps constraint minimization takes place is denoted by N t,i . Thus |N t,0 | + p i=1 |N t,i | = M for any task t.

C INEXACT CMDP-WITHIN-ONLINE ALGORITHM

Algorithm 1 presents the inexact-CMDP-within-online algorithm for Meta-SRL. The first step in the algorithm is to initialize with some random actor policy ϕ 1 , and the learning rate α 1 for the first task. Then, for each task t, a within-task algorithm (i.e., CRPO) is run for M steps to obtain a policy πt . The discounted state visitation distribution νt induced by πt is then estimated using the trajectory data collected within task t. Afterward, an inexact OGD method is run on the new loss functions to update the meta-initialization policy ϕ t+1 , and the learning rate α t+1 . The online learning loop is iterated for all tasks t ∈ [T ].

D PROOF IN SECTION 2

We first present a simplified proof for the results in Equation 2. This result also shows in (9) how the safety threshold η t can be chosen to achieve sublinear convergence rate in M . Lemma 4. For CRPO (Xu et al., 2021) with the softmax parametrization and the exact critic estimation (i.e., no critic evaluation error), if we have η t ≥ 2 αM E s∼ν * t [D (π * t |π t,0 )] + 2M α 2 c 2 max |S||A| (1 -γ) 3 , ( ) then the following holds 1. N t,0 ̸ = ∅, i.e., πt is well-defined, 2. J t,0 (π * t ) -J t,0 (π t ) ≤ η t . 3. J t,i (π * t ) -J t,i (π t ) ≤ η t , for i = 1, . . . , p. Proof. The following inequality holds due to Lemma 7 in (Xu et al., 2021) : α m∈Nt,0 (J t,0 (π * t ) -J t,0 (π t,m )) + αη t p i=1 |N t,i | ≤ E s∼ν * t [D (π * t |π t,0 )] + 2M α 2 |S||A| (1 -γ) 3 . ( ) We first verify item 1. If N t,0 = ∅, then p i=1 |N t,i | = M , and 10 implies that αη t M ≤E s∼ν * t [D (π * t |π t,0 )] + 2M α 2 |S||A| (1 -γ) 3 which contradicts 9. Thus, we must have N t,0 ̸ = ∅. We then proceed to verify item 2. If m∈Nt,0 (J t,0 (π * t ) -J t,0 (π t,m )) > η t |N t,0 | , then 10 implies that αη t M ≤ E s∼ν * t [D (π * t |π t,0 )] + 2M α 2 |S||A| (1 -γ) 3 , which contradicts 9. Hence, item 2 holds. Finally, the item 3 holds obviously since πt is sampled from N t,0 . This completes the proof. We now prove Lemma 1 in Section 2. Lemma 5. Assume {ν * t } T t=1 and {π * t } T t=1 are given. For each task t, we run CRPO for M iterations with α = (1-γ) 3 2 √ 2M |S||A| L 2 g (log T +1) µπT + D * 2 . In addition, the initialization {π t,0 } T t=1 are determined by playing FTRL or OGD on the functions E s∼ν * t [D KL (π * t |•)] , for t = 1, . . . , T . Then, it holds that Ri ≤ 8|S||A| M (1 -γ) 3 L 2 g (log T + 1) µ π T + D * 2 , ∀i = 1, . . . , p. Proof. By the within-task guarantee for CMDP, we know that R0 and { Ri } p i=1 are well-defined. In addition, it holds that R0 ≤ 1 T T t=1 2E s∼ν * t [D KL (π * t |π t,0 )] αM + 4α|S||A| (1 -γ) 3 = 2 T T t=1 E s∼ν * t [D KL (π * t |ϕ t )] -E s∼ν * t [D KL (π * t |ϕ * )] αM + 2 T T t=1 E s∼ν * t [D KL (π * t |ϕ * )] αM + 2α|S||A| (1 -γ) 3 . where ϕ t = π t,0 . The first inequality follows from the choice of η t from Lemma 4. The key step is the last step, which splits the total loss into the loss of the meta-update algorithm and the the loss if we had always initialized at ϕ * . Since each E s∼ν * t [D KL (π * t |•) ] is µ π -strongly convex due to Assumption 1, and each ϕ t is determined by playing OGD, we have that:  2 T T t=1 E s∼ν * t [D KL (π * t |ϕ t )] -E s∼ν * t [D KL (π * t |ϕ * )] αM ≤ 2L 2 g (log T + 1) µ π αM T , E s∼ν * t [D KL (π * t |ϕ * )] αM + 2α|S||A| (1 -γ) 3 = 2D * 2 αM + 4α|S||A| (1 -γ) 3 . Setting the value of α = L 2 g (log T +1) µπ T +D * 2 (1-γ) 3 √ 2M |S||A| , we can obtain the TAOG R0 as: R0 ≤ 8 L 2 g (log T +1) µπT + D * 2 |S||A| M (1 -γ) 3 The bound for Ri can be derived similarly. The lemma above shows how the parameters like learning rate α and safety threshold η t can be chosen to achieve decreasing TAOG and TACV in the number of updates per task M and the number of tasks T .

E INEXACT ONLINE GRADIENT DESCENT E.1 BASICS FOR ϵ-SUBGRADIENT

We start with some basics for ϵ-subdifferential used in the subsequent analysis. This material is based on (Jean-Baptiste, 2010, Chap. XI). Throughout this section, we consider a convex, closed, and proper function f : R d → R ∪ {+∞} with domain Dom(f ). We always consider a positive ϵ > 0. Definition 2 (ϵ-subgradient (Jean-Baptiste, 2010)). Given x ∈ Dom(f ), the vector u ∈ R d is called ϵ-subgradient of f at x when the following property holds for any x ∈ R d : f (x) ≥ f (x) + ⟨u, x -x⟩ -ϵ. The set of all ϵ-subgradients of f at x is the ϵ-subdifferential of f at x, denoted by ∂ ϵ f (x). In view of the exact subdifferential ∂f (x), ∂ ϵ f (x) can be called an approximate subdifferential, which is a set-valued function with a convex graph. For practical use, ∂ ϵ f (x) can be used to characterize the ϵ-solution to a convex minimization problem. Lemma 6. ((Jean-Baptiste, 2010, Thm. 1.1.5)) The following two properties are equivalent. 0 ∈ ∂ ϵ f (x) ⇐⇒ f (x) ≤ f (x) + ϵ, for all x ∈ R d . One useful result that stems directly from the definition is to link the ϵ-subdifferential of two uniformly close functions (e.g., an expectation of a function and its empirical version). Lemma 7. Consider two convex functions f and g, with the property that ∥f -g∥ ∞ ≤ ϵ, where ∥f -g∥ ∞ = max x |f (x)g(x)|. Then, for any x ∈ R d and u ∈ ∂f (x) in the subdifferential of f at x, it is also in the 2ϵ-subdifferential of g at x, i.e., u ∈ ∂ 2ϵ g(x). Proof. The proof follows directly by convexity and the uniform condition: g(y) ≥ f (y) -ϵ ≥ f (x) + ⟨s, y -x⟩ -ϵ ≥ g(x) + ⟨s, y -x⟩ -2ϵ, where the second inequality is by the convexity of f , and the first and last inequalities are due to the supremum norm condition. Published as a conference paper at ICLR 2023 Algorithm 2: Inexact OGD Algorithm Input: Learning rate α, x 1 = 0 1: for t = 1, .., T do 2: Incur loss ℓ t (x t ) and compute ϵ-gradient ∇t ℓ t (x t ) 3: x t+1 = P X (x tα ∇t ℓ t (x t )) 4: end for Our next result is concerned with bounding the distance (measured in ℓ 2 norm) between the true gradient and the ϵ-subgradient of the function, assuming the function is differentiable and smooth. Lemma 8. Suppose a function f is convex, differentiable, and L-smooth over Dom(f ), and u ∈ ∂ ϵ f (x) is an ϵ-subgradient of f at x ∈ Dom(f ). Then, ∥u -∇f (x)∥ 2 2 ≤ 2ϵ 2C 1 -C 2 1 L , for any C 1 ∈ {c ∈ (0, 2 L ) : x + c(u -∇f (x)) ∈ Dom(f )}. In particular, if x + 1 L (u -∇f (x)) ∈ Dom(f ), then ∥u -∇f (x)∥ 2 2 ≤ 2ϵL. Proof. Since u is an ϵ-gradient, f (y) ≥ f (x) + ⟨u, y -x⟩ϵ for all y ∈ Dom(f ). Thus, 0 ≤ f (x) -f (y) + ⟨∇f (x), y -x⟩ + L 2 ∥y -x∥ 2 ≤ ⟨∇f (x) -u, y -x⟩ + 1 2 ∥y -x∥ 2 + ϵ Choose y = x + c(u -∇f (x)) for c ∈ (0, 2 L ) such that x + c(u -∇f (x)) ∈ Dom(f ), we have that ∥u -∇f (x)∥ 2 2 ≤ 2ϵ 2c -c 2 L . The smoothness condition in the above seems necessary, as we can construct counterexamples that drive the distance of an ϵ-subgradient and its exact counterpart arbitrarily large without the smoothness condition. In fact, it is known that the set-valued mapping (x, ϵ) → ∂ ϵ f (x) is inner semi-continuous for a Lipschitz-continuous f , which is implied by the fact that the distance (using the Hausdorff distance for sets) between any two subdifferential ∂ ϵ f (x) and ∂ ϵ ′ f (x ′ ) for all x, x ′ ∈ R d and ϵ, ϵ ′ is positive, and shown to be bounded by O 2010, Thm. 4.1.3) . While the exact gradient can be interpreted as ϵ-subgradient driving ϵ → 0 + , the existing bound provided by (Jean-Baptiste, 2010, Thm. 4.1.3 ) is vacuous in this case; on the other hand, the bound provided in Lemma 8 remains meaningful. 1 min{ϵ,ϵ ′ } (∥x -x ′ ∥ + |ϵ -ϵ ′ | (Jean-Baptiste,

E.2 STATIC REGRET FOR THE INEXACT OGD ALGORITHM

In the following, we consider the online learning setup, where a sequence of loss functions {ℓ t } t∈[T ] are revealed sequentially, and the performance of the OGD algorithm (see Algorithm 2) is measured against a static decision in hindsight: (static regret) T t=1 ℓ t (x t ) -min x∈X T t=1 ℓ t (x) where {x t ∈ X} t∈[T ] is a sequence of actions played by the online algorithm. For simplicity, we assume that X belongs to the domains of ℓ t for all t ∈ [T ]. Furthermore, we define the following cumulative inexact error bounds: E T := T t=1 ϵ t , where ϵ t corresponds to the inexactness of the ϵ t -subgradient in each round of OGD. Theorem E.1 (Static regret bound for the inexact OGD). Assume that {ℓ t } t∈[T ] are convex and L 2 -smooth, with bounded gradient, i.e., ∥∇ℓ t (x)∥ 2 ≤ L 1 for all t ∈ [T ] and all x ∈ X. Then, for any comparator x ∈ X, with the stepsize α := ∥x∥ L1 √ 2T , we have that T t=1 ℓ t (x t ) - T t=1 ℓ t (x) ≤ L 1 ∥x∥ √ 2T + 1 + √ 2cL 1 L 2 ∥x∥ √ T T t=1 ϵ t , where ϵ t is the amount of inexactness at each step t. Proof. By convexity and the fact that ∇t is an ϵ t -subgradient of ℓ t at x t , we have that ℓ t (x t ) -ℓ t (x) ≤ ⟨ ∇t , x t -x⟩ + ϵ t , ∀x ∈ X Hence, summing over t = 1, ..., T , we get 1 T T t=1 ℓ t (x t ) -ℓ t (x) ≤ 1 T T t=1 ⟨ ∇t , x t -x⟩ + ϵ t . To bound the RHS, observe that ∥x t+1 -x∥ 2 ≤ ∥x t -α ∇t -x∥ 2 = ∥x t -x∥ 2 -2α⟨x t -x, ∇t ⟩ + α 2 ∥ ∇t ∥ 2 , where the first inequality is due to the OGD update rule and the nonexpansiveness of the projection operator. Thus, rearranging the terms and exploiting the telescopic sum over t ∈ [T ], we have that T t=1 ⟨x t -x, ∇t ⟩ ≤ 1 2α (∥x 1 -x∥ 2 -∥x T +1 -x∥ 2 ) + α 2 T t=1 ∥ ∇t ∥ 2 ≤ 1 2α ∥x 1 -x∥ 2 + α 2 T t=1 ∥ ∇t ∥ 2 . Furthermore, since ℓ t is L 2 -smooth with bounded gradient, and ∇t is an ϵ t -gradient for any t ∈ [T ], by Lemma 8, the following holds: ∥ ∇t ∥ 2 ≤ 2∥∇ t ∥ 2 + 2∥∇ t -∇t ∥ 2 ≤ 2L 2 1 + 2cL 2 ϵ t , where the constant c is specified by Lemma 8. Hence, by combining the above relations, we get 1 T T t=1 ℓ t (x t ) -ℓ t (x) ≤ 1 2αT ∥x 1 -x∥ 2 + 1 T T t=1 α 2 ∥ ∇t ∥ 2 + ϵ t ≤ 1 2αT ∥x 1 -x∥ 2 + αL 2 1 + αcL 2 + 1 T T t=1 ϵ t . Let α = ∥x∥ L1 √ 2T , then we get the RHS as L 1 ∥x∥ 2 T + 1 + T T t=1 ϵ t . Remark 3. We can relax the dependence of setting the stepsize on T by using a standard doubling trick (first proposed in (Auer et al., 2002) , see also, e.g., (Balcan et al., 2019; Khodak et al., 2019) ). After establishing the static regret for the inexact OGD, we can use this result to obtain the proof of Lemma 2, which gives the static regret if we run inexact OGD over the loss sequences E ν * t [D KL (π * t |π t,0 )] for all t ∈ [T ]. Overall, the following regret bound will eventually help us establish the proof of Theorem 3.2, where we will utilize the static regret upper bound for inexact OGD over the loss sequences E ν * t [D KL (π * t |π t,0 )] for all t ∈ [T ] . Also, we denote the norm of the policy with respect to the state distribution ν as ∥π∥ ν = s∈S ν(s)π(s). Now we proceed to present the proof for Lemma 2. 2T , then the following bound holds for static regret: T t=1 ℓ t (π t,0 ) - T t=1 ℓ t (π * 0 ) ≤ √ 2T L g ∥π * 0 ∥ + 1 + 4 √ 2L g L π ∥π * 0 ∥ (2C 1 -C 2 1 L π ) √ T E T , for any C 1 ∈ {c ∈ 0, 2 Lπ : π * 0 + c( ∇t -∇ t ) ∈ ∆A |S| ϱ } where ∇t and ∇ t are an ϵ t -subgradient and exact subgradient of E ν * t [D KL (π * t |π t,0 )] at π t,0 , respectively, E T := T t=1 ϵ t is the cumulative inexactness. Proof. The proof follows directly after substituting c =  c 2 = 2 + 4 √ 2LgLπ∥ϕ * ∥ (2C1-C 2 1 Lπ) √ T , where ϕ * is the fixed optimal metainitialization for all the tasks given by ϕ * = arg min ϕ∈∆A |S| ϱ 1 T T t=1 E s∼νt [D KL (π t |ϕ)]. For each task t, we run CRPO for M iterations with α = |S|A| 2M (1-γ) 3 c1 √ T + c2E T T + D * 2 , and we obtain {ν t } T t=1 and {π t } T t=1 . In addition, the initialization {π t,0 } T t=1 are determined by playing OGD on the functions E s∼νt [D KL (π t |•)] , for t = 1, . . . , T . Then, it holds that Ri ≤ 8|S||A| √ M (1 -γ) 3/2   √ 2L g ∥ϕ * ∥ √ T + 2 + 4 √ 2L g L π ∥ϕ * ∥ (2C 1 -C 2 1 L π ) √ T E T T + D * 2   ∀i = 0, . . . , p. Proof. We know that R0 and { Ri } p i=1 are well-defined. In addition, it holds that R0 ≤ 2 T T t=1 E s∼ν * t [D KL (π * t |ϕ t )] αM + 2α|S||A| (1 -γ) 3 = 2 T T t=1 E s∼ν * t [D KL (π * t |ϕ t )] -E s∼ν * t [D KL (π * t |ϕ * )] αM + 2 T T t=1 E s∼ν * t [D KL (π * t |ϕ * )] αM + 2α|S||A| (1 -γ) 3 ≤ 2 T T t=1 E s∼ν * t [D KL (π * t |ϕ t )] -E s∼ν * t [D KL (π * t |ϕ * )] αM + 2 T T t=1 E s∼νt [D KL (π t |ϕ * )] ± ϵ t αM + 2α|S||A| (1 -γ) 3 . where ϕ t = π t,0 . Second equality follows from the fact that the total loss can be split into the loss of the meta-update algorithm and the the loss if we had always initialized at ϕ * . Last inequality follows from the KL-divergence estimation error bound in Theorem 3.1. Since each E s∼νt [D KL (π t |•) ] is µ π -strongly convex due to Assumption 1, and since each ϕ t is determined by playing FTL or inexact OGD, the following term can be upper bounded using Lemma 9 as follows: 2 T T t=1 E s∼ν * t [D KL (π * t |ϕ t )] -E s∼ν * t [D KL (π * t |ϕ * )] αM ≤ 2 αM √ 2L g ∥ϕ * ∥ √ T + 1 + 4 √ 2L g L π ∥ϕ * ∥ (2C 1 -C 2 1 L π ) √ T E T T , where  2 T T t=1 E s∼νt [D KL (π t |ϕ * )] ± ϵ t αM + 2α|S||A| (1 -γ) 3 ≤ 2 D * 2 αM + 2E T T αM + 4α|S||A| (1 -γ) 3 . Setting the value of α = (1-γ) 3/2 c 1 √ T + c 2 E T T + D * 2 √ 2M |S||A| , where c 1 = √ 2L g ∥ϕ * ∥, c 2 = 2 + 4 √ 2LgLπ∥ϕ * ∥ (2C1-C 2 1 Lπ) √ T , we can obtain the TAOG R0 as follows: R0 ≤ 8 c1 √ T + c2E T T + D * 2 |S||A| M (1 -γ) 3 The bound for Ri can be derived similarly.

E.3 DYNAMIC REGRET FOR THE INEXACT OGD ALGORITHM

In the following, we consider a stronger notion of regret that measures the performance of the OGD algorithm (see Algorithm 2) against a dynamically changing sequence in hindsight (see, e.g., (Zinkevich, 2003; Jadbabaie et al., 2015; Zhang et al., 2017) ): (dynamic regret) T t=1 ℓ t (x t ) - T t=1 ℓ t (x * t ) where x * t ∈ arg min x∈X ℓ t (x) is the optimal decision for the loss ℓ t . It is well known that in the worst case, it is impossible to achieve a sub-linear dynamic regret bound, due to the arbitrary fluctuation in the functions (Zinkevich, 2003; Besbes et al., 2015; Yang et al., 2016) . Thus, it is common to upper bound the dynamic regret in terms of a certain regularity of the comparator sequence. One possible regularity condition is the path length of the comparator sequence (Zinkevich, 2003; Jadbabaie et al., 2015) : P T := T t=2 ∥x * t -x * t-1 ∥, which captures the cumulative Euclidean norm of the difference between successive comparators (note that we will use ∥ • ∥ for the Euclidean norm, unless otherwise specified). The path-length measure is also the regularity condition used in existing inexact OGD literature (Bedi et al., 2018; Dixit et al., 2019) . However, as remarked in (Zhang et al., 2017) , a potentially tighter bound can be achieved by examining the squared path-length measure: S T := T t=2 ∥x * t -x * t-1 ∥ 2 , ( ) which can be much smaller than P T when the local variations are small. For example, when ∥x * t -x * t-1 ∥ = Θ(1/ √ T ) for all t ∈ [T ], we have P T = Θ( √ T ) but S T = Θ(1). In this section, we provide analysis with respect to both measures for strongly convex and smooth functions. Furthermore, we propose to apply inexact OGD multiple times in each round, and demonstrate that the dynamic regret is reduced from O(P T + E T ) to O(min{P T + E T , S T + ẼT }), where ẼT := T t=1 √ ϵ t is the cumulative square root inexactness bounds. Note that our results improve over existing bounds for inexact online learning (Bedi et al., 2018; Dixit et al., 2019) and can be regarded as a generalization of (Zhang et al., 2017) to the inexact settings. We start with a result that will be used in later analysis. Lemma 10. Assume that f : X → R is λ-strongly convex and L-smooth, and let x * = arg min x∈X f (x) be the unique optimal solution. Let v = P X (xα ∇f (x)), where ∇f (u) ∈ ∂ ϵ f (u) and α ≤ 1 2L , we have that ∥v -x * ∥ 2 ≤ 1 λα + 1 ∥x * -x∥ 2 + cα + 2Lα λLα + L ϵ, where the constant c is specified in Lemma 8. Proof. By the update rule, we have that v = arg min x ′ ∈X f (x) + ⟨ ∇f (x), x ′ -x⟩ + 1 2α ∥x ′ -x∥ 2 . ( ) By strong convexity of the objective above, ⟨ ∇f (x), v -x⟩ + 1 2α ∥v -x∥ 2 ≤ ⟨ ∇f (x), x * -x⟩ + 1 2α ∥x * -x∥ 2 - 1 2α ∥v -x * ∥ 2 . ( ) Since, f (x) is λ-strongly convex and L-smooth, we have that f (x * ) - λ 2 ∥x * -x∥ 2 ≥ f (x) + ⟨∇f (x), x * -x⟩, and f (x * ) ≤ f (x) + ⟨∇f (x), x * -x⟩ + L 2 ∥x * -x∥ 2 . ( ) Also, since ∇f (x) is an ϵ-subgradient, we can write f (x * ) ≥ f (x) + ⟨ ∇f (x), x * -x⟩ -ϵ. ( ) Algorithm 3: Inexact Online Multiple Gradient Descent Algorithm Input: Learning rate α, x 1 = 0 1: for t = 1, .., T do 2: Incur loss ℓ t (x t ) 3: z 1 t = x t 4: for k = 1, ..., K do 5: z k+1 t = P X (x t -α ∇ℓ t (z k t )) 6: end for 7: x t+1 = z K+1 t 8: end for Combining 18, 19 and 20, we have that f (x * ) + L -λ 2 ∥x * -x∥ 2 ≥ f (x) + ⟨ ∇f (x), x * -x⟩ -ϵ. Combining the above relations, we have that f (v) ≤ f (x) + ⟨∇f (x), v -x⟩ + L 2 ∥v -x∥ 2 = f (x) + ⟨ ∇f (x), v -x⟩ + L 2 ∥v -x∥ 2 + ⟨∇f (x) -∇f (x), v -x⟩ (i) ≤ f (x) + ⟨ ∇f (x), x * -x⟩ + L 2 - 1 2α ∥v -x∥ 2 + 1 2α ∥x * -x∥ 2 - 1 2α ∥v -x * ∥ 2 + ⟨∇f (x) -∇f (x), v -x⟩ (ii) ≤ f (x * ) + L 2 - 1 2α ∥v -x∥ 2 + 1 2α ∥x * -x∥ 2 - 1 2α ∥v -x * ∥ 2 + ⟨∇f (x) -∇f (x), v -x⟩ + ϵ (iii) ≤ f (v) - λ 2 + 1 2α ∥v -x * ∥ 2 + L 2 - 1 2α ∥v -x∥ 2 + 1 2α ∥x * -x∥ 2 + ⟨∇f (x) -∇f (x), v -x⟩ + ϵ (iv) ≤ f (v) - λ 2 + 1 2α ∥v -x * ∥ 2 + L 2 - 1 2α ∥v -x∥ 2 + 1 2α ∥x * -x∥ 2 + ∥∇f (x) -∇f (x)∥∥v -x∥ + ϵ (v) ≤ f (v) - λ 2 + 1 2α ∥v -x * ∥ 2 + L 2 - 1 2α + κ 2 ∥v -x∥ 2 + 1 2α ∥x * -x∥ 2 + c 2κ + 1 ϵ, where the first inequality is due to L-smoothness, (i) follows from 17, (ii) is due to convexity, (iii) is due to strong convexity, (iv) follows from Cauchy-Schwarz inequality, and (v) is due to the inequality ab ≤ 1 2κ a 2 + κ 2 b 2 for a, b ≥ 0 and κ > 0 and the constant c comes from Lemma 8. Choosing κ = L, α ≤ 1 2L , and rearranging the above, we have then proved the claim. Theorem E.3 (Dynamic regret for inexact OGD with multiple updates). Assume that ℓ t : X → R is λstrongly convex, L 1 -Lipschitz, and L 2 -smooth for all t ∈ [T ]. By setting α ≤ 1 2L2 , K := ⌈ ln 2 ln(1+λα) ⌉, then, for any β > 0, we have that T t=1 ℓ t (x t ) -ℓ t (x * t ) ≤ min C 1 ∥x 1 -x * 1 ∥ 2 + C 2 E T + C 3 S T + 1 2β T t=1 ∥∇ℓ t (x * t )∥ 2 , C 4 ∥x 1 -x * 1 ∥ + C 5 T t=1 √ ϵ t + C 4 P T , where C 1 = 2(L 2 + β), C 2 = (L 2 + β) 3cα+6αL2 2λαL2 , C 3 = 3(L 2 + β), C 4 = 2L1 2- √ 2 and C 5 = 2L1 2- √ 2 cα+2L2α 2αλL2 . Proof. The proof has two parts, where we use different techniques to bound the dynamic regret by S T and E T , as well as P T and ẼT . Then the final bound is obtained by taking the minimum between the two bounds. Bounding the dynamic regret by S T and E T . Since ℓ t is L 2 -smooth, we have that ℓ t (x t ) -ℓ t (x * t ) ≤ ⟨∇ℓ t (x * t ), x t -x * t ⟩ + L 2 2 ∥x t -x * t ∥ 2 (21) ≤ ∥∇ℓ t (x * t )∥∥x t -x * t ∥ + L 2 2 ∥x t -x * t ∥ 2 (22) ≤ 1 2β ∥∇ℓ t (x * t )∥ 2 + L 2 + β 2 ∥x t -x * t ∥ 2 , ( ) where the second inequality is due to Cauchy-Schwartz and the third inequality is due to ab ≤ 1 2β a 2 + β 2 b 2 for a, b ≥ 0 and β > 0. Now, using ∥x -y∥ 2 ≤ (1 + ι)∥x -z∥ 2 + 1 + 1 ι ∥z -y∥ 2 , we can bound T t=1 ∥x t -x * t ∥ 2 ≤ ∥x 1 -x * 1 ∥ 2 + T t=2 (1 + ι)∥x t -x * t-1 ∥ 2 + 1 + 1 ι ∥x * t -x * t-1 ∥ 2 . ( ) Recall the updating rule z j+1 t-1 = P X (z j t-1α ∇f t-1 (z j t-1 )), j = 1, ..., K; then, we can write that ∥x t -x * t-1 ∥ 2 = ∥z K+1 t-1 -x * t-1 ∥ 2 (25) ≤ 1 λα + 1 K ∥x t-1 -x * t-1 ∥ 2 + 1 - 1 λα+1 K 1 -1 λα+1 cα + 2L 2 α λL 2 α + L 2 ϵ t-1 , where we recursively apply the result from Lemma 10. Thus, by plugging in 25 into 24, and using the definitions of S T and S T , we have that T t=1 ∥x t -x * t ∥ 2 ≤ ∥x 1 -x * 1 ∥ 2 + (1 + ι) 1 λα + 1 K T t=1 ∥x t -x * t ∥ 2 (26) + (1 + ι) 1 - 1 λα+1 K 1 -1 λα+1 cα + 2L 2 α λL 2 α + L 2 E T + 1 + 1 ι S T . Rearranging the terms, the above relation implies that T t=1 ∥x t -x * t ∥ 2 ≤ (1 + λα) K (1 + λα) K -(1 + ι) ∥x 1 -x * 1 ∥ 2 + 1 + 1 ι (1 + λα) K (1 + λα) K -(1 + ι) S T + (1 + ι) (1 + λα) K -1 (1 + λα) K -(1 + ι) cα + 2L 2 α λL 2 α E T Let ι = 1 2 and choose K = ⌈ log 2 log(1+λα) ⌉, we have T t=1 ∥x t -x * t ∥ 2 ≤ 4∥x 1 -x * 1 ∥ 2 + 3cα + 6L 2 α λαL 2 E T + 6S T . Combine the above with 23, and summing over t ∈ [T ], we have that T t=1 ℓ t (x t ) -ℓ t (x * t ) ≤ 1 2β T t=1 ∥∇ℓ t (x * t )∥ 2 + 3(L 2 + β)S T + (L 2 + β) 3cα + 6Lα 2λαL E T + 2(L 2 + β)∥x 1 -x * 1 ∥ 2 , which holds true for any positive β > 0. Bounding the dynamic regret by P T and ẼT . By 26 and the choice of K = ⌈ log 2 log(1+λα) ⌉, we have that: ∥x t -x * t-1 ∥ 2 ≤ 1 2 ∥x t-1 -x * t-1 ∥ 2 + cα + 2L 2 α 2αλL 2 ϵ t-1 . Thus, ∥x t -x * t-1 ∥ ≤ 1 2 ∥x t-1 -x * t-1 ∥ 2 + cα + 2L 2 α 2αλL 2 ϵ t-1 ≤ 1 √ 2 ∥x t-1 -x * t-1 ∥ + cα + 2L 2 α 2αλL 2 √ ϵ t-1 , where the last inequlity follows from √ a + b ≤ √ a + √ b. Due to the bounded gradient assumption, we have that T t=1 ℓ t (x t ) -ℓ t (x * t ) ≤ L 1 T t=1 ∥x t -x * t ∥ To bound T t=1 ∥x t -x * t ∥, notice that T t=1 ∥x t -x * t ∥ ≤ ∥x 1 -x * 1 ∥ + T t=2 ∥x t -x * t-1 ∥ + ∥x * t-1 -x * t ∥ ≤ ∥x 1 -x * 1 ∥ + 1 √ 2 T t=1 ∥x t -x * t ∥ + cα + 2L 2 α 2αλL 2 ẼT + P T , which implies that T t=1 ∥x t -x * t ∥ ≤ 2 2 - √ 2 ∥x 1 -x * 1 ∥ + 2 2 - √ 2 cα + 2L 2 α 2αλL 2 ẼT + 2 2 - √ 2 P T . Plugging the above in 28 proves the claim. In the above result, the number of OGD updates per round is on the order of O(L 2 /α), where L 2 /α is the condition number of each loss function. Below, we also provide a dynamic regret bound for standard OGD (single update per round); as a result, we only provide the bound in terms of P T (similar to (Jadbabaie et al., 2015; Mokhtari et al., 2016) . After establishing the dynamic regret for the inexact OGD, we can use this result to obtain the proof of Lemma 3 in the main paper, which provides the dynamic regret of inexact OGD over the loss sequences E ν  T t=1 ℓ t (ϕ t ) - T t=1 ℓ t (ψ * t ) ≤ min C 1 ∥ϕ 1 -ψ * 1 ∥ 2 + C 2 E T + C 3 S T + 1 2β T t=1 ∥∇ℓ t (ψ * t )∥ 2 , C 4 ∥ϕ 1 -ψ * 1 ∥ + C 5 ẼT + C 4 P T , where Proof. The proof directly follows after plugging in the constants from Theorem E.3. C 1 = 2(L π + β), C 2 = (L π + β) 3C6α+6αLπ 2µπαLπ , C 3 = 3(L π + β), C 4 = 2Lg 2- √ 2 ,

F KL DIVERGENCE ESTIMATION ERROR BOUND

We recall the following notations. For each task t, the initial state distribution is denoted by ρ t , the state distribution for the optimal policy π * t is given by ν * t , the state distribution for the policy πt is denoted by νt , and the state distribution estimated using the trajectory sample dataset D t is denoted as νt . In the main paper, we breakdown the KL divergence estimation error by the sources of origin: E ν * t [D KL (π * t |π)] -E νt [D KL (π t |π)] = E ν * t [D KL (π * t |π)] -E νt [D KL (π * t |π)] (A) + E νt [D KL (π * t |π)] -E νt [D KL (π * t |π)] (B) + E νt [D KL (π * t |π)] -E νt [D KL (π t |π)] (C) , where (A) accounts for the mismatch between the discounted state visitation distributions of an optimal policy π * t and a suboptimal one πt , (B) originates from the estimation error of DualDICE, and (C) is due to the difference between π * t and πt measured according to πt . By the triangle inequality, we can bound the total error by controlling each term separately. This decomposition is general in the sense that it provides a guideline to bound each term with potentially different strategies. In particular, the term (B) can be bounded differently if we replace DualDICE with another stationary distribution estimation algorithm. To bound the terms (A) and (C), we have developed new techniques based on tame geometry and subgradient flow systems. To streamline the presentation, we consider the tabular setting with softmax parametrization. To bound (A), we need to control the distance between ν * t and νt , which can be bounded by the distance between the inducing policy parameters as long as they are Lipschitz continuous (Xu et al., 2020, Lemma 3) . In addition, the bound on (C) also depends on the distance between policies. In general, controlling the distance between a policy to an optimal policy based on the suboptimality gap requires the optimization to have some curvatures around the optima (e.g., quadratic growth (Drusvyatskiy & Lewis, 2018) or Hölderian growth (Johnstone & Moulin, 2020)). However, to the best of the knowledge of the authors, the only available results are algorithm-dependent PL inequalities for policy gradient (Mei et al., 2020) or quadratic growth with entropy regularization (Ding et al., 2021b) . Discussion on Assumption 1: As discussed in the main text, Assumption 1 implies boundedness and Lipschitzness of the KL divergence. We make use of this in bounding the terms (A) and (C) in ( 29) and eventually obtain Theorems 3.1 and 3.3. We expect that Assumption 1 is also needed in unconstrained meta-learning by adapting our method, i.e., the MDP-within-online framework. Technically, Assumption 1 is a minimum requirement even for single-task CRPO to provide provable guarantees. This can be seen in the convergence guarantee of the original CRPO method (Lemma 4 and Lemma 21 in our paper, or Theorem 3 in (Xu et al., 2021) last line of their proof before the term D KL (π * t |π t,0 ) is submerged in the big-O notation). For example, as shown in our (2), R 0 = J t,0 (π * t ) -E[J t,0 (π t )] ≤ 2 α t M E s∼ν * t [D KL (π * t |π t,0 )] + 4α t c 2 max |S||A| (1 -γ) 3 . To ensure that the bound is nontrivial, we need to bound the term D KL (π * t |π t,0 ). However, if π t,0 does not have full support over the state/action space, then there may be a state s where π * t (s) > 0 but π t,0 (s) = 0, which would make the KL divergence infinite.

F.1 PRELIMINARIES ON TAME GEOMETRY

For the sake of completeness, let us recall some fundamental concepts/results in tame geometry, which allows us to study the global geometry of the solution maps of a wide range of optimization problems, which will be used in bounding the estimation error for the KL divergence. More information can be found in (Davis et al., 2020; Van den Dries & Miller, 1996) . Recall that a class of functions on a bounded set is called C p smooth when it possesses the uniformly bounded partial derivatives up to order p. 2. For any sequence of points x k in a stratum I a , converging to a point x ⋆ in a stratum I b , if the corresponding normal vectors v k ∈ N Ia (x k ) converge to a vector v, then the inclusion v ∈ N I b (x ⋆ ) holds. Here N Ia (x k ) denotes the normal cone to I a at x k . Roughly speaking, stratification is a locally finite partition of a given set into differentiable manifolds, which fit together in a regular manner (property 1 in Def. 3). Whitney stratification as defined above is a special type of stratification for which the strata are such that their tangent spaces (as viewed from normal cones) also fit regularly (property 2). There are several paths to verifying Whitney stratifiability. For instance, one can show that the function under study belongs to one of the well-known function classes, such as semialgebraic functions (Davis et al., 2020) , whose members are known to be Whitney stratifiable. However, to study the solution function of a general convex optimization problem, we need a far-reaching axiomatic extension of semialgebraic sets to classes of functions definable on "o-minimal structures," which are very general classes and share several attractive analytic features as semialgebraic sets, including Whitney stratifiability (Davis et al., 2020; Van den Dries & Miller, 1996) . Definition 4 (o-minimal structure). (Van den Dries & Miller, 1996) An o-minimal structure is defined as a sequence of Boolean algebras O v of subsets of R v , such that for each n v ∈ N, the following properties hold: 1. If some set X belongs to O v , then X × R belong to O v+1 . 2. Let P proj : R v × R → R v denote the coordinate projection operator onto R v , then for any X in O v+1 , the set P proj (X) belongs to O v . 3. O v contains all sets of the form {x ∈ R v : y(x) = 0}, where y(x) is a polynomial in R v . 4. The elements of O 1 are exactly the finite unions of intervals (possibly infinite) and points. Then all the sets that belong to O v are called definable in the o-minimal structure. Definable sets have broader applicability than semialgebraic sets (in the sense that the latter is a special kind of definable sets) but enjoys the same, remarkable stability property: the composition of definable mappings (including sum, inf-convolution, and several other classical operations of analysis involving a finite number of definable objects) in some o-minimal structure remains in the same structure. We will crucially exploit these properties in the following sections.

F.2 BASIC PROPERTIES OF SUBGRADIENT FLOW SYSTEMS

We also recall some basic definitions and properties of the subgradient flow system (see, e.g., (Bolte et al., 2010, Thm. 13) ). Let f : R d → R ∪ {+∞} be a proper lower semicontinuous function. Definition 5 (Subgradient flow system). For every x ∈ dom(f ), there exists a unique absolutely continuous curve (called trajectory or subgradient curve) θ(τ ) : [0, +∞) → R d that satisfies θ(τ ) ∈ -∂f (θ(τ )) a.e. on (0, +∞) θ(0) = θ 0 ∈ dom(f ). (30) Moreover, the trajectory also satisfies the following properties (Bolte et al., 2010, Thm. 13 ): 1. θ(τ ) ∈ dom(∂f ) for all τ ∈ (0, +∞). 2. For all τ > 0, the right derivative θ(τ + ) is well defined and equal to θ(τ + ) = -∂ 0 f (θ(τ )), where ∂ 0 f (θ) is the minimum norm subgradient in ∂f (θ). In particular, we have that θ(τ ) = -∂ 0 f (θ(τ )), for almost all τ . F.3 BOUNDING THE DISTANCE ∥ θt -θ * t ∥ Recall Assumption 2, which requires that the objective/constraint functions and policy parametrization are definable in some o-minimal structure (Van den Dries & Miller, 1996) . This is a mild assumption as practically all functions from real-world applications, including deep neural networks, are definable in some o-minimal structure (Davis et al., 2020) ; also, the composition of mappings, along with the sum, inf-convolution, and several other classical operations of analysis involving a finite number of definable objects in some o-minimal structure remains in the same structure (Van den Dries & Miller, 1996) . The far-reaching consequence of definability, exploited in this study, is that definable sets and functions admit, for each k ≥ 1, a C k -Whitney stratification with finitely many strata (see, for instance, (Van den Dries & Miller, 1996, Result 4.8) ). This remarkable property, combined with the result that any stratifiable functions enjoys a nonsmooth Kurdyka-Łojasiewicz inequality (Bolte et al., 2007) , provides the foundation to bound the distance ∥π * tπt ∥ by the suboptimality gap. Note that without further specifications, π * t is understood as one of the optimal policies that are closest to the policy πt (i.e., the projection of πt onto the optimal policy set). We start with the following elementary result. Here and throughout the section, we use F t, d = {π t,θ : J t,i (π t,θ ) ≤ dt,i } to denote the feasible set with upper bounds d. Note that F t,d is the original feasible set. We also let I F t, d (•) be the indicator function for the set F t, d. Lemma 12. The function (with variable θ) J t,0 (π t,θ ) + I F t, d (π t,θ ), where dt is any vector such that F t, d is non-empty, is definable. Proof. Since J t,i (•) is definable for i = 1, ..., p, by the rule of composition, which is due to the definable counterpart of the Tarski-Seidenberg theorem, J t,i (π t,θ )d t,i is definable for i = 1, ..., p. Thus, F t, d is definable on the same o-minimal structure by definition. Furthermore, I F t, d (•) is definable as the indicator of F t, d. The definability of J t,0 (π t,θ ) follows similarly. Since definability is preserved under addition, the function J t,0 (π t,θ ) + I F t, d (π t,θ ) is definable. For the convenience of the reader, we restate the result for non-smooth Kurdyka-Łojasiewicz (KL) inequality from (Bolte et al., 2007, Thm. 14) . Proposition 1 (Non-smooth Kurdyka-Łojasiewicz inequality). Let f be a lower semicontinuous definable function. There exists ρ > 0, a strictly increasing continuous definable function h : [0, ρ] → (0, ∞) which is C 1 smooth on (0, ρ), with h(0) = 0, and a continuous definable function X : R + → (0, ρ) such that ∥∂ 0 f (x)∥ ≥ 1 h ′ (|f (x)|) , whenever 0 < |f (x)| ≤ X (∥x∥). F t,d < l a t e x i t s h a 1 _ b a s e 6 4 = " r 2 v K w D J 2 m r o 7 b + u D 0 Q F O F J Q R K R w = " > A A A C A X i c b V B N S 8 N A E N 3 U r 1 q / o l 4 E L 4 t F 8 C A l k a I e i 4 J 4 r G A / o C 1 l s 9 m 2 S z e b s D s R S o g X / 4 o X D 4 p 4 9 V 9 4 8 9 + 4 a X P Q 1 g c D j / d m m J n n R Y J r c J x v q 7 C 0 v L K 6 V l w v b W x u b e / Y u 3 t N H c a K s g Y N R a j a H t F M c M k a w E G w d q Q Y C T z B W t 7 4 O v N b D 0 x p H s p 7 m E S s F 5 C h 5 A N O C R i p b x 9 0 A w I j S k R y k / Y T O O 0 C F z 7 D f t q 3 y 0 7 F m Q I v E j c n Z Z S j 3 r e / u n 5 I 4 4 B J o I J o 3 X G d C H o J U c C p Y G m p G 2 s W E T o m Q 9 Y x V J K A 6 V 4 y / S D F x 0 b x 8 S B U p i T g q f p 7 I i G B 1 p P A M 5 3 Z v X r e y 8 T / v E 4 M g 8 t e w m U U A 5 N 0 t m g Q C w w h z u L A P l e M g p g Y Q q j i 5 l Z M R 0 Q R C i a 0 k g n B n X 9 5 k T T P K u 5 5 p X p X L d e u 8 j i K 6 B A d o R P k o g t U Q 7 e o j h q I o k f 0 j F 7 R m / V k v V j v 1 s e s t W D l M / v o D 6 z P H 5 5 F l w E = < / l a t e x i t > F t, d < l a t e x i t s h a 1 _ b a s e 6 4 = " P f o p 8 Q 9 c 9 9 K 9 Q 2 H P T 7 0 Z M y 5  + U 5 4 = " > A A A B 7 n i c b V B N S 8 N A E J 3 4 W e t X 1 a O X Y B H E Q 0 m k q M e i F 4 8 V 7 A e 0 s W y 2 m 3 b p Z r P s T o Q S + i O 8 e F D E q 7 / H m / / G b Z u D t j 4 Y e L w 3 w 8 y 8 U A l u 0 P O + n Z X V t f W N z c J W c X t n d 2 + / d H D Y N E m q K W v Q R C S 6 H R L D B J e s g R w F a y v N S B w K 1 g p H t 1 O / 9 c S 0 4 Y l 8 w L F i Q U w G k k e c E r R S q 6 t 4 D x / P e 6 W y V / F m c J e J n 5 M y 5 K j 3 S l / d f k L T m E m k g h j T 8 T 2 F Q U Y 0 c i r Y p N h N D V O E j s i A d S y V J G Y m y G b n T t x T q / T d K N G 2 J L o z 9 f d E R m J j x n F o O 2 O C Q 7 P o T c X / v E 6 K 0 X W Q c a l S Z J L O F 0 W p c D F x p 7 + 7 f a 4 Z R T G 2 h F D N 7 a 0 u H R J N K N q E i j Y E f / H l Z d K 8 q P i X A = " > A A A B 8 H i c b V B N S 8 N A E J 3 U r 1 q / q h 6 9 L B b B U 0 m k q M e i F 4 8 V 7 I c 0 o W y 2 m 3 b p b h J 2 J 0 I p / R V e P C j i 1 Z / j z X / j t s 1 B W x 8 M P N 6 b Y W Z e m E p h 0 H W / n c L a + s b m V n G 7 t L O 7 t 3 9 Q P j x q m S T T j D d Z I h P d C a n h U s S 8 i Q I l 7 6 S a U x V K 3 g 5 H t z O / / c S 1 E U n 8 g O O U B 4 o O Y h E J R t F K j / 6 Q o p + K H v b K F b f q z k F W i Z e T C u R o 9 M p f f j 9 h m e I x M k m N 6 X p u i s G E a h R M 8 m n J z w x P K R v R A e 9 a G l P F T T C Z H z w l Z 1 b p k y j R t m I k c / X 3 x I Q q Y 8 Y q t J 2 K 4 t A s e z P x P 6 + b Y X Q d T E S c Z s h j t l g U Z Z J g Q m b f k 7 7 Q n K E c W 0 K Z F v Z W w o Z U U 4 Y 2 o 5 I N w V t + e Z W 0 L q r e Z b V 2 X 6 v U b / I 4 i n A C p 3 A O H l x B H e 6 g A U 1 g o O A Z X u H N 0 c 6 L 8 + 5 8 L F o L T j 5 z D H / g f P 4 A 6 T C Q f g = = < / l a t e x i t > ⇡t < l a t e x i t s h a 1 _ b a s e 6 4 = " z A D o H L C u 5 P M 0 6 q b O d M o p H g c r j 7 w = " > A A A B + H i c b V B N S 8 N A E N 3 4 W e t H o x 6 9 L B Z B P J R E i n o s e v F Y w X 5 A E 8 N m s 2 2 X b j Z h d y L U 0 F / i x Y M i X v 0 p 3 v w 3 b t s c t P X B w O O 9 G W b m h a n g G h z n 2 1 p Z X V v f 2 C x t l b d 3 d v c q 9 v 5 B W y e Z o q x F E 5 G o b k g 0 E 1 y y F n A Q r J s q R u J Q s E 4 4 u p n 6 n U e m N E / k P Y x T 5 s d k I H m f U w J G C u y K B 1 x E L P d S P g n g 4 S y w q 0 7 N m Q E v E 7 c g V V S g G d h f X p T Q L G Y S q C B a 9 1 w n B T 8 n C j g V b F L 2 M s 1 S Q k d k w H q G S h I z 7 e e z w y f 4 x C g R 7 i f K l A Q 8 U 3 9 P 5 C T W e h y H p j M m M N S L 3 l T 8 z + t l 0 L / y c y 7 T D J i k 8 0 X 9 T G B I 8 D Q F H H H F K I i x I Y Q q b m 7 F d E g U o W C y K p s Q 3 M W X l 0 n 7 v O Z e 1 O p 3 9 W r j u o i j h I 7 Q M T p F L r p E D X S L m q i F K M r Q M 3 p F b 9 a T 9 W K 9 W x / z 1 h W r m D l E f 2 B 9 / g D k + J N A < / l a t e x i t >

⇡⇤ t

Figure 3 : To bound the distance between π * t and πt , we bound the distance between π * t and the optimal policy with respect to a larger feasible set F t, d by an argument based on subgradient flow curve. Note that πt ∈ F t, d may be with respect to the original set of constraints but feasible with respect to the relaxed constraints. We then bound the distance between the optimal policies π * t and π * t , which correspond to the original feasible set F t,d and the enlarged set F t, d. By the triangle inequality, we can then derive the desired bound on the distance between π * t and πt . Note that for better visualization, we vertically separate the sets F t,d and F t, d, which also aims to indicate that in general the optimal solution π * t has a higher objective than π * t due to the relaxed constraints. Let θ and θ * t denote the parameters of a policy π θ and π * t , respectively. Directly bounding the distance between θ and θ * t is difficult because π may be infeasible (this is even true for πt , since it is only guaranteed to approximately satisfy the constraints), i.e., θ / ∈ F t,d . Thus, the typical approach of following the subgradient flow of J t,0 (π θ ) + I F t,d (π θ ) to reach θ * t is not applicable. The idea is to enlarge the feasible set F t,d by increasing the violation threshold dt,i ≥ d t,i + δ, for any δ > 0, such that with high probability, θ ∈ F t, d. Then by following the subgradient flow for J t,0 (π θ ) + I Ft (π θ ), we can arrive at a critical point θ * t (corresponding to the policy π * t ), which is most likely different from θ * t . It then remains to bound the distance between θ * t and θ * t , which is possible due to the preservation of definability through inf projection. This is the roadmap we will follow. A graphical illustration of the approach is shown in Fig. 3 . Bounding the term ∥θ * t -θ * t ∥. In this part, we will bound the term ∥θ * t -θ * t ∥, which will be used to bound ∥π * tπ * t ∥. Firstly, we will prove that the parameter θ t , which represents the solution map of an optimization with definable objective and constraints, is definable. Proposition 2. Let θ t (d) ∈ arg min {J t,0 (π t,θ ), s.t. J t,i (π t,θ ) ≤ d t,i , ∀i = 1, ..., p} be the solution map of the constraint parameters d. Then, the function θ t (d) is continuous and definable. Furthermore, there exists a finite partition of the space such that the restriction of θ t (d) to each partition is C p smooth. Proof. First, it can be seen that the solution map θ t (d) ∈ arg min J t,0 (π t,θ ) + I F t,d (π t,θ ). Let ϕ t (d) = min J t,0 (π t,θ ) + I F t,d (π t,θ ) be the optimal value function. Since J t,0 (π t,θ ) + I F t,d (π t,θ ) is definable by Proposition 12, and definability is preserved under inf projection, ϕ t (d) is definable. Since θ t (d) = {θ : J t,0 (π t,θ ) + I F t,d (π t,θ ) = ϕ t (d)}, by the Tarski-Seidenberg Theorem, θ t (d) is definable. The continuity property follows directly from Berge's Maximum theorem. Following the discussion of Whitney stratifications in (Bolte et al., 2007) , since the graph of a definable function is Whitney stratifiable, we can construct a partition by projecting the stratification into the function domain, which will be a Whitney C p -stratification by the constant rank theorem. Furthermore, the restriction of the definable function to each stratum is C p -smooth. Alternatively, we can directly use the fact that for any definable function, there exists a C p -decomposition which has a finite number of cells, and the restriction to each cell is C p -smooth (Van den Dries & Miller, 1996) . This completes the proof. Now that we have proved that the function θ t (d) is definable, we can obtain the bound ∥θ * t -θ * t ∥. Intuitively, our proof exploits the fact that continuous and definable functions exhibit controlled behaviors along any path, even if it crosses over a finite number of Whitney strata. Lemma 13. For any d such that F t, d is non-empty, the following holds: ∥θ * t -θ * t ∥ = ∥θ(d) -θ( d)∥ = O(∥d -d∥). Proof. Since every smooth function over a bounded set is Lipschitz, let us denote L d as the maximum of the Lipschitz constants for all the cells of the Whitney stratification of θ t (d). Let d(λ) = λd + (1λ) d, where 0 ≤ λ ≤ 1, be the curve that connects between d and d. Also, let 0 = λ 1 ≤ ... ≤ λ n = 1 be the partition such that θ t (d(λ)) belongs to one cell for all λ i < λ < λ i+1 for i = 1, ..., n -1. We know that n < ∞ since d(θ t ) is Whitney stratifiable. Thus, ∥θ t (d) -θ t ( d)∥ ≤ n-1 i=1 ∥θ t (d(λ i )) -θ t (d(λ i+1 ))∥ ≤ L d n-1 i=1 ∥d(λ i ) -d(λ i+1 )∥ ≤ L d ∥d -d∥ n-1 i=1 |λ i+1 -λ i | = L d ∥d -d∥ where the first inequality is due to triangle inequality, the second inequality is due to Lipschitz continuity, the third inequality is due to the definition of d(λ), the first equality is due to the nondecreasing sequence of λ i . Bounding the term ∥ θ * t -θt ∥. Recall that θt is the parameter for πt (output of within-task CRPO), and θ * t is the parameter for an optimal solution with an enlarged feasible set F t, d. In this subsection, we will obtain the upper bound for the term ∥ θ * t -θt ∥. Let f (θ, d) = J t,0 (π θ )+I F t, d (π θ ) , and choose di = O(1/ √ M ) for i = 1, ..., p, which coincides with the upper bound on constraint violation for within-task CRPO such that θt ∈ F t, d with high probability. In the next result, we will condition on this high-probability event. Lemma 14. With the choice of d = d + δ, where δ = O(1/ √ M ) coincides with the upper bound on constraint violation for within-task CRPO such that θt ∈ F t, d, the following holds: ∥ θ * t -θt ∥ ≤ O h 1/ √ M , where h is a strictly increasing continuous function with the property that h(0) = 0 as specified in Lemma 1. Proof. Without loss of generality, consider f (θ) = J t,0 (π θ ) + I F t, d (π θ ) + c, where c := inf J t,0 (π θ ) + I Ft (π θ ), so that the minimal value of f is translated to 0. For simplicity, also assume that f ( θt ) ≤ X (∥ θt ∥). Note that this assumption can be relaxed by using the concept of "curves of maximal slope" at the cost of slightly more complicated analysis and bounds (Ioffe, 2009) . Now, consider a subgradient flow θ(τ ) ∈ -∂f (θ(τ )) (see Definition 5), initialized at θ(0) = θt then, for any 0 ≤ s ′ < s, we have that h f (θ(s ′ )) -h f (θ(s)) = s ′ s d dτ h f (θ(τ )) dτ = s s ′ h ′ f (θ(τ )) ∥ θ(τ )∥ 2 dτ ≥ s s ′ ∥ θ(τ )∥dτ ≥ s s ′ θ(τ )dτ = ∥θ(s) -θ(s ′ )∥ where the second equality is due to the property of the subgradient flow (see Sec. F.2), the first inequality is due to ∥∂ 0 (hf ) θ(τ ) ∥ ≥ 1 from Proposition 1, and the second inequality is due to the triangle inequality. Thus, by taking s ′ = 0 and s → ∞, we have shown that h(f ( θt )) ≥ ∥ θt -θ * t ∥. Therefore, ∥ θt -θ * t ∥ ≤ h(f ( θt ) -f ( θ * t )) (i) ≤ h(J t,0 (π t ) -J t,0 (π * t )) , where the first inequality is due to the optimality of π * t , and (i) follows since both πt and π * t are feasible for F t, d. Note that the suboptimality bound can be split as h(J t,0 (π t ) -J t,0 (π * t )) = h J t,0 (π t ) -J t,0 (π * t ) + J t,0 (π * t ) -J t,0 (π * t ) . By CRPO, we can bound the value difference J t,0 (π t ) -J t,0 (π * t ) ≤ O(1/ √ M ). Moreover, Since the value function is Lipschitz (Xu et al., 2020, Lemma 4) , the value difference J t,0 (π * t ) -J t,0 (π * t ) can be bounded by the distance ∥θ * t -θ * t ∥, which is bounded again by O(1/ √ M ) according to Lemma 13. Hence, recognizing that h is strictly increasing, we have proved the claim. Bounding the term ∥θ * t -θt ∥. Finally, we are able to bound the term of our original interests. Lemma 15. Under assumption 2, the following holds: ∥θ * t -θt ∥ ≤ O h 1 √ M + 1 √ M , where h is a strictly increasing continuous function with the property that h(0) = 0 as specified in Lemma 1. Proof. The claim follows directly from Lemmas 13 and 14 and the triangle inequality. Remark 4. Note that our strategy to bound ∥θ * t -θt ∥ is algorithmic-agnostic as it only relies on the optimization landscape. The only place we rely on the algorithm is to bound the suboptimality gap, which is then converted to a bound on ∥ θ * t -θt ∥ in Lemma 14. Also, the enlargement of the feasible set should be viewed as a proof technique and has no implications for the algorithm design. Indeed, the motivation for the enlargement is to properly design a subgradient flow system. Thus, the result of Lemma 15 is not conditioned on how the enlargement is performed. Also, note that definability is used differently in Lemmas 13 and 14. In the former case, we exploit the Whitney stratification property to provide an upper bound, while in the latter case, we exploit the KL property to obtain a lower bound, hence they serve different purposes. F.4 BOUNDING TERM (A): |E ν * t [D KL (π * t |π)] -E νt [D KL (π * t |π)]| The result from Lemma 15 can be used directly to provide bounds for (A) and (C). We start with the term (A). Lemma 16. The following bound holds: |E s∼ν * t [D KL (π * t |π)] -E s∼νt [D KL (π * t |π)]| = O h 1 √ M + 1 √ M ( ) where h is a strictly increasing continuous function with the property that h(0) = 0 as specified in Lemma 1. Proof. |E s∼ν * t [D KL (π * t |π)] -E s∼νt [D KL (π * t |π)]| = s∈St ν * t (s) -νt (s) D KL (π * t (s)|π(s)) ≤ C π ∥ν * t -νt ∥ 1 ≤ 2C π C ν ∥θ * t -θt ∥ 2 where the first equality is by definition, the first inequality is due to Assumption 1, and the second inequality is due to (Xu et al., 2020, Lem. 3) , which also specifies the constant C ν , and (Levin & Peres, 2017, Prop. 4.2). The result then follows by recalling the result from Lemma 15. F.5 BOUNDING TERM (C): |E νt [D KL (π * t |π)] -E νt [D KL (π t |π)]| Similarly, we can prove the upper bound for the error term (C). Lemma 17. The following bound holds: |E s∼νt [D KL (π * t |π)] -E s∼νt [D KL (π t |π)]| = O h 1 √ M + 1 √ M (32) Proof. |E s∼νt [D KL (π * t |π)] -E s∼νt [D KL (π t |π)]| = s∈S νt (s) D KL (π * t |π) -D KL (π t |π) ≤ s∈S νt (s) D KL (π * t |π) -D KL (π t |π) ≤ L g s∈S νt (s)∥π * t (s) -πt (s)∥ 2 ≤ L g s∈S νt (s)∥θ * t -θt -c ′ 1∥ ∞ ≤ L g ∥θ * t -θt ∥ 2 where the first inequality is due to the non-negativity of νt (s) and triangle inequality, the second inequality is due to Assumption 1, the third inequality holds for any constant c ′ and is due to (Mei et al., 2020, Lem. 24) , and the last inequality is due to s∈S νt (s) = 1 and by choosing c ′ = 0. The result then follows by recalling the result from Lemma 15. F.6 BOUNDING TERM (B): |E νt [D KL (π * t |π)] -E νt [D KL (π * t |π)]| Now, we will upper bound the error term (B). The proof follows DualDICE (Nachum et al., 2019) . We introduce the following notations. Let Êd D t denote an average of empirical samples where {s i , a i , r i , s ′ i } N i=1 ∼ d Dt , and ρ t be the initial state distribution for the CMDP task t. The number of data points N = O(M 1+1/σ ), where σ is any positive number σ ∈ (0, 1). Note that the additional factor of O(M 1/σ ) results from the critic evaluation per policy update (see (Xu et al., 2021, Thm. 1) ). We will roughly bound N = O(M 2 ) in the following to simplify the presentation. The stationary distribution correction factor is denoted as w πt/Dt (s, a) = νt(s,a) d D t (s,a) . We make the following regularity assumption on the distribution d Dt with respect to the target policy πt (Nachum et al., 2019, Asm. 1) . Assumption 3 (Reference distribution property). For any (s, a), νt (s, a) > 0 implies that d Dt (s, a) > 0. Furthermore, the correction terms are bounded by some finite constant C ω : ∥ω νt/Dt ∥ ∞ ≤ C ω . For convenience, we recapitulate the key points from DualDICE, where we also omit the task dependence t (i.e., we use d D , π, and ρ in lieu of d Dt , πt , and ρ t , respectively). The objective function is given by J(z, ζ) = E (s,a,s ′ )∼,a ′ ∼(s ′ ) (z(s, a) -γz(s ′ , a ′ ))ζ(s, a) -ζ(s, a) 2 /2 (33) -(1 -γ) E s0∼β,a0∼(s0) [z(s 0 , a 0 )] . The objective in the form prior to introduction of ζ is denoted as J(z): J(z) = 1 2 E (s,a)∼ (z -z)(s, a) 2 -(1 -γ) E s0∼β,a0∼(s0) [z(s 0 , a 0 )] . Let Ĵ(z, ζ) denotes the empirical surrogate of J(z, ζ) with optimal solution as (ẑ * , ζ * ). We denote z * = arg min z∈ J(z) and z * = arg min z:S×A→ R J(z). We denote L(z) = max ζ∈H J(z, ζ) and L(z) = max ζ∈H Ĵ(z, ζ) as the primal objectives, and ℓ(ζ) = min z∈F J(z, ζ), l(ζ) = min z∈F Ĵ(z, ζ) as the dual objectives. We apply some optimization algorithm OP T for optimizing Ĵ(z, ζ) with samples {s i , a i , r i , s ′ i } N i=1 ∼, {s i 0 } N i=1 ∼ β, and target actions a ′ i ∼ (s ′ i ), a i 0 ∼ (s i 0 ) for i = 1, . . . , N . The output of OP T is denoted by (ẑ, ζ) . We also make the following definitions to capture the error of approximation with F for z and H for ζ in optimizing Ĵ(z, ζ): ϵ approx (F) := sup z∈S×A→ R inf z F ∈F (∥z F -z∥ D,1 + ∥z F -z∥ ρπ,1 ) ϵ approx (H) := sup ζ∈S×A→ R inf ζ H ∈H (∥ζ H -ζ∥ D,1 + ∥ζ H -ζ∥ ρπ,1 ) ϵ approx (F, H) := ϵ approx (F) + ϵ approx (H) We also define ϵ opt := ∥ ζ -ζ * ∥ 2 Dt + ẑ * -Bπ ẑ * -ẑ -Bπ ẑ 2 Dt (39) as the optimization error of OPT from DualDICE. Lemma 18. By estimating νt with DualDICE, the following bound holds: |E νt [D KL (π * t |π)] -E νt [D KL (π * t |π)]| = O 1 M + ϵ opt + ϵ approx (F, H) , Proof. We begin with the following decomposition: . (E νt [D KL (π * t |π)] -E νt [D KL (π * t |π)]) 2 ≤ 2 Êd D t a (ẑ -Bπt ẑ)(s, a) -(ẑ * -Bπt ẑ * )(s, a) D KL (π * t |π) We will bound each term above separately. ϵ 1 ≤ 2C 2 π Êd D t a ẑ -Bπt ẑ (s, a) -ẑ * -Bπt ẑ * (s, a) 2 ≤ 2C 2 π ∥ ζ -ζ * ∥ 2 Dt + ẑ * -Bπ ẑ * -ẑ -Bπ ẑ 2 Dt ϵopt , where the error ϵ opt is induced by the optimization OPT. The error term ϵ 2 can be decomposed as ϵ 2 ≤2 C 2 π Êd D t a ẑ * -Bπt ẑ * (s, a) -E d D t a ẑ * -B πt ẑ * (s, a) 2 ϵstat + 2C 2 π E d D t a ẑ * -B πt ẑ * (s, a) -ω πt/Dt (s, a) 2 =2ϵ stat + 2C 2 π E d D t a ẑ * -B πt ẑ * (s, a) -z * -B πt z * (s, a) 2 , ( ) where the equality is due to the result that z * -B πt z * (s, a) = ω πt/Dt (s, a) (see (Nachum et al., 2019, Eq. 17) ) and ϵ stat is the error due to the finite number error. By (Nachum et al., 2019, Lem. 7) , ϵ stat = O log M +log 1 δ M 2 with probability at least 1δ, where we use the bound on the number of data as O(M 2 ). To bound the second term, use the fact that J(z) as defined in 35 is 1-strongly convex. Hence, E d D t a ẑ * -B πt ẑ * (s, a) -z * -B πt z * (s, a) 2 ≤ ∥ ẑ * -B πt ẑ * -z * -B πt z * ∥ 2 Dt ≤ 2 J(ẑ * ) -J(z * ) where (i) follows from (Nachum et al., 2019, Section D.1) ϵ approx (F) is the error due to the approximation with F for z, ϵ approx (H) is the error due to the approximation with H for ζ, and ϵ est is the estimation error, and L is the Lipschitz constant for f . To bound the error between J(ẑ * ) and J(z * ), we use the decomposition suggested in (Nachum et al., 2019) : J(ẑ * ) -J(z * ) = J(ẑ * ) -L(ẑ * ) (i) + L(ẑ * ) -L(z * F ) (ii) + L(z * F ) -J(z * F ) (iii) + J(z * F ) -J(z * ) (iv) , where (i) ≤ 2Cω 1-γ ∥ζ * H -ζ * ∥ Dt,1 ≤ 2Cω 1-γ ϵ approx (H), (ii) = O √ log M +log 1 δ M by (Nachum et al., 2019, Lem. 6 ) (by also plugging in N = O(M 2 )), (iii) ≤ 0 by definition, and (iv) = O(ϵ approx (F)). Note that we refer the reader to (Nachum et al., 2019, Sec. D.1) for the above bounds. Therefore, we can bound J(ẑ * ) -J(z * ) on the order of O ϵ approx (H) + ϵ approx (F) + √ log M +log 1 δ M . Combining the above relations, while noting that 1 √ M decreases slower than 1 M in terms of M and is thus kept as the upper bound, we have shown the result.

F.7 PUTTING IT TOGETHER: BOUNDING THE KL DIVERGENCE ESTIMATION ERROR

Theorem F.1 (KL divergence estimation error bound). The following bound holds: |E ν * t [D KL (π * t |π)] -E νt [D KL (π t |π)]| = O h 1 √ M + 1 √ M + √ ϵ opt + ϵ approx (F, H) , where h is a strictly increasing continuous function with the property that h(0) = 0 as specified in Lemma 1, ϵ approx (F, H) is defined in 38, and ϵ opt is defined in 39. Proof. The result follows by combining the upper bounds for the error terms (A), (B) and (C), as specified by Lemmas 16, 18, and 17. We also apply the elementary inequality √ a + b + c ≤ √ a + √ b + √ c to further simplify the bound. Remark 5. The bound above depends on the number of iterations M per task in different ways. By increasing M , we can expect to reduce the suboptimality gap, which can help reduce the distance between πt to the optimal set of policies. Also, increasing M results in a larger dataset used to estimate its stationary distribution offline by DualDICE, which reduces the estimation error. The bound indicates that the only terms that do not vanish as we increase the number of iterations per task are those due to the inherent optimization error ϵ opt and function approximation error ϵ approx (F, H). In the case those terms are negligible (which are possible in view of the recent breakthrough in overparametrized deep learning (Zhang et al., 2021; Neyshabur et al., 2019; Li & Liang, 2018; Zou et al., 2018; Arora et al., 2019) , see also (Fan et al., 2021) for a survey), then the KL divergence estimation can be driven to arbitrary accuracy. G PROOFS FOR THE SECTION 3.3

G.1 TAOG AND TACV BOUNDS FOR CRPO WITH ADAPTIVE LEARNING RATES

This section presents the task-averaged regret upper bounds for the CRPO when the adaptive learning rates α t are used for each task, and the Q-estimation error is accounted for. We also recall that d t,i is the constraint upper bound for i = 1, ..., p and η t is the tolerance for constraint violation (i.e., increasing the upper bound to d t,i + η t ). For a single run of CRPO in task t, we denote N t,0 as the set of time steps the reward is maximized and N t,i as the set of time step constraint i is minimized. The Q-function in the CRPO algorithm is learned through TD learning with the total number of iterations denoted by K in . The Q-function of objective i for policy π t,m at time step m is denoted by Q i t,m , and the estimated Q-function is denoted by Qi t,m . The maximum value for both rewards and constraints is assumed to be c max . With all notations for CRPO in place, we present the following result (Xu et al., 2021) Lemma 19. For the CRPO algorithm in the tabular settings with learning rates α t , the following bound holds: α t m∈Nt,0 J t,0 (π * t ) -J t,0 (π t,m ) + η t α t p i=1 |N t,i | ≤ E s∼ν * t [D KL (π * t |π t,0 )] + 2c 2 max |S||A| (1 -γ) 3 α 2 t p i=0 |N t,i | + p i=0 m∈Nt,i α t (3 + (1 -γ) 2 + 3α t c max ) (1 -γ) 2 ∥Q i t,m -Qi t,m ∥ 2 Proof. If m ∈ N t,0 , by (Xu et al., 2021, Lemma 7) , we have that: α t J t,0 (π * t ) -J t,0 (π t,m ) ≤ E ν * t [D KL (π * t |π t,m ) -D KL (π * t |π t,m+1 )] + 2c 2 max |S||A| (1 -γ) 3 α 2 t + 3α t (1 + α t c max ) (1 -γ) 2 ∥Q 0 t,m -Q0 t,m ∥ 2 . ( ) Similarly, if m ∈ N t,i , we can write α t J t,i (π t,m ) -J t,i (π * t ) ≤ E ν * t [D KL (π * t |π t,m ) -D KL (π * t |π t,m+1 )] + 2c 2 max |S||A| (1 -γ) 3 α 2 t + 3α t (1 + α t c max ) (1 -γ) 2 ∥Q i t,m -Qi t,m ∥ 2 . ( ) Taking the summation of 42 and 43 from m = 0 to M -1, we get Xu et al., 2021, Eq. 15) , by rearranging the terms above, we obtain the result. α t m∈Nt,0 J t,0 (π * t ) -J t,0 (π t,m ) + p i=1 m∈Nt,i α t J t,i (π t,m ) -J t,i (π * t ) ≤ E ν * t [D KL (π * t |π t,0 )] + 2c 2 max |S||A| (1 -γ) 3 p i=0 α 2 t |N t,i | + p i=0 m∈Nt,i 3α t (1 + α t c max ) (1 -γ) 2 ∥Q i t,m -Qi t,m ∥ 2 Since J t,i (π t,m ) -J t,i (π * t ) ≥ η t -∥Q i t,m -Qi t,m ∥ ( Next, we study the condition on the maximum constraint violation threshold η t and how it affects N t,0 and the upper bounds for TAOG and TACV. We make the following assumption to proceed. Assumption 4. Assume that m∈Nt,0 J t,0 (π * t ) -J t,0 (π t,m ) ≥ c J for some c J ∈ (-1 2 α t η t M, 0]. The assumption above indicates that the policies in N t,0 do not have rewards higher than the optimal policy by more than 1 2 α t η t on average. Note that it is indeed possible to have rewards higher than the optimal policy if the corresponding policy does not satisfy some safety constraints (i.e., infeasible policy). However, it is not a strong assumption since we are comparing it with the optimal policy. The above assumption is not present in (Xu et al., 2021) , which invalidates one of its derivation steps (in particular, (Xu et al., 2021, Thm. 3 )), and is thus introduced to rectify the proof. Lemma 20. Suppose that the following condition holds: 1 2 η t M α t ≥ E ν * t [D KL (π * t |π t,0 )] + 2c 2 max |S||A|M (1 -γ) 3 p i=0 α 2 t + p i=0 m∈Nt,i α t (3 + (1 -γ) 2 + 3α t c max ) (1 -γ) 2 ∥Q i t,m -Qi t,m ∥ 2 . ( ) Then, we have that N t,0 ̸ = ∅, i.e., πt is well-defined; also, one the following two statements must hold, 1. |N t,0 | ≥ M/2, 2. m∈Nt,0 J t,0 (π * t ) -J t,0 (π t,m ) ≤ 0. Under assumption 4, we also have the following holds: |N t,0 | ≥ 1 2 -κ M for some κ ∈ (0, 1 2 ). Proof. The proof for N t,0 ̸ = ∅ follows directly from (Xu et al., 2021, Lem. 9) . For the second statement, we consider the case that m∈Nt,0 J t,0 (π * t ) -J t,0 (π t,m ) > 0. From Lemma 19, it implies that η t p i=1 α t |N t,i | ≤ E s∼ν * [D KL (π * t |π t,0 )] + 2c 2 max |S||A| (1 -γ) 3 p i=0 α 2 t |N t,i | + p i=0 m∈Nt,i α t (3 + (1 -γ) 2 + 3α t c max ) (1 -γ) 2 ∥Q i t,m -Qi t,m ∥ 2 . Suppose that |N t,0 | < M/2, then p i=1 |N t,i | > M/2, we have that 1 2 α t η t M < E s∼ν * [D KL (π * t |π t,0 )] + 2c 2 max |S||A| (1 -γ) 3 p i=0 α 2 t |N t,i | + p i=0 m∈Nt,i α t (3 + (1 -γ) 2 + 3α t c max ) (1 -γ) 2 ∥Q i t,m -Qi t,m ∥ 2 , which contradicts 44. Hence, we must have |N t,0 | ≥ M/2. Next, we show that |N t,0 | ≥ 1 2κ M for some κ ∈ (0, 1 2 ). Under assumption 4 and by Lemma 19, we have that η t p i=1 α t |N t,i | ≤ E s∼ν * [D KL (π * t |π t,0 )] + 2c 2 max |S||A| (1 -γ) 3 p i=0 α 2 t |N t,i | + p i=0 m∈Nt,i α t (3 + (1 -γ) 2 + 3α t c max ) (1 -γ) 2 ∥Q i t,m -Qi t,m ∥ 2 -α t c J . Choose κ := -c J αtηtM . Since -c J < 1 2 α t η t M by assumption, we have that κ ∈ (0, 1 2 ). Consider the case that |N t,0 | < 1 2κ M , which implies that p i=1 |N t,i | > 1 2 + κ M . This implies that 1 2 + κ α t η t M ≤ E s∼ν * [D KL (π * t |π t,0 )] + 2c 2 max |S||A| (1 -γ) 3 p i=0 α 2 t |N t,i | + p i=0 m∈Nt,i α t (3 + (1 -γ) 2 + 3α t c max ) (1 -γ) 2 ∥Q i t,m -Qi t,m ∥ 2 , which again contradicts 44. Hence, we must have |N t,0 | ≥ 1 2κ M . Now, we prove the upper bound of suboptimality and constraint violation per task. Lemma 21. Let the violation tolerance be chosen as: η t = 2E s∼ν * t [D KL (π * t |π t,0 )] M α t + α t 4c 2 max |S||A| (1 -γ) 3 + p i=0 2α t (3 + (1 -γ) 2 + 3α t c max ) √ M α t (1 -γ) 2 , Then, the following holds U t,0 (π t,0 , α t ) = c t 1 α t M E s∼ν * t [D KL (π * t |π t,0 )] + c t 2 α t + p i=0 c t 3 α t + c t 4 α 2 t α t √ M (45) U t,i (π t,0 , α t ) = U t,0 (π t,0 , α t ) + c t 5 √ M , where c t 1 = 2, c t 2 = 4c 2 max |S||A| (1-γ) 3 , c t 3 = 3+(1-γ) 2 (1-γ) 2 , c t 4 = 3cmax (1-γ) 2 , and c t 5 = 2 √ (1-γ)|S||A| 1-2κ Proof. From Lemma 19, we have that α t m∈Nt,0 J t,0 (π * t ) -J t,0 (π t,m ) + η t p i=1 α t |N t,i | ≤ E s∼ν * t [D KL (π * t |π t,0 )] + 2c 2 max |S||A| (1 -γ) 3 p i=0 α 2 t |N t,i | + p i=0 m∈Nt,i α t (3 + (1 -γ) 2 + 3α t c max ) (1 -γ) 2 ∥Q i t,πm -Qi t,ωm ∥ 2 If m∈Nt,0 J t,0 (π * t )-J t,0 (π t,m ) ≤ 0, then J t,0 (π * t )-E[J t,0 (π t )] ≤ 0. If m∈Nt,0 J t,0 (π * t )- J t,0 (π t,m ) > 0, then, by Lemma 20, we have |N t,0 | ≥ M/2. Hence, J t,0 (π * t ) -E[J t,0 (π t )] = 1 |N t,0 | m∈Nt,0 [J t,0 (π * t ) -J t,0 (π t,m )] ≤ 2 α t M E ν * t [D KL (π * t |π t,0 )] + c t 2 α t + p i=0 m∈Nt,i (c t 3 α t + c t 4 α 2 t ) M α t ∥Q i t,πm -Qi t,ωm ∥ 2 , ≤ 2 α t M E ν * t [D KL (π * t |π t,0 )] + c t 2 α t + p i=0 m∈Nt,i (c t 3 α t + c t 4 α 2 t ) √ M α t where the last inequality is due to the choice of K in = Θ(M 1/σ log 2/σ (|S| 2 |A| 2 M 1+2/σ /δ)) as specified by (Xu et al., 2021, Lem. 8 ) for critic evaluations. Here, the constants are chosen as c t 1 = 2, c t 2 = 4c 2 max |S||A| (1-γ) 3 , c t 3 = 3+(1-γ) 2 (1-γ) 2 , c t 4 = 3cmax (1-γ) 2 . For constraint violation, consider any i = 1, ..., p, we have E[J t,i (π t )] -d t,i = 1 |N t,0 | m∈Nt,0 J t,i (π t,m ) -d t,i ≤ 1 |N t,0 | m∈Nt,0 Jt,i (π t,m ) -d t,i + 1 |N t,0 | m∈Nt,0 | Jt,i (π t,m ) -J t,i (π t,m )| ≤ η t + 1 |N t,0 | p i=0 m∈Nt,i ∥Q i t,πm -Qi t,πm ∥ 2 ≤ η t + 2 (1 -2κ)M p i=0 m∈Nt,i ∥Q i t,πm -Qi t,πm ∥ 2 where the first inequality is due to triangle inequality, the second inequality is by the design of the CRPO algorithm, and the third inequality is due to Lemma 20, where κ ∈ (0, 1 2 ). By the choice of K in , we have that p i=0 m∈Nt,i ∥Q i t,πm -Qi t,πm ∥ 2 ≤ (1 -γ)|S||A|M . Plugging the value of η t yields the desired result. Finally, we are able to provide the following bounds on TAOG and TACV in the case of adaptive learning rates. Theorem G.1 (Bounds on TAOG and TACV). Suppose we run the CRPO algorithm for M steps per task t with learning rates α t . Then, after T tasks, the TAOG R0 is given by R0 = 1 T T t=1 c t 1 α t M E s∼ν * t [D KL (π * t |π t,0 )] + c t 2 α t + p i=0 c t 3 α t + c t 4 α 2 t α t √ M , and the TACV Ri is given by Ri = 1 T T t=1 c t 1 α t M E s∼ν * t [D KL (π * t |π t,0 )] + c t 2 α t + p i=0 c t 3 α t + c t 4 α 2 t α t √ M + c t 5 √ M , for i = 1, ..., p, where c t 1 = 2, c t 2 = 4c 2 max |S||A| (1-γ) 3 , c t 3 = 3+(1-γ) 2 (1-γ) 2 , c t 4 = 3cmax (1-γ) 2 , and c t 5 = 2 √ (1-γ)|S||A| 1-2κ Proof. The proof follows directly by summing the results 45 and 46 over t = 1, ..., T .

G.2 ADAPTING TO THE DYNAMIC REGRET USING ADAPTIVE LEARNING RATES

We restate the theorem below for convenience. Theorem G.2. Let each within-task CMDP t run M steps of CRPO, initialized by policy π t,0 := INIT(t) and learning rates {α t } p i=0 := SIM(t). Let κ * := arg min L(κ), where L(κ) = U sim T (κ) + U init T ({ψ t } T t=1 ) κ + E T κ + T t=1 f init t (ϕ t ) κ + f rate t (κ) , and {ψ * t } T t=1 is any comparator sequence. Then, the following bounds on TAOG and TACV hold: Ri ≤ L(κ * ) T , ∀ i = 0, ..., p. Proof. The idea of the proof is to freeze the learning rates first to obtain a dynamic regret bound based on policy initialization and then optimize over the learning rates to obtain a tighter characterization. Also, since TAOG and TACV only differ by a bias term that does not depend on either the learning rates or the initial policy, we can treat them indistinguishably. In particular, T t=1 U t (π t,0 , α t ) = T t=1 f sim t (α t ) (51) ≤ min κ U sim T (κ) + T t=1 f sim t (κ) (52) ≤ min κ U sim T (κ) + U init T (Ψ) κ + T t=1 f init t (ψ t ) κ + f rate t (κ) (53) ≤ min κ U sim T (κ) + U init T (Ψ) κ + E T κ + T t=1 f init t (ϕ t ) κ + f rate t (κ) . ( ) where 2T , then the following bound holds for static regret: Ψ := {ϕ t } T t=1 . Let L(κ) = U sim T (κ) + U init T (Ψ) κ + E T κ + T t=1 f init t (ϕ t ) κ + f rate t (κ) T t=1 f sim t (κ) - T t=1 f sim t (α * ) ≤ √ 2T K α |α * | + 1 + 4 √ 2K α L α |α * | (2C 1 -C 2 1 L α ) √ T E T , for any C 1 ∈ {c ∈ 0, 2 Lα : α * + c(u -∇t ) ∈ Λ} where u is an ϵ-subgradient of f sim t (κ) with respect to κ, E T := T t=1 ϵ t is the cumulative inexactness, ϵ t is the upper bound from Theorem 3.1. Proof. The proof follows directly after substituting c =  = 3+(1-γ) 2 (1-γ) 2 . If INIT(t) and SIM(t) are FTL or inexact OGD over the sequences f init t and f sim t , then, the following bounds on TAOG and TACV hold: Ri ≤ 1 √ M   √ 2K α |α * | √ M T + c t 3 + 4 √ 2K α L α |α * | (2C 1 -C 2 1 L α ) √ T E T √ M T + 1 c t 2 U init T ({ψ * t } t∈[T ] ) + E T + T V 2 ψ M 1/4 T   , ) for all i = 0, . . . , p, where {ψ * t } t∈[T ] is any comparator sequence, c t 3 = 3+(1-γ) 2 (1-γ) 2 , and c t 2 = 4c 2 max |S||A| (1-γ) 3 . Proof. Firstly, the following inexact upper bounds hold for U init T and U sim T : U init T ({ψ * t } t∈T ) = min C 1 ∥ϕ 1 -ψ * 1 ∥ 2 + C 2 E T + C 3 S T + 1 2β T t=1 ∥∇ℓ t (ψ * t )∥ 2 , C 4 ∥ϕ 1 -ψ * 1 ∥ + C 5 ẼT + C 4 P T , U sim T (κ) = √ 2T K α |α * | + 1 + 4 √ 2K α L α |α * | (2C 1 -C 2 1 L α ) √ T E T , where the constants in the 58 and 59 are from the Lemma 11 and Corollary 2 respectively. Plugging these in the equation 49, we can obtain the following: L(κ) ≤ √ 2T K α |α * | + 1 + 4 √ 2K α L α |α * | (2C 1 -C 2 1 L α ) √ T E T + 1 κ min C 1 ∥ϕ 1 -ψ * 1 ∥ 2 + C 2 E T + C 3 S T + 1 2β T t=1 ∥∇ℓ t (ψ * t )∥ 2 , C 4 ∥ϕ 1 -ψ * 1 ∥ + C 5 ẼT + C 4 P T + E T κ + T V 2 ψ κ + f rate t (κ), where the relation V 2 ψ = 1 T T t=1 E νt [D KL (π t |ψ * t )] is used to get the second last term T V 2 ψ κ . To get κ * such that L(κ) is minimized, we proceed using the KKT optimality conditions to get dL dκ as dL dκ = -U init T ({ψ} t∈[T ] ) κ 2 - E T κ 2 - T Vψ κ 2 + c t 2 M + c t 4 √ M . Therefore, we obtain κ * = U init T (ψ)+E T +T V 2 ψ c t 2 M +c t 4 √ M . Substituting this value of κ * in G.2, and using the approximation 1 M + √ M ≊ 1 M 1/4 , we can obtain the final result.

H ADDITIONAL EXPERIMENTS AND DETAILS

In this section, we describe our experimental setup and other additional details for the OpenAI gym experiments under constrained settings. We present the performance of Meta-SRL on the Acrobot and the Frozen lake under high task-similarity conditions. We first present some details on the baselines used to avoid any confusion. Details of baselines used: Denote the policy initialization for task t as ϕ t . First baseline is the FAL, which initializes the policy ϕ t+1 for the test task t + 1 as ϕ t+1 = 1 t t i=1 ϕ i . This is done online as the tasks are encountered sequentially. For the simple averaging baseline, we run CRPO on 10 tasks with the random initialization and evaluate the performance on a test task by initializing with the average of all the suboptimal policies from the batch of suboptimal policies, i.e., ϕ T = 1 T -1 T -1 i=1 ϕ i , where T is the test task. This can be seen as an offline method, where suboptimal policies from T -1 tasks are stored and averaged to get the initialization for the test task. The pre-trained baseline uses suboptimal policy from an already trained task to initialize the policy on the test task, i.e., ϕ t = πt ′ , where ϕ t is the policy initialization for the task t, and πt ′ is the suboptimal policy returned some pre-trained task t ′ . This baseline could be thought of as the Strawman initialization strategy, where the policy for the next task is initialized using the suboptimal policy from the previous task, i.e., ϕ t+1 = πt . For the Meta-SRL in the discrete state action space (i.e., Frozen lake), we take the weighted average of the previous suboptimal policies weighted by the stationary distributions induced by each suboptimal policy over all the states. We also adapt the learning rates α t for the CRPO algorithm for each task t. The difference between FAL and Meta-SRL is that Meta-SRL weights the suboptimal policies higher in the states which were encountered more frequently. Random initialization baseline is using random iniitalization for the within-task algorithm CRPO. Experimental setup: We run all the algorithms online where tasks are encountered sequentially and present the results for the test task after the policy initialization suggested by respective baselines. We do 10 runs for each baseline on the test task and present the variance plots. On the test task, we train for 8 steps on the Frozen lake and for 5 steps on the Acrobot. In Frozen lake, each step corresponds to 5 episodes, and the average rewards/costs are reported for each step in the performance and constraint violation plots.

H.1 FROZEN LAKE

Frozen lake: For the Frozen lake, we randomly generate T = 10 different orientations as tasks over the probability of a state being frozen or a hole and evaluate the performance for the scenarios with high task-similarity (low variance for the latent CMDP distribution) or low task-similarity (high variance for the latent CMDP distribution). The agent gets rewarded +2 when it reaches the goal state and incurs a cost -1 when it falls into a hole. We choose the constraint threshold d t,i = 0.3. High task-similarity: To generate tasks with high task-similarity, we start with a random frozen lake grid of 4 × 4, where the probability of each grid being frozen is 0.7. Then, we generate 9 different grids which differ from the first one by only one of the grids. This means the agent always encounters the new grid, which is very similar to the previous task. From Figure 4 , we can observe that baselines pre-trained and FAL are competitive with the Meta-SRL in terms of reward maximization and almost zero constraint violations. The good performance of the pre-trained baseline can be explained using the fact that the the test task and the training task are very similar; the policy initialization will be close to the optimal policy of the test task. Low task-similarity: In this case, random tasks are generated where the probability of a tile being frozen is kept between 0.3 and 0.7. The tasks are less similar due to the high uncertainty associated with the changing orientations.

H.2 ACROBOT

Acrobot: Acrobot is a 2 link robot OpenAI gym environment with continuous state space. The agent is rewarded when it achieves a certain height of the end link. Two constraints are introduced for two links, where a -1 cost is incurred if any link swings in the prohibited direction. We randomly generate T = 50 different tasks with different mass links and centers of gravity. High task-similarity: To generate tasks with high similarity for the acrobot, we considered changing the mass of the links, the center of gravity (COG), and constraint threshold for each link. The changes in these quantities were done by adding noise to the default quantities. We considered a Gaussian noise with a low variance of 0.1 to change the tasks only slightly. From Figure 5 , we can observe that only pre-trained and FAL baselines are competitive with the Meta-SRL in terms of reward maximization and almost zero constraint violations. Low task-similarity: To generate low similar tasks, we increased the variance of the Gaussian noise to 0.3. We can observe from Figure 2 that the performance of the baselines was poor for constraint satisfaction, while Meta-SRL could converge quickly for reward maximization and constraint satisfaction. Note that, in real-world settings, tasks are likely to have low similarity in terms of how close their optimal policies are. The good performance of Meta-SRL under these settings highlights its potential to be extended to real-world settings where safety constraints are present.

H.3 HALF CHEETAH

Half-cheetah is a simulation environment for a 2-dimensional robot. It consists of 9 links and eight joints, where the goal for the cheetah is to run at a certain velocity. It has a 17-dimensional state space and a 6-dimensional action space. The reward is calculated as the negative of the absolute difference between the current cheetah velocity and the desired velocity. The original HalfCheetah environment does not have any constraints. We introduce a constraint that penalizes the deviation of the cheetah's head from some desired height: h cheetah -h target ≤ ϵ, where we specify the cumulative absolute difference between the cheetah head height and the desired height to be less than a tolerance ϵ. The cheetah is trained on T = 100 tasks for both high and low task-similarity settings. High task-similarity: To generate tasks with high similarity, the goal velocity for each training task is uniformly sampled from a range of [0.35, 0.65]m/s. From Figure 6 , we can observe that under high task similarity settings, Meta-SRL is able to achieve high rewards and also able to keep the constraint violation of the cheetah's head height below the threshold. Under high task-similarity settings, pre-trained and Meta-SRL perform well, as expected. However, it can be observed that both simple averaging and random initialization perform poorly in this setting. Low task-similarity: To generate tasks with low similarity for the half-cheetah, the goal velocity for each training task is uniformly sampled from a range of [0.0, 1.0]m/s. Tasks are less similar due to the high variance of goal velocities that the cheetah is trained on. It can be observed from Figure 7 that Meta-SRL is able to achieve higher rewards and zero constraint violations quickly compared to other baseline initializations under low task-relatedness settings. The pre-trained baseline can achieve higher rewards, but similar to other baselines, it cannot achieve constraint satisfaction within 10 steps. It can also be observed that both simple averaging and random initialization perform poorly in reward maximization in this setting. Close inspection indicates that there is a high variance among the policy parameters learned from each task, which may result in interference among different tasks in the relatively high dimensional state space. knows when a new task has arrived and is allowed to interact with the MDP over a set of episodes (the number is linear with respect to M in our paper). Due to the above difference, the worst-case lower bound of requiring an exponential number of episodes to learn an ϵ-optimal policy in (Kwon et al., 2021) does not hold in our case. Indeed, if the identity (referred to as "context" in latent MDP) is revealed or can be inferred, (Kwon et al., 2021) is able to achieve a regret that is polynomial in the number of episodes (Thms. 3.3 and 3.4 from (Kwon et al., 2021) ). Furthermore, a close examination of the bounds provided by (Kwon et al., 2021) also reveals some differences from our result. In particular, let K be the number of contexts in a latent MDP and N be the total number of episodes (N is on the order of T M in our case as we encounter T tasks, each with M episodes). Then (Kwon et al., 2021) is able to bound the regret (without dividing by the number of episodes N ) as O( √ KN ). To compare their bound with ours, we consider each task in the meta-learning setting as a context, so T = O(K). Therefore, their upper bound (after dividing by the number of episodes N = T M ) becomes O(1/ √ M ), which does not diminish with the number of tasks T . Note that our bound (see the comment after Corollary 1) is O Vψ M 3/4 √ T (after dividing by the number of episodes N = T M ), where for simplicity we have assumed E T = 0, i.e., exact access to the loss function. Note that Vψ is a measure of task-relatedness (a smaller value indicates more relatedness among tasks). It can be seen that while we have a worse order dependence on M , our bound scales with task relatedness Vψ and diminishes with respect to the increasing number of tasks T . This is expected as we leverage the relatedness among contexts (in fact, the result of (Kwon et al., 2021) would hold when tasks are sufficiently different from each other to infer the contexts with spectral methods). In summary, we refer to (Kwon et al., 2021) as an example that achieving regret diminishing in the number of tasks T is hard, even with the assumption of observing the task identities (contexts). 



This regret is slightly different from(Xu et al., 2021) as we assume an exact critic estimation for simplicity. For more details about the CRPO algorithm, choice of parameters, and the convergence analysis for a single task, we refer the reader to Appendices B and D. When online learning is played on E s∼ν * t [DKL (π * t |π)] to determine πt+1,0, we treat θ in π θ for all s ∈ S and a ∈ A as the decision variable. For simplicity, we will refer to π as the decision variable. √2cL1L2∥x∥ √ T < l a t e x i t s h a 1 _ b a s e 6 4 = " p d y h p a b z / S e U c 1 Y u g F k j 2 p 1 Jx T s = " > A A A B + n i c b V D L S s N A F L 2 p r 1 p f q S 7 d D B b B h Z R E i r o s C u K y g n 1 A G 8 J k M m 2 H T h 7 M T J Q S 8 y l u X C j i 1 i 9 x 5 9 8 4 a b P Q 1 g M D h 3 P u 5 Z 4 5 X s y Z V J b 1 b Z R W V t f W N 8 q b l a 3 t n d 0 9 s 7 r f k V E i C G 2 T i E e i 5 2 F J O Q t p W z H F a S 8 W F A c e p 1 1 v c p 3 7 3 Q c q J I v C e z W N q R P g U c i G j G C l J d e s D g K s x g T z 9 C Z z U 3 X q Z 6 5 Z s + r W D G i Z 2 A W p Q Y G W a 3 4 N / I g k A Q 0 V 4 V j K v m 3 F y k m x U I x w m l U G i a Q x J h M 8 o n 1 N Q x x Q 6 a S z 6 B k 6 1 o q P h p H Q L 1 R o p v 7 e S H E g 5 T T w 9 G Q e V C 5 6 u f i f 1 0 / U 8 N J J W R g n i o Z k f m i Y c K Q i l P e A f C Y o U X y q C S a C 6 a y I j L H A R O m 2 K r o E e / H L y 6 R z V r f P 6 4 2 7 R q 1 5 V d R R h k M 4 g h O w 4 Q K a c A s t a A O B R 3 i G V 3 g z no w X 4 9 3 4 m I + W j G L n A P 7 A + P w B g 4 S U L Q = = < / l a t e x i t >



and U sim T are simply placeholders for upper bounds on the respective regrets for some inexact online algorithms. In particular, INIT and SIM can be any inexact online algorithms in Algorithm 1, and the results of Theorem 3.3 can be instantiated by plugging in the respective U init T and U sim T . The following corollary presents the TAOG, and TACV regret bounds when INIT and SIM are inexact OGD over the loss functions { f init t If INIT(t) and SIM(t) are inexact OGD, and are run over the sequences { f init t

Figure1: Frozen lake results for reward maximization and constraint violations when the taskrelatedness is low. The Blue dashed line represents the averaged thresholds for the constraint violations. We do 10 runs on each baseline to get the performance plots with variance.

Figure 2: Acrobot results for reward maximization and constraint violations when the task-relatedness is low. Blue dashed line represents the averaged thresholds for the constraint violations.

Denote ℓ t (π t,0 ) := E ν * t [D KL (π * t |π t,0 )] for all t ∈ [T ]. For any fixed comparator π * 0 = arg min π0∈∆A |S| ϱ T t=1 ℓ t (π 0 ), if OGD is run on a sequence of loss functions { lt } t∈[T ] , where lt := E νt [D KL (π t |π t,0 )] with the step-size α := ∥π * 0 ∥ Lg √

Lπ and other appropriate constants in Theorem E.1.Note that the inexactness bound ϵ t can be obtained from Theorem 3.1. Establishing the above Corollary, we can finally provide the proof for Theorem 3.2. s∼νt [D KL (π t |ϕ)] be the empirical task-similarity, and let c 1 = √ 2L g ∥ϕ * ∥, and

the constants are from the Corollary 9. Now, we will upper bound the second term. Since ϕ * = arg min ϕ 1 T T t=1 E s∼νt [D KL (π t |ϕ)], by the definition of D * , we have E s∼νt [D KL (π t |ϕ)] ≤ D * 2 . Thus, by substituting the definition of ϕ * , it holds that

Whitney Stratification). A Whitney C k stratification of a set I is a partition of I into finitely many nonempty C k manifolds, called strata, satisfying the following compatibility conditions: 1. For any two strata I a and I b , the implication I a ∩ I b ̸ = ∅ implies that I a ⊂ clI b holds, where clI b denotes the closure of the set I b .

l e p 9 t V y 7 y e M o w D G c w B n 4 c A U 1 u I M 6 N I D C C J 7 h F d 4 c 5 b w 4 7 8 7 H v H X F y W e O 4 A + c z x / 7 m I 9 Z < / l a t e x i t > ⇡ ⇤ t < l a t e x i t s h a 1 _ b a s e 6 4 = " r H g 5 B d B D e u x u p q d d D b f 6 s 0 p 0 4 I

-Bπt ẑ * )(s, a)D KL (π * t |π) -E d D t a ω πt/Dt (s, a)D KL (π * t |π)) 2 ϵ2

) and define κ * = arg min L(κ). (56) Thus, plugging κ = κ * in 54 results in 50. Now, we provide the regret upper bound for U sim T (κ), when SIM(t) is OGD over the sequence f sim t (κ). Corollary 2. For any fixed comparator α * = arg min SIM(t) is OGD which is run on a sequence of loss functions { f sim t } t∈[T ] with the step-size α * Kα √

Lα and other appropriate constants in Theorem E.1. Next, we provide the proof of Corollary 1 TAOG and TACV regret bounds when INIT and SIM are either FTL or inexact OGD. Corollary 3. For any fixed comparator α * = arg min

Figure 4: Frozen lake results for reward maximization and constraint violations when the taskrelatedness is high. The blue dashed line represents the averaged thresholds for the constraint violations.

Figure 5: Acrobot results for reward maximization and constraint violations when the task-relatedness is high. The blue dashed line represents the averaged thresholds for the constraint violations.

Lemma 2 (Static regret bound for inexact OGD). Denote f t (π t,0 ) := E ν *

Lemma 3 (Dynamic regret bound for inexact OGD). Denote f t (ϕ t ) := E ν * t [D KL (π * t |ϕ t )] for all t ∈ [T ]. For any dynamically varying comparator ψ * t , if single-step inexact OGD is run with the step-size β ≤ 1 2µπ on a sequence of loss functions { ft } t∈[T ] , where ft (ϕ t ) = E νt [D KL (π t |ϕ t )] , then the following bound holds for dynamic regret:

KL (π * t |ϕ)] with E νt [D KL (π t |ϕ)] in the above. Inspired by

Let each within-task CMDP t run M steps of CRPO, initialized by policy π t,0 := INIT(t) and learning rates α t := SIM(t). Let κ * := arg min L(κ), where

where L g is the upper bound on ∇ ϕ E s∼ν * t [D KL (π * t |ϕ)], µ π is the strong convexity parameter for the KL divergence of the softmax policy. KL (π * t |ϕ)], by the definition of D * , we have E s∼ν * t [D KL (π * t |ϕ * )] ≤ D * 2 . Thus, by substituting the definition of ϕ * , it holds that

and C 5 = where ∇t and ∇ t are an ϵ t -subgradient and exact subgradient of E ν * t [D KL (π * t |ψ t )] at ψ t , respectively, E T := T t=1 ϵ t is the cumulative inexactness.

,π t,0 policy initialization for task t α t learning rate of within-task algorithm t ∈ [T ] set of all tasks, where [T ] = {1, . . . , T } M t CMDP for task t S state space of CMDP M t A ∈ R na action space of CMDP M t ρ t initial state distribution of task t P t (•|s, a) transition kernel for task t c t,0 : S × A → [0, 1] reward function c t,i : S × A → [0, 1] cost function i for task t p total number of constraints m ∈ [M ] set of all timesteps for within-task algorithm ∆(A) |S| simplex over all state-action pairs π t : S → ∆(A) stochastic policy for task t ν π t state visitation distribution of policy π at task t θ softmax policy parameters V i t,π (s) state-value function for reward (i = 0) or cost i in task t with policy π Q i t,π (s, a) action-value function for reward (i = 0) or cost i in task t with policy π J t,i (π) expected total reward (i = 0) or cost i for task t and policy π d t,i bound on the expected total cost i for task t Π * Ri TAOG and TACV πt suboptimal policy returned by within-task algorithm in task t D * , D * true and empirical task-similarity V ψ , Vψ true and empirical task-relatedness ∆A ϱ shrinkage simplex set inside ∆A L g , L π Lipschitzness and smoothness parameter for KL divergence of policy π w.r.t. initial policy C π maximum value of KL divergence of policy π w.r.t. initial policy ω π/Dt (s, a) stationary distribution correction for task t at state s action a D t off policy dataset for task t µ π strong convexity parameter for KL divergence of policy π w.r.t. initial policy {ψ * K in number of iterations in the critic estimation of CRPO η t tolerance for the constraint violation d t,i for task t P T , S T path-length and squared path-length of the comparator ψ * Domain of the function f ft (•) loss functions for suboptimal policy E νt [D KL (π t |π t,0 )] Table of notations

Table of constants.

7. ACKNOWLEDGMENTS

The authors acknowledge the generous support by NSF, the Commonwealth Cyber Initiative (CCI), 4-VA collaborative research grant, C3.ai Digital Transformation Institute, and the U.S. Department of Energy. We would also like to thank the anonymous reviewers, which helped us to improve the quality of the manuscript and Tengyu Xu for providing the code for CRPO.

H.4 HUMANOID

Humanoid is a simulation environment of a 3D bipedal robot, which consists of a torso (abdomen) with two arms and legs. Each leg and arm has two links (representing the knees and elbows, respectively). It has a 376-dimensional observation space and a 17-dimensional action space. The goal of the humanoid is to walk forward as fast as possible without falling over.The original humanoid environment does not have any constraints. We introduce a constraint that penalizes the deviation of the angles between the torso and the upper arm and the angle between the upper arm and the lower arm, such that humanoid motions are smooth and graceful. The cumulative constraint is given as:where θ tr , θ tl , θ r , and θ l are the angles between the torso and right arm, the angle between the torso and the left arm, the angle between both the upper and lower right arms, and the angle between both the upper and lower left arms, respectively. We specify the cumulative absolute difference between all these angles and the desired angle to be less than a tolerance ϵ. The reward is calculated on the basis of the dot product between the direction and the velocity vector of the Center of Gravity of the humanoid, multiplied by the default scaling value in the humanoid environment W f . the humanoid as follows:where r is the instantaneous reward that accounts for the amount of forward movement by the humanoid, v x , and v y are the horizontal and lateral components of the velocity, and θ is the walking direction of the humanoid. The default value of W f is 1.25. The humanoid is trained on T = 250 tasks for both high and low task-similarity settings.High task-similarity: We generate different tasks by changing the direction of motion of the humanoid. Possible direction angles in the humanoid environment range from -π/2 to π/2 (which varies from left to right). To generate tasks with high similarity, the goal direction of the humanoid for each training task is uniformly sampled from a range of [-π/4, π/4]. From Figure 8 , we can observe that under high task similarity settings, Meta-SRL is able to achieve high rewards and maintain the constraint violation of the humanoid's hand and torso angles below the threshold of ϵ = 4. Under high task-similarity settings, both pre-trained and Meta-SRL perform well, as expected. However, it can be observed that both simple averaging and random initialization perform poorly in this setting. Moreover, the pre-trained baseline also fails to learn reward-maximizing behaviors. Low task-similarity: To generate tasks with low similarity for the humanoid, the goal direction for each training task is uniformly sampled from a range of [-π/4, π/4]. Tasks are less similar due to the high variance of goal direction that the humanoid is trained on. Figure 9 shows that Meta-SRL is able to quickly achieve higher rewards and zero constraint violations compared to other baseline initializations under low task-relatedness settings. The pre-trained baseline also achieves constraint satisfaction in this case but fails to learn behaviors to maximize the rewards within 10 steps. It can also be observed that both simple averaging and random initialization perform poorly in reward maximization in this setting. This can be attributed to a high variance among the policy parameters learned from each task, which may result in interference among different tasks in the relatively high-dimensional state space. There is a key difference in the problem setting of meta-learning in our study and the latent MDP setting in (Kwon et al., 2021) . The latent MDP setting is more challenging in the sense that there is no clear boundary between tasks. In the latent MDP setting, each episode may come from an unknown MDP drawn from a distribution (as a special case of POMDP); in the meta-learning setting, the agent

