Planning to Practice: Efficient Online Fine-Tuning by Composing Goals in Latent Space
Abstract —General-purpose robots in real-world settings re- quire 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 finetuning, which uses previously collected data to pre-train both the conditional subgoal generator and the policy, and then finetune the policy via online exploration.
This fine-tuning 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. 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 [1].
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 [2], [3].
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 g ( · | ) π ( · | , )
[Figure] state [4], [5], [6].
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 longhorizon goal-reaching tasks can be decomposed into shorterhorizon tasks consisting of subgoals.
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 goalconditioned 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 goal-conditioned 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)
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 fine-tuning the goalconditioned 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 pretrained 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.
II. R ELATED W ORK
We propose to use a combination of optimization-based planning and fine-tuning with goal-conditioned 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 [8], [9], [10], [11], [12], [13], [14], and can also finetune through online interaction [15], [16], [17], [4], [18], [19]. Such methods have been used in a variety of robotic settings [20], [21], [6], [17]. 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 [22], [23], [24].
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 [25], [26], [27], [28], [29], [30], [31], [32].
Prior has explored various strategies for proposing goals for exploration [33], [34], [4], [35], and studied goal-conditioned RL from offline data [5].
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 [36].
Motion planning methods solve the geometric problem of reaching a goal configuration with dynamics and collision constraints [37], [38], [39], [40], [41].
Prior methods have also considered task and motion planning as a combined problem [42].
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 [43], [44], [45], [46], [47], [48].
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 [33], [49], [50], [43], [46], [4], [35].
The method we employ is most closely related conceptually to the method proposed by Pertsch et al.
[46], which also employs a hierarchical subgoal optimization, and the method proposed by Nasiriany et al.
[43], 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 [34], 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 optimization 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.
III. 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?
IV. 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 goalconditioned policy π for solving the target task specified by a desired final goal s g .
The goal-conditioned policy is pretrained 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 shorthorizon 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 multistage tasks specified by s g .
Defining informative goal-reaching rewards and extracting useful state representations from high-dimensional raw observations such as images can be challenging.
Following the practice in prior work [33], [4], 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 Sec.
VI-B.
V. 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 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.
Require: set of final goals G , time horizon T , offline data
D offline , number of subgoals K .
1: Train
2: Initialize online replay D online ← ∅ .
3: while not converged do 4:
Reset the environment and observe s 0 .
Sample s g from G .
Plan for the subgoals
ˆ s 1: K .
7: k ←8: for t = 1 , ..., 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
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.
A. Conditional Subgoal Generation
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 [46] or a replay buffer [44], which is unlikely to propose useful plans for tasks with large, combinatorial state spaces (i.e., with multiple objects).
Algorithm
( s
, L,
, M,
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 .
1: Sample N sequences 2: Recursively generate subgoals { ˆ
} Ni s, z ) . cost.
then 6: return s
7: else 8:
Denote ˆ s s 0 .
Initialize the plan ˆ S as an empty list 10: for i = 1 , ..., K do 11:
Append s i , L
M, M, N ) to S 12: end for 13: return S 14: end if
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)
[7] 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 late 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) [51] 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.
B. Efficient Planning in the Latent Space
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 [46], 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) [52], 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.
C. Cost Function For Feasible Subgoals
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. IV, the goal state is considered [Figure] to be reached when the Euclidean distance between the last subgoal in the plan and the desired goal is less than a threshold δ in latent
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
[Equation]
where we use ˆ s
= 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 Sec. VI-B.
VI. 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?
Can the subgoals planned by PTP facilitate online finetuning 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? Videos of our experimental results are available on the project website: sites.google.com/view/planning-to-practice
A. Experimental Setup
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 5dimensional continuous action to change the gripper status through position control.
The action dictates the change the coordinates the rotation, and the status of the fingers.
We use PyBullet [53] for our
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 and 125 steps in the real world, which are much longer than the time horizon of the demonstrations.
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 [43] learns a variational auto-encoder (VAE) [51] to capture the prior distribution of states and plans for subgoals without conditioning on any context.
GCP [46] 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. B. Implementation Details
Following [4], we use a vector quantized variational autoencoder (VQ-VAE)
[54] as the state encoder, which encodes a 48 × 48 × 3 image to a 720-dimensional encoding.
For the policy and the value functions, we use the same network architectures from [4] for simulation experiments and a standard convolutional neural network architecture for real-world experiments.
The conditional subgoal generator is implemented with a U-Net architecture [55] 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 QLearning (IQL) [56] is used as the underlying RL algorithm for offline pre-training and online fine-tuning with default hyperparameters.
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 [25] with 70% probability.
We use ϵ = 3 for the reward function defined in Sec.
IV, η = 0 .
01 in Eqn.
C. Quantitative Comparisons
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 finetuning for the target task for 150 epochs.
Each epoch takes 2,000 simulation steps (only during fine-tuning) and 2, 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.
3 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.
3, 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 does not 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 the the non-hierarchical PTP while has a minor effect on the hierarchical PTP.
Real-world evaluation.
We pre-train the policy forepochs and fine-tune it for 10 epochs.
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 I. Planning enables the robot to succeed partially with just the offline initialized policy, achieving success rates of 12 . % are [Table]
and 25 . 0% on the three tasks.
(When the offline policy is conditioned on only the final goal image without planning, the success rate is 0% .)
Then in each task, we fine-tune to a significantly higher success rate.
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 45 epochs, we already observe that the robot’s performance reaching subgoals during training time significantly improves, collecting even more coherent and useful data.
After 10 epochs, we achieve success rates of 62 .
% and 50 . 0% .
In comparison, GCP cannot provide useful guidance to the policy when the generated goals are noisy.
D. Generated Subgoals
In Fig.
4, 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 [43] 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 [46] 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.
VII. C ONCLUSION AND D ISCUSSION
We presented PTP, a method for real-world learning of temporally extended skills by utilizing planning and finetuning 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.