Year: 2021

Abstract:
Existing offline reinforcement learning (RL) methods face a few major challenges, particularly the distributional shift between the learned policy and the behavior policy. Offline Meta-RL is emerging as a promising approach to address these challenges, aiming to learn an informative meta-policy from a collection of tasks. Nevertheless, as shown in our empirical studies, offline Meta-RL could be outperformed by offline single-task RL methods on tasks with good quality of datasets, indicating that a right balance has to be delicately calibrated between “exploring” the out-of-distribution state-actions by following the meta-policy and “exploiting” the offline dataset by staying close to the behavior policy. Motivated by such empirical analysis, we explore model-based offline Meta-RL with regularized Policy Optimization (MerPO), which learns a meta-model for efficient task structure inference and an informative meta-policy for safe exploration of out-of-distribution state-actions. In particular, we devise a new meta-Regularized model-based ActorCritic (RAC) method for within-task policy optimization, as a key building block of MerPO, using conservative policy evaluation and regularized policy improvement; and the intrinsic tradeoff therein is achieved via striking the right balance between two regularizers, one based on the behavior policy and the other on the meta-policy. We theoretically show that the learnt policy offers guaranteed improvement over both the behavior policy and the meta-policy, thus ensuring the performance improvement on new tasks via offline Meta-RL. Experiments corroborate the superior performance of MerPO over existing offline Meta-RL methods.

heading: 1 INTRODUCTION
text: Offline reinforcement learning (a.k.a., batch RL) has recently attracted extensive attention by learning from offline datasets previously collected via some behavior policy (Kumar et al., 2020). However, the performance of existing offline RL methods could degrade significantly due to the following issues: 1) the possibly poor quality of offline datasets (Levine et al., 2020) and 2) the inability to generalize to different environments (Li et al., 2020b). To tackle these challenges, offline Meta-RL (Li et al., 2020a; Dorfman & Tamar, 2020; Mitchell et al., 2020; Li et al., 2020b) has emerged very recently by leveraging the knowledge of similar offline RL tasks (Yu et al., 2021a). The main aim of these studies is to enable quick policy adaptation for new offline tasks, by learning a meta-policy with robust task structure inference that captures the structural properties across training tasks.
Because tasks are trained on offline datasets, value overestimation (Fujimoto et al., 2019) inevitably occurs in dynamic programming based offline Meta-RL, resulted from the distribution shift between the behavior policy and the learnt task-specific policy. To guarantee the learning performance on new offline tasks, a right balance has to be carefully calibrated between “exploring” the out-of-distribution state-actions by following the meta-policy, and “exploiting” the offline dataset by staying close to the behavior policy.
However, such a unique “exploration-exploitation” tradeoff has not been considered in existing offline Meta-RL approaches, which would likely limit their ability to handle diverse offline datasets particularly towards those with good behavior policies. To illustrate this issue more concretely, we
compare the performance between a state-of-the-art offline Meta-RL algorithm FOCAL (Li et al., 2020b) and an offline single-task RL method COMBO (Yu et al., 2021b) in two new offline tasks. As illustrated in Figure 1, while FOCAL performs better than COMBO on the task with a bad-quality dataset (left plot in Figure 1), it is outperformed by COMBO on the task with a good-quality dataset (right plot in Figure 1). Clearly, existing offline Meta-RL fails in several standard environments (see Figure 1 and Figure 11) to generalize universally well over datasets with varied quality. In order to fill such a substantial gap, we seek to answer the following key question in offline Meta-RL:
How to design an efficient offline Meta-RL algorithm to strike the right balance between exploring with the meta-policy and exploiting the offline dataset?
To this end, we propose MerPO, a model-based offline Meta-RL approach with regularized Policy Optimization, which learns a meta-model for efficient task structure inference and an informative meta-policy for safe exploration of out-of-distribution state-actions. Compared to existing approaches, MerPO achieves: (1) safe policy improvement: performance improvement can be guaranteed for offline tasks regardless of the quality of the dataset, by strike the right balance between exploring with the meta-policy and exploiting the offline dataset; and (2) better generalization capability: through a conservative utilization of the learnt model to generate synthetic data, MerPO aligns well with a recently emerging trend in supervised meta-learning to improve the generalization ability by augmenting the tasks with “more data” (Rajendran et al., 2020; Yao et al., 2021). Our main contributions can be summarized as follows:
(1) Learnt dynamics models not only serve as a natural remedy for task structure inference in offline Meta-RL, but also facilitate better exploration of out-of-distribution state-actions by generating synthetic rollouts. With this insight, we develop a model-based approach, where an offline metamodel is learnt to enable efficient task model learning for each offline task. More importantly, we propose a meta-regularized model-based actor-critic method (RAC) for within-task policy optimization, where a novel regularized policy improvement module is devised to calibrate the unique “exploration-exploitation” tradeoff by using an interpolation between two regularizers, one based on the behavior policy and the other on the meta-policy. Intuitively, RAC generalizes COMBO to the multi-task setting, with introduction of a novel regularized policy improvement module to strike a right balance between the impacts of the meta-policy and the behavior policy.
(2) We theoretically show that under mild conditions, the learnt task-specific policy based on MerPO offers safe performance improvement over both the behavior policy and the meta-policy with high probability. Our results also provide a guidance for the algorithm design in terms of how to appropriately select the weights in the interpolation, such that the performance improvement can be guaranteed for new offline RL tasks.
(3) We conduct extensive experiments to evaluate the performance of MerPO. More specifically, the experiments clearly show the safe policy improvement offered in MerPO, corroborating our theoretical results. Further, the superior performance of MerPO over existing offline Meta-RL methods suggests that model-based approaches can be more beneficial in offline Meta-RL.

heading: 2 RELATED WORK
text: Offline single-task RL. Many existing model-free offline RL methods regularize the learnt policy to be close to the behavior policy by, e.g., distributional matching (Fujimoto et al., 2019), support matching (Kumar et al., 2019), importance sampling (Nachum et al., 2019; Liu et al., 2020), learning lower bounds of true Q-values (Kumar et al., 2020). Along a different avenue, model-based algorithms learn policies by leveraging a dynamics model obtained with the offline dataset. (Matsushima et al., 2020) directly constrains the learnt policy to the behavior policy as in model-free algorithms. To penalize the policy for visiting states where the learnt model is likely to be incorrect, MOPO (Yu et al., 2020) and MoREL (Kidambi et al., 2020) modify the learnt dynamics such that the value estimates are conservative when the model uncertainty is above a threshold. To remove the need of uncertainty quantification, COMBO (Yu et al., 2021b) is proposed by combining model-based policy optimization (Janner et al., 2019) and conservative policy evaluation (Kumar et al., 2020).
Offline Meta-RL. A few very recent studies have explored the offline Meta-RL. Particularly, (Li et al., 2020a) considers a special scenario where the task identity is spuriously inferred due to biased datasets, and applies the triplet loss to robustify the task inference with reward relabelling. (Dorfman
& Tamar, 2020) extends an online Meta-RL method VariBAD (Zintgraf et al., 2019) to the offline setup, and assumes known reward functions and shared dynamics across tasks. Based on MAML (Finn et al., 2017), (Mitchell et al., 2020) proposes an offline Meta-RL algorithm with advantage weighting loss, and learns initializations for both the value function and the policy, where they consider the offline dataset in the format of full trajectories in order to evaluate the advantage. Based on the off-policy Meta-RL method PEARL (Rakelly et al., 2019), (Li et al., 2020b) combines the idea of deterministic context encoder and behavior regularization, under the assumption of deterministic MDP. Different from the above works, we study a more general offline Meta-RL problem. More importantly, MerPO strikes a right balance between exploring with the meta-policy and exploiting the offline dataset, which guarantees safe performance improvement for new offline tasks.

