Instruction-Tuning Llama-3-8B Excels in City-Scale Mobility Prediction

Peizhi Tang, Chuang Yang, Tong Xing, Xiaohang Xu, Renhe Jiang, Kaoru Sezaki · DOI

Abstract

Predicting long-term human mobility at a city scale is a complex challenge that traditional domain-specific models often struggle to address due to limited generalization across diverse urban environments. This paper presents Llama-Mob, an adaptation of the Llama-3-8B large language model (LLM) for human mobility prediction. By reformulating trajectory forecasting as a natural language question-answering task and employing parameter-efficient fine-tuning (PEFT), Llama-Mob achieves state-of-the-art performance. The model not only secured the top ranking in the Human Mobility Prediction Challenge 2024 but also demonstrated significant zero-shot generalization capabilities across multiple metropolitan areas.

1. Introduction

Human mobility prediction—the task of forecasting individual movement patterns within an urban environment—is a cornerstone of modern urban planning, epidemic modeling, and disaster response. Despite its importance, the field has been dominated by models that are either too specialized to generalize or too focused on short-term "next-step" predictions.

Recent advances in Large Language Models (LLMs) suggest that these models possess sophisticated reasoning and pattern-recognition capabilities. This study investigates whether an instruction-tuned LLM can be repurposed to predict long-term (15-day) trajectories by treating spatial coordinates as a sequence-to-sequence translation problem.

2. The Limitations of Traditional Mobility Models

Existing approaches to mobility prediction typically face three significant bottlenecks:

  1. Short-term Focus: Most models are optimized for immediate forecasting (e.g., 30-minute windows), failing to capture the periodicities and routines of long-term human behavior.
  2. The Generalization Gap: Models are often over-fitted to the specific geography of a training city, rendering them ineffective when deployed in a city with a different layout.
  3. Architectural Complexity: Traditional models require bespoke, handcrafted architectures to process spatial-temporal data, making them difficult to scale or adapt to varying data formats.

3. Methodology: Llama-Mob

The researchers introduced Llama-Mob, which leverages the pre-trained knowledge of Llama-3-8B through a novel problem reformulation.

3.1 Problem Reformulation

Instead of feeding raw numerical coordinates into a regression model, the task is framed as a structured Q&A interaction:

  • Instruction Block: Sets the model's persona as a helpful assistant and defines the operational environment (a 200x200 grid) and the data format (quadruples of day_id, timeslot_id, x, and y).
  • Question Block: Provides the model with the historical movement data of an individual over the preceding 60 days.
  • Answer Block: Prompts the model to generate a predicted trajectory for the subsequent 15 days in a standardized JSON format.

3.2 Parameter-Efficient Fine-Tuning (PEFT)

To adapt the 8-billion parameter model efficiently, the authors utilized Low-Rank Adaptation (LoRA). By updating only a small subset of parameters—specifically within the attention and projection layers—the model was trained using standard token-level cross-entropy loss. This approach treats the transition from past to future mobility as a "translation" task, leveraging the LLM's inherent sequence-modeling strengths.

4. Experimental Evaluation

The model was primarily evaluated using the Human Mobility Challenge 2024 dataset, comprising trajectories for over 150,000 individuals across four Japanese metropolitan areas (Cities A, B, C, and D). The cities were discretized into 500m x 500m grid cells with 30-minute intervals.

4.1 Performance Metrics

Llama-Mob achieved the #1 average ranking in the 2024 Challenge, surpassing 35 other specialized models. In City B, the model reached a GEO-BLEU score of 0.3541, a substantial improvement over the previous state-of-the-art model, LP-Bert, which scored 0.3093.

4.2 Zero-Shot Generalization

One of the most striking findings was the model's ability to generalize. A Llama-Mob instance trained exclusively on data from City B outperformed city-specific models when tested on Cities C and D. This suggests that the model is learning universal patterns of human movement—how humans behave generally—rather than merely memorizing a specific city's map.

5. Qualitative Insights

Qualitative case studies revealed that Llama-Mob produces more "human-like" trajectories. While traditional models often predict rigid, geometric paths (such as right-angled triangles), Llama-Mob replicates the messy, overlapping, and organic nature of actual human movement. This "geometric realism" is likely a byproduct of the LLM's ability to synthesize complex historical patterns into a coherent future narrative.

6. Discussion and Future Work

Despite its predictive prowess, Llama-Mob faces a significant hurdle regarding computational efficiency:

  • Inference Latency: Llama-Mob is approximately 16,000 times slower than traditional models. A single 15-day prediction requires roughly 225 seconds, compared to 14 milliseconds for LP-Bert, making real-time applications currently unfeasible.
  • Spatial Bias: The model lacks an explicit spatial inductive bias; it treats grid locations as discrete tokens rather than points in a continuous physical space. It does not inherently "see" the distance between grid 1 and grid 100.

Future research will focus on mitigating these limitations through model quantization, speculative decoding, and the investigation of better data selection strategies to reduce the training overhead.

7. Conclusion

Llama-Mob demonstrates that large-scale instruction tuning can transform a general-purpose LLM into a powerful tool for urban mobility prediction. By outperforming domain-specific architectures and exhibiting robust zero-shot generalization, Llama-Mob sets a new benchmark for the field, highlighting the potential of LLMs to master complex spatial-temporal reasoning tasks.

Summary updated

BibTeX
@inproceedings{tang2024instruction,
  author = {Peizhi Tang and Chuang Yang and Tong Xing and Xiaohang Xu and Renhe Jiang and Kaoru Sezaki},
  title = {{Instruction-Tuning Llama-3-8B Excels in City-Scale Mobility Prediction}},
  booktitle = {HuMob-Challenge@SIGSPATIAL},
  year = {2024},
  doi = {10.1145/3681771.3699908},
}
Figure