Title: SHARING KNOWLEDGE IN MULTI-TASK DEEP REINFORCEMENT LEARNING

Abstract: We study the benefit of sharing representations among tasks to enable the effective use of deep neural networks in Multi-Task Reinforcement Learning. We leverage the assumption that learning from different tasks, sharing common properties, is helpful to generalize the knowledge of them resulting in a more effective feature extraction compared to learning a single task. Intuitively, the resulting set of features offers performance benefits when used by Reinforcement Learning algorithms. We prove this by providing theoretical guarantees that highlight the conditions for which is convenient to share representations among tasks, extending the wellknown finite-time bounds of Approximate Value-Iteration to the multi-task setting. In addition, we complement our analysis by proposing multi-task extensions of three Reinforcement Learning algorithms that we empirically evaluate on widely used Reinforcement Learning benchmarks showing significant improvements over the single-task counterparts in terms of sample efficiency and performance.

1. INTRODUCTION:

Multi-Task Learning (MTL) ambitiously aims to learn multiple tasks jointly instead of learning them separately, leveraging the assumption that the considered tasks have common properties which can be exploited by Machine Learning (ML) models to generalize the learning of each of them. For instance, the features extracted in the hidden layers of a neural network trained on multiple tasks have the advantage of being a general representation of structures common to each other. This translates into an effective way of learning multiple tasks at the same time, but it can also improve the learning of each individual task compared to learning them separately (Caruana, 1997) . Furthermore, the learned representation can be used to perform Transfer Learning (TL), i.e. using it as a preliminary knowledge to learn a new similar task resulting in a more effective and faster learning than learning the new task from scratch (Baxter, 2000; Thrun & Pratt, 2012) .

The same benefits of extraction and exploitation of common features among the tasks achieved in MTL, can be obtained in Multi-Task Reinforcement Learning (MTRL) when training a single agent on multiple Reinforcement Learning (RL) problems with common structures (Taylor & Stone, 2009; Lazaric, 2012) . In particular, in MTRL an agent can be trained on multiple tasks in the same domain, e.g. riding a bicycle or cycling while going towards a goal, or on different but similar domains, e.g. balancing a pendulum or balancing a double pendulum1 . Considering recent advances in Deep Reinforcement Learning (DRL) and the resulting increase in the complexity of experimental benchmarks, the use of Deep Learning (DL) models, e.g. deep neural networks, has become a popular and effective way to extract common features among tasks in MTRL algorithms (Rusu et al., 2015; Liu et al., 2016; Higgins et al., 2017) . However, despite the high representational capacity of DL models, the extraction of good features remains challenging. For instance, the performance of the learning process can degrade when unrelated tasks are used together (Caruana, 1997; Baxter, 2000) ; another detrimental issue may occur when the training of a single model is not balanced properly among multiple tasks (Hessel et al., 2018) .

Recent developments in MTRL achieve significant results in feature extraction by means of algorithms specifically developed to address these issues. While some of these works rely on a single deep neural network to model the multi-task agent (Liu et al., 2016; Yang et al., 2017; Hessel et al., 2018; Wulfmeier et al., 2019) , others use multiple deep neural networks, e.g. one for each task and another for the multi-task agent (Rusu et al., 2015; Parisotto et al., 2015; Higgins et al., 2017; Teh et al., 2017) . Intuitively, achieving good results in MTRL with a single deep neural network is more desirable than using many of them, since the training time is likely much less and the whole architecture is easier to implement. In this paper we study the benefits of shared representations among tasks. We theoretically motivate the intuitive effectiveness of our method, deriving theoretical guarantees that exploit the theoretical framework provided by Maurer et al. (2016) , in which the authors present upper bounds on the quality of learning in MTL when extracting features for multiple tasks in a single shared representation. The significancy of this result is that the cost of learning the shared representation decreases with a factor O( 1 / √ T ), where T is the number of tasks for many function approximator hypothesis classes. The main contribution of this work is twofold.

1. We derive upper confidence bounds for Approximate Value-Iteration (AVI) and Approximate Policy-Iteration (API)2 (Farahmand, 2011) in the MTRL setting, and we extend the approximation error bounds in Maurer et al. (2016) to the case of multiple tasks with different dimensionalities. Then, we show how to combine these results resulting in, to the best of our knowledge, the first proposed extension of the finite-time bounds of AVI/API to MTRL. Despite being an extension of previous works, we derive these results to justify our approach showing how the error propagation in AVI/API can theoretically benefit from learning multiple tasks jointly.

2. We leverage these results proposing a neural network architecture, for which these bounds hold with minor assumptions, that allow us to learn multiple tasks with a single regressor extracting a common representation. We show an empirical evidence of the consequence of our bounds by means of a variant of Fitted Q-Iteration (FQI) (Ernst et al., 2005) , based on our shared network and for which our bounds apply, that we call Multi Fitted Q-Iteration (MFQI). Then, we perform an empirical evaluation in challenging RL problems proposing multitask variants of the Deep Q-Network (DQN) (Mnih et al., 2015) and Deep Deterministic Policy Gradient (DDPG) (Lillicrap et al., 2015) algorithms. These algorithms are practical implementations of the more general AVI/API framework, designed to solve complex problems. In this case, the bounds apply to these algorithms only with some assumptions, e.g. stationary sampling distribution. The outcome of the empirical analysis joins the theoretical results, showing significant performance improvements compared to the singletask version of the algorithms in various RL problems, including several MuJoCo (Todorov et al., 2012) domains.