heading: 3 PRELIMINARIES
text: Consider a Markov decision process (MDP) M = (S,A, T, r, µ0, γ) with state space S, action space A, the environment dynamics T (s′|s, a), reward function r(s, a), initial state distribution µ0, and γ ∈ (0, 1) is the discount factor. Without loss of generality, we assume that |r(s, a)| ≤ Rmax. Given a policy π, let dπM(s) := (1 − γ) ∑∞ t=0 γ
tPM(st = s|π) denote the discounted marginal state distribution, where PM(st = s|π) denotes the probability of being in state s at time t by rolling out π in M. Accordingly, let dπM(s, a) := dπM(s)π(a|s) denote the discounted marginal state-action distribution, and J(M, π) := 11−γE(s,a)∼dπM(s,a)[r(s, a)] denote the expected discounted return. The goal of RL is to find the optimal policy that maximizes J(M, π). In offline RL, no interactions with the environment are allowed, and we only have access to a fixed dataset D = {(s, a, r, s′)} collected by some unknown behavior policy πβ . Let d πβ M(s) be the discounted marginal state distribution of πβ . The datasetD is indeed sampled from d πβ M(s, a) = d πβ M(s)πβ(a|s). DenoteM as the empirical MDP induced by D and d(s, a) as a sample-based version of dπβM(s, a). In offline Meta-RL, consider a distribution of RL tasks p(M) as in standard Meta-RL (Finn et al., 2017; Rakelly et al., 2019), where each taskMn is an MDP, i.e.,Mn = (S,A, Tn, rn, µ0,n, γ), with task-shared state and action spaces, and unknown task-specific dynamics and reward function.For each task Mn, no interactions with the environment are allowed and we only have access to an offline dataset Dn, collected by some unknown behavior policy πβ,n. The main objective is to learn a meta-policy based on a set of offline training tasks {Mn}Nn=1. Conservative Offline Model-Based Policy Optimization (COMBO). Recent model-based offline RL algorithms, e.g., COMBO (Yu et al., 2021b), have demonstrated promising performance on a single offline RL task by combining model-based policy optimization (Janner et al., 2019) and conservative policy evaluation (CQL (Kumar et al., 2020)). Simply put, COMBO first trains a dynamics model T̂θ(s′|s, a) parameterized by θ, via supervised learning on the offline dataset D. The learnt MDP is constructed as M̂ := (S,A, T̂ , r, µ0, γ). Then, the policy is learnt using D and model-generated rollouts. Specifically, define the action-value function (Q-function) as Qπ(s, a) := E [ ∑∞ t=0 γ
tr(st, at)|s0 = s, a0 = a], and the empirical Bellman operator as: B̂πQ(s, a) = r(s, a)+ γE(s,a,s′)∼D[Q(s′, a′)], for a′ ∼ π(·|s′). To penalize the Q functions in out-of-distribution stateaction tuples, COMBO employs conservative policy evaluation based on CQL: Q̂k+1 ← arg min
Q(s,a) β(Es,a∼ρ[Q(s, a)]− Es,a∼D[Q(s, a)]) +
1 2 Es,a,s′∼df [(Q(s, a)− B̂ πQ̂k(s, a))2] (1)
where ρ(s, a) := dπ M̂ (s)π(a|s) is the discounted marginal distribution when rolling out π in M̂, and df (s, a) = fd πβ M(s, a) + (1 − f)ρ(s, a) for f ∈ [0, 1]. The Bellman backup B̂π over df can be interpreted as an f -interpolation of the backup operators under the empirical MDP (denoted by BπM) and the learnt MDP (denoted by B π M̂
). Given the Q-estimation Q̂π , the policy can be learnt by: π′ ← argmax
π Es∼ρ(s),a∼π(·|s)[Q̂π(s, a)]. (2)

heading: 4 MERPO: MODEL-BASED OFFLINE META-RL WITH REGULARIZED POLICY OPTIMIZATION
text: Learnt dynamics models not only serves as a natural remedy for task structure inference in offline Meta-RL, but also facilitates better exploration of out-of-distribution state-actions by generating
synthetic rollouts (Yu et al., 2021b). Thus motivated, we propose a general framework of modelbased offline Meta-RL, as depicted in Figure 2. More specifically, the offline meta-model is first learnt by using supervised meta-learning, based on which the task-specific model can be quickly adapted. Then, the main attention of this study is devoted to the learning of an informative metapolicy via bi-level optimization, where 1) a model-based policy optimization approach is leveraged in the inner loop for each task to learn a task-specific policy; and 2) the meta-policy is then updated in the outer loop based on the learnt task-specific policies.

heading: 4.1 OFFLINE META-MODEL LEARNING
text: Learning a meta-model based on the set of offline dataset {Dn}Nn=1 can be carried out via supervised meta-learning. Many gradient-based meta-learning techniques can be applied here, e.g., MAML (Finn et al., 2017) and Reptile (Nichol et al., 2018). In what follows, we outline the basic idea to leverage the higher-order information of the meta-objective function. Specifically, we consider a proximal meta-learning approach, following the same line as in (Zhou et al., 2019):
min φm Lmodel(φm) = EMn { min θn [ E(s,a,s′)∼Dn [log T̂θn(s ′|s, a)] + η‖θn − φm‖22 ]}
(3)
where the learnt dynamics for each taskMn is parameterized by θn and the meta-model is parameterized by φm. Solving Eq. (3) leads to an offline meta-model.
Given the learnt meta-model Tφ∗m , the dynamics model for an individual offline task j can be found by solving the following problem via gradient descent with initialization Tφ∗m using Dj , i.e.,
min θj
E(s,a,s′)∼Dj [log T̂θj (s ′|s, a)] + η‖θj − φ∗m‖22. (4)
Compared to learning the dynamics model from scratch, adapting from Tφ∗m can quickly generate a dynamics model for task identity inference by leveraging the knowledge from similar tasks, and hence improve the sample efficiency (Finn et al., 2017; Zhou et al., 2019).

heading: 4.2 OFFLINE META-POLICY LEARNING
text: In this section, we turn attention to tackle one main challenge in this study: How to learn an informative offline meta-policy in order to achieve the optimal tradeoff between “exploring” the out-ofdistribution state-actions by following the meta-policy and “exploiting” the offline dataset by staying close to the behavior policy? Clearly, it is highly desirable for the meta-policy to safely ‘explore’ out-of-distribution state-action pairs, and for each task to utilize the meta-policy to mitigate the issue of value overestimation.

heading: 4.2.1 HOW DO EXISTING PROXIMAL META-RL APPROACHES PERFORM?
text: Proximal Meta-RL approaches have demonstrated remarkable performance in the online setting (e.g., (Wang et al., 2020)), by explicitly regularizing the task-specific policy close to the meta-policy. We first consider the approach that applies the online Proximal Meta-RL method directly to devise offline Meta-RL, which would lead to:
max πc EMn { max πn [ E s∼ρn, a∼πn(·|s) [ Q̂πn(s, a) ] − λD(πn, πc) ]} (5)
where πc is the offline meta-policy, πn is the task-specific policy, ρn is the state marginal of ρn(s, a) for task n and D(·, ·) is some distance measure between two probability distributions. To alleviate value overestimation, conservative policy evaluation can be applied to learn Q̂πn by using Eq. (1).
Intuitively, Eq. (5) corresponds to generalizing COMBO to the multi-task setting, where a meta policy πc is learned to regularize the within-task policy optimization.
To get a sense of how the meta-policy learnt using Eq. (5) performs, we evaluate its performance in an offline variant of standard Meta-RL benchmark Walker-2D-Params with good-quality datasets, and evaluate the testing performance of the task-specific policy after fine-tuning based on the learnt meta-policy, with respect to the meta-training steps. As can be seen in Figure 3, the proximal Meta-RL algorithm Eq. (5) performs surprisingly poorly and fails to learn an informative meta-policy, despite conservative policy evaluation being applied in within-task policy optimization to deal with the value overestimation. In particular, the testing performance degrades along with the metatraining process, implying that the quality of the learnt meta-policy is in fact decreasing.
Why does the proximal Meta-RL method in Eq. (5) perform poorly in offline Meta-RL, even with conservative policy evaluation? To answer this, it is worth to take a closer look at the within-task policy optimization in Eq. (5), which is given as follows:
πn ← argmax πn Es∼ρn,a∼πn(·|s)[Q̂ π n(s, a)]− λD(πn, πc). (6)
Clearly, the performance of Eq. (6) depends heavily on the quality of the meta-policy πc. A poor meta-policy may have negative impact on the performance and result in a task-specific policy πn that is even outperformed by the behaviour policy πβ,n. Without online exploration, the quality of πn could not be improved, which in turn leads to a worse meta-policy πc through Eq. (5). The iterative meta-training process would eventually result in the performance degradation in Figure 3.
In a nutshell, simply following the meta-policy may lead to worse performance of offline tasks when πβ is a better policy than πc. Since it is infeasible to guarantee the superiority of the meta-policy a priori, it is necessary to balance the tradeoff between exploring with the meta-policy and exploiting the offline dataset, in order to guarantee the performance improvement of new offline tasks.

