Paper deep dive
UPath: Universal Planner Across Topological Heterogeneity For Grid-Based Pathfinding
Aleksandr Ananikian, Daniil Drozdov, Konstantin Yakovlev
Intelligence
Status: succeeded | Model: Gemma-4-26B-A4B | Prompt: intel-v1 | Confidence: 90%
Last extracted: 7/20/2026, 7:35:41 AM
Summary
The paper introduces UPath, a universal heuristic predictor for grid-based pathfinding that generalizes across topologically heterogeneous environments. Unlike previous learning-based methods that assume in-distribution training and testing data, UPath is trained on simple procedural priors (Uniform, Beta, Beta-Figures) and evaluated on diverse, unseen topologies. It predicts a correction factor map to guide the A* algorithm, reducing computational effort by up to a factor of 2.2 while maintaining solution costs within 3% of optimal.
Entities (11)
Relation Signals (10)
UPath → guides → A*
confidence 95% · Second, we run a heuristic search procedure (A*) using the resulting heuristic values.
UPath → reducescomputationaleffortby → 2.2%
confidence 95% · Our extensive empirical evaluation shows that the suggested approach halves the computational effort of A* by up to a factor of 2.2
UPath → uses → Correction Factor
confidence 95% · First, given an input grid, the network predicts a dense correction factor map cf(·)
UPath → outperforms → Weighted A*
confidence 90% · It also outperforms Weighted A* and prior learnable planners
UPath → trainedon → Uniform
confidence 90% · Overall, we use the following grids for training. Uniform.
UPath → trainedon → BETA
confidence 90% · Overall, we use the following grids for training. Beta.
UPath → trainedon → Beta-Figures
confidence 90% · Overall, we use the following grids for training. Beta-Figures.
TransPath → uses → Correction Factor
confidence 90% · TransPath Kirilenko et al. (2023), which learns a correction factor
→ →
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:The performance of search algorithms for grid-based pathfinding, e.g. A*, critically depends on the heuristic function that is used to focus the search. Recent studies have shown that informed heuristics that take the positions/shapes of the obstacles into account can be approximated with the deep neural networks. Unfortunately, the existing learning-based approaches mostly rely on the assumption that training and test grid maps are drawn from the same distribution (e.g., city maps, indoor maps, etc.) and perform poorly on out-of-distribution tasks. This naturally limits their application in practice when often a universal solver is needed that is capable of efficiently handling any problem instance. In this work, we close this gap by designing an universal heuristic predictor: a model trained once, but capable of generalizing across a full spectrum of unseen tasks. Our extensive empirical evaluation shows that the suggested approach halves the computational effort of A* by up to a factor of 2.2, while still providing solutions within 3% of the optimal cost on average altogether on the tasks that are completely different from the ones used for training $\unicode{x2013}$ a milestone reached for the first time by a learnable solver.
Tags
Links
- Source: https://arxiv.org/abs/2602.23789v1
- Canonical: https://arxiv.org/abs/2602.23789v1
Trouble viewing inline? Open PDF directly →
Full Text
46,166 characters extracted from source content.
Expand or collapse full text
UPath: Universal Planner Across Topological Heterogeneity For Grid-Based Pathfinding Aleksandr Ananikian Equal contribution. Daniil Drozdov11footnotemark: 1 Konstantin Yakovlev Saint-Petersburg University a.ananikian, d.drozdov, k.yakovlev@spbu.ru Abstract The performance of search algorithms for grid-based pathfinding, e.g. A*, critically depends on the heuristic function that is used to focus the search. Recent studies have shown that informed heuristics that take the positions/shapes of the obstacles into account can be approximated with the deep neural networks. Unfortunately, the existing learning-based approaches mostly rely on the assumption that training and test grid maps are drawn from the same distribution (e.g., city maps, indoor maps, etc.) and perform poorly on out-of-distribution tasks. This naturally limits their application in practice when often a universal solver is needed that is capable of efficiently handling any problem instance. In this work, we close this gap by designing an universal heuristic predictor: a model trained once, but capable of generalizing across a full spectrum of unseen tasks. Our extensive empirical evaluation shows that the suggested approach halves the computational effort of A* by up to a factor of 2.22.2, while still providing solutions within 3%3\% of the optimal cost on average altogether on the tasks that are completely different from the ones used for training – a milestone reached for the first time by a learnable solver. 1 Introduction Path planning in static or unknown environments is a fundamental and extensively studied problem in AI and robotics. A common formulation discretizes a continuous workspace into a grid, frequently an 8‑connected one, and reduces navigation to a shortest‑path search task. In such graphs, nodes represent grid cells and edges encode permissible transitions. Figure 1: The difference between WA* and our approach. Expanded nodes are shown in magenta, while path in green. Heuristic search algorithms, such as A* Hart et al. (1968), remain the algorithmic backbone for grid‑based planning due to their elegance, completeness, and tunable efficiency. However, their performance critically depends on the quality of the heuristic – an estimate of cost‑to‑go from each node to the goal. While Manhattan or octile distance heuristics are standard, they are instance‑independent and fail to exploit the obstacle layout of a particular environment, often leading to excessive node expansions especially in cluttered maps. To overcome these limitations, recent research has explored deep learning for constructing instance-aware heuristics. By viewing grid maps as binary images, convolutional neural networks, sometimes augmented with attention or transformers, are trained to produce cost-to-go predictions or guidance maps that influence search algorithms. Notably, methods like Neural A* Yonetani et al. (2021) reformulate A* in a differentiable end‑to‑end framework, improving path optimality and search efficiency compared to classical heuristics. Another representative method is TransPath Kirilenko et al. (2023), which learns a correction factor – the ratio between a standard heuristic for 8-connected grid (i.e. the octile distance) and the perfect heuristic that equals the cost of the shortest path to a goal cell on a given grid. This approach has demonstrated up to 44× reduction in node expansions while producing solutions within 0.3%0.3\% of optimal cost. Despite these advances, a fundamental limitation remains: most learning-based heuristics are developed under an implicit in-distribution assumption, where training and deployment maps share the same generative structure. This assumption is often violated in practice, where planners must operate across heterogeneous environments and under distribution shift, typically without the opportunity to retrain or re-tune the model for each new domain. In this work, we pursue train once, search everywhere paradigm by proposing a universal heuristic predictor – a single neural network trained once and then used as a drop-in heuristic module for classical search across a broad spectrum of grid-based planning tasks, including strictly out-of-distribution scenarios. Our solver consists of two components. First, given an input grid, the network predicts a dense correction factor map cf(⋅)cf(·), where for each cell n, cf(n)cf(n) is defined as the ratio between a standard geometric heuristic (octile distance) and the perfect heuristic (the true shortest-path cost-to-go on the given map). Second, we run a heuristic search procedure (A*) using the resulting heuristic values. Predicting a correction factor, rather than regressing the absolute cost-to-go, retains a strong geometric prior while allowing the model to account for obstacle-induced detours. Crucially, our training protocol does not rely on injecting representative out-of-distribution examples. To study this regime explicitly, we train only on maps generated from simple stochastic priors (including purely local randomness, global density variation, and structured obstacle patches), but evaluate on a separate suite of 20,00020,000 planning tasks drawn from ten qualitatively different topology generators spanning both realistic layouts and diverse synthetic patterns. Supervision is obtained by running Dijkstra’s algorithm from the goal to compute the perfect cost-to-go, from which correction-factor targets are derived; obstacle and goal cells are masked during training to avoid degenerate supervision. Empirically, compared to vanilla A*, our method reduces computational effort by up to a factor of 2.2 while producing solutions within approximately 3% of optimal cost on average. It also outperforms Weighted A* and prior learnable planners, yielding a more favorable efficiency–generalization trade-off. Figure 1 qualitatively illustrates this effect: across maps with different spatial structure, our learned guidance concentrates expansions into decision-relevant regions while still recovering a valid route, in contrast to the broader expansion patterns induced by heuristic inflation. 2 Related Work The research areas most relevant to this work are learning for search – specifically, learning for pathfinding – and the evolution of pathfinding datasets used to study navigation and shortest-path planning. Learning-guided best-first search Many planning and reasoning problems can be cast as search on a (possibly implicit) state-transition graph, unifying classical path planning with combinatorial puzzles, logic synthesis, and retrosynthetic planning Zhao et al. (2024). A large fraction of practical approaches rely on best-first search (BestFS), where an evaluation function f prioritizes which frontier state to expand next. Learning-based methods improve search by predicting effective components of f, such as heuristics, achieving strong results in domains like Rubik’s Cube Agostinelli et al. (2019) and Sokoban Orseau et al. (2023). Recent work further explores training guidance that transfers across multiple environments Hao et al. (2024). Machine learning for pathfinding Within pathfinding, learning-based methods can be roughly grouped into two main directions. The first (and most closely related to our work) learns a heuristic or search guidance signal that can be used at inference time within a classical planner such as A*. The latter remains unchanged, but its expansion order is shaped by a learned model, enabling plug-and-play integration and preserving the desirable guarantees and modularity of classical search. Representative examples include approaches that predict heuristics for A*-like algorithms SaIL Bhardwaj et al. (2017), TransPath Kirilenko et al. (2023). The second direction focuses on differentiable planning, where gradients are propagated through a planning procedure to train neural components end-to-end. Examples include Yonetani et al. (2021) and Chen et al. (2025). These methods are conceptually appealing because they directly optimize planning behavior, but they are often challenging to deploy in practice due to slow training, instability, and sensitivity to hyperparameters, especially when scaling to large environments or long-horizon searches. Path planning datasets and evaluation distributions Benchmarking grid-based path planning has traditionally relied on simulated environments. A widely used reference collection is the Moving AI Lab benchmark suite Sturtevant (2012), which synthetic maps (e.g., mazes, rooms, and random obstacles), maps derived from commercial games such as Baldur’s Gate, and large-scale city/street layouts. Another common source is the Motion Planning (MP) dataset Bhardwaj et al. (2017), which provides eight families of grid environments with distinctive obstacle patterns. Building on MP, the Tiled Motion Planning (TMP/TiledMP) dataset Yonetani et al. (2021) composes multiple MP maps into larger layouts to increase structural diversity. Despite their utility, these benchmarks still only partially reflect the spatial statistics of real indoor environments. HouseExpo Li et al. (2019), based on the manually created SUNCG dataset Song et al. (2017), was introduced to narrow this gap by providing a large-scale collection of 2D indoor layouts. In our work, we sample a subset from each of the above datasets and rescale all maps to a fixed grid resolution, as well as we add a range of other procedurally generated layouts that cover different grid topologies. 3 Background 3.1 Pathfinding problem Consider a graph G, specifically, a grid made up of the blocked and free cells. From any free cell, an agent can move to any of its eight neighboring cells, four in the cardinal directions, and four diagonally, provided that the destination cell is also free. Movements in the cardinal directions each carry a cost of 11, while diagonal moves cost 2 2. This framework is known as an 8-connected grid with non-uniform movement costs. A path between two distinguished free cells startstart and goalgoal is a sequence of the adjacent cells connecting them: π(start,goal)=(c0=start,c1,c2,…,cn=goal)π(start,goal)=(c_0=start,c1,c2,…,c_n=goal). This path is valid if and only if every cell cic_i in the sequence is free. The cost of a valid path is cost(π)=∑i=0n−1cost(ci,ci+1). cost(π)= _i=0^n-1 cost(c_i,c_i+1). Let Π denote the set of all valid paths from startstart to goalgoal. The optimal (minimum-cost) path π∗π^* is the one that satisfies ∀π∈Π:cost(π∗)≤cost(π)∀π∈ :\> cost(π^*)≤ cost(π). Now, the pathfinding problem (on an 8-connected grid) can be formally stated as a triplet: P=(G,start,goal)P=(G,start,goal). To solve this problem means to construct a corresponding valid path. An optimal solution is a shortest path π∗π^*. In this paper, we focus on finding valid paths efficiently, rather than constructing the optimal ones. 3.2 A* search A* is a heuristic search algorithm which is widely used to solve the pathfinding problems described above and is renowned for its simplicity and strong theoretical guarantees. During execution, A* incrementally grows a search tree whose nodes represent grid cells augmented with search metadata. Typically, each node stores the g-value, which is the cost of path from the start node to this node, the h-value, a heuristic estimate of the cost from this node to the goal, the f-value, which is the sum of g- and h-values. At each iteration, A* selects a node with the smallest f-value from the search frontier, called OPEN, to be expanded. Expanding a node is comprised of generating all its valid successors, those reachable by a legal move on the grid, calculating the g-value of each successor by adding the appropriate transition cost to the parent’s g-value, and then updating the search tree appropriately. Specifically, if a successor is a newly generated node then it is immediately added to the tree as the leaf; if a tree already contains a similar node but with the better g-value, the successor is discarded; if a tree contains a similar node but its g-values is worse (i.e. a better path to this node is found) then the latter is updated. Each newly added or updated search node is added to OPEN. The expanded node is removed from the search frontier and is marked as CLOSED. The algorithm terminates when the goal node is removed from OPEN, at which point the sought path can be reconstructed by following the back-pointers in the search-tree. The crucial component of A* algorithm is a heuristic function that can be considered as an input to the algorithm (along with the specific pathfinding problem instance to solve). Specifically, how well this function estimates the path costs influences vastly on the number of expansions/iterations and on the quality of the output solution, i.e. the cost of the resultant path. Heuristics A perfect heuristic h∗h^* always gives the exact cost-to-go: h∗(n)=cost(π∗(n,goal))h^*(n)= cost(π^*(n,goal)). An admissible heuristic never overestimates this cost: ∀n:h(n)≤h∗(n)∀ n:\>h(n)≤ h^*(n). A consistent (or monotone) heuristic satisfies ∀n,n′:h(n)≤h(n′)+cost(π∗(n,n′))∀ n,n :\>h(n)≤ h(n )+ cost(π^*(n,n )), which implies admissibility and guarantees that each node is expanded at most once. All of these heuristics result in finding optimal solutions. For 8-connected grids, a common admissible and consistent heuristic is the Octile heuristic: hoct(n)=2min(Δx,Δy)+|Δx−Δy|,h_oct(n)= 2 ( x, y)+| x- y|, where Δx=|xn−xg| x=|x_n-x_g| and Δy=|yn−yg| y=|y_n-y_g|, with g denoting the goal node. Unfortunately, this heuristic is overly general and do not take the specifics of each pathfinidng problem instance into account, i.e. the locations and shapes of the obstacles (blocked grid cells). In practice this often results in guiding the search into the regions near obstacles, expanding many nodes before settling on the shortest path. Thus, one way to improve the search efficiency is to develop and utilize dedicated preprocessing techniques that produce more accurate cost‑to‑go estimates (that is, closer to h∗h^*), so that nodes off the optimal route acquire higher heuristic values and are less likely to be expanded. This is the way we follow in this study. 3.3 Weighted A* A common technique for trading off solution optimality against runtime in grid-based pathfinding is to use a weighted heuristic. Instead of ranking the nodes in OPEN by f(n)=g(n)+h(n)f(n)=g(n)+h(n), Weighted A* (WA*) orders them by fw(n)=g(n)+w⋅h(n)f_w(n)=g(n)+w· h(n), where the weight, w≥1w≥ 1, is specified by the user. This simple adjustment is likely to notably reduce the number of search iterations in practice, while allowing finding the solutions whose cost is at most w times the optimal ones. In practice, WA* is widely used when faster search is more important than perfect optimality, especially since many real‑world applications can tolerate a small cost increase in exchange for significantly fewer node expansions. 4 Problem Statement Consider a fixed heuristic search algorithm Alg that takes as input a grid-based path finding problem =(G,start,goal)P=(G,start,goal) and a heuristic function hbaseh_base, used to guide the search, to produce a valid path π(start,goal)π(start,goal). Consider now a distribution of all possible path finding problems, where the input grid has a fixed size, P. In this work we focus on 64×6464× 64 grids aligning with much of the previous work on learing-based pathfinding. Let hθh_θ be a heuristic function represented as a neural network with parameters θ. Let ∼P be an arbitrary pathfinding problem and denote by exp(Alg,h,P)exp( Alg,h,P) the number of nodes expanded by Alg when guided by h. Similarly, let cost(Alg,h,)cost( Alg,h,P) denote the cost of the corresponding solution. Utilizing expexp and costcost the following normalized criteria can be contstucted: f1(θ,P):=CostRatio(hθ,P)=cost(Alg,hθ,P)cost(Alg,hbase,P),f_1(θ,P):=CostRatio(h_θ,P)= cost( Alg,h_θ,P)cost( Alg,h_base,P), f2(θ,P):=ExpRatio(hθ,P)=exp(Alg,hθ,P)exp(Alg,hbase,P).f_2(θ,P):=ExpRatio(h_θ,P)= exp( Alg,h_θ,P)exp( Alg,h_base,P). Informally f1f_1 and f2f_2 tell how Alg equipped with hθh_θ is better (or worse) compared to the baseline (i.e., Alg with hbaseh_base) in terms of solution cost and expansions respectively. The weighted combination of f1f_1 and f2f_2 is also of particluar interest: Jθ,P(λ):=(1−λ)f1(θ,P)+λf2(θ,P),λ∈[0,1],J_θ,P(λ):=(1-λ)\,f_1(θ,P)+λ\,f_2(θ,P), λ∈[0,1], This objective captures the trade-off between solution cost and computational efficiency (measured as the number of expansions). Our goal and is to minimize its expectation over tasks: θ~=argminθP∼[Jθ;P(λ)]. θ= _θ\;E_P [J_θ;P(λ) ]. Informally, we wish to learn a neural network representing a heuristic function so that the latter helps the search algorithm in finding the solutions of acceptable cost faster than the baseline algorithm. In our work we use A∗ with hocth_oct as the baseline and we approximate the expectation with the empirical average over a finite dataset D of test tasks that we carefully design. 5 Method Our solver, named UPath, is naturally a heuristic predictor for grid-based pathfinding under strong topological shift, hence U – universal. It relies on four key components: a correction-factor formulation of the heuristic function; an encoder–transformer–decoder network with long skip connections and specific loss for accurate dense prediction; a training dataset generated solely from simple procedural priors that prevents the network from overfittiting. Finally, an important contribution is a novel dataset of test instances that is tailored to empirically evaluate solvers under a full spectrum of grid topologies – an universal evaluation suite (UPF). 5.1 Heuristic function and search procedure Correction factor is combination of the baseline heuristic and the ideal heuristic, as suggested in Kirilenko et al. (2023). cf∗(n)=hoct(n)h∗(n).cf^*(n)= h_oct(n)h^*(n). (1) It is this heuristic that we wish our network to predict. To compute it for each problem (at the training phase) we run Dijkstra from the goal to obtain h∗(n)h^*(n) for all free cells and then compute cf∗(n)cf^*(n) via (1) wherever it is well-defined. Specifically, for reachable non-goal cells, 0<cf∗(n)≤10<cf^*(n)≤ 1 (as hocth_oct is admissible). For unreachable cells, cf∗(n)=0cf^*(n)=0 as h∗(n)=∞h^*(n)=∞. For obstacle cells and the goal cell (where hoct=h∗=0h_oct=h^*=0), the target in (1) is undefined. We therefore exclude such cells from the training loss via masking (described later in Section 5.3), and set their stored target to a dummy constant (i.e., 11) purely for implementation convenience. At test time the network outputs a dense map cf^(n)∈(0,1] cf(n)∈(0,1] that we convert into a regular heuristic suitable for A∗: h^(n)=hoct(n)max(cf^(n),ε), h(n)= h_oct(n) ( cf(n), ), (2) with a small ε=10−9 =10^-9 for numerical stability. Overall, the planner remains standard, only the heuristic is learned. Figure 2: Beta-Figures, 64x64. Figure 3: Neural network architecture. 5.2 Training Datasets In contrast to prior work in learning-based pathfinding that is centered around utilizing for training the tasks sampled from the same (limited) distribution as for testing, we aim to learn a universal predictor that being trained once is capable to accurately predict the heuristic and, thus, accelerate search for an arbitrary pathfinding problem. In other words, we strive for a highly generaliziable learnable heuristic function. To this end we suggest to avoid any specific grid topologies for training but rather rely on simplistic geometric priors – random noise and basic shapes. As confirmed by our experiments this, indeed, helps us achieve our goal. Overall, we use the following grids for training. Uniform. Each cell is independently traversable with probability p=0.5p=0.5, producing high-frequency random obstacle patterns. Beta. We introduce per-map variability in obstacle density: sample θ∼Beta(2,2)θ (2,2) and mark each cell as blocked independently with probability θ. Conditioned on θ, cells are independent, but the marginal obstacle count follows a beta-binomial distribution, yielding substantially higher map-to-map variance (i.e., more very sparse and very dense maps) than the fixed-density Uniform generator. For example, on a 64×6464× 64 grid the probability of generating an entirely empty map is [(1−θ)4096]=6(4098)(4099)≈3.6×10−7E[(1-θ)^4096]= 6(4098)(4099)≈ 3.6× 10^-7, whereas under Uniform(p=0.5p=0.5) it is 2−4096≈10−12332^-4096≈ 10^-1233. Beta-Figures. We inject explicit spatial structure using geometric obstacle primitives – see Fig. 2. Let MfiguresM_figures be a binary mask formed by randomly placed and sized shapes (e.g., circles, squares, crosses), each occupying multiple cells (at least 10), and let MβM_β be a stochastic background mask sampled as in the Beta dataset. We define the final obstacle map by conjunction: Mfinal=Mfigures∧Mβ.M_final\;=\;M_figures M_β. (3) This produces coherent obstacle regions while retaining stochastic variability in density and fragmentation. 5.3 Neural heuristic predictor The network takes an input tensor of shape (2,H,W)(2,H,W): an obstacle indicator channel and a goal-indicator channel, and outputs a dense correction-factor map cf^∈ℝH×W×1 cf ^H× W× 1. We follow the encoder–transformer–decoder backbone popularized by state-of-the-art TransPath model Kirilenko et al. (2023) for predicting correction factor and introduce two modifications: long skip connections between matching-resolution encoder and decoder blocks, and an explicitly masked regression loss. Our model is depicted in Fig. 3. First, the input is processed with the convolution-based encoder that is meant to capture the geometric details such as corners, corridor boundaires etc. An encoder-produced feature map of dimensions (C,H′,W′)(C,H ,W ) is reshaped into a sequence of H′W′H W tokens of dimension C, is combined with the learned positional embeddings, and then processed by the sequence of 33 self-attention blocks. The output tokens are reshaped back to a spatial feature map and fed to the decoder. Importantly, the input to the decoder is augmented with the initial encoder features via long skip connections (merging is performed by elementwise addition). Finally, we map the final logits to (0,1](0,1] via a rescaled tanh and clamp away from zero before using (2). Loss In training the model we incorporate a loss-masking strategy that excludes obstacle cells and the goal cell from contributing to the prediction error. Specifically, Let O be the binary obstacle mask (11 for blocked cells, 0 otherwise), and let G be the singleton mask for the goal cell. Define a composite mask M=¬O&¬GM= O\ \&\ G, so that M(n)=1M(n)=1 identifies the open, non-goal cells whose cfcf–values should be learned. We train the network using a standard regression loss L2L_2 between predicted cf(n)cf(n) and the ground-truth cf∗(n)cf^*(n)), but only for cells with M(n)=1M(n)=1. Lcf=∑nM(n)⋅(cf(n)−cf∗(n))2∑nM(n)L_cf= _nM(n)·(cf(n)-cf^*(n))^2 _nM(n) 5.4 Universal Path Finding (UPF) Evaluation Dataset Indeed, it is impossible to exhaustively evaluate a pathfinding solver (either learnable one or a classical one) across all possible problem instances. On the other hand pathfinding in practice spans a broad spectrum of settings – from cluttered indoor scenes to open outdoor terrains – featuring obstacles of varying scale and structure, maps that are either synthetic or captured from real environments, and difficulty levels ranging from trivial to highly challenging. Thus to better approximate the real average performance of a planner one needs to create a (relatively) small but representative set of test tasks. To this end we design a deliberately diverse and challenging evaluation suite that stresses generalization across fundamentally different topologies. Specifically, we construct an evaluation dataset with 20,000 tasks, evenly split across 10 topologies (2,000 tasks per topology) – see Fig. 4. Our dataset, dubbed UPF (Universal Pathfinding) consists of the: Figure 4: UPF topologies, 64x64. 1. Established sources: Baldur’s Gate and Moving Street Sturtevant (2012), TMP Yonetani et al. (2021), and HouseExpo (adapted from Li et al. (2019)). 2. Noise-generated layouts: Perlin, Dcaffo Caffagni (2022), and our Rotational Symmetry and Recursive Division generators. 3. Maze-like structures: Prim-style mazes and our Masked Pyramid generator. Each topology corresponds to a procedural 64×6464× 64 map generator that produces a binary grid. Additional details on the dataset are provided in the Appendix A. Task generation and filtering. For each generated grid G, we sample a random goal cell and a start one that is definitely reachable. To avoid degenerate tasks, we enforce two criteria: Reachability Diversity. Let R be the set of traversable cells reachable from the goal. Define H(goal,G)=∑s∈Rh∗(s),H(goal,G)\;=\; _s∈ Rh^*(s), (4) a proxy for the size/shape of the reachable component. We require H(goal,G)≥HminH(goal,G)≥ H_ . For 64×6464× 64 grids we set Hmin=553H_ =553. This specific value is computed on a fully traversable 11×1111× 11 grid with the centered goal. Reachability Complexity. We retain only tasks whose cost satisfies cost(π∗(start,goal))≥ 1.05⋅hoct(start),cost(π^*(start,goal))\;≥\;1.05·h_oct(start), (5) which removes near-straight-line instances. 6 Empirical Evaluation 6.1 Training We train three models, one per training dataset (Uniform, Beta, Beta-Figures). For all models we use the same training protocol. Each model is optimized with Adam Kingma and Ba (2017) for 50 epochs with batch size 512, and we use a OneCycleLR learning-rate schedule Smith and Topin (2018) with a peak learning rate of 8×10−38× 10^-3. On a single NVIDIA A100 (40GB), training on a dataset of 512000 tasks with input shape (2,64,64)(2,64,64) takes approximately 2.5 hours per model. 6.2 Evaluation Setup We evaluate all planners on the UPF benchmark. We compare with the following baselines: Weighted A* (WA*) with w∈2,5,10w∈\2,5,10\ and state-of-the-art learnable solver, TransPath , which also predicts correction factor and was previoulsy shown to outperform all other learning-based competitors (so we omit including them in our tests). We use the authors’ official implementation of TransPath and the released weights. Our primary metric is the expansions ratio, which is the number of nodes expanded by a solver divided by the number of nodes expanded by A* with the octile-distance heuristic. This ratio serves as a proxy for computational effort. To assess solution quality, we measure the optimal found ratio, i.e., the fraction of instances in which the returned path is optimal, and the cost ratio, i.e., the returned path length divided by the optimal path length. Unlike most of the prior work, we also evaluate runtime: for each method we measure the total runtime (including prediction time for learning-based solvers) used to solve all instances from the test dataset. 6.3 Results Table 1 reports the mean values and standard errors of our metrics in the evaluation set. As the results demonstrate, all of our learning-based planners generalize effectively to previously unseen instances, achieving near-optimal solutions while substantially reducing search effort. Optimal Found Cost Exp Ratio (%\%) ↑ Ratio (%\%) ↓ Ratio (%\%) ↓ A* 100.00 100.0 100.0 UPath (Uniform) 63.23 101.1± 2.9 53.8± 29.0 UPath (Beta) 55.24 105.1± 16.2 45.3± 31.9 UPath (Beta+Fig) 72.63 101.1± 4.1 47.4± 27.7 WA*, w=2 32.35 103.7± 4.9 54.6± 30.1 WA*, w=5 14.38 107.9± 8.9 47.3± 29.8 WA*, w=10 13.40 109.7± 11.1 45.1± 29.2 TransPath 32.34 125.9± 49.7 111.4± 134.3 Table 1: Performance comparison on 64x64 UPF. Among the learning-based planners, UPath (Beta+Fig) is characterized by the best performance: it attains the highest Optimal Found Ratio (72.63%) while keeping solution quality essentially near-optimal (101.1± 4.1%) and still reducing search effort by roughly 2.11× on average (Expansions Ratio 47.4± 27.7%). UPath (Uniform) matches the best cost accuracy (101.1± 2.9%) but is less reliable in optimal solves (63.23%) and requires noticeably more expansions (53.8± 29.0%), indicating weaker generalization to harder topologies despite similar path quality. UPath (Beta) is the most aggressive in pruning: it achieves the lowest Expansions Ratio (45.3± 31.9%), i.e., 2.21× fewer expansions than A* on average, but this speed comes with a substantial drop in optimal-solve rate (55.24%) and increased solution cost (105.1± 16.2%). The WA* baselines exhibit the expected trend: increasing w improves average expansions (down to 45.1± 29.2% at w=10w=10) but sharply degrades optimality (only 13–32% optimal found) and progressively inflates cost (up to 109.7± 11.1%), placing them on a dominated part of the frontier relative to UPath variants that achieve similar or better expansion reductions with markedly higher optimal-solve rates. Finally, TransPath is decisively outperformed on UPF: it expands more nodes than A* on average (111.4± 134.3%) and incurs the worst cost inflation (125.9± 49.7%), with very high variance. This sharp degradation relative to its originally reported setting is consistent with a strong sensitivity to the evaluation distribution: when the benchmark departs from the training-like regime, the learned heuristic can become miscalibrated, leading to both excessive search and poor solution quality. Figure 5 plots the combined cost-expansion objective J(λ)J(λ) for λ sweeping all the way from quality-dominated regimes (λ→0λ\!→\!0) to compute-dominated regimes (λ→1λ\!→\!1). Across a broad range of λ, UPath achieves a strictly better trade-off than Weighted A* baselines: in particular, UPath (Beta+Fig) outperforms WA* with w=10w=10 for all λ<0.79λ<0.79, i.e., whenever path quality is not negligible, while retaining near-optimal costs. Figure 5: Trade-off analysis. Figure 6 reports the runtime consumed to solve all the problem instances for best-performing algorithms. The results indicate that with a batch size of 55, UPath (Beta+Fig) and UPath (Beta) solve tasks faster than WA* with w=2w=2, whereas UPath (Uniform) is slower. This shows that our method delivers exceptional speed even with very small batch sizes. Figure 6: Total runtime (in seconds) as a function of batch size. Ablation. We ablate the two components introduced in Section 5.3 by training UPath (Beta) with (i) skip connections removed, and (i) both skip connections and loss masking removed. Results are summarized in Table 2. As one can note, removing the skip connections makes the search consistently less efficient, increasing expansions from 45.3%45.3\% to 53.65%53.65\%, with a small degradation in the remaining metrics. In contrast, removing loss masking produces a much larger drop: expansions further rise to 77.4%77.4\% and the success rate collapses (Optimal Found 51.64%→6.40%51.64\%\!→\!6.40\%), with higher path costs as well, indicating that masking is crucial for robust training and transfer. Skips Masking Optimal Found Cost Expansions Ratio (%\%) ↑ Ratio (%\%) ↓ Ratio (%\%) ↓ ✓ ✓ 55.24 105.1± 16.2 45.3± 31.9 × ✓ 51.64 105.7± 16.75 53.65± 31.14 × × 6.40 110.6± 15.11 77.4± 36.2 Table 2: Ablation on long skip connections and loss masking. Scaling to larger maps. To assess scalability, we also train and evaluate UPath on 128×128128× 128 maps. The obtained results demonstrate that the suggested solver performs well at higher resolutions (i.e. outperform competitors similarly to the presented 64×6464× 64 evaluation. The details of this experiment are provided in the Appendix B. 7 Conclusion We introduced UPath, a train-once, search-everywhere heuristic predictor for grid-based pathfinding under strong topological shift. UPath learns an instance-dependent correction-factor map relative to the octile prior and can be plugged directly into standard A* without modifying the search procedure. To make universality testable, we also proposed UPF, a deliberately topology-diverse evaluation suite covering ten qualitatively different map sources. Across UPF, UPath consistently improves the efficiency–quality frontier: it reduces node expansions by up to 2.2×2.2× while keeping solution cost within 3%3\% of optimal, and it dominates common Weighted A* settings by achieving comparable (or lower) expansion ratios at substantially higher optimal-solve rates. Moreover, compared to the state-of-the-art learned heuristic planner TransPath, UPath remains robust on this topology-diverse benchmark, highlighting the importance of evaluating learned heuristics beyond training-like regimes. Finally, results on 128×128128× 128 tasks indicate that the approach scales favorably when trained at the target resolution. References F. Agostinelli, S. McAleer, A. Shmakov, and P. Baldi (2019) Solving the rubik’s cube with deep reinforcement learning and search. Nature Machine Intelligence 1 (8), p. 356–363. Cited by: §2. M. Bhardwaj, S. Choudhury, and S. Scherer (2017) Learning heuristic search via imitation. In Proceedings of the 1st Annual Conference on Robot Learning, S. Levine, V. Vanhoucke, and K. Goldberg (Eds.), Proceedings of Machine Learning Research, Vol. 78, p. 271–280. External Links: Link Cited by: §2, §2. D. Caffagni (2022) 2d-path-planning-dataset. Kaggle. External Links: Link, Document Cited by: item 2, item 2. X. Chen, F. Yang, and C. Wang (2025) iA*: imperative learning-based A* search for path planning. IEEE Robotics and Automation Letters (RA-L) 10 (12), p. 12987–12994. External Links: Link Cited by: §2. M. Hao, F. Trevizan, S. Thiébaux, P. Ferber, and J. Hoffmann (2024) Guiding gbfs through learned pairwise rankings. In Proceedings of the Thirty-Third International Joint Conference on Artificial Intelligence, IJCAI-24, K. Larson (Ed.), p. 6724–6732. Note: Main Track External Links: Document, Link Cited by: §2. P. E. Hart, N. J. Nilsson, and B. Raphael (1968) A formal basis for the heuristic determination of minimum cost paths. IEEE Transactions on Systems Science and Cybernetics 4 (2), p. 100–107. External Links: Document Cited by: §1. D. P. Kingma and J. Ba (2017) Adam: a method for stochastic optimization. External Links: 1412.6980, Link Cited by: §B.1, §6.1. D. Kirilenko, A. Andreychuk, A. Panov, and K. Yakovlev (2023) TransPath: learning heuristics for grid-based pathfinding via transformers. Proceedings of the AAAI Conference on Artificial Intelligence 37 (10), p. 12436–12443. External Links: Link, Document Cited by: §1, §2, §5.1, §5.3. T. Li, D. Ho, C. Li, D. Zhu, C. Wang, and M. Q.-H. Meng (2019) HouseExpo: a large-scale 2d indoor layout dataset for learning-based algorithms on mobile robots. CoRR abs/1903.09845. Note: arXiv:1903.09845 Cited by: item 3, §2, item 1. L. Orseau, M. Hutter, and L. H. S. Lelis (2023) Levin tree search with context models. In Proceedings of the Thirty-Second International Joint Conference on Artificial Intelligence, IJCAI-23, E. Elkind (Ed.), p. 5622–5630. Note: Main Track External Links: Document, Link Cited by: §2. L. N. Smith and N. Topin (2018) Super-convergence: very fast training of neural networks using large learning rates. External Links: 1708.07120, Link Cited by: §B.1, §6.1. S. Song, F. Yu, A. Zeng, A. X. Chang, M. Savva, and T. Funkhouser (2017) Semantic scene completion from a single depth image. Proceedings of 30th IEEE Conference on Computer Vision and Pattern Recognition. Cited by: §2. N. Sturtevant (2012) Benchmarks for grid-based pathfinding. Transactions on Computational Intelligence and AI in Games 4 (2), p. 144 – 148. External Links: Link Cited by: item 1, item 6, §2, item 1. R. Yonetani, T. Taniai, M. Barekatain, M. Nishimura, and A. Kanezaki (2021) Path planning using neural A* search. In Proceedings of the 38th International Conference on Machine Learning, Proceedings of Machine Learning Research, Vol. 139, p. 12029–12039. External Links: Link Cited by: item 10, §1, §2, §2, item 1. D. Zhao, S. Tu, and L. Xu (2024) SeeA* : efficient exploration-enhanced A* search by selective sampling. In Advances in Neural Information Processing Systems, A. Globerson, L. Mackey, D. Belgrave, A. Fan, U. Paquet, J. Tomczak, and C. Zhang (Eds.), Vol. 37, p. 104138–104179. External Links: Document, Link Cited by: §2. Appendix A Test Dataset Details Below we provide details on the Universal Pathfidning Dataset (UPF) used in our experiments. UPF contains 20,000 different maps, split between 10 types of maps of varying topologies (2,000 maps per type): 1. Baldur’s Gate Sturtevant [2012]. We sample random 512×512512× 512 map from the original dataset (consisting of 75 maps) and produce our map via downsampling to the target resolution. To increase diversity, we additionally apply 90∘90 rotations (i.e., multiples of 90∘90 ). 2. Dcaffo Caffagni [2022]. We generate binary noise map and apply a morphological convolution operator with fixed parameters (as in the referenced implementation). In our codebase we additionally provide parameter settings for larger map sizes (256×256256× 256 and 512×512512× 512), which were not included in the original configuration. 3. HouseExpo (adapted from Li et al. [2019]). We sample a random floorplan from the full pool of 35126 maps from the original dataset. Each sampled map is converted to the target resolution using a custom resizing procedure: depending on the source size, we either downsample the map or pad the boundary region with obstacles (non-traversable cells) to match the desired dimensions. 4. Masked Pyramid (ours). We construct a pyramid consisting of 15 concentric layers. Layers are contiguous (solid) except for corner cells at each layer. For every layer, we designate four corner-related cells whose traversability is randomized as follows: with probability 0.250.25 we mark exactly 1 of the 4 cells as blocked; with probability 0.250.25 we mark exactly 3 cells as blocked; and with probability 0.50.5 we mark exactly 2 cells as blocked. 5. Prim Maze (maze-like generator). We initialize a fully blocked grid, select an initial traversable cell, and add its blocked neighbors to a frontier list. While the frontier list is non-empty, we pop a cell from the list; if it has exactly one traversable neighbor, we mark it traversable and add its blocked neighbors to the frontier. The processed cell is then removed from the list. This procedure produces maze-like corridor structures. 6. Moving Street Sturtevant [2012]. We utilize the original Moving AI maps, that are 4×4× larger (per side) than our target resolution. We first crop a random sub-window of size 2×2× the target side length, and then downsample by a factor of 2 (per side) to obtain the final map. 7. Perlin (ours) We sample an i.i.d. binary noise grid and apply two iterations of majority-rule smoothing using the 3×33× 3 Moore neighborhood: a cell becomes blocked if more than 4 cells in its neighborhood (including itself) are blocked; otherwise it becomes traversable. 8. Recursive Division (ours). We recursively partition the grid by alternating horizontal and vertical splits, drawing wall segments along each split. To introduce stochastic openings, each wall cell is flipped to traversable with probability 0.20.2. 9. Rotational Symmetry noise (ours). We generate noise on one quadrant (one quarter of the map) and then mirror it to the remaining quadrants to enforce rotational symmetry. This yields maps whose global structure is easier to exploit than fully unconstrained noise at the same resolution, providing a targeted test of whether models leverage such regularities. 10. TMP Yonetani et al. [2021]. We use the standard TMP dataset generation pipeline provided by the original authors, without modification. UPF Topology S1 S2 S3 S4 S5 Baldur’s Gate Dcaffo House Expo Masked Pyramid Prim maze Moving Street Perlin Recursive Division Rotational Symmetry TMP Table 3: Representative map samples (five per source/generator). Appendix B Additional Evaluation Results Below we report results of the additional experiments involving maps of larger size (compared to the main experiment), i.e. 128×128128× 128. B.1 Training For the 128×128128× 128 setting, we train the model on the Beta-Figures dataset, since it achieved the best cost–runtime trade-off on 64×6464× 64 maps. Training follows the same recipe as in the main experiments: we optimize with Adam Kingma and Ba [2017] for 50 epochs using batch size 512, and apply a OneCycleLR schedule Smith and Topin [2018] with peak learning rate 8×10−38× 10^-3. On a single NVIDIA A100 40GB GPU, training on 512000 tasks with input shape (2,128,128)(2,128,128) takes approximately 8.5 hours per model. The increased runtime is primarily due to using a 4-layer encoder–decoder, rather than 3 layers, to better handle the higher input resolution. B.2 Evaluation Setup We evaluate all planners on the UPF benchmark with 128×128128× 128 maps, using the same WA* baselines as in the 64×6464× 64 experiments. We do not evaluate TransPath in this setting, since its published implementation and released artifacts are built around 64×6464× 64 grid maps, and the performance of the original TransPath on 128×128128× 128 maps is not satisfactory (as we have evidenced after a series of preliminary experiments). In addition, to probe scale generalization, we apply UPath trained on Beta-Figures at 64×6464× 64 directly to 128×128128× 128 tasks, without any fine tuning. We use the same evaluation metrics as in the 64×6464× 64 setting, namely expansions ratio, optimal found ratio, and length ratio. B.3 Results We denote the model trained on Beta-Figures at 64×6464× 64 as UPath (64×6464× 64) and the model trained on Beta-Figures at 128×128128× 128 as UPath (128×128128× 128). Table 4 presents the mean values and standard errors of the performance metrics on the 128×128128× 128 evaluation set. As the results demonstrate, all of our learning-based planners generalize effectively to previously unseen instances, achieving near-optimal solutions while substantially reducing search effort. UPath (128×128128× 128) performs very well in all three key metrics: optimal-found ratio, average path length, and total expansions. It falls only marginally behind WA* (w=5w=5) in expansion count. However, WA* (w=5w=5) trades that small efficiency gain for a very steep loss in solution quality: it achieves just 7%7\% optimal-found ratio with paths about 9%9\% longer than optimal — much worse than ≈54%≈ 54\% optimal of UPath (128×128128× 128) and ≈2.4%≈ 2.4\% length inflation, although its expansion ratio is only slightly lower at 41.4%41.4\% versus A*+UPath’s 44.0%44.0\%. This highlights the classic weighted A* trade‑off: higher w reduces expansions but leads to worse path quality. For UPath trained at 64×6464× 64, performance is weaker than for the 128×128128× 128 variant, but the model still generalizes well and remains robust to larger instances. Optimal Found Length Expansions Ratio (%\%) ↑ Ratio (%\%) ↓ Ratio (%\%) ↓ A* 100.00 100.0 100.0 UPath (64x64) 23.84 103.7± 7.0 48.79± 31.3 UPath (128x128) 54.20 102.4± 6.9 44.0± 28.7 WA*, w=2 21.22 104.5± 5.3 48.2± 33.8 WA*, w=5 7.17 109.2± 9.2 41.4± 33.4 WA*, w=10 6.44 111.02± 11.0 39.3± 32.3 Table 4: Performance of the evaluated planners on 128×128128× 128 UPF maps. Runtime breakdown We evaluated the runtime of each method. Figure 7 reports the total runtime consumed by a solver while solving all instances in the test dataset (the lower the better). X-axis shows the size of the batch used by learnable solvers. For the latter we count both the heuristic prediction time (GPU time) and search time (CPU). Indeed, the prediction time is 0 for A* and WA*. The results indicate that when a batch size is greater than 11, UPath (128×128128× 128) solves tasks faster than A* and WA*. And the difference is getting higher with the increase of the batch. For example, when the batch size is 100, UPath (128×128128× 128) is approximately 2.22 times faster than A* and 1.17 times faster than WA*(w=2w=2). Figure 7: Total runtime (in seconds) on UPF 128×128128× 128 as a function of batch size.