NextLocLLM: Location Semantics Modeling and Coordinate-Based Next Location Prediction with LLMs

Shuai Liu, N. Cao, Yile Chen, Yue Jiang, Gao Cong, Cong, GaoarXiv 2024 · DOI

Abstract

Next location prediction is a critical task in human mobility analysis. Existing methods typically formulate it as a classification task based on discrete location IDs, which hinders spatial continuity modeling and limits generalization to new cities. In this paper, we propose NextLocLLM, a novel framework that reformulates next-location prediction as coordinate regression and integrates LLMs for both location semantics encoding and coordinate-level prediction. To model location functional semantics, it constructs LLM-enhanced POI embeddings by leveraging language understanding capabilities of LLMs to extract functional semantics from textual descriptions of POI categories. These POI embeddings are combined with spatiotemporal trajectory representation and fed into the same LLM, enabling unified semantic and predictive modeling. A lightweight regression head generates coordinate outputs, which are mapped to top-k candidate locations via post-prediction retrieval module, ensuring structured outputs. Experiments across diverse cities show that NextLocLLM outperforms existing baselines in both supervised and zero-shot settings.

Introduction

Predicting human movement is essential for urban management and personalized recommendation systems. However, traditional approaches face significant challenges. Most current models treat next-location prediction as a classification problem over discrete "Location IDs." This paradigm introduces three primary issues:

  1. City-Specific ID Dependency: Models trained on specific IDs cannot generalize to new cities where IDs differ.
  2. Loss of Spatial Continuity: Discrete categories ignore the geographic proximity between locations.
  3. Semantic Blindness: Models often fail to understand the functional purpose of a location (e.g., a park vs. a transit hub).
Comparison of NextLocLLM with previous DL-based and LLM-based models. NextLocLLM uses coordinate regression and LLM-enhanced embeddings to overcome the limitations of ID-based classification.

Methodology

NextLocLLM addresses these limitations by shifting from discrete classification to continuous coordinate regression, powered by a Large Language Model (LLM) backbone.

LLM-Enhanced POI Embeddings

Instead of one-hot vectors, NextLocLLM uses an LLM (specifically GPT-2) to process textual descriptions of Point of Interest (POI) categories. This extracts "functional semantics"—the underlying reason why people visit a place—which remains consistent across different cities.

Coordinate Regression and Unified Backbone

The model is trained to output normalized $(x, y)$ coordinates using a Web Mercator projection. This preserves spatial relationships and allows the model to predict locations outside its training set. The framework utilizes a partially frozen LLM; by freezing self-attention layers and fine-tuning only specific parameters like positional encodings, the model leverages its pre-trained world knowledge for mobility patterns.

Post-Prediction Retrieval

To ensure actionable outputs, a KD-tree is employed during inference. The predicted coordinates are used to query the nearest real-world candidate locations, providing a structured top-k list of destinations.

Detailed architecture of the NextLocLLM framework. (a) shows the overall pipeline from embeddings to KD-tree retrieval. (b) and (c) detail the trajectory content and POI semantic embedding modules.

Experimental Evaluation

The authors evaluated NextLocLLM on real-world datasets from Xi’an, Japan (Yjmob100k), and Singapore.

Key Results

  • Accuracy: NextLocLLM achieved a Hit@1 of 58.14% on the Xi’an dataset, outperforming state-of-the-art baselines like ROTAN (52.36%) and GETNext.
  • Zero-Shot Generalization: When trained on Xi’an and tested on Singapore, NextLocLLM maintained high performance. In contrast, traditional ID-based models dropped to near 0% accuracy because they could not interpret the new city's location IDs.
  • Efficiency: Unlike prompt-based LLM approaches that generate coordinates token-by-token, NextLocLLM’s regression head is orders of magnitude faster, reducing inference time from roughly 26 hours to under 4 minutes on the Xi'an dataset.

Conclusion

NextLocLLM represents a significant shift in human mobility modeling. By combining the semantic reasoning of LLMs with the spatial continuity of coordinate regression, it provides a robust, generalizable framework for next-location prediction across diverse urban environments. Future work will focus on improving precision at finer spatial scales and incorporating additional multimodal signals.

Summary updated

BibTeX
@misc{liu2024nextlocllm,
  author = {Shuai Liu and N. Cao and Yile Chen and Yue Jiang and Gao Cong and Cong, Gao},
  title = {{NextLocLLM: Location Semantics Modeling and Coordinate-Based Next Location Prediction with LLMs}},
  year = {2024},
  eprint = {2410.09129},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.09129},
}
Figure