heading: 4.2.2 SAFE POLICY IMPROVEMENT WITH META-REGULARIZATION
text: To tackle the above challenge, we next devise a novel regularized policy improvement for withintask policy optimization of task n, through a weighted interpolation of two different regularizers based on the behavior policy πβ,n and the meta-policy πc, given as follows:
πn ← argmax πn Es∼ρn,a∼πn(·|s)[Q̂ π n(s, a)]− λαD(πn, πβ,n)− λ(1− α)D(πn, πc), (7)
for some α ∈ [0, 1]. Here, α controls the trade-off between staying close to the behavior policy and following the meta-policy to “explore” out-of-distribution state-actions. Intuitively, as α is closer to 0, the policy improvement is less conservative and tends to improve the task-specific policy πn towards the actions in πc that have highest estimated Q-values. Compared to Eq. (6), the exploration penalty induced byD(πn, πβ,n) serves as a safeguard and stops πn following πc over-optimistically.
Algorithm 1 RAC
1: Train dynamics model T̂θn using Dn; 2: for k = 1, 2, ... do 3: Perform model rollouts starting from
states in Dn and add into Dmodel,n; 4: Policy evaluation by recursively solv-
ing Eq. (1) using Dn ∪ Dmodel,n; 5: Improve policy by solving Eq. (7); 6: end for Safe Policy Improvement Guarantee. Based on conservative policy evaluation Eq. (1) and regularized policy improvement Eq. (7), we have the meta-regularized model-based actor-critic method (RAC), as outlined in Algorithm 1. Note that different distribution distance measures can be used in Eq. (7). In this work, we theoretically show that the policy πn(a|s) learnt by RAC is a safe improvement over both the behavior policy πβ,n and the meta-policy πc on the underlying MDP Mn, when using the maximum total-variation distance for D(π1, π2), i.e., D(π1, π2) := maxsDTV (π1||π2). For convenience, define νn(ρ, f) = Eρ [(ρ(s, a)− dn(s, a))/df,n(s, a)], and let δ ∈ (0, 1/2). We have the following important result on the safe policy improvement achieved by πn(a|s).
Theorem 1. (a) Let = β[νn(ρ πn ,f)−νn(ρπβ,n ,f)] 2λ(1−γ)D(πn,πβ,n) . If νn(ρ πn , f) − νn(ρπβ,n , f) > 0 and α ∈(
max{ 12 − , 0}, 1 2 ) , then J(Mn, πn) ≥ max{J(Mn, πc) + ξ1, J(Mn, πβ,n) + ξ2} holds with
probability at least 1− 2δ, where both ξ1 and ξ2 are positive for large enough β and λ;
(b) More generally, we have that J(Mn, πn) ≥ max{J(Mn, πc) + ξ1, J(Mn, πβ,n) + ξ2} holds with probability at least 1− 2δ, when α ∈ (0, 1/2), where ξ1 is positive for large enough λ.
Remark 1. The expressions of ξ1 and ξ2 are involved and can be found in Eq. (14) and Eq. (15) in the appendix. In part (a) of Theorem 1, both ξ1 and ξ2 are positive for large enough β and λ, pointing to guaranteed improvements over πc and πβ,n. Due to the fact that the dynamics TM̂n learnt via supervised learning is close to the true dynamics TMn on the states visited by the behavior policy πβ,n, d πβ,n
M̂n (s, a) is close to dπβ,nMn (s, a) and ρ πβ,n is close to dn(s, a), indicating that the condition νn(ρ
πn , f)−νn(ρπβ,n , f) > 0 is expected to hold in practical scenarios (Yu et al., 2021b). For more general cases, a slightly weaker result can be obtained in part (b) of Theorem 1, where ξ1 is positive for large enough λ and ξ2 can be negative.
Remark 2. Intuitively, the selection of α balances the impact of πβ,n and πc, while delicately leaning toward the meta-policy πc because πβ,n has played an important role in policy evaluation to find a lower bound of Q-value. As a result, Eq. (7) maximizes the true Q-value while implicitly regularized by a weighted combination, instead of α-interpolation, between D(πn, πβ,n) and D(πn, πc), where the weights are carefully balanced through α. In particular, in the tabular setting, the conservative policy evaluation in Eq. (1) corresponds to penalizing the Q estimation (Yu et al., 2021b):
Q̂k+1n (s, a) = B̂πQ̂kn(s, a)− β[ρ(s, a)− dn(s, a)]
df,n(s, a) . (8)
Clearly, increases with the value of the penalty term in Eq. (8). As a result, when the policy evaluation Eq. (1) is overly conservative, the lower bound of α will be close to 0, and hence the regularizer based on the meta-policy πc can play a bigger role so as to encourage the “exploration” of out-of-distribution state-actions following the guidance of πc. On the other hand, when the policy evaluation Eq. (1) is less conservative, the lower bound of α will be close to 12 , and the regularizer based on πβ,n will have more impact, leaning towards “exploiting” the offline dataset. In fact, the introduction of 1) behavior policy-based regularizer and 2) the interpolation for modeling the interaction between the behavior policy and the meta-policy, is the key to prove Theorem 1.
Practical Implementation. In practice, we can use the KL divergence to replace the total variation distance between policies, based on Pinsker’s Inequality: ‖π1−π2‖ ≤ √ 2DKL(π1||π2). Moreover, since the behavior policy πβ,n is typically unknown, we can use the reverse KL-divergence between πn and πβ,n to circumvent the estimation of πβ,n, following the same line as in (Fakoor et al., 2021):
DKL(πβ,n||πn) = Ea∼πβ,n [log πβ,n(a|s)]− Ea∼πβ,n [log πn(a|s)] ∝ −Ea∼πβ,n [log πn(a|s)] ≈ −E(s,a)∼Dn [log πn(a|s)].
Then, the task-specific policy can be learnt by solving the following problem: max πn Es∼ρn,a∼πn(·|s) [ Q̂πn(s, a) ] + λαE(s,a)∼Dn [log πn(a|s)]− λ(1− α)DKL(πn||πc). (9)

heading: 4.2.3 OFFLINE META-POLICY UPDATE
text: Built on RAC, the offline meta-policy πc is updated by taking the following two steps, in an iterative manner: 1) (inner loop) given the meta-policy πc, RAC is run for each training task to obtain the task-specific policy πn; 2) (outer loop) based on {πn}n, πc is updated by solving:
max πc EMn { E s∼ρn, a∼πn(·|s) [ Q̂πn(s, a) ] + λαE(s,a)∼Dn [log πn(a|s)]− λ(1− α)DKL(πn||πc) } (10) where both ρn and Q̂πn are from the last iteration of the inner loop for each training task. By using RAC in the inner loop for within-task policy optimization, the learnt task-specific policy πn and the meta-policy πc work in concert to regularize the policy search for each other, and improve akin to ‘positive feedback’. Here the regularizer based on the behavior policy serves an important initial force to boost the policy optimization against the ground: RAC in the inner loop aims to improve the task-specific policy over the behavior policy at the outset and the improved task-specific policy consequently regularizes the meta-policy search as in Eq. (10), leading to a better meta-policy eventually. Noted that a meta-Q network is learnt using first-order meta-learning to initialize taskspecific Q networks. It is worth noting that different tasks can have different values of α to capture the heterogeneity of dataset qualities across tasks.
In a nutshell, the proposed model-based offline Meta-RL with regularized Policy Optimization (MerPO) is built on two key steps: 1) learning the offline meta-model via Eq. (3) and 2) learning the offline meta-policy via Eq. (10). The details are presented in Algorithm 2 in the appendix.

heading: 4.3 MERPO-BASED POLICY OPTIMIZATION FOR NEW OFFLINE RL TASK
text: Let Tφ∗m and π ∗ c be the offline meta-model and the offline meta-policy learnt by MerPO. For a new offline RL task, the task model can be quickly adapted based on Eq. (4), and the task-specific policy can be obtained based on π∗c using the within-task policy optimization module RAC. Appealing to Theorem 1, we have the following result on MerPO-based policy learning on a new task.
Proposition 1. Consider a new offline RL task with the true MDP M. Suppose πo is the MerPO-based task-specific policy, learnt by running RAC over the meta-policy π∗c . If = β[ν(ρπo ,f)−ν(ρπβ ,f)] 2λ(1−γ)D(πo,πβ) ≥ 0 and α ∈ ( max{ 12 − , 0}, 1 2 ) , then πo achieves the safe performance improvement over both π∗c and πβ , i.e., J(M, πo) > max{J(M, π∗c ), J(M, πβ)} holds with probability at least 1− 2δ, for large enough β and λ.
Proposition 1 indicates that MerPO-based policy optimization for learning task-specific policy guarantees a policy with higher rewards than both the behavior policy and the meta-policy. This is particularly useful in the following two scenarios: 1) the offline dataset is collected by some poor behavior policy, but the meta-policy is a good policy; and 2) the meta-policy is inferior to a good behavior policy.

