U NIVERSAL S UCCESSOR F EATURES FOR T RANSFER R EINFORCEMENT L EARNING
Anonymous authors
Paper under double-blind review
A BSTRACT
Transfer in Reinforcement Learning (RL) refers to the idea of applying knowledge gained from previous tasks to solving related tasks.
Learning a universal value function (Schaul et al., 2015), which generalizes over goals and states, has previously been shown to be useful for transfer.
However, successor features are believed to be more suitable than values for transfer (Dayan, 1993; Barreto et al., 2017), even though they cannot directly generalize to new goals.
In this paper, we propose (1) Universal Successor Features (USFs) to capture the underlying dynamics of the environment while allowing generalization to unseen goals and (2) a ﬂexible end-to-end model of USFs that can be trained by interacting with the environment.
We show that learning USFs is compatible with any RL algorithm that learns state values using a temporal difference method.
Our experiments in a simple gridworld and with two MuJoCo environments show that USFs can greatly accelerate training when learning multiple tasks and can effectively transfer knowledge to new tasks.
I NTRODUCTION
Deep Reinforcement Learning (RL) has been able to achieve human-level performance in many domains, such as playing Atari games (Mnih et al., 2015) and controlling robotic arms (Levine et al., 2016).
However, these methods often spend a huge amount of time and resources to train a deep model to perform a single task.
Currently applying knowledge gained from performing a single task to performing another related task remains a challenging problem.
This is the problem Transfer learning is trying to solve (Taylor & Stone, 2009).
Evidently though transferring knowledge from one task to another would not be possible if the two tasks were completely unrelated.
Therefore, in this work, we focus on one particular transfer scenario, where dynamics among tasks remain the same while their goals are different.
We elaborate on this in Sec.2.
What can we use as knowledge for transfer in RL?
One form of model-free knowledge is the goalspeciﬁc state-values as in general value functions (Sutton et al., 2011).
However, the state-values’ dependency on the goal and its corresponding reward structure may be an obstacle when attempting to use these values for transfer.
An alternative form of model-based knowledge is to learn the transition dynamics 1 , which are independent of the reward function.
However, when performing a rollout with the estimated transition dynamics prediction error will accumulate over time, which may limit the utility of this approach in practice.
A third form of knowledge that may be suitable for transfer is successor features (SFs) (Dayan, 1993; Barreto et al., 2017; 2018), which can recover state-values without explicitly performing a rollout.
Brieﬂy speaking, SFs provide an action-contingent summary of the future.
This third approach, cannot directly generalize to unseen new goals.
In this paper, we propose Universal Successor Features (USFs).
Similar to how a universal value function (Schaul et al., 2015) learn to generalize values over goals, USFs learn to generalize successor features over goals.
Since SFs for each goal capture certain knowledge about the underlying dynamics of the environment, USFs could learn the shared dynamics and exploit their generality over the goals.
Furthermore, USFs are also able to recover values without explicitly performing a rollout.
USFs result from decomposing universal state-values into USFs and reward features.
Note that while we focus on state-action-values (or simply action-values) in this paper in order to tackle control problems, this idea can apply to state-values as well.
Unlike in Schaul et al.
, we learn these two decomposed factors jointly by exploring the environment while bootstrapping.
Our contributions are three-fold.
First, we propose USFs and show how they can be applied to any
RL algorithm that learns state-values using a temporal difference method.
Second, we propose a ﬂexible end-to-end architecture that is suitable to learn USFs by interacting with the environment.
Third, our experiments demonstrate that USFs can greatly accelerate training when learning multiple tasks and can effectively transfer knowledge to new tasks.
This paper is organized as follows.
In Sec.2, we introduce USFs together with our end-to-end architecture, training procedure, and we further explain how USFs can be used for transfer
Reinforcement
Learning.
Then, in Sec.3, we demonstrate the results of applying USFs to a simple gridworld environment and two
MoJuCo environments.
Afterward, in Sec.4, we discuss some of the most relevant papers in the literature.
Finally we conclusions in Sec.5.
U NIVERSAL S UCCESSOR F EATURES
Consider a Markov decision process (MDP) with state space S , action space A , and transition function p where p ( s (cid:48) | s, a ) is the probability 2 of transitioning to s (cid:48) ∈ S when action a ∈ A is taken in state s ∈ S .
We borrow the extension of the MDP framework to goals and state-dependent discounting from Schaul et al.
For each goal g ∈ G (often G ⊆ S
but this is not an explicit requirement of this framework), deﬁne the pseudo-reward function r g ( s, a, s (cid:48) ) and pseudo-discount function γ g ( s ) ∈ [0 , 1] .
To deﬁne an episodic problem in this framework we can deﬁne γ g ( s ) to be 0 if s is a terminal state with respect to g .
For any policy π : S (cid:55)→ A and ﬁxed goal g , the action-value function is deﬁned as
[Equation]
As we now show, we can factorize Q πg into successor features and goal-speciﬁc features.
2. T RANSFER VIA U NIVERSAL S UCCESSOR F EATURES
As with Kulkarni et al.
(2016) and Barreto et al.
(2017), we assume that the reward function r g ( s t , a t , s t +1 ) can be factorized as
[Equation]
where φ : S ×
A × S (cid:55)→ R d represents the transitions and w g ∈ R
d are goal-speciﬁc features of the reward.
Note that in this factorization only w g depends on the goal.
In many situations φ ( s t , a t , s t +1 ) can be rewritten as φ ( s t +1 ) .
To see why, consider a simple gridworld with d cells.
Here φ ( s t , a t , s t +1 )
=
φ ( s t +1 ) can be a one-hot vector indicating the position of the agent at time t + 1 , while w g can be a d -dimensional vector whose i -th entry is the immediate reward of reaching the cell i under the goal g .
If φ ( s t , a t , s t +1 ) and w g are deﬁned in this way then whatever the previous state s t and action a t are, as long as the agent ends up in s t +1 , the transition is represented by φ ( s t +1 ) and the agent will receive the corresponding reward from w g for reaching that state.
In other cases where the reward depends on the whole transition, we can easily modify subsequent discussion and model architecture to accommodate this.
Using the factorization in Eq.(1), the action-value can be rewritten as
[Equation]
where ψ πg ( s, a ) are the Universal Successor Features (USFs) of s and a for goal g .
In the above gridworld example, ψ πg ( s, a ) would be a d -dimensional vector of discounted expected future state visitations that results after taking action a in state s and thereafter following policy π .
If w g is given, then the following Bellman equations enable us to learn USFs the same way as we would learn the action-values:
[Equation]
We can approximate ψ π ( s, a ) using a model ψ π ( s, a ; θ ψ ) parameterized by θ ψ , so that our method can be used with any algorithm that learns action-values using a temporal difference method 3 , including on-policy methods like SARSA (Sutton, 1996) and
A2C (Mnih et al., 2016) as well as off-policy methods like DQN (Mnih et al., 2015) and DDPG (Lillicrap et al., 2016).
One remaining problem is that we need to have w g for a given g .
One way to accomplish this is to model w g as w ( g ; θ w ) and learn the parameters θ w .
In order to utilize USFs for transfer, we can learn the parameters θ =
[ θ ψ , θ w ] from some “good” policies and their SFs for a subset of goals, then let the model generalize these learned SFs to the
SFs of “good” policies of unseen goals.
In the next section, we describe how one could train θ .
2. T RAINING USF S
Suppose that at time t , we obtain a transition 4 { g, s t , a t , s t +1 , r t +1 , γ t +1 } where r t +1 =
r g ( s t , a t , s t +1 ) and γ t +1 = γ g ( s t , a t , s t +1 ) .
This transition can either come directly from the environment or may be sampled from a replay buffer.
Recall that USFs can be applied to any base RL algorithm as long as it involves learning action-values using a temporal difference method.
In the case of DQN, which naturally extends to our multi-goal setting (see Appendix A for more details), we update the parameters θ Q of the action-value function using (semi-)gradient descent on [ Q ( s t , a t , g ; θ Q ) − y t ]where y t =
r t +
[Equation]
+
[Equation] [Equation]
2) is considered a ﬁxed target action-value (i.e., it is treated as a constant rather than a function of θ Q ).
Similarly, to learn USFs’ parameters θ for optimal action-values 5 , the next-state action a ∗ could be
[Equation]
Using this, we deﬁne the loss on Q to be
[Equation] [Equation]
, g
[Equation]
w
[Equation]
g ; θ w )
[Equation]
2 where (cid:98) Q t =
r t +1 + γ t +1 ψ ( s t +1 , a ∗ , g ; θ ψ ) (cid:62) w ( g ; θ w ) (3) is the ﬁxed target action-value.
Similarly, we deﬁne the loss on SF to be
[Equation]
where
[Equation]
is considered the ﬁxed target SF.
This loss ensures that the learned SF will satisfy its own Bellman equation.
As we will show in the experiments, this loss is resilient to the reward structure of the
MDP.
Although we can separately learn w based on a regression loss from Eq.(1), it is less informative in terms of guiding the agent compared to regression based on Eq.(3), the actual quantity for decision making (results in Appendix D).
Our ﬁnal loss function is L = L Q + λ · L ψ where λ >is a hyperparameter.
With this loss, we can perform updates based on the (semi-)gradient ∇ θ L .
To see how we can use USFs for transfer, note that because learning is based on the optimal action,
Eq.(3) and (4) learn the ψ that corresponds to the optimal policy of the given goal.
As long as the model is powerful enough, the learned USFs can directly generalize to unseen goals.
For each such goal, USFs can either produce a ψ corresponding to an optimal policy for that goal, or provide a reasonable approximation.
For the features φ ( s t , a t , s t +1 ) , as discussed above, it is often sufﬁcient to model it as φ ( s t +1 ) .
When there exists meaningful, natural representations for states, for example, one-hot vectors in a gridworld, we can use them for state representation.
If not then we need to learn φ ( s ) .
One obvious way to learn φ ( s ) would be to regress r on φ , w , but, as we mentioned above, learning based on r is less informative.
Unlike Kulkarni et al.
(2016) who learn the state representations separately with an auto-encoder, we embed the learning of φ into the learning of the USFs, in particular, one hidden layer in the neural networks as shown in Fig.1.
1: Initialize θ and replay buffer D 2: for each episode do 3:
Get goal g and initial state s4: for each time step t = 0 , · · · , T do 5: a t = Uniform( |A| ) if Bernoulli( (cid:15) ) otherwise argmax a Q g ( s t , a ; θ ) (cid:46) (cid:15) -greedy 6:
Execute a t and observe next state s t +1 and immediate reward r t + 7:
Store transition { g, s t , a t , s t +1 , r t +1 , γ t +1 } in D 8:
Sample random minibatch of transitions { g i , s i , a i , s i +1 , r i +1 , γ i +1 } from D 9:
Compute target (cid:98) Q i and (cid:98) ψ i according to Eq.
(3) and (4) (cid:46) as opposed to y t in Eq.(2) in case of multi-goal DQN 10:
Perform gradient descent on L w.r.t.
θ based on the targets (cid:46) as opposed to Eq.(2) 11: end for 12: end for
Fig.1 shows the neural network structure of our USFs.
This version corresponds to the ﬁnite action case.
After going through part of the USF network, a state s is represented by a d -dimensional vector φ ( s ) (Kulkarni et al., 2016).
Then it is concatenated with a goal vector to produce a ( |A| × d ) -dimensional
SF vector ψ ( s, a, g ) for all |A| actions.
On the right-most part of the network, we have a model to compute w g given a goal g .
The inner product of ψ and w will be the action-value Q for the corresponding action.
As a concrete example, Algo. 1 shows how DQN can be extended to Multi-goal DQN and how USFs can be applied to Multi-goal DQN.
There is an easy extension for the continuous action case.
The base
RL algorithm (e.g., DDPG, which also naturally extends to a Multigoal setting) may have an additional “actor” component for the policy.
In such cases, our model, with some minor modiﬁcations, can accommodate this.
We elaborate on this in Appendix B.
E MPIRICAL S TUDIES
When evaluating the transfer capability of the USFs framework, we seek to answer two key questions.
Firstly, when learning with multiple goals, can USFs successfully transfer knowledge between these goals and consequentially speed up training?
Secondly, how well can it transfer knowledge from previous tasks to new, previously unseen tasks?
To answer the ﬁrst question, we begin by training USFs on a set of training tasks (or source tasks) to evaluate its performance under a multitask setting.
Then, to answer the second question, we switch to a new set of unseen tasks (or target tasks) and observe how quickly and how well the agent can adapt to the new set of tasks.
In practice, this means we use the parameters the model has learned on the source tasks as initialization for the model on the target tasks.
Note that we also carry over the replay buffer from the source tasks.
In order to answer our aforementioned questions, we compare Multi-goal DQN with USFs as described in Algo.
1 against Multi-goal DQN.
While this is sufﬁcient for the ﬁnite action case, we would also like to consider the continuous action case.
For the continuous action case, we note that as with DQN, DDPG (Lillicrap et al., 2016) naturally extends to multiple-goals.
We refer to the resulting algorithm as Multi-goal DDPG, and we similarly compare it to Multi-goal DDPG with
USFs.
Note that as both Multi-goal DQN and Multi-goal DDPG can generalize over goals, they are strong baselines for comparison.
We do not compare to UVFA because learning it while exploring the environment in a Reinforcement Learning fashion is prone to be unstable and may require further prior knowledge to achieve reasonable performance (Schaul et al., 2015, Sec. 5.3).
In order to deal with this two-stage procedure mentioned above, we have to treat the replay buffer used in the above algorithms differently during the second stage.
In the ﬁrst stage the replay buffer is treated normally, but during the second stage, we maintain two buffers.
The ﬁrst buffer is the buffer carried over from training on the source tasks.
The second buffer is a new buffer where every new
[Figure]
→
G
[Figure] [Figure]
transition is stored.
Whenever we sample from the replay buffer in the second stage, we randomly pick one of the two buffers with equal probabilities.
To evaluate the performance of the above algorithms, we use the done rate , or the percentage of episodes where the agent reaches the goal.
We also include the average number of steps per episode as a supplementary result in the appendix.
We calculate these metrics using the same set of the goals the agent is learning on.
Additionally, in Sec.3.1, we also evaluate USFs on a set of hold-out goals, which is disjoint from the set of source and target goals.
This set of hold-out goals is used to evaluate the direct transfer performance (Taylor & Stone, 2009) or the performance on unseen goals without learning from interacting with them.
This is in contrast to the target goals where we evaluate the performance on unseen goals when learning from interacting with them.
All our results are averages of 20 runs.
We smooth our curves with a mean ﬁlter using window size of 50 in our gridworld experiments and a window size of 25 in our MuJoCo experiments.
In training we use (cid:15) -greedy when there are ﬁnite actions, but when evaluating we only consider the greedy policy in both the ﬁnite action and continuous action settings to measure the actual quality of the learned policy.
3. G RIDWORLD
We ﬁrst evaluate USFs on a simple gridworld environment as shown in Fig.2a, where the agent is trying to reach a speciﬁc goal cell.
Within this domain we consider three different reward structures: constant − 0 .
1 per step, 0 when reaching the goal room − k/ 10 per step, 0 when reaching the goal where k is the number of rooms the agent must still traverse (including the room the goal is in) to reach the goal using the optimal policy mixed at the start of each episode, randomly pick one of the two reward structures above
The room based reward structure is designed to provide the agent with an approximate distance to the goal while reducing the likelihood that the agent will get stuck in corners.
In this problem, as shown in Fig.1, the network takes the ( x, y ) coordinates of the current state and goal as input.
However, φ , which is the target of the USFs can either be a one-hot indicator vector as discussed in Sec.2.1 or can be learned as described in Sec.2.2.
We refer to the former as the one-hot representation and the latter as the learned representation .
We limit each episode to 31 steps, and, for each episode, the goal is randomly selected from a set of 12 goals.
To reduce the variability of goal sets and subsequently ease analysis, each set of goals is formed by randomly selecting 3 goals in each room without replacement.
After 48k timesteps of training in the ﬁrst stage, the set ofgoals is swapped out for a new, disjoint set of 12 goals formed by the same method for testing.
This allows us to determine the extent to which USFs can perform transfer learning.
We sweep over hyper-parameter settings and report results from the best performing one.
Fig.3 (left) compares the performance when evaluation is done using the same set of goals while Fig.3 (right) compares the performance when evaluated on a set of hold-out goals.
This helps us analyze the generality of the algorithms or the ability of the algorithms to transfer knowledge to new, unseen tasks without learning from them .
We provide the corresponding number of steps per episode in
Appendix C.
We make several observations regarding the aforementioned results.
(1) During training in the ﬁrst stage, Multi-goal DQN + USFs performs considerably better than Multi-goal DQN in regards to both maximizing the done rate and minimizing the number of steps per episode with all three reward structures.
The fact that this improvement is consistent across different reward structures indicates that USFs are robust against different reward structures.
For the test stage (second stage denoted by the shaded region), Multi-goal DQN + USFs can adapt at least as fast and occasionally faster.
(3) One would expect that because the one-hot representation accurately describes the states and perfectly satisfy Eq.
(1), Multi-goal DQN + USFs should perform better using the one-hot representation than with the learned representation.
However, this is not always the case.
As seen in the constant reward case, using ﬁxed representations can actually decrease performance when compared with learned representations.
One reason could be that when the reward structure is more stable/consistent like with the constant reward structure, learning the representations may be a less noisy process and, as a result, more effective.
The performance difference with and without
USFs is especially notable in Fig.3 (right) where the greedy policy learned by Multi-goal DQN is evaluated on a set of hold-out goals.
This difference in performance means that the USFs can, in fact, generalize better to new goals without even learning them, which may be one reason why it can achieve faster adaptation.
(5) When adding USFs to Multi-goal DQN, the improvement is more signiﬁcant with the room and mixed reward structures than the constant one.
This may suggest that
USFs are learning the factorization as we described in Sec.2 and this factorization may be helping the agent deal with reward structures that are very different between goals.
3. M U J O C O
In order to demonstrate the utility of USFs with continuous state/action spaces, we apply it to two environments that use the MuJoCo physics engine (Todorov et al., 2012).
The ﬁrst, the Reacher-v environment (Brockman et al., 2016), is shown in Fig.2b.
The second, OpenAI’s Gym FetchReachv2 environment (Plappert et al., 2018), is shown in Fig.2c.
For the Reacher-v2 environment, the agent’s objective is to move the joints so that the tip of the limb reaches a speciﬁc goal location.
In this environment, the goal g is speciﬁed by its ( x, y ) coordinates, the state fed to the network as input includes the position and velocity of the joints, and the actions are continuous and provide control of the joints.
In order to build a set of training and test goals for use with the Reacher-v2 environment, we partition the reachable goal space.
We use 4 spots around a 2-D platform as shown in Fig.2b to select training goals.
Training proceeds for 45k steps.
In the second stage, we randomly select points from the remaining reachable areas for testing.
For the FetchReach-v2 environment, the agent moves a simulated robotic arm and tries to make its gripper reach a speciﬁc goal location.
The goal g is speciﬁed as ( x, y, z ) coordinates, the state fed to the network as input includes the position and velocity of the hand, and the actions are continuous and provide three-dimensional control of the hand and one-dimensional control of the hand’s gripper.
To make the task harder, we lower the threshold for when the gripper has reached the goal to 0 .
Similarly to the Reacher-v2 environment, to build a set of training and test goals, we partition the reachable goal space.
We ﬁrst place the large sphere shown in Fig.
2d into the reachable area of the arm.
We then select the 6 highlighted spots around the sphere to select training goals.
Training proceeds for 50k steps.
As with the FetchReach-v2 environment, we randomly select points from the remaining reachable areas for testing.
Unlike in the gridworld experiments of Sec. 3.1, in both the Reacher-v2 environment and the
FetchReach-v2 environment φ must be learned.
The reward signal for both environments is the negative distance to the goal.
We show the done rate for the Reacher-v2 environment in Fig.
4a and for the FetchReach-v2 environment in Fig.
5a.
We furthermore provide the corresponding number of steps per episode in
Fig.9a and Fig.9b from Appendix C. For both the Reacher-v2 and the FetchReach-v2 environment,
[Figure]
[Figure]
USFs provide a considerable advantage in the ﬁrst stage, which suggests that USFs are useful when transferring between multiple tasks even in complicated environments.
When solving unseen tasks in the second stage, Multi-goal DDPG + USFs again offers an advantage over Multi-goal DDPG.
Additionally, in Fig.
4a there is a noticeable gap in the asymptotic performance, which indicates that USFs may be less subject to bias carrying over from previous tasks.
One possible reason why
Multi-goal DDPG + USFs may perform better is that USFs capture the transition dynamics of the environment, which tend to be stable among tasks.
To investigate why there exists such pronounced difference in performance, we also plot their TD errors (Eq.
(3)) in Fig.
4b and Fig.
5b.
We can observe that Multi-goal DDPG + USFs tends to have a more stable temporal difference error.
This may be one of the underlying reasons for more effective learning.
R ELATED W ORK
This work is most closely related to Universal Value Function Approximators (Schaul et al., 2015), or UVFA.
UVFA uses a two-stage procedure to learn this approximator, primarily in a supervised learning fashion.
It begins by constructing a state and goal representation using transitions from multiple tasks/goals via matrix factorization.
Then, in the second stage, it approximates such representations using deep neural nets so that it can generalize to unseen goals.
One of the key drawbacks of UVFA is that it relies heavily on the availability of known values for existing goals, whether optimal or estimated by a Horde-like architecture (Sutton et al., 2011).
Learning UVFA while exploring the environment in a Reinforcement Learning fashion is prone to be unstable and may require further prior knowledge to achieve reasonable performance (Schaul et al., 2015, Sec. 5.3).
In contrast, we demonstrate that our method can successfully learn SFs via direct bootstrapping and can be applied on top of any algorithm that learns state-action values using a temporal difference method.
This work is also related to Successor Features (SFs)
(Barreto et al., 2017; 2018).
Barreto et al.
(2017) perform General Policy Improvement (GPI) using previous tasks’ values. However, unlike with USFs, tasks are learned in a sequential manner (Caruana, 1997) and there is no direct generalization to unseen tasks.
The follow-up work by Barreto et al. (2018) showed that using rewards and action-values from training tasks as state features and successor features respectively is equally expressive when the training tasks are linearly independent.
When facing a new task, however, a new set of successor features must be learned, which means the model is required to grow linearly as we encounter more and more goals.
In comparison, USFs use a shared successor feature model to handle a large number or even inﬁnitely many goals, thereby avoiding an excessive memory cost.
Using the related concept of Successor Representations (SRs), Kulkarni et al. (2016) proposed a deep learning framework to approximate SRs and incorporate Q -learning to learn SRs through interacting with an environment that has a single goal.
In comparison, our approach learns the universal SFs that generalize not only over states but also over goals.
This generalization allows USFs to perform both multi-task learning and transfer learning.
Furthermore, while Kulkarni et al.’s method and USFs both make use of TD error, we additionally use Q -loss on state-action value (Eq.
(3)) instead of reward-prediction loss (from Eq.
(1)) to learn both USFs and goal-speciﬁc features w .
Appendix D show that this modiﬁcation can lead to a noticeable improvement in performance.
In addition to some of the work mentioned above, there exist several other papers that focus on learning with multiple tasks or goals.
Horde (Sutton et al., 2011) learns multiple general value functions simultaneously for preset goals in an off-policy manner.
Unlike our method, it cannot handle an inﬁnite number of goals and cannot generalize to unseen new goals.
Hindsight Experience Replay (Andrychowicz et al., 2017) maintains a replay buffer with additional goals for each trajectory to speed up learning and improve sample efﬁciency.
It is based on an observation that every failure trajectory (i.e., every episode where the agent was not able to reach its goal) can be a successful one if we treat the ﬁnal state of the trajectory as the goal.
Exploiting this observation creates a method that can generalize over goals when the reward signal is sparse.
However, unlike with USFs,
HER requires access to the reward function for each additional goal.
If such information is indeed available, USFs can be used in conjunction with HER.
We investigate this in Appendix E. Temporal Difference Models (Pong et al., 2018) learn time-varying value functions for goal-oriented problems.
It is somewhat related to our work in that it is also concerned with using temporal difference methods to learn the dynamics of the environment.
Finally, UNREAL (Jaderberg et al., 2016) uses auxiliary tasks to facilitate learning in a multi-goal environment.
However, they do not explicitly attempt to generalize over multiple goals or transfer knowledge between tasks.
C ONCLUSION
In this work we proposed Universal Successor Features (USFs) to perform transfer in Reinforcement Learning when tasks share the same underlying dynamics, but their goals differ.
We noted that USFs can be applied on top of any existing algorithms that learn action-values or state-values using a temporal difference method and subsequently presented an end-to-end architecture that can learn USFs by interacting with the environment.
Finally, we demonstrated that USFs can accelerate learning and are able to generalize over goals, including unseen ones
A M ULTI - GOAL B ASELINES
In this section, we elaborate on the multi-goal DQN and multi-goal DDPG baselines appearing in
Sec. 2 and 3.
Algo.2 shows the pseudo-code for Multi-goal DQN without USFs, and the corresponding model architecture is shown in Fig.6.
The two key differences between Algo.2 and Algo.1 is that in Algo.2 the target and the objective function are based on Eq.(2) instead of Eq.(3) and (4).
The extension of this to DDPG is straightforward.
1: Initialize θ and replay buffer D 2: for each episode do 3:
Get goal g and initial state s4: for each time step t = 0 , · · · , T do 5: a t = Uniform( |A| ) if Bernoulli( (cid:15) ) otherwise argmax a Q g ( s t , a ; θ ) (cid:46) (cid:15) -greedy 6:
Execute a t and observe next state s t +1 and immediate reward r t + 7:
Store transition { g, s t , a t , s t +1 , r t +1 , γ t +1 } in D 8:
Sample random minibatch of transitions { g i , s i , a i , s i +1 , r i +1 , γ i +1 } from D 9:
Compute target y i =
r i +
+ γ
i +1 max a Q ( s i +1 , a, g i ; θ ) (see Eq.
Perform (semi-)gradient descent on [ Q ( s i , a i , g i ; θ ) − y i ] 2 w.r.t.
θ based on the target 11: end for 12: end for
B DDPG WITH USF S
In this section, we discuss how DDPG can be extended to the multi-goal setting and how it can be used with USFs.
Algo.
3 shows the pseudo-code for Multi-goal DDPG with USFs, and the corresponding model architecture is shown in Fig.7.
There are two major differences from Algo.1.
First, the action selection method is different.
The exploration (line 5) and the next-state action (line 9) now depend on the actor network (dashed components in Fig.7) instead of the action-values or taking the maximum.
Second, there is an additional step of policy gradient (line 12) when updating the actor network.
1: Initialize USFs’ parameters θ , actor parameters θ π and replay buffer D 2: for each episode do 3:
Get goal g and initial state s4: for each time step t = 0 , · · · , T do 5: a t =
π
( s t ; θ π ) + (cid:15) where (cid:15) ∼ N (0 , σ 2 ) (cid:46)
Noisy action 6:
Execute a t and observe next state s t +1 and immediate reward r t + 7:
Store transition { g, s t , a t , s t +1 , r t +1 , γ t +1 } in D 8:
Sample random minibatch of transitions { g i , s i , a i , s i +1 , r i +1 , γ i +1 } from D 9:
Compute next state action a
i +1 =
π ( s i +1 ; θ π ) 10:
Compute target (cid:98) Q i and (cid:98) ψ i according to Eq.
(3) and (4) with a i +1 instead of a ∗ 11:
Perform gradient descent on L w.r.t.
θ based on the targets 12:
Update θ π by policy gradient descent 13: end for 14: end for
C N UMBER OF S TEPS PER E PISODE
Fig.8 shows the average number of steps per episode from the runs appearing in Fig.3, Fig.9a shows that for the runs appearing in Fig.4a, and Fig.9b shows that for the runs appearing in Fig.5a.
[Figure]
D L EARNING WITH AN A LTERNATIVE O BJECTIVE
This section empirically justiﬁes our proposed objective and showcase the difference in performance when using an obvious alternate objective.
Recall that, as described in Sec.2.2, we use L Q + λ · L ψ as our objective when learning the model parameters.
One could instead use Eq.(1) to replace Eq.(3) with the following loss:
[Equation]
Fig.10 shows the done rates on the Gridworld domain described in Sec.
3.1 when using an actionvalue–based loss ( L Q + λ · L ψ ) and when using a reward-prediction–based loss ( L r + λ · L ψ ).
Here we observe that, under all three reward structures, L Q performs considerably better than L r .
E E XPERIMENTS WITH HER
Hindsight Experience Replay (Andrychowicz et al., 2017), or HER, is a method of accelerating learning in multi-goal settings.
It accomplishes this by hallucinating experienced transitions as if they were experienced while pursuing an alternate goal.
However, notice that unlike USFs, HER requires access to the reward function for the alternative goal in order to hallucinate accurate transitions.
If such information is indeed available, USFs can be used in conjunction with HER.
We experiment with USFs and HER in both the gridworld domain described in Sec.3.1, and the two
MuJoCo domains described in Sec.3.2. Fig. 11 shows the done rate achieved by Multi-goal DQN with and without USFs when they are used in conjunction with HER. Fig.12 shows the done rate achieved by Multi-goal DDPG with and without USFs when they are combined with HER.
In both cases, we observe that HER does not diminish and occasionally increases the beneﬁts of USFs.
[Figure] F E XPERIMENTAL D ETAILS In this section, we detail the hyperparameters used and the architectural details of our experiments. For the Gridworld domain, we used Multi-goal DQN and Multi-goal DQN with USFs.
The architecture of Multi-goal DQN appears in 6.
Here θ (1) , θ (2) , and θ (3) were fully connected networks with one hidden layer of 81, 64, and 256 nodes respectively and ReLU activation.
The architecture of Multi-goal DQN with USFs is described in App.
A and shown in Fig.
Here θ (1) , θ (2) , and θ (3) were fully connected networks with one hidden layer of 81, 64, and 256 nodes respectively and
ReLU activation.
θ w was a fully connected network with two hidden layers of 64 nodes and ReLU activation.
For the MuJoCo domain, we used Multi-goal DDPG and Multi-goal DDPG with USFs.
The architecture of Multi-goal DDPG is the same as the architecture appearing in Fig.
6 but with the addition of an actor network.
Here the actor network was a fully connected network with two hidden layers of 64 nodes and ReLU activation.
θ (1) , θ (2) , and θ (3) were fully connected networks with one hidden layers of 64 nodes and ReLU activation.
The architecture of Multi-goal DDPG with USFs is described in App. B and shown in Fig.
Here θ π and θ w were fully connected networks with two hidden layers of 64 nodes and ReLU activation.
θ (1) ψ , θ (2) ψ , θ (3) ψ were fully connected networks with one hidden layer of 64 nodes and ReLU activation.
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
1e
[Table]
1e
[Table]
1e
[Table]
1e
[Table]
[Table]
1e
[Table]
1e
[Table]
1e
[Table]
1e
[Table]
[Table]
N
[Table]
1e
[Table]
N/
[Table]
1e
[Table]
[Table]
[Table]
HER Future Steps
N/A
N/A
HER Buffer Sampling Probability
N/A
N/A 0.