Timestamps as Prompts for Geography-Aware Location Recommendation

Yan Luo, Haoyi Duan, Ye Liu, Fu-Lai Chung

Abstract

Location recommendation is a critical component of personalized map services and urban planning, yet existing models often struggle with temporal flexibility and geographic precision. This paper introduces the Temporal Prompt-based and Geography-aware (TPG) framework, which rethinks location recommendation by treating target timestamps as explicit query prompts. This approach enables "interval prediction"—the ability to predict a user's location at any specific future time, even when intermediate check-in data is missing. Furthermore, TPG addresses the "hard boundary" problem inherent in geographic gridding through a novel shifted window mechanism. Extensive evaluations on five real-world datasets demonstrate that TPG significantly outperforms state-of-the-art methods in both accuracy and robustness.

Introduction

Predicting a user's next Point-of-Interest (POI) is essential for enhancing travel experiences. However, current state-of-the-art models face two primary limitations. First, they typically treat recommendation as a fixed sequence, implicitly fusing temporal intervals into the history. This makes them effective at predicting the immediate next step but poor at predicting locations further in the future (interval prediction). Second, the common practice of "gridding" geographic coordinates to handle data sparsity creates hard boundaries; two nearby POIs may be assigned to different cells, causing the model to ignore their physical proximity and violating Tobler’s First Law of Geography.

The TPG Framework

The TPG framework addresses these challenges through a Transformer-based architecture comprising three specialized modules:

1. Geography-aware Encoder

To resolve the hard boundary problem, the model employs a Shifted Window Mechanism. For every geographic grid cell, the encoder generates eight additional augmented neighbor grids by shifting the window along the X and Y axes. By applying n-gram processing on "quadkeys" (hierarchical grid identifiers), the model captures spatial relationships across multiple resolutions, ensuring that proximity is preserved even across grid lines.

2. History Encoder

A standard Transformer encoder processes the multi-modal embeddings of a user’s check-in history. This includes POI identifiers, user IDs, timestamps, and geographic data, creating a rich representation of past behavior.

3. Temporal Prompt-based Decoder

The core innovation of TPG is the use of the target timestamp as a query prompt rather than a simple input feature. By "prompting" the decoder with a specific time $T$, the model can selectively attend to relevant historical patterns to predict where a user will be at that exact moment. This decouples the historical sequence from the specific query, allowing for flexible predictions across varying time intervals.

Experimental Evaluation

Datasets

The framework was validated using five diverse, real-world Location-Based Social Network (LBSN) datasets:

  • Gowalla & Brightkite: Large-scale datasets with global check-in coverage.
  • Foursquare (NYC, TKY, SIN): City-specific datasets for New York, Tokyo, and Singapore, representing different urban densities and mobility patterns.

Performance and Key Results

TPG demonstrated clear superiority over eight leading baselines, including STAN, GeoSAN, and MobTCast:

  • Accuracy: TPG achieved up to a 20.2% improvement in NDCG@5 and a 16.2% improvement in Recall@5 over the best-performing baselines.
  • Interval Prediction: In scenarios where the most recent check-ins were masked (e.g., using check-ins 1–97 to predict the 100th), TPG’s performance remained stable. In contrast, traditional sequential models experienced sharp declines in accuracy, proving TPG's robustness for long-range forecasting.
  • Computational Efficiency: By leveraging a Transformer-based design, TPG avoids the massive memory overhead associated with the matrix operations found in models like STAN.

Discussion and Future Work

An unexpected finding during the study was that the inclusion of User Embeddings actually hindered performance. The authors suggest this may be due to a misalignment between the vector spaces of behavioral sequences and specific geographic locations.

Future research will focus on:

  1. Intelligent Prompting: Incorporating natural language prompts (e.g., "Where will the user go for dinner on a rainy day?") to add semantic context to temporal queries.
  2. Foundation Models: Exploring large-scale pre-training on mobility data to develop a foundation model for human geography, similar to Large Language Models in the text domain.

Conclusion

By reframing timestamps as prompts and introducing a shifted window for geographic data, the TPG framework provides a more flexible and accurate solution for location recommendation. Its ability to perform interval prediction and overcome the limitations of discrete gridding represents a significant step forward in modeling human mobility.

Summary updated

Abstract

Location recommendation plays a vital role in improving users' travel experience. The timestamp of the POI to be predicted is of great significance, since a user will go to different places at different times. However, most existing methods either do not use this kind of temporal information, or just implicitly fuse it with other contextual information. In this paper, we revisit the problem of location recommendation and point out that explicitly modeling temporal information is a great help when the model needs to predict not only the next location but also further locations. In addition, state-of-the-art methods do not make effective use of geographic information and suffer from the hard boundary problem when encoding geographic information by gridding. To this end, a Temporal Prompt-based and Geography-aware (TPG) framework is proposed. The temporal prompt is firstly designed to incorporate temporal information of any further check-in. A shifted window mechanism is then devised to augment geographic data for addressing the hard boundary problem. Via extensive comparisons with existing methods and ablation studies on five real-world datasets, we demonstrate the effectiveness and superiority of the proposed method under various settings. Most importantly, our proposed model has the superior ability of interval prediction. In particular, the model can predict the location that a user wants to go to at a certain time while the most recent check-in behavioral data is masked, or it can predict specific future check-in (not just the next one) at a given timestamp.
BibTeX
@inproceedings{luo2023timestamps,
  author = {Yan Luo and Haoyi Duan and Ye Liu and Fu-Lai Chung},
  title = {{Timestamps as Prompts for Geography-Aware Location Recommendation}},
  booktitle = {ACM International Conference on Information and Knowledge Management},
  year = {2023},
  doi = {10.1145/3583780.3615083},
}
Figure