heading: 5 EXPERIMENTS
text: In what follows, we first evaluate the performance of RAC for within-task policy optimization on an offline RL task to validate the safe policy improvement, and then examine how MerPO performs when compared to state-of-art offline Meta-RL algorithms. Due to the space limit, we relegate additional experiments to the appendix.

heading: 5.1 PERFORMANCE EVALUATION OF RAC
text: Setup. We evaluate RAC on several continuous control tasks in the D4RL benchmark (Fu et al., 2020) from the Open AI Gym (Brockman et al., 2016), and compare its performance to 1) COMBO (where no meta-policy is leveraged) and 2) COMBO with policy improvement Eq. (6) (namely, COMBO-3), under different qualities of offline datasets and different qualities of meta-policy (good and poor). For illustrative purpose, we use a random policy as a poor-quality meta-policy, and choose the learnt policy after 200 episodes as a better-quality meta-policy. We evaluate the average return over 4 random seeds after each episode with 1000 gradient steps.
Results. As shown in Figure 4, RAC can achieve comparable performance with COMBO-3 given a good-quality meta-policy, and both clearly outperform COMBO. Besides, the training procedure is also more stable and converges more quickly as expected when regularized with the meta-policy. When regularized by a poor-quality meta-policy, that is significantly worse than the behavior policy in all environments, the performance of COMBO-3 degrades dramatically. However, RAC outperforms COMBO even when the meta-policy is a random policy. In a nutshell, RAC consistently
achieves the best performance in various setups and demonstrates compelling robustness against the quality of the meta-policy, for suitable parameter selections (α = 0.4 in Figure 4).
Impact of α. As shown in Theorem 1, the selection of α is important to guarantee the safe policy improvement property of RAC. Therefore, we next examine the impact of α on the performance of RAC under different qualities of datasets and meta-policy. More specifically, we consider four choices of α: α = 0, 0.4, 0.7, 1. Here, α = 0 corresponds to COMBO-3, i.e., regularized by the meta-policy only, and the policy improvement step is regularized by the behavior policy only when
α = 1. Figure 5 shows the average return of RAC over different qualities of meta-policies under different qualities of the offline datasets. It is clear that RAC achieves the best performance when α = 0.4 among the four selections of α, corroborating the result in Theorem 1. In general, the performance of RAC is stable for α ∈ [0.3, 0.5] in our experiments.

heading: 5.2 PERFORMANCE EVALUATION OF MERPO
text: Setup. To evaluate the performance of MerPO, we follow the setups in the literature (Rakelly et al., 2019; Li et al., 2020b) and consider continuous control meta-environments of robotic locomotion. More specifically, tasks has different transition dynamics in Walker-2D-Params and Point-RobotWind, and different reward functions in Half-Cheetah-Fwd-Back and Ant-Fwd-Back. We collect the offline dataset for each task by following the same line as in (Li et al., 2020b). We consider the following baselines: (1) FOCAL (Li et al., 2020b), a model-free offline Meta-RL approach based on a deterministic context encoder that achieves the state-of-the-art performance; (2) MBML (Li et al., 2020a), an offline multi-task RL approach with metric learning; (3) Batch PEARL, which modifies PEARL (Rakelly et al., 2019) to train and test from offline datasets without exploration; (4) Contextual BCQ (CBCQ), which is a task-augmented variant of the offline RL algorithm BCQ (Fujimoto et al., 2019) by integrating a task latent variable into the state information. We train on a set of offline RL tasks, and evaluate the performance of the learnt meta-policy during the training process on a set of unseen testing offline RL tasks.
Fixed α vs Adaptive α. We consider two implementations of MerPO based on the selection of α. 1) MerPO: α is fixed as 0.4 for all tasks; 2) MerPO-Adp: at each iteration k, given the task-policy πkn for task n and the meta-policy π k c at iteration k, we update α k n using one-step gradient descent to minimize the following problem. min αkn (1− αkn)(D(πkn, πβ,n)−D(πkn, πkc )), s.t. αkn ∈ [0.1, 0.5]. (11) The idea is to adapt αkn in order to balance between D(π k n, πβ,n) and D(π k n, π k c ), because Theorem 1 implies that the safe policy improvement can be achieved when the impacts of the meta-policy and the behavior policy are well balanced. Specifically, at iteration k for each task n, αkn is increased when the task-policy πkn is closer to the meta-policy π k c , and is decreased when π k n is closer to the behavior policy. Note that αkn is constrained in the range [0.1, 0.5] as suggested by Theorem 1.
Results. As illustrated in Figure 6, MerPO-Adp yields the best performance, and both MerPOAdp and MerPO achieve better or comparable performance in contrast to existing offline Meta-RL approaches. Since the meta-policy changes during the learning process and the qualities of the behavior policies vary across different tasks, MerPO-Adp adapts α across different iterations and tasks so as to achieve a ‘local’ balance between the impacts of the meta-policy and the behavior policy. As expected, MerPO-Adp can perform better than MerPO with a fixed α. Here the best testing performance for the baseline algorithms is selected over different qualities of offline datasets.
Ablation Study. We next provide ablation studies by answering the following questions.
(1) Is RAC important for within-task policy optimization? To answer this question, we compare MerPO with the approach Eq. (5) where the within-task policy optimization is only regularized by
the meta-policy. As shown in Figure 7(a), with the regularization based on the behavior policy in RAC, MerPO performs significantly better than Eq. (5), implying that the safe policy improvement property of RAC enables MerPO to continuously improve the meta-policy.
(2) Is learning the dynamics model important? Without the utilization of models, the within-task policy optimization degenerates to CQL (Kumar et al., 2020) and the Meta-RL algorithm becomes a model-free approach. Figure 7(b) shows the performance comparison between the cases whether the dynamics model is utilized. It can be seen that the performance without model utilization is much worse than that of MerPO. This indeed makes sense because the task identity inference (Dorfman & Tamar, 2020; Li et al., 2020a;b) is a critical problem in Meta-RL. Such a result also aligns well with a recently emerging trend in supervised meta-learning to improve the generalization ability by augmenting the tasks with “more data” (Rajendran et al., 2020; Yao et al., 2021).
(3) How does MerPO perform in unseen offline tasks under different data qualities? We evaluate the average return in unseen offline tasks with different data qualities, and compare the performance between (1) MerPO with α = 0.4 (“With meta”) and (2) Run a variant of COMBO with behavior-regularized policy improvement, i.e., α = 1 (“With beha only”). For a fair comparison, we initialize the policy network with the meta-policy in both cases. As shown in Figure 7(c), the average performance of “With meta” over different data qualities is much better than that of “With beha only”. More importantly, for a new task with expert data, MerPO (“With meta”) clearly outperforms COMBO as illustrated in Figure 7(d), whereas the performance of FOCAL is worse than COMBO.

heading: 6 CONCLUSION
text: In this work, we study offline Meta-RL aiming to strike a right balance between “exploring” the out-of-distribution state-actions by following the meta-policy and “exploiting” the offline dataset by staying close to the behavior policy. To this end, we propose a model-based offline Meta-RL approach, namely MerPO, which learns a meta-model to enable efficient task model learning and a meta-policy to facilitate safe exploration of out-of-distribution state-actions. Particularly, we devise RAC, a meta-regularized model-based actor-critic method for within-task policy optimization, by using a weighted interpolation between two regularizers, one based on the behavior policy and the other on the meta-policy. We theoretically show that the learnt task-policy via MerPO offers safe policy improvement over both the behavior policy and the meta-policy. Compared to existing offline Meta-RL methods, MerPO demonstrates superior performance on several benchmarks, which suggests a more prominent role of model-based approaches in offline Meta-RL.
REPRODUCIBILITY STATEMENT
For the theoretical results presented in the main text, we state the full set of assumptions of all theoretical results in Appendix B, and include the complete proofs of all theoretical results in Appendix C. For the experimental results presented in the main text, we include the code in the supplemental material, and specify all the training details in Appendix A. For the datasets used in the main text, we also give a clear explanation in Appendix A.