2. PRELIMINARIES:

Let B(X ) be the space of bounded measurable functions w.r.t. the σ-algebra σ X , and similarly B(X , L) be the same bounded by L < ∞.

A Markov Decision Process (MDP) is defined as a 5-tuple M =< S, A, P, R, γ >, where S is the state space, A is the action space, P : S × A → S is the transition distribution where P(s |s, a)

is the probability of reaching state s when performing action a in state s, R : S × A × S → R is the reward function, and γ ∈ (0, 1] is the discount factor. A deterministic policy π maps, for each state, the action to perform: π : S → A. Given a policy π, the value of an action a in a state s represents the expected discounted cumulative reward obtained by performing a in s and following π thereafter:

Q π (s, a) E[ ∞ k=0 γ k r i+k+1 |s i = s, a i = a, π]

, where r i+1 is the reward obtained after the i-th transition. The expected discounted cumulative reward is maximized by following the optimal policy π * which is the one that determines the optimal action values, i.e., the ones that satisfy the Bellman optimality equation (Bellman, 1954) : Q * (s, a) S P(s |s, a) [R(s, a, s ) + γ max a Q * (s , a )] ds . The solution of the Bellman optimality equation is the fixed point of the optimal Bellman operator T * : B(S × A) → B(S × A) defined as

(T * Q)(s, a) S P(s |s, a)[R(s, a, s ) + γ max a Q(s , a )]ds .

In the MTRL setting, there are multiple MDPs M (t) =< S (t) , A (t) , P (t) , R (t) , γ (t) > where t ∈ {1, . . . , T } and T is the number of MDPs. For each MDP M (t) , a deterministic policy π t : S (t) → A (t) induces an action-value function

Q πt t (s (t) , a (t) ) = E[ ∞ k=0 γ k r (t) i+k+1 |s i = s (t) , a i = a (t) , π t ].

In this setting, the goal is to maximize the sum of the expected cumulative discounted reward of each task.

In our theoretical analysis of the MTRL problem, the complexity of representation plays a central role. As done in Maurer et al. (2016) , we consider the Gaussian complexity, a variant of the well-known Rademacher complexity, to measure the complexity of the representation. Given a set X ∈ X T n of n input samples for each task t ∈ {1, . . . , T }, and a class H composed of k ∈ {1, . . . , K} functions, the Gaussian complexity of a random set H( X) = {(h k (X ti )) : h ∈ H} ⊆ R KT n is defined as follows:

EQUATION

where γ tki are independent standard normal variables. We also need to define the following quantity, taken from Maurer (2016) : let γ be a vector of m random standard normal variables, and f ∈ F :

EQUATION

)

Equation 2 can be viewed as a Gaussian average of Lipschitz quotients, and appears in the bounds provided in this work. Finally, we define L(F) as the upper bound of the Lipschitz constant of all the functions f in the function class F.

3. THEORETICAL ANALYSIS:

The following theoretical study starts from the derivation of theoretical guarantees for MTRL in the AVI framework, extending the results of Farahmand (2011) in the MTRL scenario. Then, to bound the approximation error term in the AVI bound, we extend the result described in Maurer (2006) to MTRL. As we discuss, the resulting bounds described in this section clearly show the benefit of sharing representation in MTRL. To the best of our knowledge, this is the first general result for MTRL; previous works have focused on finite MDPs (Brunskill & Li, 2013) or linear models (Lazaric & Restelli, 2011) .

3.1. MULTI-TASK REPRESENTATION LEARNING:

The multi-task representation learning problem consists in learning simultaneously a set of T tasks µ t , modeled as probability measures over the space of the possible input-output pairs (x, y), with x ∈ X and y ∈ R, being X the input space. Let w ∈ W : X → R J , h ∈ H : R J → R K and f ∈ F : R K → R be functions chosen from their respective hypothesis classes. The functions in the hypothesis classes must be Lipschitz continuous functions. Let Z = (Z 1 , . . . , Z T ) be the multi-sample over the set of tasks µ = (µ 1 , . . . , µ T ), where Z t = (Z t1 , . . . , Z tn ) ∼ µ n t and Z ti = (X ti , Y ti ) ∼ µ t . We can formalize our regression problem as the following minimization problem:

EQUATION

where we use f = (f 1 , . . . , f T ), w = (w 1 , . . . , w T ), and define the minimizers of Equation (3) as ŵ, ĥ, and f . We assume that the loss function : R × R → [0, 1] is 1-Lipschitz in the first argument for every value of the second argument. While this assumption may seem restrictive, the result obtained can be easily scaled to the general case. To use the principal result of this section, for a generic loss function , it is possible to use (•) = (•) / max , where max is the maximum value of . The expected loss over the tasks, given w, h and f is the task-averaged risk:

EQUATION

The minimum task-averaged risk, given the set of tasks µ and the hypothesis classes W, H and F is ε * avg , and the corresponding minimizers are w * , h * and f * .

3.2. MULTI-TASK APPROXIMATE VALUE ITERATION BOUND:

