Abstract
Searching for a path between two nodes in a graph is one of the most well-studied and fundamental problems in computer science. In numerous domains such as robotics, AI, or biology, practitioners develop search heuristics to accelerate their pathfinding algorithms. However, it is a laborious and complex process to hand-design heuristics based on the problem and the structure of a given use case. Here we present PHIL (Path Heuristic with Imitation Learning), a novel neural architecture and a training algorithm for discovering graph search and navigation heuristics from data by leveraging recent advances in imitation learning and graph representation learning. At training time, we aggregate datasets of search trajectories and ground-truth shortest path distances, which we use to train a specialized graph neural network-based heuristic function using backpropagation through steps of the pathfinding process. Our heuristic function learns graph embeddings useful for inferring node distances, runs in constant time independent of graph sizes, and can be easily incorporated in an algorithm such as A* at test time. Experiments show that PHIL reduces the number of explored nodes compared to state-of-the-art methods on benchmark datasets by 58.5% on average, can be directly applied in diverse graphs ranging from biological networks to road networks, and allows for fast planning in time-critical robotics domains.
Introduction
Finding the shortest path between two nodes is a cornerstone of computer science, essential for applications ranging from GPS navigation to chemical reaction planning. While algorithms like A are highly efficient, their performance depends critically on a heuristic function*—an estimate of the distance to the goal.
Traditionally, these heuristics are hand-designed (e.g., Euclidean distance for maps). However, manual design is laborious and often fails to capture the complex "inductive biases" of specific domains, such as structural patterns in protein-protein interaction networks or obstacle layouts in warehouse robotics. Existing machine learning approaches often struggle because search is inherently non-i.i.d. (independent and identically distributed); the nodes encountered depend on previous choices. Furthermore, a heuristic must run in constant time to avoid becoming the bottleneck of the search process itself.
Methodology: PHIL
The authors introduce PHIL (Path Heuristic with Imitation Learning), a framework that treats heuristic discovery as an imitation learning problem. PHIL utilizes a Recurrent Graph Neural Network (GNN) architecture. Unlike standard GNNs that process static graphs, PHIL incorporates a Gated Recurrent Unit (GRU) to act as a "memory." This memory captures the structure of the graph explored so far, enabling the model to navigate partial observability and recognize when it is stuck in local minima.
To address the non-i.i.d. nature of search data, PHIL is trained using the AggreVaTe imitation learning algorithm. The model "rolls in" with its current policy and "rolls out" with an oracle (a perfect heuristic knowing true shortest paths). Training involves Truncated Backpropagation Through Time (TBTT), allowing the model to learn how its internal "belief" about the graph should evolve over sequences of search steps. Crucially, the forward pass runs in $O(1)$ time relative to the total graph size, ensuring real-time planning efficiency.
Experimental Evaluation
PHIL was evaluated across a diverse set of domains, including grid benchmarks with challenging obstacles, citation networks (Cora, PubMed), biological networks (OGBG-Molhiv, PPI), road networks (OSMnx), and 3D drone flight simulations.
Key Results
- Efficiency Gains: PHIL reduced the number of expanded nodes by 58.5% on average compared to SAIL (the previous state-of-the-art). In specific datasets like "Gaps+Forest," the reduction reached 82.3%.
- Generalization: In citation and road networks, PHIL outperformed top baselines by an average of 13.4%. It successfully learned abstract topological heuristics in non-Euclidean domains where human intuition often fails.
- Robotics Performance: In 3D drone simulations, PHIL's search effort was within 0.3% to 4.9% of the theoretical minimum (the oracle path), significantly outperforming traditional A* and BFS.
- Computational Speed: PHIL runs 57.9% faster than novelty-based search methods like BFWS while maintaining high accuracy.
Discussion and Future Work
A key insight from this work is that memory is essential. By maintaining a latent representation of the visited graph, PHIL can escape local minima (like U-shaped obstacles) more effectively than heuristics that only consider the current node. Furthermore, the results demonstrate that imitation learning is superior to standard supervision for search tasks; standard supervised learning performed up to 40x worse, as it lacks the experience of its own mistakes.
Despite its success, PHIL can still occasionally struggle with extremely complex "bug trap" structures. Future research could explore "foundation models" for search that generalize across entirely different graph types without requiring per-domain retraining.
Summary updated