Abstract
Traditional Imitation Learning (IL) methods often struggle with long-horizon reasoning tasks where small errors compound over time. Hierarchical Imitation Planning with Search (HIPS) addresses these challenges by discovering variable-length subgoals within expert trajectories. By integrating a Vector Quantized Variational Autoencoder (VQVAE) for subgoal generation with classical search algorithms, HIPS enables agents to plan effectively in complex environments. Experimental results across challenging domains like Sokoban and the Traveling Salesman Problem demonstrate that HIPS significantly outperforms standard IL and offline reinforcement learning baselines, even surpassing expert performance in certain scenarios.
Introduction
Imitation Learning (IL) provides a powerful framework for training agents by leveraging expert demonstrations. However, applying IL to "long-horizon" problems—tasks requiring a long sequence of precise actions—remains a significant challenge. In environments such as Sokoban or complex robotic manipulation, a single deviation from the expert path can lead to states from which recovery is impossible.
Flat imitation models, which map states directly to actions, are particularly vulnerable to these compounding errors. While hierarchical approaches attempt to mitigate this by decomposing tasks into subgoals, they often rely on rigid, fixed-length temporal segments (e.g., selecting a subgoal every $N$ steps). Such fixed intervals are often misaligned with the natural logic of a task. Furthermore, most IL methods are bounded by the quality of the demonstrations; they lack a mechanism to optimize or improve upon the expert's path. HIPS is designed to overcome these limitations through adaptive subgoal discovery and high-level planning.
Methodology
HIPS introduces a three-tiered framework for hierarchical reasoning: subgoal identification, generative modeling, and high-level search.
1. Adaptive Subgoal Identification
Rather than segmenting trajectories at fixed intervals, HIPS employs a "detector" trained via reinforcement learning (specifically, the REINFORCE algorithm). This detector learns to partition expert trajectories into variable-length segments. The reward for the detector is based on the performance of a low-level policy: if the low-level policy can successfully reach a proposed state and replicate expert actions, that state is deemed a meaningful milestone. This allows the system to capture the underlying logical structure of the task, identifying subgoals that correspond to actual progress rather than arbitrary time steps.
2. Discrete Subgoal Generation via VQVAE
Once subgoals are identified, HIPS trains a Vector Quantized Variational Autoencoder (VQVAE) to model the distribution of these milestones. The VQVAE learns to propose a discrete set of potential subgoals from any given state. The use of vector quantization is critical; by mapping the continuous latent space to a discrete codebook, HIPS effectively limits the "branching factor" of the task. This discretization makes high-level planning computationally feasible by providing a finite set of likely next steps.
3. High-Level Planning and Search
At inference time, HIPS does not simply act reactively. Instead, it uses the VQVAE to propose candidate subgoals and employs classical search algorithms—such as A, Monte Carlo Tree Search (MCTS), or Policy-Guided Heuristic Search (PHS)—to find an optimal sequence of subgoals. Once a high-level plan is established, a learned low-level policy executes the primitive actions required to transition between subgoals. This planning phase allows the agent to "look ahead" and avoid the compounding errors that plague flat models.
Experimental Setup and Results
The authors evaluated HIPS on four domains requiring deep reasoning: Sokoban (a PSPACE-complete puzzle), the Sliding Tile Puzzle (STP), Box-World (a relational key-and-lock task), and a grid-based Traveling Salesman Problem (TSP).
Performance and Success Rates
HIPS demonstrated a substantial performance gap over strong baselines, including Behavioral Cloning (BC), Conservative Q-Learning (CQL), and the Decision Transformer (DT). In the Sokoban domain, HIPS achieved a 97.5% success rate, whereas BC and CQL achieved only 18.7% and 3.3%, respectively.
The "Stitching" Property and Self-Improvement
One of the most significant findings was HIPS's ability to outperform the expert demonstrations. In the TSP task, HIPS-A solved 100% of the test cases with an average of 168 steps, while the original "Teacher" demonstrations averaged 336 steps*. Because HIPS plans in a learned subgoal space, it can "stitch" together the most efficient segments from different demonstrations, resulting in a policy that is more optimal than any single expert trajectory in the training set.
Discussion and Limitations
While HIPS represents a significant advancement in hierarchical IL, several challenges remain. The planning phase currently requires a way to verify if a subgoal is reachable, which necessitates either the true environment dynamics or a learned dynamics model. Additionally, the current implementation is tailored to discrete state spaces. Extending HIPS to continuous control, such as high-dimensional robotics, would require new methods for defining subgoal reachability thresholds.
Furthermore, the model's performance is sensitive to hyperparameters, particularly the size of the VQVAE codebook and the subgoal penalty ($\alpha$). Future research may explore learning more abstract goal representations that can filter out task-irrelevant sensory noise, further increasing the robustness of the planning process.
Conclusion
HIPS provides a robust framework for long-horizon imitation by combining adaptive subgoal discovery with the power of discrete search. By moving beyond fixed-length hierarchies and reactive execution, HIPS enables agents to solve complex reasoning tasks and even improve upon the expert data they were trained on.
Summary updated