We start by considering the bound for the AVI framework which applies for the single-task scenario.

Theorem 1. (Theorem 3.4 of Farahmand ( 2011)) Let K be a positive integer, and

EQUATION

where

EQUATION

) with E(ε 0 , . . . , ε K-1 ; r) = K-1 k=0 α 2r k ε k , the two coefficients c VI1,ρ,ν , c VI2,ρ,ν

, the distributions ρ and ν, and the series α k are defined as in Farahmand (2011) .

In the multi-task scenario, let the average approximation error across tasks be:

EQUATION

where Q t,k+1 = ft,k • ĥk • ŵt,k , and T * t is the optimal Bellman operator of task t. In the following, we extend the AVI bound of Theorem 1 to the multi-task scenario, by computing the average loss across tasks and pushing inside the average using Jensen's inequality. Theorem 2. Let K be a positive integer, and

EQUATION

ν , we have:

1 T T t=1 Q * t -Q π K t 1,ρ ≤ 2γ (1 -γ) 2 inf r∈[0,1] C 1 2 VI (K; r)E 1 2 avg (ε avg,0 , . . . , ε avg,K-1 ; r) + 2γ K R max,avg 1 -γ (8) with E avg = K-1 k=0 α 2r k ε avg,k , γ = max t∈{1,...,T } γ t , C 1 2 VI (K; r) = max t∈{1,...,T } C 1 2 VI,ρ,ν (K; t, r), R max,avg = 1 T T t=1 R max,t and α k = (1-γ)γ K-k-1 1-γ K+1 0 ≤ k < K, (1-γ)γ K 1-γ K+1 k = K .

Remarks Theorem 2 retains most of the properties of Theorem 3.4 of Farahmand (2011) , except that the regression error in the bound is now task-averaged. Interestingly, the second term of the sum in Equation ( 8) depends on the average maximum reward for each task. In order to obtain this result we use an overly pessimistic bound on γ and the concentrability coefficients, however this approximation is not too loose if the MDPs are sufficiently similar.

3.3. MULTI-TASK APPROXIMATION ERROR BOUND:

We bound the task-averaged approximation error ε avg at each AVI iteration k involved in (8) following a derivation similar to the one proposed by Maurer et al. (2016) , obtaining: Theorem 3. Let µ, W, H and F be defined as above and assume 0 ∈ H and f (0) = 0, ∀f ∈ F.

Then for δ > 0 with probability at least 1 -δ in the draw of Z ∼ T t=1 µ n t we have that

ε avg ( ŵ, ĥ, f ) ≤ L(F) c 1 L(H) sup l∈{1,...,T } G(W(X l )) n + c 2 sup w w( X) O(H) nT +c 3 min p∈P G(H(p)) nT + c 4 sup h,w h(w( X)) O(F) n √ T + 8 ln( 3 δ ) nT + ε * avg . (9)

Remarks The assumptions 0 ∈ H and f (0) = 0 for all f ∈ F are not essential for the proof and are only needed to simplify the result. For reasonable function classes, the Gaussian complexity

G(W(X l )) is O( √ n). If sup w w( X)

and sup h,w h(w( X)) can be uniformly bounded, then they are O( √ nT ). For some function classes, the Gaussian average of Lipschitz quotients O(•) can be bounded independently from the number of samples. Given these assumptions, the first and the fourth term of the right hand side of Equation ( 9), which represent respectively the cost of learning the meta-state space w and the task-specific f mappings, are both O( 1 / √ n). The second term represents the cost of learning the multi-task representation h and is O( 1 / √ nT ), thus vanishing in the multi-task limit T → ∞. The third term can be removed if ∀h ∈ H, ∃p 0 ∈ P : h(p) = 0; even when this assumption does not hold, this term can be ignored for many classes of interest, e.g. neural networks, as it can be arbitrarily small.

The last term to be bounded in ( 9) is the minimum average approximation error ε * avg at each AVI iteration k. Recalling that the task-averaged approximation error is defined as in (7), applying Theorem 5.3 by Farahmand (2011) we obtain:

EQUATION

)

with C AE defined as in Farahmand (2011) .

Final remarks:

The bound for MTRL is derived by composing the results in Theorems 2 and 3, and Lemma 4. The results above highlight the advantage of learning a shared representation. The bound in Theorem 2 shows that a small approximation error is critical to improve the convergence towards the optimal action-value function, and the bound in Theorem 3 shows that the cost of learning the shared representation at each AVI iteration is mitigated by using multiple tasks. This is particularly beneficial when the feature representation is complex, e.g. deep neural networks.

3.4. DISCUSSION:

As stated in the remarks of Equation ( 9), the benefit of MTRL is evinced by the second component of the bound, i.e. the cost of learning h, which vanishes with the increase of the number of tasks. Obviously, adding more tasks require the shared representation to be large enough to include all of them, undesirably causing the term sup h,w h(w( X)) in the fourth component of the bound to increase. This introduces a tradeoff between the number of features and number of tasks; however, for a reasonable number of tasks the number of features used in the single-task case is enough to handle them, as we show in some experiments in Section 5. Notably, since the AVI/API framework provided by Farahmand (2011) provides an easy way to include the approximation error of a generic function approximator, it is easy to show the benefit in MTRL of the bound in Equation ( 9). Despite being just multi-task extensions of previous works, our results are the first one to theoretically show the benefit of sharing representation in MTRL. Moreover, they serve as a significant theoretical motivation, besides to the intuitive ones, of the practical algorithms that we describe in the following sections.

