Learning to Search from Demonstration Sequences

Dixant Mittal, Liwei Kang, Wee Sun LeeICLR 2025

The Challenge of Learning to Plan

In many real-world scenarios, AI agents have access to "demonstration sequences"—logs of an expert solving a problem—but lack a ground-truth simulator or a pre-defined search tree. When learning from these sequences, standard approaches usually fall into two camps, both with significant drawbacks:

  1. Model-free learning: The agent tries to mimic the expert directly. This often fails when the agent encounters a state slightly different from the training data, leading to brittle performance.
  2. Model-based learning: The agent learns a "world model" (a simulator) separately and then tries to plan with it. However, small errors in the world model compound during planning, leading the agent into "imaginary" states that don't exist in reality.

The core challenge is figuring out how to train a search algorithm end-to-end. The act of building a search tree is inherently discrete and non-differentiable; if changing a model parameter slightly causes the algorithm to expand a completely different branch of the tree, the loss function becomes discontinuous, making standard gradient descent impossible.

Introducing Differentiable Tree Search Network (D-TSN)

To overcome this, the authors introduce the Differentiable Tree Search Network (D-TSN), a novel architecture that embeds the logic of a best-first search algorithm directly into a neural network. It consists of four learnable submodules: an Encoder (mapping observations to latent states), a Transition Model, a Reward Model, and a Value Function.

D-TSN Tree Expansion and Backup

To make the search process differentiable, D-TSN employs two key innovations:

  • Stochastic Tree Expansion: Instead of greedily picking the "best" node to expand, D-TSN uses a softmax distribution over path values to sample which node to expand. This turns a discrete, hard choice into a probabilistic one, making the expected loss continuous in the parameter space.
  • REINFORCE with Variance Reduction: The expansion policy is optimized using the REINFORCE algorithm. To combat the high variance typical of policy gradients, the authors adapt a "telescoping sum" trick. This creates a stable baseline for gradient updates by measuring the reduction in loss at each step of the tree construction.

The final model is trained on a combined loss that includes Q-value regression, consistency losses (ensuring the transition model stays grounded), and Conservative Q-Learning (CQL) to prevent the model from overestimating the value of unseen actions.

Key Insights

By training the world model and the planner together, D-TSN creates a built-in safety rail. The model learns to avoid states where its world model is inaccurate. If the planner ventures into a "hallucinated" state that leads to a high loss, the gradient descent process corrects the world model or the value function to prevent that mistake in the future.

Furthermore, unlike a flat "black box" neural network, D-TSN has the structure of a search algorithm built-in. This inductive bias makes it highly sample-efficient—it doesn't just learn what to do; it learns how to look ahead.

Experimental Results

The researchers evaluated D-TSN across three distinct domains to test reasoning, generalization, and complex environment navigation:

  1. Game of 24: A mathematical reasoning task where the goal is to combine four numbers using basic arithmetic to reach 24. D-TSN successfully fine-tuned a Large Language Model (Llama3-8B), achieving a 45.24% success rate, more than doubling the performance of a standard Supervised Fine-Tuning (SFT) baseline (21.32%).
  2. 2D Grid Navigation: A custom environment where a robot must find an exit. The model was trained on maps with two exits and tested on maps with only one to measure generalization.
  3. Procgen Games: A suite of 16 procedurally generated games designed to test how well agents generalize to new, unseen levels.
Navigation and Procgen Results

The results demonstrate D-TSN's robust generalization capabilities. In the Navigation task, when moved from the 2-exit training set to the 1-exit test set, model-free baselines saw their success rate plummet from 94.5% to 47.1%. D-TSN maintained a 99.3% success rate, proving it had learned the underlying logic of navigation rather than just memorizing paths. Across the Procgen suite, D-TSN outperformed prominent baselines like TreeQN and model-free Q-networks, achieving the highest mean Z-score (0.35).

Limitations and Future Work

While D-TSN marks a significant step forward in differentiable planning, it currently focuses on deterministic environments and discrete action spaces. Extending this architecture to handle stochastic worlds (where an action might have multiple outcomes) and continuous control (like robotics) are major next steps. Additionally, while tested on a math task with Llama3, scaling the transition model to handle the vast state space of open-ended natural language remains a significant, exciting challenge for future research.

Summary updated

BibTeX
@inproceedings{mittal2025learning,
  author = {Dixant Mittal and Liwei Kang and Wee Sun Lee},
  title = {{Learning to Search from Demonstration Sequences}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=v593OaNePQ},
}
Figure