heading: A EXPERIMENTAL DETAILS
text: A.1 META ENVIRONMENT DESCRIPTION
• Walker-2D-Params: Train an agent to move forward. Different tasks correspond to different randomized dynamcis parameters.
• Half-Cheeta-Fwd-Back: Train a Cheetah robot to move forward or backward, and the reward function depends on the moving direction. All tasks have the same dynamics model but different reward functions.
• Ant-Fwd-Back: Train an Ant robot to move forward or backward, and the reward function depends on the moving direction. All tasks have the same dynamics model but different reward functions.
• Poing-Robot-Wind: Point-Robot-Wind is a variant of Sparse-Point-Robot (Li et al., 2020b), a 2D navigation problem introduced in (Rakelly et al., 2019), where each task is to guide a point robot to navigate to a specific goal location on the edge of a semi-circle from the origin. In Point-Robot-Wind, each task is affected by a distinct “wind” uniformly sampled from [−0.05, 0.05]2, and hence differs in the transition dynamics.
A.2 IMPLEMENTATION DETAILS AND MORE EXPERIMENTS
A.2.1 EVALUATION OF RAC
Model learning. Following the same line as in (Janner et al., 2019; Yu et al., 2020; 2021b), the dynamics model for each task is represented as a probabilistic neural network that takes the current state-action as input and outputs a Gaussian distribution over the next state and reward:
T̂θ(st+1, r|s, a) = N (µθ(st, at),Σθ(st, at)). An ensemble of 7 models is trained independently using maximum likelihood estimation, and the best 5 models are picked based on the validation prediction error using a held-our set of the offline dataset. Each model is represented by a 4-layer feedforward neural network with 256 hidden units. And one model will be randomly selected from the best 5 models for model rollout.
Policy optimization. We represent both Q-network and policy network as a 4-layer feedforward neural network with 256 hidden units, and use clipped double Q-learning (Fujimoto et al., 2018) for Q backup update. A max entropy term is also included to the value function for computing the target Q value as in SAC (Haarnoja et al., 2018). The hyperparameters used for evaluating the performance of RAC are described in Table 1.
Additional experiments. We also evaluate the performance of RAC in Walker2d under different qualities of the meta-policy. As shown in Figure 8(a) and 8(b), RAC achieves the best performance in both scenarios, compared to COMBO and COMBO-3. Particularly, the performance of COMBO3 in Figure 8(a) degrades in the later stage of training because the meta-policy is not superior over the behavior policy in this case. In stark contrast, the performance of RAC is consistently better, as it provides a safe policy improvement guarantee over both the behavior policy and the meta-policy.
Beside, we also compare the performance of these three algorithms under an expert behavior policy in Figure 8(c), where a meta-policy usually interferes the policy optimization and drags the learnt policy away from the expert policy. As expected, RAC can still achieve comparable performance with COMBO, as a result of safe policy improvement over the behavior policy for suitable parameter selections.
We examine the impact of α on the performance of RAC under different qualities of the meta-policy for HalfCheetah with expert data. In this case, the meta-policy is a worse policy compared to the behavior policy. As shown in Figure 8(d), the performance α = 0.4 is comparable to the case of α = 1 where the policy improvement step is only regularized based on the behavior policy, and clearly better than the other two cases.
A.2.2 EVALUATION OF MERPO
Data collection. We collect the offline dataset for each task by training a stochastic policy network using SAC (Haarnoja et al., 2018) for that task and rolling out the policies saved at each checkpoint to collect trajectories. Different checkpoints correspond to different qualities of the offline datasets. When training with MerPO, we break the trajectories into independent tuples {si, ai, ri, s′i} and store in a replay buffer. Therefore, the offline dataset for each task does not contain full trajectories over entire episodes, but merely individual transitions collected by some behavior policy.
Setup. For each testing task, we obtain the task-specific policy through quick adaptation using the within-task policy optimization method RAC, based on its own offline dataset and the learnt metapolicy, and evaluate the average return of the adapted policy over 4 random seeds. As shown earlier, we take α = 0.4 for all experiments about MerPO. In MerPO-Adp, we initialize α with 0.4 and update with a learning rate of 1e− 4. Meta-model learning. Similar as in section A.2.1, for each task we quickly adapt from the metamodel to obtain an ensemble of 7 models and pick the best 5 models based on the validation error. The neural network used for representing the dynamics model is same with that in section A.2.1.
Meta-policy learning. As in RAC, we represent the task Q-network, the task policy network and the meta-policy network as a 5-layer feedforward neural network with 300 hidden units, and use clipped double Q-learning (Fujimoto et al., 2018) for within task Q backup update. For each task, we also use dual gradient descent to automatically tune both the parameter β for conservative policy evaluation and the parameter λ for regularized policy improvement:
• Tune β. Before optimizing the Q-network in policy evaluation, we first optimize β by solving the following problem: min Q max β≥0 β(Es,a∼ρ[Q(s, a)]− Es,a∼D[Q(s, a)]− τ) + 1 2 Es,a,s′∼df [(Q(s, a)− B̂ πQ̂k(s, a))2].
Intuitively, the value of β will be increased to penalty the Q-values for out-of-distribution state-actions if the difference Es,a∼ρ[Q(s, a)]−Es,a∼D[Q(s, a)] is larger than some threshold value τ .
Besides, we also build a meta-Q network Qmeta over the training process as an initialization of the task Q networks to facilitate the within task policy optimization. At the k-th meta-iteration for meta-policy update, the meta-Q network is also updated using the average Q-values of current batch B of training tasks with meta-q learning rate ξq , i.e.,
Qk+1meta = Q k meta − ξq[Qkmeta −
1 |B| ∑ n∈B Qn].
Therefore, we initialize the task Q networks and the task policy with the meta-Q network and the meta-policy, respectively, for within task policy optimization during both meta-training and metatesting. The hyperparameters used in evaluation of MerPO are listed in Table 2.
For evaluating the performance improvement in a single new offline task, we use a smaller learning rate of 8e− 5 for the Q network and the policy network update.
A.2.3 MORE EXPERIMENTS.
We also evaluate the impact of the utilization extent of the learnt model, by comparing the performance of MerPO under different cases of real data ratio, i.e., the ratio of the data from the offline dataset in the data batch for training. As shown in Figure 9(a), the performance of MerPO can be further boosted with a more conservative utilization of the model.
To understand how much benefit MerPO can bring for policy learning in unseen offline RL tasks, we compare the performance of the following cases with respect to the gradient steps taken for learning in unseen offline RL tasks: (1) Initialize the task policy network with the meta-policy and run RAC (“With meta”); (2) Run RAC using the meta-policy without network initialization (“With meta (no init)”); (3) Run RAC with a single regularization based on behavior policy without network initialization, i.e., α = 1 (“With beha only”); (4) Run COMBO (“No regul.”). As shown in Figure 9(b), “With meta” achieves the best performance and improves significantly over “No regul.” and “With beha only”, i.e., learning alone without any guidance of meta-policy, which implies that the
learnt meta-policy can efficiently guide the exploration of out-of-distribution state-actions. Without network initialization, “With meta (no init)” and “With beha only” achieve similar performance because good offline dataset is considered here. Such a result is also consistent with Figure 8(d).
We evaluate the testing performance of MerPO, by changing sample size of all tasks. Figure 10(a) shows that the performance of MerPO is stable even if we decrease the number of trajectories for each task to be around 200. In contrast, the number of trajectories collected in other baselines is of the order 103. Figure 10(b) illustrates the testing sample efficiency of MerPO, by evaluating the performance at new offline tasks under different sample sizes. Clearly, a good task-specific policy can be quickly adapted at a new task even with 5 trajectories (1000 samples) of offline data. We also evaluate the training sample efficiency of MerPO in Point-Robot-Wind. As shown in Figure 9(c) the performance of MerPO is stable even if we decrease the number of trajectories for each task to be around 200.
A.2.4 MORE COMPARISON BETWEEN FOCAL AND COMBO
Following the setup as in Figure 1, we compare the performance between FOCAL and COMBO in two more environments: Half-Cheetah-Fwd-Back and Ant-Fwd-Back. As shown in Figure 11, although FOCAL performs better than COMBO on the task with a bad-quality dataset, it is outperformed by COMBO on the task with a good-quality dataset. This further confirms the observation made in Figure 1.
A.3 ALGORITHMS
We include the details of MerPO in Algorithm 2.
Algorithm 2 Regularized policy optimization for model-based offline Meta-RL (MerPO) 1: Initialize the dynamics, actor and critic for each task, and initialize the meta-model and the
meta-policy; 2: for k = 1, 2, ... do 3: for each training taskMn do 4: Solve the following problem with gradient descent for h steps to compute the dynamics
model T̂θkn based on the offline dataset Di: min θn E(s,a,s′)∼Dn [log T̂θn(s ′|s, a)] + η‖θn − φm(k)‖22;
5: end for 6: Update φm(k + 1) = φm(k)− ξ1[φm(k)− 1N ∑N n=1 θ k n]; 7: end for 8: Quickly obtain the estimated dynamics model T̂n for each training task by solving Eq. (4) with t steps gradient descent;
9: for k = 1, 2, ... do 10: for each training taskMn do 11: for j = 1, ..., J do 12: Perform model rollouts with T̂n starting from states in Dn and add model rollouts to Dnmodel; 13: Policy evaluation by recursively solving Eq. (1) using data from Dn ∪ Dnmodel; 14: Given the meta-policy πkc , improve policy π k n by solving Eq. (7); 15: end for 16: end for 17: Given the learnt policy πkn for each task, update the meta-policy π k+1 c by solving Eq. (10)
with one step gradient descent; 18: end for