Q * Q K 1 2 4 8 (c) #Task analysis

4. SHARING REPRESENTATIONS:

We want to empirically evaluate the benefit of our theoretical study in the problem of jointly learning T different tasks µ t , introducing a neural network architecture for which our bounds hold. Following our theoretical framework, the network we propose extracts representations w t from inputs x t for each task µ t , mapping them to common features in a set of shared layers h, specializing the learning of each task in respective separated layers f t , and finally computing the output 1(a) ). The idea behind this architecture is not new in the literature. For instance, similar ideas have already been used in DQN variants to improve exploration on the same task via bootstrapping (Osband et al., 2016) and to perform MTRL (Liu et al., 2016) .

y t = (f t • h • w t )(x t ) = f t (h(w t (x t ))) (Figure

The intuitive and desirable property of this architecture is the exploitation of the regularization effect introduced by the shared representation of the jointly learned tasks. Indeed, unlike learning a single task that may end up in overfitting, forcing the model to compute a shared representation of the tasks helps the regression process to extract more general features, with a consequent reduction in the variance of the learned function. This intuitive justification for our approach, joins the theoretical benefit proven in Section 3. Note that our architecture can be used in any MTRL problem involving a regression process; indeed, it can be easily used in value-based methods as a Q-function regressor, or in policy search as a policy regressor. In both cases, the targets are learned for each task µ t in its respective output block f t . Remarkably, as we show in the experimental Section 5, it is straightforward to extend RL algorithms to their multi-task variants only through the use of the proposed network architecture, without major changes to the algorithms themselves.

5. EXPERIMENTAL RESULTS:

To empirically evince the effect described by our bounds, we propose an extension of FQI (Ernst et al., 2005; Riedmiller, 2005) , that we call MFQI, for which our AVI bounds apply. Then, to empirically evaluate our approach in challenging RL problems, we introduce multi-task variants of two well-known DRL algorithms: DQN (Mnih et al., 2015) and DDPG (Lillicrap et al., 2015) , which we call Multi Deep Q-Network (MDQN) and Multi Deep Deterministic Policy Gradient (MDDPG) respectively. Note that for these methodologies, our AVI and API bounds hold only with the simplifying assumption that the samples are i.i.d.; nevertheless they are useful to show the benefit of our method also in complex scenarios, e.g. MuJoCo (Todorov et al., 2012) . We remark that in these experiments we are only interested in showing the benefit of learning multiple tasks with a shared representation w.r.t. learning a single task; therefore, we only compare our methods with the single task counterparts, ignoring other works on MTRL in literature. Experiments have been developed using the MushroomRL library (D 'Eramo et al., 2020) , and run on an NVIDIA R DGX Station TM and Intel R AI DevCloud. Refer to Appendix B for all the details and our motivations about the experimental settings.

5.1. MULTI FITTED Q-ITERATION:

As a first empirical evaluation, we consider FQI, as an example of an AVI algorithm, to show the effect described by our theoretical AVI bounds in experiments. We consider the Car-On-Hill problem as described in Ernst et al. (2005) , and select four different tasks from it changing the mass of the car and the value of the actions (details in Appendix B). Then, we run separate instances of FQI with a single task network for each task respectively, and one of MFQI considering all the tasks simultaneously. Figure 1 (b) shows the L 1 -norm of the difference between Q * and Q π K averaged over all the tasks. It is clear how MFQI is able to get much closer to the optimal Q-function, thus giving an empirical evidence of the AVI bounds in Theorem 2. For completeness, we also show the advantage of MFQI w.r.t. FQI in performance. Then, in Figure 1 (c) we provide an empirical evidence of the benefit of increasing the number of tasks in MFQI in terms of both quality and stability.

5.2. MULTI DEEP Q-NETWORK:

As in Liu et al. (2016) , our MDQN uses separate replay memories for each task and the batch used in each training step is built picking the same number of samples from each replay memory. Furthermore, a step of the algorithm consists of exactly one step in each task. These are the only minor changes to the vanilla DQN algorithm we introduce, while all other aspects, such as the use of the target network, are not modified. Thus, the time complexity of MDQN is considerably lower than vanilla DQN thanks to the learning of T tasks with a single model, but at the cost of a higher memory complexity for the collection of samples for each task. We consider five problems with similar state spaces, sparse rewards and discrete actions: Cart-Pole, Acrobot, Mountain-Car, Car-On-Hill, and Inverted-Pendulum. The implementation of the first three problems is the one provided by the OpenAI Gym library Brockman et al. (2016) , while Car-On-Hill is described in Ernst et al. (2005) and Inverted-Pendulum in Lagoudakis & Parr (2003) .

Figure 2 (a) shows the performance of MDQN w.r.t. to vanilla DQN that uses a single-task network structured as the multi-task one in the case with T = 1. The first three plots from the left show good performance of MDQN, which is both higher and more stable than DQN. In Car-On-Hill, MDQN is slightly slower than DQN to reach the best performance, but eventually manages to be more stable. Finally, the Inverted-Pendulum experiment is clearly too easy to solve for both approaches, but it is still useful for the shared feature extraction in MDQN. The described results provide important hints about the better quality of the features extracted by MDQN w.r.t. DQN. To further demonstrate this, we evaluate the performance of DQN on Acrobot, arguably the hardest of the five problems, using a single-task network with the shared parameters in h initialized with the weights of a multi-task network trained with MDQN on the other four problems. Arbitrarily, the pre-trained weights can be adjusted during the learning of the new task or can be kept fixed and only the remaining randomly initialized parameters in w and f are trained. From Figure 2 (b), the advantages of initializing the weights are clear. In particular, we compare the performance of DQN without initialization w.r.t. DQN with initialization in three settings: in Unfreeze-0 the initialized weights are adjusted, in No-Unfreeze they are kept fixed, and in Unfreeze-10 they are kept fixed until epoch 10 after which they start to be optimized. Interestingly, keeping the shared weights fixed shows a significant performance improvement in the earliest epochs, but ceases to improve soon. On the other hand, the adjustment of weights from the earliest epochs shows improvements only compared to the uninitialized network in the intermediate stages of learning. The best results are achieved by starting to adjust the shared weights after epoch 10, which is approximately the point at which the improvement given by the fixed initialization starts to lessen.

5.3. MULTI DEEP DETERMINISTIC POLICY GRADIENT:

In order to show how the flexibility of our approach easily allows to perform MTRL in policy search algorithms, we propose MDDPG as a multi-task variant of DDPG. As an actor-critic method, DDPG requires an actor network and a critic network. Intuitively, to obtain MDDPG both the actor and critic networks should be built following our proposed structure. We perform separate experiments on two sets of MuJoCo Todorov et al. (2012) problems with similar continuous state and action spaces: the first set includes Inverted-Pendulum, Inverted-Double-Pendulum, and Inverted-Pendulum-Swingup as implemented in the pybullet library, whereas the second set includes Hopper-Stand, Walker-Walk, and Half-Cheetah-Run as implemented in the DeepMind Control SuiteTassa et al. (2018) . Figure 3(a) shows a relevant improvement of MDDPG w.r.t. DDPG in the pendulum tasks. Indeed, while in Inverted-Pendulum, which is the easiest problem among the three, the performance of MDDPG is only slightly better than DDPG, the difference in the other two problems is significant. The advantage of MDDPG is confirmed in Figure 3 (c) where it performs better than DDPG in Hopper and equally good in the other two tasks. Again, we perform a TL evaluation of DDPG in the problems where it suffers the most, by initializing the shared weights of a single-task network with the ones of a multi-task network trained with MDDPG on the other problems. Figures 3(b ) and 3(d) show evident advantages of pre-training the shared weights and a significant difference between keeping them fixed or not.

6. RELATED WORKS:

Our work is inspired from both theoretical and empirical studies in MTL and MTRL literature. In particular, the theoretical analysis we provide follows previous results about the theoretical properties of multi-task algorithms. For instance, Cavallanti et al. (2010) and Maurer (2006) prove the theoretical advantages of MTL based on linear approximation. More in detail, Maurer (2006) derives bounds on MTL when a linear approximator is used to extract a shared representation among tasks. Then, Maurer et al. (2016) , which we considered in this work, describes similar results that extend to the use of non-linear approximators. Similar studies have been conducted in the context of MTRL. Among the others, Lazaric & Restelli (2011) and Brunskill & Li (2013) give theoretical proofs of the advantage of learning from multiple MDPs and introduces new algorithms to empirically support their claims, as done in this work.

Generally, contributions in MTRL assume that properties of different tasks, e.g. dynamics and reward function, are generated from a common generative model. About this, interesting analyses consider Bayesian approaches; for instance Wilson et al. (2007) assumes that the tasks are generated from a hierarchical Bayesian model, and likewise Lazaric & Ghavamzadeh (2010) considers the case when the value functions are generated from a common prior distribution. Similar considerations, which however does not use a Bayesian approach, are implicitly made in Taylor et al. ( 2007), Lazaric et al. (2008) , and also in this work.

In recent years, the advantages of MTRL have been empirically evinced also in DRL, especially exploiting the powerful representational capacity of deep neural networks. For instance, Parisotto et al. (2015) and Rusu et al. (2015) propose to derive a multi-task policy from the policies learned by DQN experts trained separately on different tasks. Rusu et al. (2015) compares to a therein introduced variant of DQN, which is very similar to our MDQN and the one in Liu et al. (2016) , showing how their method overcomes it in the Atari benchmark Bellemare et al. (2013) . Further developments, extend the analysis to policy search (Yang et al., 2017; Teh et al., 2017) , and to multi-goal RL (Schaul et al., 2015; Andrychowicz et al., 2017) . Finally, Hessel et al. (2018) addresses the problem of balancing the learning of multiple tasks with a single deep neural network proposing a method that uniformly adapts the impact of each task on the training updates of the agent.

7. CONCLUSION:

We have theoretically proved the advantage in RL of using a shared representation to learn multiple tasks w.r.t. learning a single task. We have derived our results extending the AVI/API bounds (Farahmand, 2011) to MTRL, leveraging the upper bounds on the approximation error in MTL provided in Maurer et al. (2016) . The results of this analysis show that the error propagation during the AVI/API iterations is reduced according to the number of tasks. Then, we proposed a practical way of exploiting this theoretical benefit which consists in an effective way of extracting shared representations of multiple tasks by means of deep neural networks. To empirically show the advantages of our method, we carried out experiments on challenging RL problems with the introduction of multi-task extensions of FQI, DQN, and DDPG based on the neural network structure we proposed. As desired, the favorable empirical results confirm the theoretical benefit we described.

A PROOFS A.1 APPROXIMATED VALUE-ITERATION BOUNDS:

Proof of Theorem 2. We compute the average expected loss across tasks:

1 T T t=1 Q * t -Q π K t 1,ρ ≤ 1 T T t=1 2γ t (1 -γ t ) 2 inf r∈[0,1] C 1 2 VI,ρ,ν (K; t, r)E 1 2 (ε t,0 , . . . , ε t,K-1 ; t, r) + 2 1 -γ t γ K t R max,t ≤ 2γ (1 -γ) 2 1 T T t=1 inf r∈[0,1] C 1 2 VI,ρ,ν (K; t, r)E 1 2 (ε t,0 , . . . , ε t,K-1 ; t, r) + 2 1 -γ t γ K t R max,t ≤ 2γ (1 -γ) 2 1 T T t=1 inf r∈[0,1] C 1 2 VI,ρ,ν (K; t, r)E 1 2 (ε t,0 , . . . , ε t,K-1 ; t, r) + 2 1 -γ γ K R max,avg ≤ 2γ (1 -γ) 2 inf r∈[0,1] 1 T T t=1 C 1 2 VI,ρ,ν (K; t, r)E 1 2 (ε t,0 , . . . , ε t,K-1 ; t, r) + 2 1 -γ γ K R max,avg ≤ 2γ (1 -γ) 2 inf r∈[0,1] C 1 2 VI (K; r) 1 T T t=1 E 1 2 (ε t,0 , . . . , ε t,K-1 ; t, r) + 2 1 -γ γ K R max,avg (11) with γ = max t∈{1,...,T } γ t , C 1 2 VI (K; r) = max t∈{1,...,T } C 1 2

VI,ρ,ν (K; t, r), and R max,avg = 1 /T T t=1 R max,t .

Considering the term 1 /T

EQUATION

. Using Jensen's inequality:

EQUATION

.

So, now we can write (11) as

1 T T t=1 Q * t -Q π K t 1,ρ ≤ 2γ (1 -γ) 2 inf r∈[0,1] C 1 2 VI (K; r)E 1 2 avg (ε avg,0 , . . . , ε avg,K-1 ; r) + 2 1 -γ γ K R max,avg , with ε avg,k = 1 /T T t=1 ε t,k and E avg (ε avg,0 , . . . , ε avg,K-1 ; r) = K-1 k=0 α 2r k ε avg,k .

Proof of Lemma 4. Let us start from the definition of optimal task-averaged risk:

ε * avg,k = 1 T T t=1 Q * t,k+1 -T * t Q t,k

where Q * t,k , with t ∈ [1, T ], are the minimizers of ε avg,k . Consider the task ť such that ťk = arg max t∈{1,...,T }

Q * t,k+1 -T * t Q t,k 2 ν ,

we can write the following inequality:

ε * avg,k ≤ Q * ťk ,k+1 -T * ť Qť k ,k ν .

By the application of Theorem 5.3 by Farahmand (2011) to the right hand side, and defining b k,i = Qť k ,i+1 -T * ť Qť k ,i ν , we obtain:

ε * avg,k ≤ Q * ťk ,k+1 -(T * ť ) k+1 Qť k ,0 ν + k-1 i=0 (γť k C AE (ν; ťk , P )) i+1 b k,k-1-i .

Squaring both sides yields the result:

ε * avg,k ≤ Q * ťk ,k+1 -(T * ť ) k+1 Qť k ,0 ν + k-1 i=0 (γť k C AE (ν; ťk , P )) i+1 b k,k-1-i 2 . A.2 APPROXIMATED POLICY-ITERATION BOUNDS

We start by considering the bound for the API framework:

Theorem 5. (Theorem 3.2 of Farahmand ( 2011)) Let K be a positive integer, and

Q max ≤ Rmax 1-γ . Then for any sequence (Q k ) K-1 k=0 ⊂ B(S × A, Q max ) and the corresponding sequence (ε k ) K-1 k=0 , where ε k = Q k -Q π k 2

ν , we have:

Q * -Q π K 1,ρ ≤ 2γ (1 -γ) 2 inf r∈[0,1] C 1 2 PI,ρ,ν (K; r)E 1 2 (ε 0 , . . . , ε K-1 ; r) + γ K-1 R max , (12)

where

EQUATION

)

with E(ε 0 , . . . , ε K-1 ; r) = K-1 k=0 α 2r k ε k , the three coefficients c PI1,ρ,ν , c PI2,ρ,ν , c PI3,ρ,ν , the distributions ρ and ν, and the series α k are defined as in Farahmand (2011) .

From Theorem 5, by computing the average loss across tasks and pushing inside the average using Jensen's inequality, we derive the API bounds averaged on multiple tasks. Theorem 6. Let K be a positive integer, and Q max ≤ Rmax 1-γ . Then for any sequence

(Q k ) K-1 k=0 ⊂ B(S × A, Q max ) and the corresponding sequence (ε avg,k ) K-1 k=0 , where ε avg,k = 1 T T t=1 Q t,k -Q π k t 2

ν , we have:

1 T T t=1 Q * t -Q π K t 1,ρ ≤ 2γ (1 -γ) 2 inf r∈[0,1] C 1 2 PI (K; r)E 1 2

avg (ε avg,0 , . . . , ε avg,K-1 ; r)

EQUATION

with

E avg = K-1 k=0 α 2r k ε avg,k , γ = max t∈{1,...,T } γ t , C 1 2 PI (K; r) = max t∈{1,...,T } C 1 2 PI,ρ,ν (K; t, r), R max,avg = 1 T T t=1 R max,t and α k = (1-γ)γ K-k-1 1-γ K+1 0 ≤ k < K, (1-γ)γ K 1-γ K+1 k = K .

Proof of Theorem 6. The proof is very similar to the one for AVI. We compute the average expected loss across tasks:

EQUATION

Using Jensen's inequality as in the AVI scenario, we can write (15) as:

EQUATION

with ε avg,k = 1 /T T t=1 ε t,k and E avg (ε avg,0 , . . . , ε avg,K-1 ; r) = K-1 k=0 α 2r k ε avg,k .

A.3 APPROXIMATION BOUNDS:

Proof of Theorem 3. Let w * 1 , . . . , w * T , h * and f * 1 , . . . , f * T be the minimizers of ε * avg , then:

EQUATION

We proceed to bound the three components individually:

• C can be bounded using Hoeffding's inequality, with probability 1 -δ /2 by ln( 2 /δ) /(2nT ), as it contains only nT random variables bounded in the interval [0, 1];

• B can be bounded by 0, by definition of ŵ, ĥ and f , as they are the minimizers of Equation (3);

• the bounding of A is less straightforward and is described in the following.

We define the following auxiliary function spaces:

• W = {x ∈ X → (w t (x ti )) : (w 1 , . . . , w T ) ∈ W T }, • F = y ∈ R KT n → (f t (y ti )) : (f 1 , . . . , f T ) ∈ F T ,

and the following auxiliary sets:

• S = ( (f t (h(w t (X ti ))), Y ti )) : f ∈ F T , h ∈ H, w ∈ W T ⊆ R T n , • S = F (H(W ( X))) = (f t (h(w t (X ti )))) : f ∈ F T , h ∈ H, w ∈ W T ⊆ R T n , • S = H(W ( X)) = (h(w t (X ti ))) : h ∈ H, w ∈ W T ⊆ R KT n ,

which will be useful in our proof.

Using Theorem 9 by Maurer et al. (2016) , we can write: 

EQUATION

EQUATION

where L(F ) is the largest value for the Lipschitz constants in the function space F , and D(S ) is the Euclidean diameter of the set S .

Using Theorem 12 by Maurer et al. (2016) again, for universal constants c 1 and c 2 :

EQUATION

Putting ( 19) and (20) together:

EQUATION

At this point, we have to bound the individual terms in the right hand side of ( 21), following the same procedure proposed by Maurer et al. (2016) .

Firstly, to bound L(F ), let y, y ∈ R KT n , where y = (y ti ) with y ti ∈ R K and y = (y ti ) with y ti ∈ R K . We can write the following:

EQUATION

)

