P LANNING TO P RACTICE : E FFICIENT O NLINE F INET UNING BY C OMPOSING G OALS IN L ATENT S PACE
A BSTRACT
General-purpose robots in real-world settings require diverse repertoires of behaviors to complete challenging tasks in unstructured environments.
To address this problem, goal-conditioned reinforcement learning aims to train policies that can reach configurable goals for a wide range of tasks on command.
However, such goal-conditioned policies are notoriously difficult and time-consuming to train from scratch.
In this paper, we propose Planning to Practice (PTP), a method that makes it practical to train goal-conditioned policies for long-horizon tasks that require multiple distinct types of interactions to solve.
Our approach is based on two key ideas.
First, we decompose the goal-reaching problem hierarchically, with a high-level planner that sets intermediate subgoals using conditional subgoal generators in the latent space for a low-level model-free policy.
Second, we propose a hybrid offline reinforcement learning approach with online fine-tuning, which uses previously collected data to pre-train both the conditional subgoal generator and the policy, and then fine-tune the policy via online exploration.
This finetuning process is itself facilitated by the planned subgoals, which break down the original target task into short-horizon goal-reaching tasks that are significantly easier to learn.
We conduct experiments in both the simulation and real world, in which the policy is pre-trained on demonstrations of short primitive behaviors and fine-tuned for temporally extended tasks that are unseen in the offline data.
Our experimental results show that PTP can generate feasible sequences of subgoals that enable the policy to efficiently solve the target tasks.
I NTRODUCTION
Developing controllers that can solve a range of tasks and generalize broadly in real-world settings is a long-standing challenge in robotics.
Such generalization in other domains such as computer vision and natural language processing has been attributed to training large machine learning models on massive datasets Krizhevsky et al.
Consequently, one promising approach to robustly handle a wide variety of potential situations that a robot might encounter is to train on a large dataset of robot behaviors.
Prior work in robotics has demonstrated effectively generalization from training on large datasets for individual tasks, such as grasping Levine et al.
Yu et al.
However, a general-purpose robot should be able to perform a wide range of skills, and should also be taskable .
That is, it must be able to complete a specific task when specified by a human, including temporally extended tasks that require sequencing many skills together to complete.
This topic has been studied in prior work on goal-conditioned reinforcement learning, where a robot aims to perform a task given a desired end state Khazatsky et al.
; Chebotar et al.
; Kalashnikov et al.
What remains to make these methods widely applicable for real-world robotics?
While goal-conditioned policies can be trained effectively for relatively short tasks, temporally extended multi-stage can pose a significant challenge for current methods.
These tasks present a major exploration challenge during online learning, and a major challenge for credit assignment during offline learning.
In this paper, we aim to address these challenges by combining two ideas.
The first is that long-horizon goal-reaching tasks can be decomposed into shorter-horizon tasks consisting of subgoals.
Supplementary video: sites.google.com/view/planning-to-practice
[Figure]
The second is that these subgoals can be used to fine-tune a goal-conditioned policy online, even if its performance from offline data is poor
The first idea enables us to address the exploration challenge, by automatically generating intermediate subgoals that can be “practiced” on the way to a longer-horizon final goal.
In the framework of goal-conditioned RL, solving long horizon tasks can be reduced to the problem of optimization over a sequence of subgoals for the goal-conditioned policy, and this optimization over subgoals can be regarded as a kind of high-level planning, where the optimizer selects “waypoints” for achieving a distant goal.
The high-level planner itself can use a learned high-level model.
However, if we rely entirely on offline data, credit assignment challenges make it difficult to perform longer-horizon tasks even with subgoal planning.
Even if the offline RL policy performs well on each individual skill, there may be errors from stitching skills together because the initial states of each stage diverge from the offline data when they are composed together.
In practice, this leads to poor performance when using only offline training.
Therefore, the second key idea in our work is to utilize subgoal planning not merely to perform a multi-stage task, but also to make it possible to practice that task to finetune it online.
While online training for temporally extended tasks is ordinarily difficult, by addressing the exploration challenge with subgoal planning, we make it possible for the robot to practice a series of relatively short-horizon tasks, which makes this kind of finetuning feasible.
Thus, the planner acts both as a higher level policy when performing the task, and as a scaffolding curriculum for finetuning the lower-level goal-conditioned policy By collecting data actively in a specific environment, we can directly experience the distribution shift and can use reinforcement learning to improve performance under this shift.
To this end, we propose Planning to Practice (PTP), an approach that efficiently trains a goalconditioned policy to solve multi-step tasks by setting subgoals to exploit the compositional structure of the offline data.
An outline is shown in Fig.
Our approach is based around a planner that composes generated subgoals to guide the goal-conditioned policy during an online fine-tuning phase.
To propose diverse and reachable subgoals to form the candidate plans, we design a conditional subgoal generator based on conditional variational autoencoder (CVAE)
Sohn et al.
Through training on the offline dataset, the conditional subgoal generator captures the distribution of reachable subgoals from a given state and generates sequences of subgoals from the learned latent space in a recursive manner.
Our subgoal planning algorithm hierarchically searches for subgoals in a coarse-to-fine manner using multiple conditional subgoal generators that trained to generate goals at different temporal resolutions.
Both the goal-conditioned policy and the conditional subgoal generators are pre-trained on the offline data, and the policy is fine-tuned on the novel target task.
Our main contribution is a system for learning to solve long-horizon goal-reaching tasks by finetuning the goal-conditioned policy with subgoal planning in a learned latent space.
We evaluate our approach on multi-stage robotic manipulation tasks with raw image observations and image goals in both simulation and the real world.
After being pre-trained on short demonstrations of primitive interactions, our approach is able to find feasible subgoal sequences as plans for unseen final goals by recursively generating subgoals with the learned conditional subgoal generators.
By comparing our approach with both model-free methods and prior approaches that optimize over subgoals, we demonstrate that the produced plans significantly improve the learning efficiency and the resultant success rates during the online fine-tuning.
R ELATED W ORK
We propose to use a combination of optimization-based planning and fine-tuning with goalconditioned reinforcement learning from prior data in order to allow robots to learn temporally extended skills.
In this section, we cover prior methods in offline RL, planning, goal-conditioned
RL, and how they relate to our method.
Learning from prior data.
Offline reinforcement learning methods learn from prior data Lange et al.
; Fujimoto et al.
; Kumar et al.
; Zhang et al.
(2021a)
; Kumar et al.
Fujimoto & Gu (2021); Singh et al.
(2020), and can also finetune through online interaction Nair et al.
Villaflor et al.
; Lu et al.
; Khazatsky et al.
; Lee et al.
Meng et al.
Such methods have been used in a variety of robotic settings Kalashnikov et al.
; Cabi et al.
; Kalashnikov et al.
; Lu et al.
Our focus is not on introducing new offline RL methods.
Rather, our work shows that planning over subgoals for a goal-conditioned policy that is pretrained offline can enable finetuning for temporally extended skills that would otherwise be very difficult to learn.
Goal-conditioned reinforcement learning.
The aim of goal-conditioned reinforcement learning (GCRL) is to control the agent to efficiently reach specified goal states Kaelbling (1993); Schaul et al.
Eysenbach et al.
Compared to policies that are trained to solve a fixed task, the same goal-conditioned policy can perform a variety of tasks when it is commanded with different goals.
Such flexibility allows GCRL to better share knowledge across different tasks and make use of goal relabeling techniques to improve the sample efficiency without meticulous reward engineering Andrychowicz et al.
; Pong et al.
(2020); Fang et al.
; Ding et al.
; Gupta et al.
; Sun et al.
Eysenbach et al.
Ghosh et al.
Prior has explored various strategies for proposing goals for exploration Nair et al.
(2018; 2019); Khazatsky et al.
Chane-Sane et al.
(2021), and studied goal-conditioned RL from offline data Chebotar et al.
However, such works generally aim to learn short-horizon behaviors, and learning to reach goals that require multiple stages (e.g., several manipulation primitives) is very difficult, as shown in our experiments.
Our work aims to extend model-free goal-conditioned RL methods by incorporating elements of planning to enable effective finetuning for multi-stage tasks.
Planning.
A wide range of methods have been developed for planning in robotics.
At the most abstract level, symbolic task planning searches over discrete logical formulas to accomplish abstract goals Fikes & Nilsson (1971).
Motion planning methods solve the geometric problem of reaching a goal configuration with dynamics and collision constraints Kavraki et al.
; Koenig &
Likhachev (2002); Karaman & Frazzoli (2011); Zucker et al. (2013); Kalakrishnan et al.
Prior methods have also considered task and motion planning as a combined problem Srivastava et al.
These methods generally assume high-level structured representations of environments and tasks, which can be difficult to actualize in real-world environments.
Since in our setting we only have image inputs and not structured scene representations, we focus on methods that can handle raw images for observations and task specification.
Combining goal-conditioned RL and planning.
A number of recent works have sought to integrate concepts from planning with goal-conditioned policies in order to plan sequences of subgoals for longer-horizon tasks Nasiriany et al.
Eysenbach et al.
(2019); Charlesworth & Montana (2020);
Pertsch et al.
; Sharma et al.
; Zhang et al.
(2021b).
These prior methods either propose subgoals from the set of previously seen states, or directly optimize over subgoals, often by utilizing a latent variable model to obtain a concise representation of image-based states Nair et al.
; Ichter et al.
; Nair & Finn (2019); Nasiriany et al.
; Pertsch et al.
Khazatsky et al.
(2021); Chane-Sane et al.
The method we employ is most closely related conceptually to the method proposed by Pertsch et al.
Pertsch et al.
(2020), which also employs a hierarchical subgoal optimization, and the method proposed by Nasiriany et al.
Nasiriany et al.
(2019), which also optimizes over sequences of latent vectors from a generative model.
Our approach makes a number of low-level improvements, including the use of a conditional generative model Nair et al.
(2019), which we show leads to significantly better performance.
More importantly, our method differs conceptually from these prior works in that our focus is specifically on utilizing subgoal opti- mization as a way to enable finetuning goal-conditioned policies for longer-horizon tasks.
We show that it is in fact this capacity to enable effective finetuning that enables our method to solve more complex multi-stage tasks in our experiments.
P ROBLEM S TATEMENT
In this paper, we consider the problem of learning to complete a long-horizon task specified by a goal image.
The robot learns over a variety of initial configurations and goal distributions, which cover a range of behaviors such as opening or closing a drawer, and picking, placing, or pushing an object.
As prior data, the robot has access to an offline dataset of trajectories D offline
= { τ 1 , τ 2 , . . .
, τ N } for offline pre-training.
In each trajectory, the robot is controlled by a human tele-operator or a scripted policy to achieve one of the goals the environment affords.
A goal-conditioned policy is pre-trained on this dataset using offline RL algorithms.
After offline pre-training, the robot is placed in a particular environment that it has online access to interact in.
Even though the initial configuration of this environment may have been included in the set of training environments, the goal distribution for this environment at test time requires sequencing multiple skills together, which is not present in the offline data.
For instance, as shown in Fig. 1, the robot would need to first slide away the can that blocks the drawer, then reaches the handle of the drawer, and finally opens the drawer.
Na¨ıvely running offline RL may not solve the long-horizon test tasks for two reasons.
First, the robot is given a test goal distribution that is long horizon but offline dataset consists of individual skills.
The method needs to somehow compose these individual skills autonomously in order to succeed at goals drawn from the test distribution.
Second, offline RL may not solve the task due to distribution shift.
Distribution shift appears in two forms: distribution shift between transitions in the prior data and transitions obtained by the actively rolling out the policy, and the distribution shift introduced when performing tasks sequentially.
If the robot may actively interact in the new environment to improve its policy, how can the robot further practice and improve its performance?
P RELIMINARIES
We consider a goal-conditioned Markov Decision Process (MDP) denoted by a tuple M =
( S , A , ρ, P, G , γ ) with state space S , action space A , initial state probability ρ , transition probability P , a goal space G , and discount factor γ .
In each episode, a desired goal s g ∈ G is sampled for the robot to reach.
At each time step t , a goal-conditioned policy π ( a t | s t , s g ) selects an action a t ∈ A conditioned on the current state s t and goal s g .
After each step, the robot receives the goal-reaching reward r t ( s t +1 , s g ) .
The robot aims to reach the goal by maximizing the average cumulative reward E [Σ t γ t r t ] .
Our approach learns a goal-conditioned policy π for solving the target task specified by a desired final goal s g .
The goal-conditioned policy is pre-trained on a previously collected offline dataset D offline and then fine-tuned to reach s g by accumulating data into an online replay buffer D online .
D offline contains diverse short-horizon interactions with objects in the environment.
During online fine-tuning, we would like the policy to learn to improve and compose these short-horizon behavior for multi-stage tasks specified by s g .
Defining informative goal-reaching rewards and extracting useful state representations from highdimensional raw observations such as images can be challenging.
Following the practice in prior work Nair et al.
; Khazatsky et al.
(2021), we pre-train a state encoder h
= ϕ
( s ) to extract the latent state representation h .
By encoding the states and goals to the latent space, we can obtain an informative goal-reaching reward function r t =
R ( h t +1 , h g ) by computing h t +1 = ϕ
( s t +1 ) and h g = ϕ
( s g ) .
Specifically, R ( h t +1 , h g ) returns 0 when || h t +1 ,
h g
|| <
ϵ and -1 otherwise, where ϵ is a selected threshold.
In addition, we also use ϕ ( s t +1 ) as the backbone feature extractor in all of our models that take s as an input.
For simplicity, we directly use s to denote h in the rest of the paper.
The details of the state encoder are explained in Appendix A.
P LANNING TO P RACTICE
We propose Planning to Practice (PTP), an approach that efficiently fine-tunes a goal-conditioned policy to solve novel tasks.
To enable the robot to efficiently learn to solve the target task, we propose to use subgoals to facilitate the online fine-tuning of the goal-conditioned policy.
Given the initial state s 0 and the goal state s g , we search for a sequence of K subgoals ˆ s 1 : K
= ˆ s 1 , ..., ˆ s K to guide the robot to reach s g .
Such subgoals will inform the goal-conditioned policy π ( a | s, s g ) what is the immediate next step on the path to s g and provide the policy more dense reward signals compared to directly using the final goal.
We choose the sequence of subgoals at the beginning of each episode and feed the first subgoal in the sequence to the goal-conditioned policy.
The policy will switch to the next subgoal in the sequence when the current subgoal is reached or the time budget assigned for the current subgoal runs out.
The main challenge is to search for a sequence of subgoals that can lead to the desired final goals while ensuring each subgoal is a valid state that can be reached from the previous subgoal.
Particularly when the states correspond to full images, most vectors will not actually represent valid states, and indeed na¨ıvely optimizing over image pixels may simply result in out-of-distribution inputs that lead to erroneous results when input into the goal-conditioned policy.
As outlined in Fig.
1, we devise a method to effectively propose and select valid subgoal sequences to guide online fine-tuning by means of a generative model.
At the heart of our approach is a conditional subgoal generator g ( ·| s 0 ) that recursively produces candidate subgoals in a hierarchical manner conditioned on the initial state s 0 .
To find the optimal sequence of subgoals
ˆ s ∗ 1: K , we first sample N candidate sequences ˆ s 11: K , ..., ˆ s N 1: K from the state space using the conditional subgoal generator.
Then we rank the candidate sequences using a cost function c ( s 0 , ˆ s 1: K , s g ) .
The sequence that corresponds to the lowest cost will be selected as ˆ s ∗ 1: K for the goal-conditioned policy.
Through this sampling-based planning procedure, we choose the subgoal for guiding the goal-conditioned policy π during online fine-tuning.
The overall algorithm is summarized in Algorithm 1.
Next we describe the design of each module in details.
Require: set of final goals G , time horizon T , offline data D offline , number subgoals
1: Train
Initialize converged do 4:
Reset the environment and observe s
Sample
Plan for the subgoals
7: k ←8: for
T do 9:
Compute the action a t ← π ( a t | s t
ˆ s K ) 10:
Observe the state s t +1 and the reward r t 11:
D online ← D online ∪ ( s t , a t , r t , s t +1 ) .
12: if t (mod ∆ t ) =
=
or || s t +1 − ˆ s K
|| <
ϵ then 13: k ← min( k + 1 , K ) 14: end if 15: end for 16:
Train π on batches sampled from D offline and
D online .
17: end while
Require: the initial state s 0 , the goal state s g , number of subgoals K , number of levels L , multiplier M , number of samples N .
: Sample N latent action sequences {
K } Ni generate g ( s, z ) .
5. C ONDITIONAL S UBGOAL G ENERATION
The effectiveness of our planner relies on the generation of diverse and feasible sequences of subgoals as candidates.
Specifically, we would like to generate the candidates by sampling from the distribution of suitable subgoal sequences p (ˆ s 1 , ..., ˆ s K | s 0 )
conditioned on the initial state s 0 .
Most existing methods independently sample the subgoal at each step from a learned prior distribution Pertsch et al.
(2020) or a replay buffer Eysenbach et al.
(2019), which is unlikely to propose useful plans for tasks with large, combinatorial state spaces (i.e., with multiple objects).
We propose to break down p (ˆ s 1 , ..., ˆ s K | s 0 ) into p (ˆ s 1 | s 0 )
Π ki =1 p (ˆ s i |
ˆ s i − 1 ) through modeling the conditional distribution p ( s ′ | s ) of the reachable next subgoal s ′ .
By utilizing temporal compositionality, the conditional subgoal generation paradigm improves generalization and enables generation of sequences of arbitrary lengths.
We use a conditional variational encoder (CVAE)
Sohn et al.
(2015) to capture the distribution of reachable goals p ( s ′ | s ) .
In the CVAE, we define the decoder as g ( s, z ) and the encoder as q ( z | s, s ′ ) , where z is the learned latent representation of the transitions and it is sampled from a prior probability p ( z ) .
To propose a sequence of subgoals, we use g ( s, z ) as the conditional subgoal generator.
Conditioned on the initial state s 0 , the first subgoal ˆ s 1 can be generated as ˆ s 1 =
g ( s 0 , z 1 ) given the sampled z 1 .
Then the i th subgoal can be recursively generated by sampling z i ∼ p
( z )
and
computing ˆ
s i
=
g (ˆ s i − 1 , z i ) given the previous subgoal
ˆ s i − 1 .
In this way, we could sample a sequence of i.i.d.
latent representations z 1 , ..., z K and recursively generate ˆ s 1 , ..., ˆ s K conditioned on the initial state s 0 using the conditional subgoal generator.
The CVAE is trained to minimize the evidence lower bound (ELBO)
Kingma & Welling (2014) of p ( s ′ | s ) given the offline dataset D .
During training, we sample transitions ( s t , s τ ) from the offline dataset to form the minibatches, where τ = t + ∆ t is a future step that is ∆ t steps ahead.
Instead of using a fixed ∆ t , we sample ∆ t from a range for each transition to provide richer data.
To encourage the trained model to be robust to compounding errors, we sample sequences composed of multiple states and use the subgoal reconstructed at the previous step as the context in the next step.
Therefore, the objective for training the conditional subgoal generator is:
[Equation]
where D KL [ ·||· ] indicates the KL-Divergence.
5. E FFICIENT P LANNING IN THE L ATENT S PACE
We build a planner that efficiently searches for sequences of subgoals in the latent space as shown in Algorithm 2.
To tackle the large search space of candidate subgoal sequences, we design a hierarchical planning algorithm that searches for subgoals in a coarse-to-fine manner and re-use the previously selected subgoals as candidates in new episodes.
The hierarchical planning is conducted at L levels with different temporal resolutions ∆ t 1 , ..., ∆ t L .
The temporal resolution of each level is an integral multiple of that of the previous level, i.e., ∆ t i =
M ∆ t i − 1 , where M is a scaling factor and is set to 2 in our experiments.
We first plan for the subgoals
ˆ s 11 , ˆ s 12 , ... on the first level.
Then the subgoals ˆ s l 1: K of finer temporal resolution are planned on each level l to connect the subgoals planned on the previous level l − 1 .
Specifically, given the adjacent subgoals ˆ s l − 1 i and ˆ s l − 1 i +1 produced on the previous level, we plan for a segment of M subgoals
ˆ s li ∗ M +1 , ..., ˆ s l ( i +1) ∗ M on the level l , by treating ˆ s l − 1 i and ˆ s l − 1 i +1 as the initial state and final goal state in Eqn. 3.
The planned segments are returned to the previous level and concatenated as a more fine-grained plan.
For this purpose, we train L conditional subgoal generators to propose subgoals that are ∆ t 1 , ..., ∆ t L steps away, respectively.
In contrast to the prior work Pertsch et al.
(2020), the conditional subgoal generators enable us to plan for unseen goals that are beyond the temporal horizon of the demonstrations in the offline dataset by exploiting the compositional structure of the demonstrations.
By recursively generating the subgoals across time at each level, we only need to enforce that the temporal resolution of the top level ∆ t L is smaller than since the the conditional subgoal generator f 1 ( s, z ) needs to be trained on trajectories at least ∆ t L + 1 steps in length.
We maintain a latent plan buffer for each level to further facilitate the planning with the conditional subgoal generator.
After each episode, the selected latent representations on each level are appended to the corresponding latent plan buffer.
In each target task, the subgoals are supposed to have the same semantic meaning.
In spite of the variations of the initial and goals state in each episode, the optimal plans in the latent space can often be similar to each other.
Therefore, we sample half of the latent representations from the prior distribution p ( z ) and the other half from the latent plan buffer among the initial samples to enhance the chance of finding a close initial guess.
We build our planner upon the model predictive path integral (MPPI) Gandhi et al.
(2021), which iteratively optimizes the plan through importance sampling.
In each interaction, we perturb the chosen plan in the latent space with a small Gaussian noise as new candidates.
5. C OST F UNCTION F OR F EASIBLE S UBGOALS
To provide informative guidance to the policy π ( a | s, s g ) , we would like that the final goal s g can be reached at the end of the episode while encouraging the transition between each pair of subgoals to be feasible within a limited time budget.
As explained in Sec. 4, the goal state is considered to be reached when the Euclidean distance between the last subgoal in the plan and the desired goal is less than a threshold δ in the learned latent space.
The feasibility of each transition between adjacent subgoals can be measured using the goal-conditioned value function V ( s, s ′ ) trained by the reinforcement learning algorithm.
Therefore, finding the subgoals ˆ s ∗ 1: K can be formulated as a constrained optimization problem: minimize
[Equation]
subject to
V (ˆ s i , ˆ s i +1 ) ≥ δ, for i = 0 , ..., K −where we use ˆ s 0 = s 0 to denote the initial state for convenience.
By re-writing Eq. 2 as a Lagrangian, we obtain the cost function with a weight η :
[Equation]
The details of our method are explained in Appendix A.
E XPERIMENTS
In our experiments, we aim to answer the following questions: 1) Can PTP propose and select feasible subgoals as plans for real-world robotic manipulation tasks?
2) Can the subgoals planned by PTP facilitate online fine-tuning of the goal-conditioned policies to solve target tasks unseen in the offline dataset? 3)
How does each design option affect the performance of PTP?
6. E XPERIMENTAL S ETUP
Environment.
As shown in Fig.
2, our experiments are conducted in a table-top manipulation environment with a Sawyer robot.
At the beginning of each episode, a fixed drawer and two movable objects are randomly placed on the table.
The robot can change the state of the environment by opening/closing the drawer, sliding the objects, and picking and placing objects into different destinations, etc.
At each time step, the robot receives a 48 x 48 RGB image via a Logitech C920 camera as the observation and takes a 5-dimensional continuous action to change the gripper status through position control.
The action dictates the change of the coordinates along the three axes, the change of the rotation, and the status of the fingers.
We use PyBullet Coumans & Bai (2016–2021) for our simulated experiments.
Prior data.
The prior data consists of varied demonstrations for different primitive tasks.
In each demonstrated trajectory, we randomly initialize the environment and perform primitive interactions such as opening the drawer and poking the object.
These trajectories are collected using teleoperation in the real world, and a scripted policy that uses privileged information of the environment (e.g., the object pose and the status of the drawer) in simulation.
The trajectories vary in length from 5 to 150 time steps, with 2,344 trajectories in the real world and 4,000 in simulation.
Target tasks.
In each target task, a desired goal state is specified by a 48 x 48 RGB image (same dimension with the observation).
The robot is tasked to reach the goal state by interacting with the objects on the table.
Task success for our evaluation is determined based on the object positions at the end of each episode (this metric is not used for learning).
As shown in Fig.
2, we design three target tasks that require multi-stage interactions with the environment to complete.
These target tasks are designed with temporal dependencies between stages (e.g.the robot needs to first move away a can that blocks the drawer before opening the drawer).
The transitions from the initial state to the goal state are unseen in the offline data.
The episode length is 400 steps in simulation andsteps in the real world, which are much longer than the time horizon of the demonstrations.
[Figure]
Baselines and ablations.
We compare PTP with 3 baselines and 3 ablations.
Model-Free uses a policy directly conditioned on the final goal and conducts online fine-tuning without using any subgoals.
LEAP Nasiriany et al.
(2019) learns a variational auto-encoder (VAE) Kingma & Welling (2014) to capture the prior distribution of states and plans for subgoals without conditioning on any context.
GCP Pertsch et al.
(2020) learns a goal predictor that hierarchically generates intermediate subgoals between the initial state and the goal state.
To analyze the design options in PTP, we also compare with variations of our method by removing the latent plan buffer ( PTP (w/o B) ), the hierarchical planning algorithm ( PTP (w/o
H) ), and both of these two designs ( PTP (w/o H and B) ).
All methods use the same neural network architecture in the goal-conditioned policy and are pre-trained on the same offline dataset.
6. Q UANTITATIVE C OMPARISONS
We evaluate PTP and baselines on three unseen target tasks.
We use simulated versions of these tasks for comparisons and ablations, and real-world tasks, where all pretraining and finetuning uses only real-world data, to evaluate the practical effectiveness of the method.
Simulation .
We first pre-train the goal-conditioned policy on the offline dataset for 100 epochs and the run online fine-tuning for the target task for 150 epochs.
Each epoch takes 2,000 simulation steps (only during fine-tuning) and 2,000 training iterations.
We run online fine-tuning using each method with 3 different random seeds.
After each epoch, we test the policy in the target task for 5 episodes.
We report the average success rate across 3 runs in Fig.
4 where the negative x-axis indicates the offline pre-training epochs and positive x-axis indicates the online fine-tuning epochs.
As shown in Fig.
4, our full model consistently outperforms baselines with a large performance gap.
The generated subgoals not only enables the pre-trained policy to achieve higher success rate by breaking down the hard problems into easier pieces, but also introduces larger performance improvements during online fine-tuning.
After fine-tuning for 150 epochs, the policy achieves the success rates of 84.9%, 59.9%, 49.3% in the three target tasks respectively.
Compared to the policy pre-trained on the offline dataset, the performance is significantly improved (+31.6%, +37.8%, and +13.8%).
When directly using the final goal or subgoals generated by baseline methods, the policy’s performance plateaus at around 0.0% to 30.0% and doesn’t improve much during online fine-tuning.
We found that the hierarchical planner and the latent plan buffer are crucial for PTP’s performance.
Without these two design options, the planner often suffers from the large search space of possible subgoal sequences and the resultant success rates decrease.
The latent plan buffer significantly improves the performance of non-hierarchical PTP while it has a minor effect on hierarchical PTP.
[Table]
Real-world evaluation.
We pre-train the policy for 200 epochs and fine-tune it forepochs.
In each epoch, we run 10,000 training iterations and collect 1,000 steps in the real world.
We train on three target tasks which are shown in Figure 2, and report the success rate of the goal-conditioned policy before and after online fine-tuning in Table 1.
Planning enables the robot to succeed partially with just the offline initialized policy, achieving success rates of 12 .
% and 25 .
0% on the three tasks.
Qualitatively, at the beginning of fine-tuning, the robot often fails, deviating from the planned subgoals or colliding with the environment.
With the planned subgoals, the original long-horizon task is broken down to short snippets that are easier to complete.
Even if a subgoal is not reached successfully at first, the data is useful to collect additional experience and fine-tune the policy.
After fine-tuning for 4-5 epochs, we already observe that the robot’s performance reaching subgoals during training time significantly improves, collecting even more coherent and useful data.
Afterepochs, we achieve success rates of
5% , 100 . 0% and 50 .
In comparison, GCP cannot provide useful guidance to the policy when the generated goals are noisy.
6. G ENERATED S UBGOALS
In Fig.
3, we present qualitative results of the generated subgoals for each task in the real world.
Each row shows a sequence of generated subgoals produced by the planner in each method.
In all the three target tasks, PTP successfully plans for a sequence of subgoals that can lead to the desired final goal.
The transition between adjacent subgoals are feasible within a short period of time.
By comparison, both of the baseline methods fail to generate reasonable plans.
Without conditioning on the current state, LEAP Nasiriany et al.
(2019) can hardly produce any realistic images of the environment.
Most of the generated subgoals are highly noisy images with duplicated robot arms and objects.
The quality of the subgoals produced by GCP Pertsch et al.
(2020) is higher than that of LEAP but still much worse than ours.
GCP cannot generalize well for the initial state and the goal state that are out of the distribution of the offline dataset, which contains only short snippets of demonstrations.
C ONCLUSION AND D ISCUSSION
We presented PTP, a method for real-world learning of temporally extended skills by utilizing planning and fine-tuning to stitch together skills from prior data.
First, planning is used to convert a long-horizon task into achievable subgoals for a lower level goal-conditioned policy trained from prior data.
Then, the goal-conditioned policy is further fine-tuned with active online interaction, mitigating the distribution shift between the offline data and actual states seen during rollouts.
This procedure allows robots to extend their capabilities autonomously, composing previously seen data into more complicated and useful skills.
A I MPLEMENTATION D ETAILS
Following Khazatsky et al.
(2021), we use a vector quantized variational autoencoder (VQVAE) van den Oord et al.
(2017) as the state encoder, which encodes a 48 × 48 × 3 image to a 720-dimensional encoding.
The conditional subgoal generator is implemented with a U-Net architecture Ronneberger et al.
and decodes the subgoal from a 8-dimensional latent representations conditioned on the encoding of the current state.
In our planner, we use L = 3 , K = 8 ,
M = 2 , N = 1024 , and we run MPPI for 5 iteration on each level.
g is trained to predict subgoals that are 15, 30, and 60 steps away.
Implicit Q-Learning (IQL)
Kostrikov et al.
(2021) is used as the underlying RL algorithm for offline pre-training and online fine-tuning with default hyperparameters.
We use the same network architectures for the policy and the value functions from Khazatsky et al.
(2021) for simulation experiments.
For real-world experiments, we use a convolutional neural network instead.
We use Adam optimizer with a learning rate of 3 · 10 − 4 and a batch size of 1024.
During training, we relabel the goal with future hindsight experience replay Andrychowicz et al.
(2017) with 70% probability.
We use ϵ = 3 for the reward function defined in Sec. 4, η = 0 .
01 in
Eqn. 3.