heading: B PRELIMINARIES
text: For ease of exposition, let TM and rM denote the dynamics and reward function of the underlying MDPM, TM and rM denote the dynamics and reward function of the empirical MDPM induced by the dataset D, and TM̂ and rM̂ denote the dynamics and reward function of the learnt MDP M̂. To prevent any trivial bound with∞ values, we assume that the cardinality of a state-action pair in the dataset D, i.e., |D(s, a)|, in the denominator, is non-zero, by setting |D(s, a)| to be a small value less than 1 when (s, a) /∈ D. Following the same line as in (Kumar et al., 2020; Yu et al., 2021b), we make the following standard assumption on the concentration properties of the reward and dynamics for the empirical MDPM to characterize the sampling error.
Assumption 1. For any (s, a) ∈M, the following inequalities hold with probability 1− δ:
‖TM(s ′|s, a)− TM(s′|s, a)‖1 ≤ CT,δ√ |D(s, a)| ; |rM(s, a)− rM| ≤ Cr,δ√ |D(s, a)|
where CT,δ and Cr,δ are some constants depending on δ via a √ log(1/δ) dependency.
Based on Assumption 1, we can bound the estimation error induced by the empirical Bellman backup operator for any (s, a) ∈M:∣∣∣BπMQ̂k(s, a)− BπMQ̂k(s, a)∣∣∣
= ∣∣∣∣∣rM(s, a)− rM(s, a) + γ∑ s′ (TM(s ′|s, a)− TM(s′|s, a))Eπ(a′|s′)[Q̂k(s′, a′)] ∣∣∣∣∣ ≤|rM(s, a)− rM(s, a)|+ γ ∣∣∣∣∣∑ s′ (TM(s ′|s, a)− TM(s′|s, a))Eπ(a′|s′)[Q̂k(s′, a′)]
∣∣∣∣∣ ≤ Cr,δ√ |D(s, a)| + γ‖TM(s ′|s, a)− TM(s′|s, a)‖1‖Eπ(a′|s′)[Q̂k(s′, a′)]‖∞ ≤Cr,δ + γCT,δRmax/(1− γ)√ |D(s, a)|
= ((1− γ)Cr,δ/Rmax + γCT,δ)Rmax (1− γ) √ |D(s, a)|
≤ (Cr,δ/Rmax + CT,δ)Rmax (1− γ) √ |D(s, a)| , Cr,T,δRmax (1− γ) √ |D(s, a)| .
Similarly, we can bound the difference between the Bellman backup induced by the learnt MDP M̂ and the underlying Bellman backup:∣∣∣BπM̂Q̂k(s, a)− BπMQ̂k(s, a)∣∣∣
≤|rM̂(s, a)− rM(s, a)|+ γRmax 1− γ Dtv(TM̂, TM)
where Dtv(TM̂, TM) is the total-variation distance between TM̂ and TM.
For any two MDPs, M1 and M2, with the same state space, action space and discount factor γ, and a given fraction f ∈ (0, 1), define the f -interpolant MDP Mf as the MDP with dynamics: TMf = fTM1 + (1 − f)TM2 and reward function: rMf = frM1 + (1 − f)rM2 , which has the same state space, action space and discount factor withM1 andM2. Let Tπ be the transition matrix on state-action pairs induced by a stationary policy π, i.e., Tπ = T (s′|s, a)π(a′|s′). To prove the main result, we first restate the following lemma from (Yu et al., 2021b) to be used later.
Lemma 1. For any policy π, its returns in any MDPM, denoted by J(M, π), and inMf , denoted by J(M1,M2, f, π), satisfy the following: J(M, π)− η ≤ J(M1,M2, f, π) ≤ J(M, π) + η where
η = 2γ(1− f) (1− γ)2 RmaxDtv(TM2 , TM) + γf 1− γ |EdπM [(T π M − TπM1)Q π M]|
+ f
1− γ Es,a∼dπM [|rM1(s, a)− rM(s, a)|] + 1− f 1− γ Es,a∼dπM [|rM2(s, a)− rM(s, a)|].
Lemma 1 characterizes the relationship between policy returns in different MDPs in terms of the corresponding reward difference and dynamics difference.