whence L(F ) ≤ L(F).

Then, we bound: To minimize the last term, it is possible to choose y 0 = 0, as f (0) = 0, ∀f ∈ F, resulting in min y∈Y G(F(y)) = G(F(0)) = 0. We consider Car-On-Hill problem with discount factor 0.95 and horizon 100. Running Adam optimizer with learning rate 0.001 and using a mean squared loss, we train a neural network composed of 2 shared layers of 30 neurons each, with sigmoidal activation function, as described in Riedmiller (2005) . We select 8 tasks for the problem changing the mass of the car m and the value of the discrete actions a (Table 1 ). Figure 1(b ) is computed considering the first four tasks, while Figure 1 (c) considers task 1 in the result with 1 task, tasks 1 and 2 for the result with 2 tasks, tasks 1, 2, 3, and 4 for the result with 4 tasks, and all the tasks for the result with 8 tasks. To run FQI and MFQI, for each task we collect transitions running an extra-tree trained following the procedure and setting in Ernst et al. (2005) , using an -greedy policy with = 0.1, to obtain a small, but representative dataset. The optimal Q-function for each task is computed by tree-search3 for 100 states uniformly picked from the state space, and the 2 discrete actions, for a total of 200 state-action tuples.

G(W ( X)) = E sup

B.2 MULTI DEEP Q-NETWORK:

