PathGPT: Reframing Path Recommendation as a Natural Language Generation Task with Retrieval-Augmented Language Models

Steeve C. Marcelyn, Yucen Gao, Yuzhe Zhang, Xiaofeng Gao · 2025

Read PathGPT: Reframing Path Recommendation as a Natural Language Generation Task with Retrieval-Augmented Language Models by Steeve C. Marcelyn, Yucen Gao, Yuzhe Zhang, Xiaofeng Gao (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2504-05846.txt.

Introduction

Marcelyn and co-authors recast in 2025 route planning as a language task and build PathGPT, a retrieval-backed model that writes travel paths in words. Classic planners lean on fixed goals or bespoke models that need costly retraining for each new setting. Language offers a flexible frame instead.

Past travel records are first rewritten as readable text and stored. A hybrid search pulls path context that matches the user's stated limits. A pretrained language model then drafts a plausible route from that context. Tests on large trajectory sets show scores on par with specialist methods. The frame adapts to new scenarios with no retraining, which suits trip tools that face shifting tastes and constraints.

Catalog record

CREATORSteeve C. Marcelyn, Yucen Gao, Yuzhe Zhang, Xiaofeng Gao
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE37 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2504-05846

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

PathGPT: Reframing Path Recommendation as a Natural Language Generation Task with Retrieval-Augmented Language Models Steeve C. Marcelyn, Yucen Gao, Yuzhe Zhang, Xiaofeng Gao Abstract Path recommendation (PR) aims to generate travel paths that are customized to a user’s specific preferences and constraints. Conventional approaches often employ explicit optimization objectives or specialized machine learning architectures; however, these methods typically exhibit limited flexibility and generalizability, necessitating costly retraining to accommodate new scenarios. This paper introduces an alternative paradigm that conceptualizes PR as a natural language generation task. We present PathGPT, a retrieval-augmented large language model (LLM) system that leverages historical trajectory data and natural language user constraints to generate plausible paths. The proposed methodology first converts raw trajectory data into a human-interpretable textual format, which is then stored in a database. Subsequently, a hybrid retrieval system extracts path-specific context from this database to inform a pretrained LLM. The primary contribution of this work is a novel framework that demonstrates how integrating established information retrieval and generative model components can enable adaptive, zero-shot path generation across diverse scenarios. Extensive experiments on large-scale trajectory datasets indicate that PathGPT’s performance is competitive with specialized, learning-based methods, underscoring its potential as a flexible and generalizable path generation system that avoids the need for retraining inherent in previous data-driven models. Our code is available at https://github.com/Kuramenai/PathGPT/ . Keywords Path Recommendation \cdot Deep Learning \cdot Large Language Model \cdot Retrieval Augmented Generation 1 Introduction Path recommendation is one of the core services of many GPS-aided navigation systems Jain et al. (2021) . And conventionally, graph-based routing algorithms, such as Dijkstra’s and A*, are frequently used to find and recommend travel paths, often the fastest or the shortest, to users navigating through increasingly complex road networks Jiang et al. (2022) . However, empirical analysis of large-scale trajectory data reveals a significant discrepancy: human drivers may sometimes choose paths that are neither the fastest nor the shortest Quercia et al. (2014) Ceikute and Jensen (2013a) . This divergence highlights a fundamental limitation of conventional search-based algorithms, as real-world navigation involves multiple, often implicit factors that are difficult to encode, such as prioritizing a scenic view over travel time or avoiding highways during a leisurely drive Ceikute and Jensen (2013b) . Recent advances in computer hardware, combined with the availability of large-scale trajectory datasets Wang et al. (2017) , have spurred the development of data-driven path recommendation algorithms Li et al. (2020) . Leveraging the ability of machine learning to identify latent patterns in data, these models can generate paths optimized for a variety of factors beyond simple distance, such as traffic conditions or proximity to points of interest, thereby offering more sophisticated solutions to the PR problem. Many of these approaches can be viewed as learning a Markovian model, where the goal is to predict the next road segment based on the current one, given a transition probability matrix learned from historical data and user preferences. Provided a query q , the recommended path \mathcal{P} can be obtained from the following equation: P(\mathcal{P}|q)\approx\prod_{i=1}^{|\mathcal{P}|}P(e_{i}|e_{i-1},q) (1) However, despite their advancements, these data-driven models suffer from a significant limitation: a lack of flexibility. They are typically trained to generate paths based on a predetermined set of constraints, and the learned transition probability matrix cannot be easily dynamically adapted to new requirements post-training. For example, a model trained to optimize for traffic conditions cannot, without modification, generate a path that must pass through a specific sequence of user-defined points of interest. A naive solution to this inflexibility would be to train a distinct model for every conceivable user requirement. However, such an approach is not only computationally inefficient but also practically infeasible. The set of all potential user constraints is vast and often unknown a priori, making it impossible to develop a comprehensive suite of specialized models that could constitute a truly unified solution. Inspired by the remarkable success of Large Language Models (LLMs) across a diverse range of tasks, including question answering and code generation Brown et al. (2020) , we postulate that the extensive world knowledge and sophisticated natural language understanding capabilities inherent in these models can be harnessed for path generation. We also note that the autoregressive nature of LLMs, which is encapsulated by the next token prediction (Equation 2 ), is also expressed in a similar form to Equation 1 , which may imply that although representing different architectures, they might share some similarities in their modeling. P(x_{1},x_{2},\dots,x_{T})=\prod_{t=1}^{T}P(x_{t}\mid x_{1},x_{2},\dots,x_{t-1}) (2) More importantly, the LLMs’ fundamental architecture would enable conditioning the entire generation process on arbitrary user preferences expressed in natural language, a capability far beyond that of standard Markovian approaches. This inherent flexibility is what could make LLMs uniquely suited to solve the personalized path recommendation problem. Such an approach would enable the recommendation of paths finely tuned to specific user requirements. This paradigm could directly address the limitations of prior methods by avoiding the need for multiple, specialized models and adeptly handling the inherent variety and ambiguity of user queries. Motivated by these findings, we developed PathGPT, a framework that enhances the path recommendation capabilities of LLMs by reformulating the Path Recommendation (PR) problem as a natural language processing task. The objective is for the LLM to generate a path that adheres to an origin-destination (OD) pair and a set of constraints, all of which are expressed in natural language. To ground the LLM’s generation in factual trajectory data, our methodology is a form of Retrieval-Augmented Generation (RAG) and consists of two primary stages. First, we preprocess a database of historical paths, which are initially represented as sequences of road network edge IDs. This process transforms them into natural language by: 1) using reverse geocoding to obtain human-readable addresses for the OD nodes, and 2) translating the edge sequence into the corresponding traversed road names. This information is then synthesized into a coherent textual description for each path (see Figure 2 ) and indexed in a knowledge base. Second, during the generation phase, given a user query, a hybrid retriever then extracts relevant historical paths from the knowledge base based on the query’s OD pair. These retrieved textual paths, combined with the original query, serve as rich, in-context information that guides the LLM in generating a final tailored path. To the best of our knowledge, PathGPT is the first framework to apply LLMs to the PR problem by combining established information retrieval and generative model components. Our experiments demonstrate its unique capability to generate paths that accommodate novel user constraints at inference time, a task that poses a significant challenge for conventional data-driven models. Furthermore, PathGPT addresses the common ’black box’ problem associated with many machine learning models. By leveraging the LLM’s generative nature, the framework can produce natural language justifications for its recommended paths, thereby enhancing user trust and confidence in the system. Our key contributions are as follows: • We propose a novel formulation of the path recommendation (PR) task as a natural language generation problem, enabling flexible user-defined constraints without retraining or goal-specific tuning. • We present PathGPT, a modular and reproducible system that integrates retrieval-augmented generation (RAG) with historical trajectory data and geospatial context, and demonstrates its applicability to path recommendation. • We introduce a

Read the complete text