heading: C PROOF OF THEOREM 1
text: Let d(s, a) := dπβM(s, a). In the setting without function approximation, by setting the derivation of Equation Eq. (1) to 0, we have that
Q̂k+1(s, a) = B̂πQ̂k(s, a)− β ρ(s, a)− d(s, a) df (s, a) .
Denote ν(ρ, f) = Eρ [ ρ(s,a)−d(s,a)
df (s,a)
] as the expected penalty on the Q-value. It can be shown (Yu
et al., 2021b) that ν(ρ, f) ≥ 0 and increases with f , for any ρ and f ∈ (0, 1). Then, RAC optimizes the return of a policy in a f -interpolant MDP induced by the empirical MDPM and the learnt MDP M̂, which is regularized by both the behavior policy πβ and the meta-policy πc:
max π
J(M,M̂, f, π)− β ν(ρ π, f)
1− γ − λαD(π, πβ)− λ(1− α)D(π, πc). (12)
Denote πo as the solution to the above optimization problem. Based on Lemma 1, we can first characterize the return of the learnt policy πo in the underlying MDPM in terms of its return in the f -interpolant MDP:
J(M,πo) + η1 ≥ J(M,M̂, f, πo) (13) where η1 = 2γ(1− f) (1− γ)2 RmaxDtv(TM̂, TM) + γf 1− γ |EdπoM [(T πo M − T πo M )Q πo M]|
+ f
1− γ Es,a∼dπoM [|rM(s, a)− rM(s, a)|] + 1− f 1− γ Es,a∼dπoM [|rM̂(s, a)− rM(s, a)|]
≤2γ(1− f) (1− γ)2 RmaxDtv(TM̂, TM) + γ2fCT,δRmax (1− γ)2 Es∼dπoM(s) [√ |A| |D(s)| √ DCQL(πo, πβ)(s) + 1 ]
+ Cr,δ 1− γ Es,a∼dπoM
[ 1√
|D(s, a)|
] + 1
1− γ Es,a∼dπoM [|rM̂(s, a)− rM(s, a)|]
,ηc1. Note that the inequality above holds because the following is true for the empirical MDPM (Kumar et al., 2020):
|EdπM [(T π M − TπM)Q π M]| ≤ γCT,δRmax 1− γ Es∼dπM(s) [√ |A| |D(s)| √ DCQL(π, πβ)(s) + 1 ] for DCQL(π1, π2)(s) := ∑ a π1(a|s) ( π1(a|s) π2(a|s) − 1 ) .
C.1 SAFE IMPROVEMENT OVER πc
We first show that the learnt policy offers safe improvement over the meta-policy πc. Following the same line as in Eq. (13), we next bound the return of the meta-policy πc in the underlying MDPM from above, in terms of its return in the f -interpolant MDP:
J(M,M̂, f, πc) ≥ J(M,πc)− η2 where
η2 ≤ 2γ(1− f) (1− γ)2 RmaxDtv(TM̂, TM) + γ2fCT,δRmax (1− γ)2 Es∼dπcM(s) [√ |A| |D(s)| √ DCQL(πc, πβ)(s) + 1 ]
+ Cr,δ 1− γ Es,a∼dπcM
[ 1√
|D(s, a)|
] + 1
1− γ Es,a∼dπcM [|rM̂(s, a)− rM(s, a)|]
,ηc2.
It follows that
J(M, πo) + ηc1 − β ν(ρπo , f)
1− γ − λαD(πo, πβ)− λ(1− α)D(πo, πc)
≥J(M,M̂, f, πo)− β ν(ρπo , f)
1− γ − λαD(πo, πβ)− λ(1− α)D(πo, πc)
≥J(M,M̂, f, πc)− β ν(ρπc , f)
1− γ − λαD(πc, πβ)
≥J(M, πc)− ηc2 − β ν(ρπc , f)
1− γ − λαD(πc, πβ),
where the second inequality is true because πo is the solution to Eq. (12). This gives us a lower bound on J(M, πo) in terms of J(M, πc):
J(M, πo) ≥ J(M, πc)−ηc1 − ηc2 + β
1− γ [ν(ρπo , f)− ν(ρπc , f)]
+ λαD(πo, πβ) + λ(1− α)D(πo, πc)− λαD(πc, πβ). It is clear that ηc1 and η c 2 are independent to β and λ. To show the performance improvement of πo over the meta-policy πc, it suffices to guarantee that for appropriate choices of β and λ,
∆c = λαD(πo, πβ) + λ(1− α)D(πo, πc)− λαD(πc, πβ) + β
1− γ [ν(ρπo , f)− ν(ρπc , f)] > 0.
To this end, the following lemma first provides an upper bound on |ν(ρπo , f)− ν(ρπc , f)|: Lemma 2. There exist some positive constants L1 and L2 such that
|ν(ρπo , f)− ν(ρπc , f)| ≤ 2(L1 + L2)Dtv(ρπo(s, a)||ρπc(s, a)).
Proof. First, we have that |ν(ρπo , f)− ν(ρπc , f)|
= ∣∣∣∣Eρπo [ ρπo(s, a)− d(s, a)fd(s, a) + (1− f)ρπo(s, a) ] − Eρπc [ ρπc(s, a)− d(s, a) fd(s, a) + (1− f)ρπc(s, a) ]∣∣∣∣ =
∣∣∣∣∣∣ ∑ (s,a) [ ρπo(s, a) ρπo(s, a)− d(s, a) fd(s, a) + (1− f)ρπo(s, a) − ρπc(s, a) ρ πc(s, a)− d(s, a) fd(s, a) + (1− f)ρπc(s, a) ]∣∣∣∣∣∣ ≤
∣∣∣∣∣∣ ∑ (s,a) [ ρπo(s, a) ρπo(s, a)− d(s, a) fd(s, a) + (1− f)ρπo(s, a) − ρπc(s, a) ρ πo(s, a)− d(s, a) fd(s, a) + (1− f)ρπo(s, a) ]∣∣∣∣∣∣ +
∣∣∣∣∣∣ ∑ (s,a) [ ρπc(s, a) ρπo(s, a)− d(s, a) fd(s, a) + (1− f)ρπo(s, a) − ρπc(s, a) ρ πc(s, a)− d(s, a) fd(s, a) + (1− f)ρπc(s, a) ]∣∣∣∣∣∣ =
∣∣∣∣∣∣ ∑ (s,a) [ρπo(s, a)− ρπc(s, a)] ρ πo(s, a)− d(s, a) fd(s, a) + (1− f)ρπo(s, a) ∣∣∣∣∣∣ +
∣∣∣∣∣∣ ∑ (s,a) ρπc(s, a) [ ρπo(s, a)− d(s, a) fd(s, a) + (1− f)ρπo(s, a) − ρ πc(s, a)− d(s, a) fd(s, a) + (1− f)ρπc(s, a) ]∣∣∣∣∣∣ ≤ ∑ (s,a) |ρπo(s, a)− ρπc(s, a)| ∣∣∣∣ ρπo(s, a)− d(s, a)fd(s, a) + (1− f)ρπo(s, a)
∣∣∣∣ + ∑ (s,a) ρπc(s, a) ∣∣∣∣ ρπo(s, a)− d(s, a)fd(s, a) + (1− f)ρπo(s, a) − ρπc(s, a)− d(s, a)fd(s, a) + (1− f)ρπc(s, a) ∣∣∣∣ .
First, observe that for the term ∣∣∣ ρπo (s,a)−d(s,a)fd(s,a)+(1−f)ρπo (s,a) ∣∣∣,
• If ρπo(s, a) ≥ d(s, a), then∣∣∣∣ ρπo(s, a)− d(s, a)fd(s, a) + (1− f)ρπo(s, a) ∣∣∣∣
≤ ∣∣∣∣ ρπo(s, a)fd(s, a) + (1− f)ρπo(s, a) ∣∣∣∣ ≤ ∣∣∣∣ ρπo(s, a)(1− f)ρπo(s, a) ∣∣∣∣ = 11− f .
• If ρπo(s, a) < d(s, a), then∣∣∣∣ ρπo(s, a)− d(s, a)fd(s, a) + (1− f)ρπo(s, a) ∣∣∣∣ ≤ ∣∣∣∣ d(s, a)fd(s, a) + (1− f)ρπo(s, a) ∣∣∣∣ ≤ ∣∣∣∣ d(s, a)fd(s, a) ∣∣∣∣ = 1f .
Therefore, ∣∣∣∣ ρπo(s, a)− d(s, a)fd(s, a) + (1− f)ρπo(s, a) ∣∣∣∣ ≤ max{ 1f , 11− f } , L1.
Next, for the term ∣∣∣ ρπo (s,a)−d(s,a)fd(s,a)+(1−f)ρπo (s,a) − ρπc (s,a)−d(s,a)fd(s,a)+(1−f)ρπc (s,a) ∣∣∣, consider the function g(x) =
x−d fd+(1−f)x for x ∈ [0, 1]. Clearly, when d(s, a) = 0,∣∣∣∣ ρπo(s, a)− d(s, a)fd(s, a) + (1− f)ρπo(s, a) − ρπc(s, a)− d(s, a)fd(s, a) + (1− f)ρπc(s, a) ∣∣∣∣ = 0. For any (s, a) that d(s, a) > 0, it can be shown that g(x) is continuous and has bounded gradient, i.e., |∇g(x)| ≤ 1f2d , L2. Hence, it follows that∣∣∣∣ ρπo(s, a)− d(s, a)fd(s, a) + (1− f)ρπo(s, a) − ρπc(s, a)− d(s, a)fd(s, a) + (1− f)ρπc(s, a)
∣∣∣∣ ≤ L2|ρπo(s, a)− ρπc(s, a)|. Therefore, we can conclude that
|ν(ρπo , f)− ν(ρπc , f)| ≤L1 ∑ (s,a) |ρπo(s, a)− ρπc(s, a)|+ L2 ∑ (s,a) ρπc(s, a)|ρπo(s, a)− ρπc(s, a)|
≤(L1 + L2) ∑ s,a |ρπo(s, a)− ρπc(s, a)|
=2(L1 + L2)Dtv(ρ πo(s, a)||ρπc(s, a)).
Recall that ρπo(s, a) = dπo
M̂ (s)πo(a|s), ρπc(s, a) = dπcM̂(s)πc(a|s),
which denote the marginal state-action distributions by rolling out πo and πc in the learnt model M̂, respectively. Lemma 2 gives an upper bound on the difference between the expected penalties induced under πo and πc, with regard to the difference between the marginal state-action distributions. Next, we need to characterize the relationship between the marginal state-action distribution difference and the corresponding policy distance, which is captured in the following lemma.
Lemma 3. Let D(π1||π2) = maxsDtv(π1||π2) denote the maximum total-variation distance between two policies π1 and π2. Then, we can have that
Dtv(ρ πo(s, a)||ρπc(s, a)) ≤ 1
1− γ max s Dtv(πo(a|s)||πc(a|s)).
Proof. Note that
Dtv(ρ πo(s, a)||ρπc(s, a)) ≤ (1− γ) ∞∑ t=0 γtDtv(ρ πo t (s, a)||ρ πc t (s, a)).
It then suffices to bound the state-action marginal difference at time t. Since both state-action marginals here correspond to rolling out πo and πc in the same MDP M̂, based on Lemma B.1 and B.2 in (Janner et al., 2019), we can obtain that
Dtv(ρ πo t (s, a)||ρ πc t (s, a))
≤Dtv(ρπot (s)||ρ πc t (s)) + max s Dtv(πo(a|s)||πc(a|s))
≤tmax s Dtv(πo(a|s)||πc(a|s)) + max s Dtv(πo(a|s)||πc(a|s))
=(t+ 1) max s Dtv(πo(a|s)||πc(a|s)),
which indicates that
Dtv(ρ πo(s, a)||ρπc(s, a)) ≤ (1− γ) ∞∑ t=0 γt(t+ 1) max s Dtv(πo(a|s)||πc(a|s))
= 1
1− γ max s Dtv(πo(a|s)||πc(a|s)).
Building on Lemma 2 and Lemma 3, we can show that
|ν(ρπo , f)− ν(ρπc , f)| ≤ 2(L1 + L2) 1− γ max s Dtv(πo(a|s)||πc(a|s))
, C max s Dtv(πo(a|s)||πc(a|s)).
Let D(·, ·) = maxsDtv(·||·). It is clear that for λ ≥ λ0 where λ0 > Cβ(1−γ)(1−2α) and α < 1 2 ,
∆c =λαD(πo, πβ) + λ(1− α)D(πo, πc)− λαD(πc, πβ) + β
1− γ [ν(ρπo , f)− ν(ρπc , f)]
=λαD(πo, πβ) + λαD(πo, πc)− λαD(πc, πβ) + λ(1− 2α)D(πo, πc)
+ β
1− γ [ν(ρπo , f)− ν(ρπc , f)]
≥λ(1− 2α)D(πo, πc) + β
1− γ [ν(ρπo , f)− ν(ρπc , f)]
≥λ(1− 2α)D(πo, πc)− Cβ
1− γ D(πo, πc) =(λ− λ0)(1− 2α)D(πo, πc) + [ λ0(1− 2α)− Cβ
1− γ
] D(πo, πc) > 0.
In a nutshell, we can conclude that with probability 1− δ
J(M, πo) ≥ J(M, πc)−ηc1 − ηc2︸ ︷︷ ︸ (a) +(λ− λ0)(1− 2α)D(πo, πc)︸ ︷︷ ︸ (b) +
[ λ0(1− 2α)− Cβ
1− γ ] D(πo, πc)︸ ︷︷ ︸
(c)
,
where (a) depends on δ but is independent to λ, (b) is positive and increases with λ, and (c) is positive. This implies that an appropriate choice of λ will make term (b) large enough to counteract term (a) and lead to the performance improvement over the meta-policy πc: J(M, πo) ≥ J(M, πc) + ξ1 where ξ1 ≥ 0.
C.2 SAFE IMPROVEMENT OVER πβ
Next, we show that the learnt policy πo achieves safe improvement over the behavior policy πβ . Based on Lemma 1, we have J(M1,M2, f, πβ) ≥ J(M, πβ)− η3 where
η3 = 2γ(1− f) (1− γ)2 RmaxDtv(TM̂, TM) + γf 1− γ |E d πβ M [(T πβ M − T πβ M )Q πβ M]|
+ f
1− γ E s,a∼d πβ M [|rM(s, a)− rM(s, a)|] + 1− f 1− γ E s,a∼d πβ M [|rM̂(s, a)− rM(s, a)|]
≤2γ(1− f) (1− γ)2 RmaxDtv(TM̂, TM) + γ2fCT,δRmax (1− γ)2 E s∼d πβ M (s) [√ |A| |D(s)| ]
+ Cr,δ 1− γ E s,a∼d πβ M
[ 1√
|D(s, a)|
] + 1
1− γ E s,a∼d πβ M [|rM̂(s, a)− rM(s, a)|]
,ηβ3 .
Therefore, it follows that
J(M, πo) + ηc1 − β ν(ρπo , f)
1− γ − λαD(πo, πβ)− λ(1− α)D(πo, πc)
≥J(M,M̂, f, πo)− β ν(ρπo , f)
1− γ − λαD(πo, πβ)− λ(1− α)D(πo, πc)
≥J(M,M̂, f, πβ)− β ν(ρπβ , f)
1− γ − λ(1− α)D(πβ , πc)
≥J(M, πβ)− ηβ3 − β ν(ρπβ , f)
1− γ − λ(1− α)D(πβ , πc),
which indicates that with probability 1− δ J(M, πc) ≥ J(M, πβ)− ηc1 − η β 3 +λαD(πo, πβ) + λ(1− α)D(πo, πc)− λ(1− α)D(πβ , πc)
+ β
1− γ [ν(ρπo , f)− ν(ρπβ , f)],
where ηβ3 is some constant that depends on δ but is independent to β and λ.
To conclude, we can have that with probability 1− 2δ J(M, πo) ≥ max{J(M, πc) + ξ1, J(M, πβ) + ξ2} where
ξ1 = −ηc1 − ηc2 + (λ− λ0)(1− 2α)D(πo, πc) + [ λ0(1− 2α)− Cβ
1− γ
] D(πo, πc) (14)
and ξ2 = −ηc1 − η β 3 + λαD(πo, πβ)+λ(1− α)D(πo, πc)− λ(1− α)D(πβ , πc) (15)
+ β
1− γ [ν(ρπo , f)− ν(ρπβ , f)]. (16)
Moreover, as we noted earlier, ξ1 > 0 for a suitably selected λ and α < 12 . For the term ν(ρ πo , f)− ν(ρπβ , f) in ξ2 where ν(ρπ, f) is defined as Eρπ [ ρπ(s,a)−d(s,a)
df (s,a)
] , as noted in (Yu et al., 2021b),
ν(ρπβ , f) is expected to be smaller than ν(ρπo , f) in practical scenarios, due to the fact that the dynamics TM̂ learnt via supervised learning is close to the underlying dynamics TM on the states visited by the behavior policy πβ . This directly indicates that d πβ
M̂ (s, a) is close to dπβM(s, a) and ρ πβ
is close to d(s, a). In this case, let
= β[ν(ρπo , f)− ν(ρπβ , f)]
2λ(1− γ)D(πo, πβ) .
We can show that for α > 12 − ,
∆β =λαD(πo, πβ) + λ(1− α)D(πo, πc)− λ(1− α)D(πc, πβ) + β
1− γ [ν(ρπo , f)− ν(ρπβ , f)]
=λαD(πo, πβ) + λ(1− α)D(πo, πc)− λ(1− α)D(πc, πβ) + 2 λD(πo, πβ) =λ [(2 + α)D(πo, πβ) + (1− α)D(πo, πc)− (1− α)D(πc, πβ)] >λ(1− α)[D(πo, πβ) +D(πo, πc)−D(πc, πβ)] >0,
and ∆β increases with λ, which implies that J(M, πo) ≥ J(M, πβ) + ξ2 = J(M, πβ)− ηc1 − η β 3 + ∆β > J(M, πβ) for an appropriate choice of λ.