The five problems we consider for this experiment are: Cart-Pole, Acrobot, Mountain-Car, Car-On-Hill, and Inverted-Pendulum4 . The discount factors are respectively 0.99, 0.99, 0.99, 0.95, and 0.95. The horizons are respectively 500, 1, 000, 1, 000, 100, and 3, 000. The network we use consists of 80 ReLu units for each w t , t ∈ {1, . . . , T } block, with T = 5. Then, the shared block h consists of one

:

For simplicity, in this paper we refer to the concepts of task and domain interchangeably.

All proofs and the theorem for API are in Appendix A.2.

ν ,

We follow the method described inErnst et al. (2005).

The IDs of the problems in the OpenAI Gym library are: CartPole-v0, Acrobot-v1, and MountainCar-v0.

Figures and Tables:

Figure 1: (a) The architecture of the neural network we propose to learn T tasks simultaneously. The w t block maps each input x t from task µ t to a shared set of layers h which extracts a common representation of the tasks. Eventually, the shared representation is specialized in block f t and the output y t of the network is computed. Note that each block can be composed of arbitrarily many layers. (b) Results of FQI and MFQI averaged over 4 tasks in Car-On-Hill, showing Q * -Q π K on the left, and the discounted cumulative reward on the right. (c) Results of MFQI showing Q * -Q π K for increasing number of tasks. Both results in (b) and (c) are averaged over 100 experiments, and show the 95% confidence intervals.

