NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Large Language Models for Spatial Trajectory Patterns Mining

Zheng Zhang, Hossein Amiri, Zhenke Liu, Andreas Züfle, Liang Zhao · DOI

Abstract

Identifying anomalies in human mobility is a high-stakes task with applications in public health, safety, and urban planning. Traditional methods often rely on complex feature engineering or data-intensive deep learning models that lack transparency. This paper explores the potential of Large Language Models (LLMs) to perform zero-shot trajectory anomaly detection by treating mobility traces as natural language reasoning tasks. We evaluate GPT-3.5, GPT-4, and Claude-2 across real-world and simulated datasets. Our findings demonstrate that LLMs not only match or exceed the performance of specialized models but also provide transparent, human-readable explanations for their detections, addressing the "black-box" challenge of traditional AI.

Introduction

Human movement is inherently complex, characterized by intricate spatial-temporal dynamics and semantic context. For instance, visiting a pub at 2:00 AM carries different implications than visiting an office at the same time. Traditionally, detecting anomalies—such as sudden shifts in routine—has required hand-crafted rules or specialized neural networks. This study investigates whether the general reasoning capabilities of LLMs can be effectively transferred to the domain of GPS coordinates and stay points without specific fine-tuning, leveraging their ability to understand semantic context and temporal patterns.

Methods

The researchers transformed raw mobility data into textual descriptions (e.g., "Sat 10:36, Pub, 0.4 km -> Sat 10:57, Apartment"). They evaluated three primary models—GPT-3.5, GPT-4, and Claude-2—using several prompting strategies to understand how context affects performance.

Prompt templates for different task settings used to evaluate LLMs in trajectory anomaly detection.

Key strategies included:

  • Separate vs. Combine: Analyzing a single user's history versus comparing a group of users to identify outliers.
  • With/Without Hints: Providing a "deviate point" to signal when a potential change in behavior occurred, testing the model's ability to perform comparative analysis.
  • Zero-Shot Learning: Relying entirely on the models' pre-existing reasoning abilities without domain-specific training.

The evaluation utilized two benchmarks: GEOLIFE, a real-world GPS dataset of 182 users, and PATTERNS-OF-LIFE (POL), a simulated environment featuring specific anomaly types like "work outliers" (skipping work) and "hunger outliers" (excessive restaurant visits).

Results and Discussion

The experimental results indicate that LLMs are potent "spatial reasoners." They successfully identified irregular patterns, such as physically improbable travel distances or deviations from established routines.

Performance comparison of LLMs against traditional and deep learning baselines on Geolife and Patterns-of-Life datasets.

As shown in the performance table, LLMs frequently outperformed specialized unsupervised detection methods. On the GEOLIFE dataset, Claude-2 with hints achieved an AUC of 0.8875, significantly surpassing the best deep learning baseline, DSVDD (0.7714). On the POL dataset, GPT-3.5 achieved an AUC of 0.7572, nearly doubling the performance of traditional methods like MoNav-TT (0.4798).

Beyond quantitative metrics, LLMs offer an "explainability advantage." For example, GPT-4 could articulate that a user's behavior was abnormal because they visited pubs during typical working hours, a level of transparency that traditional models lack. This suggests that LLMs can bridge the gap between raw data and actionable human insights.

Conclusion

LLMs represent a promising new frontier for spatial trajectory mining. Their ability to handle semantic context and provide reasoning makes them valuable for real-world monitoring. However, practical deployment faces hurdles including context window limitations for long-term data, high API costs, and significant data privacy concerns. Future research will focus on evaluating open-source models and optimizing context management for multi-year trajectories.

Summary updated

BibTeX
@misc{zhang2023large,
  author = {Zheng Zhang and Hossein Amiri and Zhenke Liu and Andreas Züfle and Liang Zhao},
  title = {{Large Language Models for Spatial Trajectory Patterns Mining}},
  year = {2023},
  eprint = {2310.04942},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.04942},
}
Figure