Review summaries:
The authors argue that offline meta-RL methods do not learn from poor data well, by demonstrating that COMBO (a single-task offline RL method) outperforms FOCAL (an offline meta-RL method) only when the training data is good. They use this to motivate a method called MerBO, which involves (1) learning a meta-dynamics model with proximal meta-RL and (2) updating a policy with real and synthetic data using a method called “RAC”, which is equivalent to COMBO but with an added KL regularizer against the behavior and meta-policy, and (3) updating the meta-policy used by RAC. The authors prove that under certain assumptions, the resulting policy will outperform both the meta-policy and the behavior policies. The authors compare the method to existing offline meta-RL methods and demonstrate that (1) the use of a dynamics model is important, (2) the addition of the behavior cloning regularizer is important, and (3) the use of the dynamics model is important to perform well on held-out offline RL tasks.

This paper proposes a model-based meta-RL approach to offline learning over a distribution of MDPs (offline meta-RL). The proposed method is inspired by COMBO and in fact is a direct extension of it to the multi-task setting. The extension involves meta-learning a model-initialisation (or prior) that can be rapidly adapted to new offline RL tasks. They further add a proximal RL policy-improvement operator, where the prior policy is meta-learned over the task distribution. They establish theoretical guarantees for their method and conduct a careful empirical investigation to motivate its design, while establishing that it provides additional benefits compared to relevant baselines. 

Targeting offline meta-reinforcement learning, the work proposes a model-based method called MerPO, with conservative value evaluation and individual policy improvement method with the tradeoff between the meta-policy and the behavior policy influence.  The main algorithm MerPO includes an initialization step and a two-loops meta-learning approach. The initialization step learns the model of the meta-model and dynamics for each task. With the fixed estimations of the models of tasks, the proposed merPO will alternatively update the policies for each task and the meta-policy.  The main contribution claimed in this paper is that the proposed method is a more robust method with the design of a regularization term involving the behavior policy, which improves the meta-learning policy when the behavior policy is actually better than the current meta-policy. Theoretical guarantees are displayed and experiments are conducted to show the performance of MerPO.

This paper considers the challenge in offline meta-RL problems, particularly, the difficulty with balancing a learned policy between exploring OOD state-actions by following the meta-policy and exploiting the offline dataset. To solve the problem, it starts with proximal meta-RL approach in the online setting, points out the problem of a degraded meta-policy in the offline setting due to lack of feedback from online interactions and proposes to regularize the task policy with additional penalty from deviating from the behaviour policy. It also integrates the model-based offline RL method for single tasks (COMBO) and offline meta-learning for task specific dynamics into its final form (MerPO). This paper provides theoretical analysis on its advantage over behaviour policy and the meta policy. Extensive experiments with ablation show the empirical performance meets its expected behaviour.