Figure 2: Discounted cumulative reward averaged over 100 experiments of DQN and MDQN for each task and for transfer learning in the Acrobot problem. An epoch consists of 1, 000 steps, after which the greedy policy is evaluated for 2, 000 steps. The 95% confidence intervals are shown.

Figure 3: Discounted cumulative reward averaged over 40 experiments of DDPG and MDDPG for each task and for transfer learning in the Inverted-Double-Pendulum and Hopper problems. An epoch consists of 10, 000 steps, after which the greedy policy is evaluated for 5, 000 steps. The 95% confidence intervals are shown.

then by Lipschitz property of the loss function and the contraction lemma Corollary 11 Maurer et al. (2016): G(S) ≤ G(S ). By Theorem 12 by Maurer et al. (2016), for universal constants c 1 and c 2 :

w∈W T kti γ kti w tk (X ti ) X ti ≤ t sup l∈{1,...,T } E sup w∈W ki γ kli w k (X li ) X li = T sup l∈{1,...,T } G(W(X l )).(23)Then, since it is possible to bound the Euclidean diameter using the norm of the supremum value in the set, we bound D(S ) ≤ 2 sup h,w h(w( X)) and D(W ( X)) ≤ 2 sup w∈W T w( X) .Also, we bound O(F ):E sup g∈F γ, g(y) -g(y ) = E sup f ∈F T ti γ ti (f t (y ti ) -f t (y ti )) = t E sup f ∈F i γ i (f (y ti ) -f (y ti ))γ i (f (y ti ) -f (y ti ))

