Model-based Lifelong Reinforcement Learning with Bayesian Exploration
Anonymous Author(s)
AffiliationAddress
Abstract
We propose a model-based lifelong reinforcement-learning approach that estimatesa hierarchical
Bayesian posterior distilling the common structure shared acrossdifferent tasks.
The learned posterior combined with a sample-based Bayesianexploration procedure increases the sample efficiency of learning across a familyof related tasks.
We first derive an analysis of the relationship between the samplecomplexity and the initialization quality of the posterior in the finite MDP setting.
We next scale the approach to continuous-state domains by introducing a Variational Bayesian Lifelong Reinforcement Learning algorithm that can be combinedwith recent model-based deep RL methods, and that exhibits backward transfer.
Experimental results on several challenging domains show that our algorithmsachieve both better forward and backward transfer performance than state-of-the-artlifelong RL methods.
Introduction
Reinforcement learning (RL) [42; 26] has been successfully applied to solve challenging individualtasks such as learning robotic control [11] and playing Go [38].
However, the typical RL settingassumes that the agent solves exactly one task, which it has the opportunity to interact with repeatedly.
In many real-world settings, an agent instead experiences a collection of distinct tasks that arrivesequentially throughout its operational lifetime; learning each new task from scratch is inefficient, buttreating them all as a single task will fail.
Therefore, recent research has focused on algorithms thatenable agents to learn across multiple, sequentially posed tasks, leveraging knowledge from previoustasks to accelerate the learning of new tasks.
This problem setting is known as lifelong reinforcementlearning [7; 50; 25].
The key questions in lifelong RL research are: How can an algorithm exploitknowledge gained from past tasks to quickly adapt to new tasks (forward transfer), and how can datafrom new tasks help the agent perform better on previously learned tasks (backward transfer)?
We propose to address these problems by extracting the common structure existing in previouslyencountered tasks so that the agent can quickly learn the dynamics specific to the new tasks.
Weconsider lifelong RL problems that can be modeled as hidden-parameter MDPs or HiP-MDPs [10; 27],where variations among the true task dynamics can be described by a set of hidden parameters.
Ouralgorithm goes further than previous work in both lifelong learning and HiP-MDPs by 1)
Separatelymodeling epistemic and aleatory uncertainty over different levels of abstraction across the collectionof tasks: the uncertainty captured by a world-model distribution describing the probability distributionover tasks, and the uncertainty captured by a task-specific model of the (stochastic) dynamics within asingle task.
To enable more accurate sequential knowledge transfer, we separate the learning processfor these two quantities and maintain a hierarchical Bayesian posterior that approximates them. 2)
Performing Bayesian exploration enabled by the hierarchical posterior: The method lets the agent actoptimistically according to models sampled from the posterior, and thus increases sample efficiency.
Specifically, we propose a model-based lifelong RL approach with Bayesian exploration that estimatesa Bayesian world-model posterior that distills the common structure of previous tasks, and then usesthis between-task posterior as a within-task prior to learn a task-specific model in each subsequenttask.
The learned hierarchical posterior model combined with sample-based Bayesian explorationprocedures can increase the sample efficiency of learning.
We first derive an explicit performancebound that shows that the task-specific model requires fewer samples to become accurate as theworld-model posterior approaches the true underlying world-model distribution for the discrete case.
We further develop Variational Bayesian exploration for Lifelong RL (VBLRL), a more scalableversion that uses variational inference to approximate the distribution and leverages Bayesian Neural
Networks (BNNs) [17; 3] to build the hierarchical Bayesian posterior.
VBLRL provides a novelway to separately estimate different kinds of uncertainties in the HiP-MDP setting.
Based on thesame framework, we also propose a backward transfer version of VBLRL that is able to provideimprovements for previously encountered tasks.
Our experimental results on a set of challengingdomains show that our algorithms achieve better both forward and backward transfer performancethan state-of-the-art lifelong RL algorithms when given only limited interactions with each task.
Background
RL is the problem of maximizing the long-term expected reward of an agent interacting with anenvironment [42].
We usually model the environment as a Markov Decision Process or MDP [36],described by a five tuple: ⟨ S, A, R, T, γ ⟩ , where S is a finite set of states; A is a finite set of actions;
R : S × A (cid:55)→ [0 , 1] is a reward function, with a lower and upper bound of 0 and 1 ; T : S × A (cid:55)→
Pr( S )is a transition function, with T ( s ′ | s, a ) denoting the probability of arriving in state s ′ ∈ S afterexecuting action a ∈ A in state s ; and γ ∈ [0 , 1) is a discount factor, expressing the agent’s preferencefor delayed over immediate rewards.
An MDP is a suitable model for the task facing a single agent.
In the lifelong RL setting, theagent instead faces a series of tasks m 1 , ..., m n , each of which can be modeled as an MDP:⟨ S ( i ) , A ( i ) , R ( i ) , T ( i ) , γ ( i ) ⟩ .
For lifelong RL problems, the performance of a specific algorithmis usually evaluated based on both forward transfer and backward transfer results [30]:
• Forward transfer : the influence that learning task t has on the performance in future task k ≻ t .
• Backward transfer : the influence that learning task t has on the performance in earlier tasks k ≺ t .
A key question in the lifelong setting is how the series of task MDPs are related; we model thecollection of tasks as a HiP-MDP, where a family of tasks is generated by varying a latent taskparameter ω drawn for each task according to the world-model distribution P Ω .
Each setting of ωspecifies a unique MDP, but the agent neither observes ω nor has access to the function that generatesthe task family.
The dynamics T ( s ′ | s, a ; ω i ) and reward function R ( r | s, a ; ω i ) for task i then dependon ω i ∈ Ω , which is fixed for the duration of the task.
The tasks are i.i.d.
sampled from a fixeddistribution and arrive one at a time.
Related work
The first category of lifelong RL algorithms learns a single model that encourages transfer acrosstasks by modifying objective functions.
EWC [28] imposes a quadratic penalty that pulls eachweight back towards its old values by an amount proportional to its importance for performance onpreviously-learned tasks to avoid forgetting.
There are several extensions of this work based on thecore idea of modifying the form of the penalty [29; 53; 33].
Another category of lifelong RL methodsuses multiple models with shared parameters and task-specific parameters to avoid or alleviate thecatastrophic problem [5; 24; 31].
The drawback of this method is that it is hard to incorporate theknowledge learned from previous tasks during initial training on a new task [31].
Nagabandi et al.[32] introduce a model-based continual learning framework based on MAML, but they focus ondiscovering when new tasks were encountered without access to task indicators.
Published HiP-MDP methods use Gaussian Processes [10] or Bayesian neural networks [27] to finda single model that works for all tasks, which may trigger catastrophic forgetting [5; 24].
MetaRL [47; 12] and multi-task RL [35; 43] settings also attempt to accelerate learning by transferringknowledge from different tasks.
Some work employs the MAML framework with Bayesian methods to learn a stochastic distribution over initial parameters [51; 16; 13].
Other work uses the collectedtrajectories to infer the hidden parameter, which is taken as an additional input when computing thepolicy [37; 56; 14].
Our method, however, focuses on problems where the tasks arrive sequentiallyinstead of having a large number of tasks available at the beginning of training.
This sequentialsetting makes it hard to accurately infer the hidden parameters, but opens the door for algorithms thatsupport backward transfer.
Some prior work uses Bayesian methods in RL to quantify uncertainty over initial MDP models [15;1; 18].
Several algorithms start from the idea of sampling from a posterior over MDPs for Bayesian
RL, maintaining Bayesian posteriors and sampling one complete MDP [41; 49] or multiple MDPs [2].
Instead of focusing on single-task RL, our algorithm aims to find a posterior over the commonstructure among multiple tasks.
Wilson et al.
[49] uses a hierarchical Bayesian infinite mixture modelto learn a strong prior that allows the agent to rapidly infer the characteristics of a new environmentbased on previous tasks.
However, it only infers the category label of a new MDP and only works indiscrete settings.
Model-based Lifelong Reinforcement Learning
Our approach is built upon two main intuitions: First, transferring the transition model instead ofpolicy/value function leads to more efficient usage of the data when “finetuning” on a new task.
As we show empirically in Section 5.1, although some model-free lifelong RL algorithms performbetter than the proposed model-based method in single-task cases, in lifelong RL setting of thesame task type the model-based method is still able to achieve comparable/better performance withonly half the amount of data.
Secondly, with a model that is able to capture different levels of theuncertainty within HiP-MDPs, an agent can employ sample-based Bayesian exploration to furtherimprove sample-efficiency.
The model underlying our approach is a hierarchical Bayesian posterior over task MDPs controlled bythe hidden parameter ω .
Intuitively, we maintain probability distributions that separately capture twocategories of uncertainty within lifelong learning tasks:
The world-model posterior P ( ω ) capturesthe epistemic uncertainty of the world-model distribution over all future and past tasks m 1 , · · · , m ncontrolled by the hidden parameter ω 1 , · · · , ω n ∼ P Ω .
As the learner is exposed to more and moretasks, this posterior should converge to the world-model distribution P Ω .
The task-specific posterior
P ( ω i ) captures the epistemic uncertainty of the current task m i
(Throughout the paper we will oftenwrite i for simplicity.).
As the learner is exposed to more and more transitions within the task, thisposterior should approach the true distribution corresponding to ω i , i.e. peaking at the true ω
i forthis specific task i , leaving only the aleatoric uncertainty of transitions within the task, which isindependent of other tasks.
Each time the agent encounters a new task, we initialize the task-specificmodel using the world-model posterior and further train it with data collected only from the new task.
One of our key insights here is that the sample complexity of learning a new task will decrease asthe initial prior of task-specific model approaches the true underlying distribution of the transitionfunction.
Thus, the agent can learn new tasks faster by exploiting knowledge common to previoustasks, thereby exhibiting positive forward transfer.
Specifically, we model the task-specific posterior via the transition dynamics usingp ( s t +1 , r t | s t , a t ; ω i ) .
The task-specific posterior, given a new state–action pair from task i , canbe rewritten via Bayes’ rule:
[Equation]
where D ti = { s 1 , a 1 , · · · , s t } is the agent’s history of task i until time step t .
The world-modelposterior, given the new data from task i , can be rewritten as:
[Equation]
where D 1: i denotes the agent’s history with all the experienced tasks 1 ∼ i until current task i .
Inparticular, each time when the agent faces a new task i and has not started updating its task specificposterior yet (that is, D ti = ∅ ), we first use the world-model posterior to initialize the task-specificprior: P ( ω i | D ti ) =
P ( ω | D 1: i ) .
The world-model distribution aims to approximate the underlying
P Ω .
The task-specific distribution aims to approximate the distribution that peaks at the true ω
i forthis specific task i .
In Section 4.1, we derive a sample complexity bound in the finite MDP case which explicitly showhow the distance between the distribution of a task’s true transition model and our task-specificmodel’s prior initialized by the parameters of the world-model posterior will affect the learningefficiency of a new task.
Then, in Section 4.2 and 4.3 we extend our high-level idea to a scalableversion that can be combined with recent model-based RL approaches and exhibits positive forward& backward transfer.
4.1 Sample Complexity Analysis
In this subsection, we consider the finite MDP setting and use a standard Bayesian explorationalgorithm BOSS [2] as a single-task baseline.
Note that BOSS creates optimism in the face ofuncertainty as the agent can choose actions based on the highest performing transition of the Kmodels sampled, which drives exploration.
We included explanations of the finite MDP version ofour algorithm BLRL (Bayesian Lifelong RL) based on BOSS in appendix C and simple experimentson Gridworlds in appendix L.
BLRL uses the world-model posterior P ( ω | D 1: i − 1 ) learned from previous i − 1 tasks to initialize(copy distribution) the task-specific prior of P ( ω i ) of new task i , aiming to decrease the numberof samples needed to learn an accurate task-specific posterior.
Our analysis focuses on how theproperties of the Bayesian prior affect the sample complexity of learning each specific task.
Let π ( ω i ) denote the prior distribution on the parameter space Γ .
We consider a set of transitionprobability densities p ( ·| ω i ) =
p ( s t +1 , r t | s t , a t , ω i ) indexed by ω i , and the true underlying density q .
We also denote the model family { p ( ·| ω i ) : ω i ∈ Γ } by the same symbol Γ .
Lemma 4.1.
The task-specific posterior in Equation 1 can be regarded as the probability densityg ( ω i ) with respect to π that attains the infimum of:
[Equation]
inf R n ( g ) controls the complexity of the density estimation process for g ( ω i ) .
Intuitively, Lemma 4.1converts the Bayesian posterior into an information theoretical minimizer that allows us to furtherinvestigate the relationship between the properties of the Bayesian prior and the risk/complexity ofattaining the posterior.
Proposition 4.2.
Define the prior-mass radius of the transition-probability densities as:
[Equation]
Intuitively, this quantity measures the distance between the Bayesian prior of the task-specific modeland the true underlying task-specific distribution.
Then, we adopt the same settings in Zhang [55]:∀ ρ ∈ (0 , 1) and η ≥ 1 , let
[Equation]
where ε upper,n is the critical upper-bracketing radius [55].
The decay rate of ε upper,n controls theconsistency of the Bayesian posterior distribution [2].
Let ρ = 12 , we have for all states and actions,h ≥ 0 and δ ∈ (0 , 1) , with probability at least 1 − δ ,
[Equation]
where π n ( ω i ) denotes the posterior distribution over ω after collecting n samples, X denotes the ncollected samples.
It functions the same as D t i in Equation 1.
Similar to BOSS, for a new MDP m ∗ ∼ M with hidden parameters ω m ∗ , we can define the Bayesianconcentration sample complexity for the task-specific posterior: f ( s, a, ϵ 0 , δ 0 , ρ 0 ) , as the minimumnumber u such that, if u IID transitions from ( s, a ) are observed, then, with probability at least 1 − δ 0 ,
[Equation]
Intuitively, the inequality means that for a model with the hidden parameter sampled from the learnedposterior distribution, the probability that that it is within ϵ 0 far away from the true model is largerthan 1 − ρ 0 .
Lemma 4.3.
Assume the posterior of each task is consistent (that is, ε upper,n = o (1) ) and set η = 2 ,then the Bayesian concentration sample complexity for the task-specific posterior
f ( s, a, ϵ, δ, ρ ) =
O (cid:16) d π +ln
ρ ϵ 2 δ − d π (cid:17) .
Proof (sketch).
This bound can be derived by directly combining Lemma 4.2 and Equation 7.
The above lemma suggests an upper bound of the Bayesian concentration sample complexity usingthe prior-mass radius.
We can further combine this result with PAC-MDP theory [39] and derive thesample complexity of the algorithm for each new task.
Proposition 4.4.
For each new task, set the sample size
K =
Θ( S 2 Aδ ln SAδ ) and the parametersϵ
= ϵ (1 − γ ) 2 , δ 0 = δSA , ρ 0 = δ S
A 2 K , then, with probability at least 1 − 4 δ , V t ( s t ) ≥ V ∗ ( s t ) − 4 ϵ 0in all
but ˜ O
( S
A 2 d π δϵ 3 (1 − γ ) 6 ) steps, where ˜ O ( · ) suppresses logarithmic dependence.
Proof (sketch).
The central part of the proof is Proposition 4.2 (detailed proof in appendix), andthe re- maining parts are exactly the same as those for BOSS.
In general, the proof is based onthe PAC-MDP theorem [40] combined with the new bound for the Bayesian concentration samplecomplexity we derived in Lemma 2.
For each new task, the main difference between BLRL and
BOSS is that we use the world-model posterior to initialize the task-specific posterior, which resultsin a new sample complexity bound with d π .
The result formalizes how the sample complexity of the lifelong RL algorithm will change withrespect to the initialization quality of the posterior: if we put a larger prior mass at a density closeto the true q such that d π is small, the sample efficiency of the algorithm will increase accordingly.
In other words, the sample complexity of our algorithm drops proportionally to d π , which is thedistance between the Bayesian prior of the task-specific model initialized by the parameters of theworld-model posterior and the true underlying task-specific distribution.
We provide a illustrativeexample in the appendix P.
4.2 Variational Bayesian Lifelong RL
The intuition from the last section is that, if we initialize the task-specific distribution with a prior thatis close to the true distribution, sample complexity will decrease accordingly.
To scale our approach,we must find a efficient way to explicitly approximate these distributions.
We propose a practicalapproximate algorithm, VBLRL, that uses neural networks and variational inference [21].
We choose Bayesian neural networks (BNN) to approximate the posterior.
The intuition is that, in thecontext of stochastic outputs, BNNs naturally approximate the hierarchical Bayesian model since theyalso maintain a learnable distribution over their weights and biases [17; 23].
We use the uncertaintyembedded in the weights and biases of networks to capture the epistemic uncertainty introducedby hidden parameters of different tasks, while we also set the outputs of the neural networks to bestochastic to capture the aleatory uncertainty within each specific task.
In our case, the BNN weightsand biases distribution q ( ω ; ϕ ) (a distribution over ω but parameterized by ϕ ) can be modeled as fullyfactorized Gaussian distributions [3]:
[Equation]
(8) where ϕ
= { µ, σ } , and µ is the Gaussian’s mean vector while σ is the covariance matrix diagonal.
We maintain a world-model BNN across all the tasks and a task-specific BNN for each task.
The inputfor all the BNNs is a state–action pair, and the output are the mean and variance of the prediction forreward and next state.
Then, the posterior distribution over the model parameters can be computedleveraging variational lower bounds [22; 23]:
[Equation]
where p ( ω ) represents the fixed prior distribution of ω , also recall that D t
= { s 1 , a 1 , r 1 , · · · , s t } .
In
VBLRL, p ( ω ) for the task-specific distribution is initialized by the world-model distribution, whilep ( ω ) of the world-model distribution is simply set to a Gaussian.
(That could be improved withmore informed task family knowledge.)
The second term on the right hand side can be approximatedthrough 1 N (cid:80)
Ni =1 log p ( s t +1 , r t | D t , a t ; ω i ) with N samples from ω i ∼ q ( ϕ ) .
This optimization canbe performed in parallel for each s , keeping ϕ t − 1 fixed.
Details about our BNN structure can befound in appendix B.
Once we have the world-model as well as the task-specific posterior model, we can do posterior sampling to drive Bayesian exploration.
Osband et al.
[34] and Rakelly et al.
[37]already show the benefit of posterior sampling for improving sample efficiency in singletask RL and meta-RL settings.
Here, instead of sampling from the posterior of value functions or latent context representations, we directly sample from the posterior of the transitionmodel and choose the optimal action based on the transition samples.
Then we use the collected samples to update the posterior and do sampling again.
The agent thus continually do
Bayesian exploration and acts more and more optimally as the posterior distribution narrows.
[Figure]
to achieve randomness in transitions.
We provide the framework of VBLRL in Figure 1.
The outer loop (yellow rectangle) standsfor the loop of training world-model BNN acrosstasks (noted at the bottom-right corner), the inner loop (cyan rectangle) stands for the trainingof the task-specific BNN within each specifictask.
We employ our posterior knowledge models in the context of a model-based RL method.
When encountering a new task, VBLRL firstuses the model parameters (that is, { µ, σ } ofweights and biases of BNN) from the generalknowledge model to initialize the task-specificposterior network (directly copy parameters).
We sample transitions from the task-specific posterior and select actions based on the generatedtransitions.
The detailed algorithm is summarized in Algorithm 1.
Specifically, for planning,at each step we begin by creating P particlesfrom the current state s pτ =
t =
s t ∀ p .
Then, wesample N candidate action sequences a t : t + T 255 from a learnable distribution.
These two steps are the same as PETS [8].
Then we propagate thestate–action pairs using the learned task-specific model
p m i ( ·| s, a ) (BNN) and use the cross entropymethod [4] to update the sampling distribution to make the sampled action sequences close to previousaction sequences that achieved high reward.
We further calculate the cumulative reward estimated(via the learned model) for previously sampled sequences and select the current action based onthe mean of that distribution.
By sampling from the task-specific posterior at each step, the agentexplores in a temporally extended and diverse manner.
For each specific task, we use the task-specific BNN to plan during forward learning.
They areupdated with only the data from the current task thus avoid catastrophic forgetting in the forwardtransfer process.
The world model is updated using the data from all the visited tasks.
The intuition isto guide the two posteriors to separately learn two categories of uncertainty within lifelong learningtasks.
The world-model posterior captures the epistemic uncertainty of the general knowledgedistribution (shared across all tasks controlled by the hidden parameters) via the internal variance ofworld-model BNN.
As the learner is exposed to more and more tasks, the posterior should convergeto P Ω .
The task-specific posterior captures the epistemic uncertainty of the current task m i , whichcomes from the aleatory uncertainty of the world model when generating ω i for a new task, via theinternal variance of task-specific BNN.
We provide additional illustration in Figure 8.
In general,we used the world-model BNN to encode P Ω over a family of tasks, and the task-specific BNN toencode P ( ω i ) , which should peak at the specific true ω i sampled for the current task.
Note that in single-task cases, other CEM-based algorithms like PETS usually maintain a set of neuralnetworks using the same training data, and sample action sequences from each of the neural netsto achieve randomness in transitions.
However, in lifelong RL settings, it is unrealistic to maintain
( ≥ 30 ) models for each task encountered.
Our usage of BNNs avoids such problems as we onlyhave to train one neural network using the same data for each task, and we can sample an unlimitednumber of different action sequences to cover more possibilities as needed.
In PETS, the epistemicuncertainty is estimated via the variance of the output mean of different neural networks, while, in
VBLRL, it is estimated via the variance of the weights and biases distribution of the BNN.
4.3 Backward Transfer of Variational Bayesian Lifelong RL
In our lifelong RL setting, the agent interacts with each task for only a limited number of episodesand the task-specific model stops learning when the next task is initiated.
As a result, there mayexist portions of the transition dynamics in which model uncertainty remains high.
However, as theworld-model posterior continues to train on new tasks, it gathers more experience in the whole statespace and can provide improved guesses concerning the “unknown" transition dynamics, even forpreviously encountered tasks.
Intuitively, the performance of an agent on one task has the potential to be further improved (positivebackward transfer) if there exists a sufficiently large set of state–action transition pairs of which thetask-specific model’s predictions are not confident due to lack of data.
In our algorithm, the aleatoryuncertainty (irreducible chance in the outcome) is measured by the output variance of the prediction{ σ r pτ , σ s pτ } , and the epistemic uncertainty (due to lack of experience) corresponds to the uncertaintyof the output mean and variance (see Definition 1 below).
Thus, a straightforward method to improvea previously learned task-specific model is to find the predictions it needs to make that have highepistemic uncertainty, and replace them with the predictions from the world-model posterior, whichhas lower epistemic uncertainty.
If we only consider reward prediction, the quantity for measuringwhether a task-specific/world model is sufficiently confident is as follows.
Definition 4.5.
For a given state–action pair ( s, a ) , we define the confidence level c of the predictions(reward) r pτ ( s, a ) from a task-specific/world model as:
[Equation]
where P is the number of particles and α is a hyperparameter controlling the scale of the second term.
A similar definition applies to the task-specific/world model’s next-state prediction.
Intuitively, cmeasures the uncertainty of the output mean and variance for each dynamic prediction.
During CEMplanning, we propagate each pair of P state particles with different network parameters thanks tothe usage of BNN, resulting in P different { µ r pτ , σ r pτ } .
Thus we can further calculate the confidencelevel of current predictions based on these P pairs of output mean and variance.
We show the detailed backward transfer algorithm in Algorithm 2.
Compared with the forwardtraining version, the agent will also calculate the confidence level of the task-specific and generalknowledge model for each particular transition and compare the value of them when predictingthe state particles.
If the task-specific model is not confident enough for this state–action pair (i.e.c m i < c wm ), we will use the world-model to do the predictions instead.
Experiments
5.1 OpenAI Gym MuJoCo Domains
We evaluated the performance of VBLRL on HiP-MDP versions of several continuous control tasksfrom the Mujoco physics simulator [45], HalfCheetah-gravity, HalfCheetah-bodyparts, Hoppergravity, Hopper-bodyparts, Walker-gravity, Walker-bodyparts , all of which are lifelong-RL benchmarks used in prior work [31].
For each of six different domains, the task-specific hidden parameterscorrespond to different gravity values or different sizes and masses of the simulated body parts.
Details can be found in the appendix.
Compared with prior work, we substantially reduced thenumber of iterations that the agent can sample and train on: 100 iterations for each task and a horizonof 100 (Halfcheetah) or 400 (Hopper & Walker) for each iteration.
We used such settings to increasethe difficulty of lifelong learning and test the sample efficiency of lifelong RL algorithms, given thatit is hard for a single-task training algorithm to obtain a good policy within such limited numberof interactions with the environments.
However, we show in appendix I and J that, as the agent is exposed to more and more tasks, our lifelong learning agent is able to achieve similar performance tothat of more fully trained single-task agents while requiring far fewer per-task samples
[Table]
We compared VBLRL against: 1.
state-of-the-art lifelong RL method LPG-FTW [31], 2.
EWC [28],which is a single-model lifelong RL algorithm that achieves comparable performance with LPG-FTWas shown in the latter paper, 3.
single-task Model-Based RL (using the same BNN structure andplanning procedures), which stands for training the agent from scratch for each new task and do notuse the world model to initialize the task-specific model, 4.
T-HiP-MDP [27], which is a model-basedlifelong RL baseline.
For a fair comparison, we further replaced the DDQN algorithm [46] usedin T-HiP-MDP with CEM planning, and let the transition model also predict the reward for eachstate–action pair.
This modified baseline is similar to the single-model version of VBLRL (i.e., onlyusing the world-model posterior across all the tasks).
Moreover, LPG-FTW and EWC are built upona relatively simple policy gradient baseline, which does not perform as well as our model-basedbaseline in the single-task setting within the same amount of interactions.
Thus, we let them collecttwice the amount of samples each iteration compared to VBLRL.
We show in Appendix I that, withsuch modifications, in single-task settings the baselines achieve better or at least similar performancecompared to the single-task version of VBLRL.
The results are shown in Table 1 and Figure 7 in Appendix J. For all six domains, we report theaverage performance of all the tasks at the beginning of training ( Start ) and after all training foreach new task ( Train ), as well as the average performance for all previous tasks after training fora given number of tasks, which is our backward transfer test ( Back ).
As shown in the results, our
VBLRL shows better performance on all three test stages of the HalfCheetah domain and Walkerdomain, as well as better backward transfer performance on Hopper-gravity and Hopper-bodypartsthan the other three algorithms.
Comparing Figure 6 and Figure 7, we find that, in the Hopperdomains, even though the single-task baseline used by LPG-FTW and EWC performed much betterthan VBLRL after we let them collect 2 × samples each iteration, VBLRL still achieves comparableperformance with LPG-FTW and EWC in lifelong RL experiments, suggesting that VBLRL iscapable of making better use of the data in the lifelong learning setting.
In the walker domainswhere the single-task baselines achieved similar performance, VBLRL shows significantly betterperformance than LPG-FTW/EWC in lifelong RL experiments.
These comparisons also suggestthat VBLRL’s lifelong learning performance may be further improved when combined with bettermodel-based deep RL algorithms, like Dreamer [20].
EWC fails in some of the tasks as it is hardto directly learn a single shared policy that achieves good performance when the tasks are highlydiverse.
T-HiP-MDP shows good results on some of the tasks because it is more sample-efficient inlearning a shared model across all the tasks and more easily captures the world-model uncertainty.
However, it cannot achieve as good performance as VBLRL as it is hard to model the task-specificuncertainty using only one model across all tasks, which also leads to negative backward transferperformance on tasks like Cheetah-Gravity.
Comparing VBLRL’s performance on the Train stageand Back stage, we also find that it shows positive backward transfer results on most tasks, withoutshowing patterns of catastrophic forgetting.
Overall, VBLRL’s world-model posterior contributesto better forward transfer performance ( Start ), the learning of task-specific posterior contributes to better forward transfer training for each new task ( Train ), and the combination of these two posteriorsguides the agent to achieve better backward transfer performance ( Back ).
Comparing our methodto LPG-FTW and EWC highlights the advantage of model-based techniques for sample efficiencyin lifelong RL setting, while comparing to T-HiP-MDP and single-task MBRL demonstrates theimportance of estimating both global and local uncertainty.
5.2 Meta-world Domains
[Figure]
Meta-World [52] contains a suite of challengingevaluation benchmarks on a robotic SAWYERarm.
We evaluated the performance of VBLRLas well as the baselines on two Meta-World tasksets: Reach and Reach-Wall following the settingsgiven by [54].
We used the v1 version of MetaWorld, with state observations and dense versionsof the reward functions.
The hidden parametersin these cases are the goals we want the robot toreach, which controls the reward functions andare not included in the agent’s observation space.
We measured performance in terms of averagecumulative rewards across tasks.
As shown in Figure 2, VBLRL achieves significantly higherperformance than the other baselines.
VBLRL-Backward denotes VBLRL’s average backwardtransfer performance on all the tasks and is higher than the final performance of VBLRL’s forwardtraining in both tasks, suggesting that our approach can achieve positive backward transfer.
We alsoinclude experimental results on MT10 and MT50 domains of Meta-World in Appendix H, which arenot typical HiP-MDP settings but have more challenging variations between different tasks.
5.3 Ablation Study
[Figure]
This section evaluates the essentiality of VBLRL’scomponents.
As shown in Figure 3 left, we testeddifferent backward transfer strategy for VBLRL.
Task-specific-Backward denotes the performanceif directly using the learned task-specific model todo all the predictions without using world model.
World-model-Backward denotes the performanceif using world-model to do all the predictions without using each task-specific model.
Compared tothese baselines, VBLRL’s backward transfer strategy achieves the best performance by combiningthese two kinds of models according to their confidence level.
We also explored the influence ofusing a Bayesian neural network to model the taskspecific model.
As shown in the right side of the figure, using BNN enables faster adaptation to newtasks compared with using regular neural networks (VBLRL-Deterministic).
We also include ablationstudies on the number of particles in CEM planning in Appendix O.
Conclusion
To improve sample efficiency in lifelong RL, our work proposed a model-based lifelong RL approachthat distills shared knowledge from similar MDPs and maintains a Bayesian posterior to approximatethe distribution derived from that knowledge.
We gave a sample-complexity analysis of the algorithmin the finite MDP setting.
Then, we extended our method to use variational inference, which scalesbetter and supports both backward and forward transfer.
Our experimental results show that theproposed algorithms enable faster training on new tasks through collecting and transferring theknowledge learned from preceding tasks.
Further discussions can be found in Appendix Q.
Checklist
For all authors...
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s
contributions and scope?
[Yes]
(b) Did you describe the limitations of your work?
[Yes]
(c) Did you discuss any potential negative societal impacts of your work?
[N/A]
(d) Have you read the ethics review guidelines and ensured that your paper conforms to
them?
[Yes]
If you are including theoretical results...
(a) Did you state the full set of assumptions of all theoretical results?
[Yes](b) Did you include complete proofs of all theoretical results?
[Yes]3.
If you ran experiments...
(a) Did you include the code, data, and instructions needed to reproduce the main experi-
mental results (either in the supplemental material or as a URL)?
[Yes]
(b) Did you specify all the training details (e
g., data splits, hyperparameters,
how they
were chosen)?
[Yes]
(c) Did you report error bars (e
g., with respect to the random seed after running experi-
ments multiple times)?
[Yes]
(d) Did you include the total amount of compute and the type of resources used (e.g., type
of GPUs, internal cluster, or cloud provider)?
[Yes]
If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
(a) If your work uses existing assets, did you cite the creators?
[N/A]
(b) Did you mention the license of the assets?
[N/A]
(c) Did you include any new assets either in the supplemental material or as a URL?
[N/A]
(d) Did you discuss whether and how consent was obtained from people whose data you’re
using/curating?
[N/A]
(e) Did you discuss whether the data you are using/curating contains personally identifiable
information or offensive content?
[N/A]
If you used crowdsourcing or conducted research with human subjects...
(a) Did you include the full text of instructions given to participants and screenshots, if
applicable?
[N/A]
(b) Did you describe any potential participant risks, with links to Institutional Review
Board (IRB) approvals, if applicable?
[N/A]
(c) Did you include the estimated hourly wage paid to participants and the total amount
spent on participant compensation?
[N/A]
A
VBLRL algorithm
Input: Initialize general knowledge(world) model p wm ( ·| s, a ; ω wm ) , planning horizon T for each task m i from i = 1 , 2 , 3 , · · · , M do
Initialize task-specific model
p
m i ( ·| s, a ; ω i ) with parameters of general knowledge model p wm for each episode do for Time t = 0 to TaskHorizon do
Sample Actions a t : t + T ∼ CEM( · )
Propagate state particles s pτ with p m i ( s ′ | s, a ; ω i )
Evaluate actions as (cid:80) t + T τ = t 1 P (cid:80)
Pp =1 p m i ( r | s, a ; ω i )
Update CEM( · ) distribution.
Execute optimal actions a ∗ t : t
+ T end for
Add transitions to replay buffer D
m i
Update task-specific model according to Equation (9) given replay buffer D
m i
Update general knowledge model according to Equation (9) given replay buffers { D m 1 , · · · , D m i } end for end for
Note that in p m i ( ·| s, a ; ω i ) and p m wm ( ·| s, a ; ω wm ) , p stands for the task-specific/world probabilisticmodel we are using.
In s pτ and (cid:80) t + T τ = t 1 P (cid:80) Pp =1 r pτ , p denotes one of the state particles p ∈ { 1 , · · · , P } .
At the beginning of training (before encountering any tasks), the agent first randomly initializethe weights and bias of the world-model BNN p wm ( ·| s, a ; ω wm ) .
Then each time when the agentencounters a new task, the task-specific model
p
m i ( ·| s, a ; ω i ) for that task will be initialized bycopying network parameters from the world-model BNN.
Then for planning, at each step we beginby creating P particles from the current state s pτ =
t =
s t ∀ p .
Then, we sample N candidate actionsequences a t : t + T from a learnable distribution.
These two steps are the same as PETS [8].
Then wepropagate the state–action pairs using the learned task-specific model
p m i ( ·| s, a ) (BNN) and use thecross entropy method [4] to update the sampling distribution to make the sampled action sequencesclose to previous action sequences that achieved high reward.
We further calculate the cumulativereward estimated (via the learned model) for previously sampled sequences and select the currentaction based on the mean of that distribution.
Then we can add the new transitions to the replay buffer.
We update the task specific model according to Equation (9) by sampling from the replay buffer ofthe current task, and update the world model with samples from all previous tasks’ replay buffers.
Algorithm
Input: Test task m i , planning horizon T , task-specific model p
m i ( s ′ , r | s, a ; ω i ) , generalknowledge model p wm ( s ′ , r | s, a ; ω wm ) for Time t = 0 to TaskHorizon do for Trial k = 1 to K do
Sample Actions a t : t + T ∼ CEM( · ) for each action do
Propagate state particles s pτ with p m i ( s ′ , r | s, a )
Propagate state particles s pτ with p wm ( s ′ , r | s, a )
Compute confidence level c m i for task-specific model and c wm for general-knowledge model ( Definition 4.5 )
Choose the propagation results from the model with higher confidence level c end for
Evaluate actions as (cid:80) t + T τ = t 1 P (cid:80) P p =1 r p τ
Update CEM( · ) distribution.
end for
Execute optimal actions a ∗ t : t
+ T end for
For backward transfer, given a previously encountered task m i , at each planning step we predictthe next state and reward with both task-specific model and world model.
Then we compare theconfidence level of these two predictions and choose to use the prediction results that have higherconfidence level.
The other planning procedures are the same as in forward training.
B BNN model
The form of the BNN we used is the same as in VIME [23].
We model the transition models as
Gaussian distributions:
[Equation]
[Equation]
The function f θ is represented as a Bayesian neural network parameterized by θ , which is furthermodeled as the posterior distribution parameterized by ϕ , predicts the mean µ s , µ r and varianceσ s , σ r given current state and action s, a .
We can view the BNN model in VBLRL as an infiniteneural network ensemble by integrating out its parameters:
[Equation] [Equation]
Compared to previous model-based algorithms that use finite number of neural network ensembles(e.g.
PETS), our choice of BNN is more suitable for lifelong RL as we only need to maintain oneneural network for each task, and we can sample an unlimited number of predictions from it whichbetter estimates the uncertainty and is essential in our setting where both dynamic function andreward function are not given unlike prior model-based RL methods.
C BLRL algorithm
Note that the single-task baseline that BLRL is built upon is BOSS, and could be replaced byother Bayesian-exploration RL algorithm .
We use a hierarchical Bayesian model to represent thedistribution over MDPs.
Figure 4 shows our generative model in plate notation .
Ψ is the parameterset that represents distribution P Ω .
It functions as the world-model posterior that aims to capture thecommon structure across different tasks.
The resulting MDP m i is created based on ω i , which is onehidden parameter sampled from Ψ .
We can sample from our approximation of Ψ to create and solvepossible MDPs.
[Figure]
The full algorithm is shown in Algorithm 3.
Each time the agent encounters a new task m i , itfirst initializes the task-specific posterior p m i ( ·| s t , a t ) with the parameter values from the currentworld-model posterior p wm , and then, for each timestep, selects actions following sampling-based
Bayesian exploration procedures from this posterior [44; 2].
A set of sampled MDPs drawn fromp m i is a concrete representation of the uncertainty within the current task.
Concretely, BLRL samples K models from the task-specific posterior whenever the number oftransitions from a state–action pair has reached threshold B .
Analogously to RMAX [6], we call astate–action pair known whenever it has been observed N s t ,a t = B times.
For each state–action pair,if it is known , we use the task-specific posterior to sample the model.
If it is unknown , we insteadsample from the world-model posterior.
These models are combined into a merged MDP m # i and
BLRL solves m # i with value iteration to get a policy π ∗ m # i .
Intuitively, this approach creates optimism in the face of uncertainty as the agent can choose actions based on the highest performing transitionof
the K models sampled, which drives exploration.
The new policy π ∗ m # i will be used to interactwith the environment until a new state–action pair reaches the sampling threshold.
The collectedtransitions from the current task will be used to update the task-specific posterior immediately, whilethe world-model posterior will be updated using transitions from all the previous tasks at a slowerpace.
For simple finite MDP problems in practice, we use the Dirichlet distribution (the conjugate forthe multinomial) to represent the Bayesian posterior.
Thus, the updating process for the posterioris straightforward to compute.
Intuitively, BLRL rapidly adapts to new tasks as long as the prior ofthe task-specific model (that is, the world-model posterior) is close to the true underlying model andcaptures the uncertainty of the common structure of a set of tasks.
Empirical evaluations of BLRL ongridworlds are given in the appendix.
Algorithm
Input: K , B initialize MDP set, the world-model posterior p wm ( s t +1 , r t | s t , a t ) for each MDP
m i do
N s,a ← 0 , ∀ s, a do _ sample ← TRUE initialize the task-specific posterior p m i ( s t +1 , r t | s t , a t ) ← p wm ( s t +1 , r t | s t , a t ) for all timesteps t = 1 , 2 , 3 , ... do if do _ sample then
Sample K models m i 1 , m i 2 ,···, m i K from the task-specific posterior p m i ( s t +1 , r t | s t , a t ) .
Merge the models into the mixed MDP m # i
Solve m # i to obtain π ∗ m # i do _ sample ← FALSE end if
Use π ∗ m # i for action selection: a t ← π m # i ( s t ) and observe reward r t and next state s t +
N s t ,a t ← N s t ,a
D Experimental Setting
D.1 OpenAI Gym Mujoco Domains
Similar to [31], we evaluated on the HalfCheetah, Hopper, and Walker-2D environments.
For thegravity domain, we select a random gravity value between 0 .
5 g and 1 .
5 g for each task.
For thebody-parts domain, we set the size and mass of each of the four parts of the body (head, torso, thigh,and leg) to a random value between 0 .
5 × and 1 .
5 × its nominal value.
As shown in Appendix Cof [31], these changes lead to highly diverse tasks for lifelong RL.
Further, as required by CEM-baseddeep RL methods [48], we added a check-done function for Hopper and Walker following the settingsin previous paper.
When implementing VBLRL, we found that in the first few episodes of each new tasks, the agenthasn’t collected enough samples of the new task, which results in overfitting problems when trainingthe task-specific.
Thus, we use the world-model posterior instead to do the first few rounds ofpredictions and let the task-specific model begin training after collecting enough samples.
Theworld-model has lower possibility of overfitting as its training data comes from all the previous tasksand has much larger quantity.
The results shown in the experiments section are collected after thetask-specific model starts collecting samples.
We list the other implementation details below.
Theplanning horizons are selected from values suggested by previous model-based RL papers [8; 48].
[Figure]
For LPG-FTW and EWC, we use the original source code 1 with parameters and model architecturessuggested in the original paper.
Specifically, we select step size from { 0 . 005 , 0 . 05 , 0 . 5 } .
For LPGFTW, e use λ = 1 e − 5 , µ = 1 e − 5 and select k from 3,5,10.
For EWC, we select λ from{ 1 e − 6 , 1 e − 7 , 1 e − 4 } .
For HiP-MDP baseline, we modify the original algorithm for a faircomparison.
We replace the DDQN algorithm used in T-HiP-MDP with the exact same CEMplanning method we used in VBLRL as well as the same parameters.
And we use the same modelarchitecture of Bayesian Neural network by modifying the baseline algorithm to also predict rewardfor each state-action pair (the original method only considers next-state prediction).
For BOSS and BLRL, we set the number of sampled models K = 5 , and γ = 0 .
95 , ∆ = 0 .
01 forvalue iteration.
We reported the results averaged over three random seeds, and the error bar shows one standarddeviation.
All experiments were run on our university’s high performance computing cluster.
One of the limitations of the current experiments is that we did not evaluate our algorithm onimage-based environments.
We leave this for future work.
D.2 Meta-World Domains
The hyperparameters used are included in Table 4.
D.3 Grid-World Item Searching
Our testbed consists of a collection of houses, each of which has four rooms.
The goal of eachtask is to find a specific object (blue, green or purple) in the current house.
The type of each roomis sampled based on an underlying distribution given by the environment.
Each room type has acorresponding probability distribution of which kind of objects can be found in rooms of this type.
Different tasks/houses vary in terms of which rooms are which types and precisely where objects arelocated in the room (the task’s hidden parameters).
Room types are sampled from a joint distribution.
[Table]
D.4 Box-jumping Task
We use a simplified version of jumping task [9] as a simple testbed for the proposed algorithm
VBLRL.
We select a random position of obstacle between 15 ∼ 33 for each task.
The 4-element state vector describes the ( x, y ) coordinates of the agent’s current position, and its velocity in the x and
[Table]
y directions.
The agent can choose from two actions: jump and right.
The reward function for thisbox-jumping task is:
[Equation]
t reach the right wall
[Equation]
−
[Equation]
t
[Equation]
hit the obstacle
[Equation]
˙
[Equation]
t [Equation] not hit the
[Equation]
E Proof for Lemma 4.1
In the following proofs as well as in the main text, n and T both denote the number of samplescollected from the environment.
We first rewrite the Bayesian posterior density g ( ω | D Ti ) with respect to π as:
[Equation]
Then, we refer to the following lemma [55] which is a known information-theoretical inequality:
Lemma E.1.
Assume that f ( ω ) is a measurable real-valued function on Γ , and g ( ω ) is a densitywith respect to π ; we have
[Equation]
We refer the readers to the original paper for detailed proof.
Based on the definition of R n ( g ) , we have:
R n ( g ) =
E π g ( ω i )
T
[Equation]
=
[Equation]
(cid:81)
[Equation]
[Equation] ) (cid:81) Tt =
[Equation]
t +1 , r t | D
[Equation]
t )
T (cid:88) t =
ln
[Equation]
( s t +1 , r t | D ti , a t ) p ( s t +1 , r t | D ti , a t ; ω i )
+ E π (cid:81)
Tt =1 p ( s t +1 , r t | D ti , a t ; ω i ) (cid:81) T t =1 q ( s t +1 , r t | D t i , a t )
T (cid:88) t =
ln p ( s t +1 , r t | D ti , a t ; ω i ) q
( s t +1 , r t | D ti , a t ) =
E π (cid:81) Tt =1 p ( s t +1 , r t | D ti , a t ; ω i ) (cid:81)
Tt =
1 q ( s t +1 , r t | D ti , a t ) (cid:104) ln (cid:81) Tt =
1 q ( s t +1 , r t | D ti , a t ) (cid:81) Tt =1 p ( s t +1 , r t | D ti , a t ; ω i ) − ln
(cid:81)
Tt =
1 q ( s t +1 , r t | D ti , a t ) (cid:81) Tt =1 p ( s t
[Equation]
Then, let f ( ω ) =
− (cid:80) Tt =
1 ln q ( s t +1 ,r t | D ti ,a t ) p ( s t +1 ,r t | D ti ,a t ; ω ) in Lemma E.1, we have
[Equation]
Combine Equation 16 and 17, we have that
[Equation]
Thus, we have that g ( ω ) attains the infimum of R n ( · ) .
F Proof for Proposition 4.2
In general, instead of using the critical prior-mass radius ε π,n to describe certain characteristics ofthe Bayesian prior as in Corollary 5.2 of Zhang [55], we define and use the prior-mass radius d π in
Proposition 4.2, which is independent of the sample size n and measures the distance between theprior and true distribution.
Firstly, by definition of KL divergence: As T → ∞ , in Lemma 4.
[Equation]
Then, we use n instead of T to denote the number of samples collected, and we rewrite the originalform for infimum of R n ( · ) as:
[Equation]
Given Equation (19) and Following [55], we define the Bayesian resolvability as
[Equation]
Intuitively, the Bayesian resolvability controls the complexity of the density estimation process.
Based on this definition and our previous definitions of d π , we can derive a simple and intuitiveestimate of the standard Bayesian resolvability.
Lemma F.1.
The resolvability of standard Bayesian posterior defined in (20) can be bounded as
[Equation]
proof.
For all d > 0 , we have
[Equation]
This bound links the Bayesian resolvability to the number of samples n and prior-mass radiusd π which is a fixed property of the density given a specific prior and the true underlying density.
Intuitively, the Bayesian posterior is better behaved when the Bayesian prior is closer to the truedistribution ( d π is smaller) and more samples are used (n is larger).
Now we can prove the main theorem of Lemma 1.
Let ρ = 12 , ϵ h
= 2 ε n +(4 η − 2)
h δ/, define Γ 1 ={ p ∈ Γ : D Reρ ( q || p ) <
ϵ h } and Γ 2 = { p ∈ : D Reρ ( q || p ) ≥ ϵ h } .
We let a = e − nh and defineπ ′
( θ ) =
aπ ( θ ) C when θ ∈ Γ 1 and π ′ ( θ ) C when θ ∈ Γ 2 , where the normalization constant
C =
( aπ (Γ 1 ) + π (Γ 2 ))
− 1 ∈ [1 , 1 /a ] .
Firstly,
[Equation]
according to the Markov inequality (with probability at least 1 − δ ) and Pinsker’s inequality.
Then,according to Theorem 5.2 and Proposition 5.2 in Zhang’s paper,
[Equation]
ρ )
[Equation]
upper
[Equation]
Then, using the definitions of d π , we further obtain
E X π ′ (Γ 2 | X )
ϵ h
[Equation] [Equation]
We use η instead of γ which is used in the original paper to avoid confusion with the discount factor.
Then, we further divide both sides by ϵ h and obtain π ′ (Γ | X ) ≤ 0 .
Then, by definition,
[Equation]
Thus, we get the desired bound.
G Proof for Proposition 4.
The result shown in Proposition 4.4 can be derived simply by replacing the Bayesian concentrationsample complexity term in BOSS with the result in Lemma 4.3.
So the central part is the proof of
Proposition 4.2, which we already did.
The other parts are the same
H Further experiments on MetaWorld
We include additional experiments on MT10 and MT50 domains of MetaWorld in Figure 10.
MT10and MT50 consist of 10 and 50 different categories of manipulation tasks, including reach, push,drawer close, button press etc. 2 , and is a highly difficult setting for multi-task RL.
We modifiedthese two domains to be lifelong learning settings: instead of getting all 10/50 tasks at the sametime at the beginning, we let them arrive sequentially.
For instance, the first task is “reach” andwe let the agent interact with it for 150 iterations, and then switch to “push” and the agent cannotcollect data from “reach” anymore, after another 150 iterations the task changes to “pick-place”, etc.
We compare the results with LPG-FTW, T-HiP-MDP as well as Single-task MBRL (train the agentfrom scratch for each new task without using the world-model posterior to initialize the task specificmodel).
The total running time on MT50 is around 48 hours on a Nvidia Geforce RTX 3090 GPU.
With the limited number of interactions for each task, our proposed algorithm is still able to achievereasonably good performance in such settings.
In MT10, the total number of tasks (10) is relativelysmall so the world-model distribution may be far from accurate, but VBLRL still performs better than
Single-task MBRL which does not use the world model to initialize the task-specific model.
In MT50,the number of tasks is large enough (50) and we can see that VBLRL significantly outperforms allthe other baselines.
This is consistent with our intuition that sample efficiency improves in the taskspecific regime when the world model approaches the environment distribution.
As the single-taskmodel-based RL baseline we used here is relatively simple (CEM planning) to be comparable with thesingle-task baseline used by LPG-FTW, it is reasonable to expect the lifelong learning performanceto be even better after combining our framework with model-based methods like Dreamer [20]; weleave such evaluations for future work
[Figure]
I Single-task baseline comparison on Mujoco domain
In this section, we compare the performance of the single-task version of our algorithm with thesingle-task version of LPG-FTW/EWC.
Note that to make it a fair comparison, we let the model-freesingle-task RL baseline used by LPG-FTW/EWC collect 2 .
× more samples (interactions with theenvironment) than VBLRL as in the lifelong learning setting.
[Figure]
J Full lifelong RL comparison on Mujoco domain
As LPG-FTW and EWC are built upon a model-free RL baseline with relatively lower sampleefficiency, we let LPG-FTW/EWC collect 2 .
× more samples (interactions with the environment)than VBLRL as in the single-task learning setting.
Comparing Figure 6 and Figure 7, we findthat in the Hopper domains, even though the single-task baseline used by LPG-FTW and EWCperforms much better than VBLRL after we let them collect 2 × samples each iteration, in lifelong RLexperiments VBLRL still achieves comparable performance with LPG-FTW and EWC.
In the walkerdomains where the single task baselines achieves similar performance, VBLRL shows significantbetter performance than LPG-FTW/EWC in lifelong RL experiments.
K How VBLRL models different categories of uncertainty
L Grid-World Item Searching
We also evaluate BLRL in a simple Grid-World domain.
Our testbed consists of a collection ofhouses, each of which has four rooms.
The goal of each task is to find a specific object (blue, green orpurple) in the current house.
The type of each room is sampled based on an underlying distributiongiven by the environment.
Each room type has a corresponding probability distribution of which kindof objects can be found in rooms of this type.
Different tasks/houses vary in terms of which roomsare which types and precisely where objects are located in the room (the task’s hidden parameters).
To simplify the problem, instead of modeling the whole MDP distribution, we use BLRL to modelthe object distribution as the Bayesian posterior and sample MDPs from the distribution.
We use
BOSS with a fixed prior (no intertask transfer) as our baseline.
The average training performance of
[Figure] [Figure]
collects enough data from the task.
The aleatory uncertainty of the final prediction is measured by the output variance of the prediction.
all 300 tasks are shown in Figure 9 top right.
Each task consists of 10 epochs, with 21 sample stepsfor each epoch.
Within the limited steps allotted for each task, BLRL is able to discover and transferthe common knowledge and helps the agent quickly adapt to new tasks as the training goes on.
Incomparison, running BOSS with a fixed prior is able to find the optimal policy eventually but needsmore sample steps and learns more slowly than BLRL. [Figure]
M Box-Jumping Task
[Figure] We use a simplified version of the jumping task [9] as a testbed for the proposed algorithm VBLRL.
As shown in Figure 9 bottom left, the goal of the agent is to reach the right side of the screen byjumping over the obstacle.
The agent can only choose from two actions: jump and right.
It will hitthe obstacle unless the jump action is chosen at precisely the right time.
We set different obstaclepositions as different tasks, constituting the HiP-MDP hidden parameters.
The 4-element statevector describes the ( x, y ) coordinates of the agent’s current position, and its velocity in the x and ydirections.
Figure 9 bottom right presents the average performance during training across all 300 tasks.
Eachtask is run for 30 episodes.
VBLRL clearly learns faster than the HiP-MDP baseline and reachesbetter final performance.
Thus, in the lifelong RL setting, separating the updating processes of theworld-model posterior and the task-specific posterior can lead to better learning efficiency.
N Additional explanation of the algorithm
Here we first provide an example to help the readers better understand our plate notation.
In our
Gridworld Item Searching case, Ψ represents the parameters of P Ω , which is the room-type andobject distribution.
For each task, the environment samples a hidden parameter ω , which is the actualroom and object layout of this house, from this distribution P Ω .
The sampled ω then will result in an
MDP m and let the agent interact with it.
N.1 planning algorithm
With the transition dynamics and reward functions, a planning algorithm like CEM is not the only wayto solve the MDP to get an optimal policy.
Another option would be using other Deep RL algorithmslike Soft actor-critic [19] with data generated from the model.
However, in this case, incorporating adeep RL algorithm means that we need to introduce additional neural networks (that is, policy/valuenetworks) for each task.
The update signal from the RL loss is usually stochastic and weak, which is even worse in this case when our model is still far from accurate.
So, here we assume applying aplanning algorithm is a better way to get the policy.
O Ablation study of the number of particles
We also run ablation studies on the number of particles in CEM planning.
The agent performanceis close when the number of particles is around 50.
The computational complexity drops as we usefewer particles and is especially larger when the number of particles ≥ 70 .
[Figure] [Figure]
P Coin Example
Consider a coin-flipping environment.
We want to find the sample complexity of the unbiased coin(i.e.
How many times we need to flip this coin such that our posterior samples are accurate.).
Considera Dirichlet prior, α
=
( n 1 , n 2 ) and θ
= ( 12 , 12 ) .
We want to find sample complexity B such thatthe posterior likelihood for a coin with heads likelihood in [0 .
5 − ϵ, 0 .
5 + ϵ ] is at least 1 − δ .
Note that the Dirichlet distribution on the two-dimensional simplex is the Beta distribution.
The
Multinomial distribution with two outcomes is the Binomial distribution.
That is, given the process
[Equation] [Equation]
[Equation]
choose a value B such that
[Equation] [Equation]
Here, n 1 and n 2 capture the prior.
The smallest B that satisfies Equation 24 can be found numerically.
We set ϵ = 0 .
1 and δ = 0 .
Here are the results of sample complexity B given different values ofn 1 , n 2 :
We fix the sum of ( n 1 , n 2 ) as 10 .
As shown in the results, the value of sample complexity B becomeslower as we use a more accurate prior (from (10 , 0) to (5 , 5) and from (0 , 10) to (5 , 5) ).
In general, for the task-specific posterior, we can relate B, ϵ and δ with the following equation:
[Equation]
( n 1 , n 2 ) lowest B (0,10) (1,9) (2,8) (3,7) (4,6) (5,5) (6,4) (7,3) (8,2) (9,1) (10,0)
For the world model posterior:(cid:88)
[Equation]
For each task, first we pick a true model P
according to the true distribution and initialize thetask-specific prior Φ old =
Φ w .
Then, we make some observations from the world.
Once we have thetrue model and the observations, we can calculate how many models are ϵ -close to the true model,weighted according to their posterior likelihood.
Q Further Discussion and Limitations
• One of the core questions in lifelong learning setting is how tasks should be related for
transfer to be effective, and in this paper we are making the HiP-MDP assumption, that is, a
family of tasks is generated by varying a latent task parameter vector drawn for each task
according to the world-model distribution.
The relationship between different tasks can bemodeled in different ways in lifelong RL and this problem setting will affect the algorithm’sperformance.
However, we do believe our method can help the agent transfer knowledge fortasks that are in other ways related, as we show in Appendix H.
• Our theoretical result that the sample efficiency improves in the task-specific regime dependson the assumption that the world model improves and approaches the true underlyingdistribution.
This is a reasonable assumption for HiP-MDP.
However, for example in caseswhere the tasks are completely different, the world model will not be improved.
Negativetransfer is likely to happen in this case as there’s no common knowledge to be transferred [Table] from other tasks.
[Table]
• The overall lifelong learning performance of our proposed algorithm is limited by the [Table] performance of the single-task model-based baseline.
We show the advantages of modelbased lifelong learning methods over model-free methods when the single-task baselines’performance are close.
However, in practice, it’s possible that the model-free lifelong RL [Table] methods still outperforms model-based methods when the model-free single-task baseline ismuch stronger.
[Table]
• Bayesian Neural Networks are more computationally expensive than regular neural networks.
The longest running time among all our experiments is MT50 which took around 48 hours [Table] to finish training and evaluation on 50 different tasks.
This is in general acceptable time cost [Table] and can be potentially improved with more recent BNN techniques.
[Table]