Then, substituting in (21), and recalling that G(S) ≤ G(S ):G(S) ≤ c 1 c 1 L(F)L(H)T sup l∈{1,...,T } G(W(X l )) + 2c 1 c 2 L(F) sup w∈W T w( X) O(H) + c 1 L(F) min p∈P G(H(p)) + 2c 2 sup h,w h(w( X)) √ T O(F).(25)Now, the first term A of (17) can be bounded substituting (25) in (18):ε avg ( ŵ, ĥ, f ) -1 nT ti ( ft ( ĥ( ŵt (X ti ))), Y ti ) between A, B and C of (17) completes the proof:ε avg ( ŵ, ĥ, f ) -ε * avg ≤ c 1 L(F)L(H) sup l∈{1,...,T } G(W(X l )) n + c 2 sup w w( X) L(F)O(H) nT + c 3 L(F) min p∈P G(H(p)) nT+ c 4 sup h,w h(w( X))

Peer review (iclr2020):
The paper attempts to give theoretical support for using shared representations among multiple tasks. The architecture has already been proposed in another paper. The main contribution of the paper is the theory that it claims to support this architecture. However, I am dubious that the architecture achieves the claimed bound. One, I do not see how the analysis of this paper is connected to this specific architecture. Two, the analysis follows from an existing paper by Farahmand (2011), which has already established a bound on the difference Q* - Q^{pi K}. This paper considers the same difference, separately for each task, so that the same bound from Farahmand (2011) can be trivially used. The shared layer h would affect the Q-values, but considering only the difference Q_t* - Q_t{pi K} abstracts away how sharing representations is helpful. Simply averaging the norm of the difference between Q_t* - Q_t{pi K} as if they are independent ignores the fact that the Q_t’s are all dependent due to the shared layer h. Also, I do not think that the proof of Theorem 2 and Theorem 6 can use the bound of Farahmand (2011). Because the definition of approximation error epsilon_k in Farahmand (2011) is very different from epsilon_{avg,k} used in this paper, this warrants the analysis to start from the beginning, deriving the bounds from relating Q_t* - Q_t^{pi K} to (epsilon_{avg, k})_{k=0}^{K-1}. The experiments compare known algorithms, and I am unsure how they support the theoretical bounds. Other comments: Inside the definition of (T*Q)(s,a), the probability measure P(s’|s,a) would be P^{(t)}. Thus, T* is not one optimality operator shared amongst all tasks, but one for each task. The notation should reflect this. Stating the descriptions of k, n explicitly in section 2 would be helpful. I had to read to section 3 to be sure that k stands for a sequence of number 0 to big K and i stands for 1 to n with n being the number of samples. Also, giving an intuitive explanation of gaussian complexity (1) and its use would also be helpful.