Introduction
Predicting Origin-Destination (OD) flows—the volume of people moving between locations—is a fundamental challenge in urban planning and transportation engineering. While existing models perform well within a single city where data is plentiful, they often struggle with "cross-city transferability." Differences in urban layouts, traffic conditions, and socio-economic factors make it difficult for models trained in one city (e.g., Beijing) to generalize to another (e.g., Xi'an). Traditional approaches like the Gravity Model are often too simplistic, while modern deep learning methods like Graph Neural Networks (GNNs) tend to overfit to specific spatial coordinates, failing to capture the universal human behaviors that drive urban mobility.
The LLM-COD Framework
To address these challenges, researchers have developed LLM-COD (Large Language Model for Cross-City OD), a framework that treats urban mobility as a semantic language problem rather than a purely numerical spatial one. This approach is built on the premise that while the physical geometry of cities varies, the underlying functional relationships between locations—and the human motivations for traveling between them—remain consistent across cultures and geographies.
The methodology involves four key steps:
- Textualizing the City: Instead of raw GPS coordinates, locations are represented as semantic distributions of Points-of-Interest (POIs). By converting spatial data into a text-based format (e.g., "this area is 30% residential, 20% food, 10% shopping"), the model can learn patterns that are transferable across different urban geographies.
- Instruction-Tuning: The framework utilizes pre-trained LLMs, specifically Llama2-7B and Gemma-7B, fine-tuned using LoRA (Low-Rank Adaptation). The model is given a structured prompt: "Given the starting place [POI list] and time [HH:MM], predict the most likely destination POIs and travel distance."
- Novel Loss Function: Standard LLMs are typically optimized for next-token prediction. LLM-COD introduces a custom weighted cross-entropy loss that penalizes errors in both the destination's semantic profile (POI distribution) and the physical "effort" required for the trip (travel distance).
- Destination Cell Matching: After the LLM generates a predicted "target POI profile," the system scans the target city's grid to find the physical location that most closely matches this profile while remaining within the predicted distance range.
Data and Evaluation
The study utilized real-world trip datasets from three major Chinese cities to test transferability:
- Beijing: Taxi trajectory data used primarily as the source city for training.
- Xi'an & Chengdu: Ride-sharing data from DiDi used as target cities to test zero-shot transferability.
- Tencent Map API: Provided POI data across 24 categories (Residential, Food, Hotel, etc.) for every grid cell in these cities.
Key Results and Insights
LLM-COD demonstrates significant improvements over traditional and state-of-the-art (SOTA) spatial models, achieving a paradigm shift in how we model urban movement.
Superior Accuracy and Transferability
The model outperformed the previous SOTA, GODDAG, by 46% in RMSE for high-precision (1km x 1km) grid predictions. Notably, LLM-COD maintained high performance even in "zero-shot" scenarios where it had never seen data from the target city. This proves that LLMs can act as "semantic bridges" by capturing universal human intent—such as the morning commute from residential zones to workplaces—regardless of the specific city layout.
Robustness Across Distances
Unlike baseline models, which often see error rates spike as trip distances increase, LLM-COD remains accurate across varying ranges. Traditional models often produce "elliptical" flow predictions—mathematically smooth but geographically unrealistic. By searching for functional matches, LLM-COD produces spatial distributions that closely mirror actual human behavior.
Hyperparameter Sensitivity
The researchers found that the weight parameter ($\alpha$) in the loss function is critical for balancing proximity and destination attractiveness. If distance is weighted too heavily, the model ignores high-quality destinations that are slightly further away, leading to suboptimal predictions. The optimal balance allows the model to prioritize functional relevance while respecting geographic constraints.
Conclusion and Future Work
LLM-COD represents a significant advancement in urban flow prediction by leveraging the semantic reasoning capabilities of Large Language Models. While the approach is computationally more intensive than simpler models and depends on high-quality POI data, it offers unprecedented transferability across diverse urban environments. Future work will focus on reducing inference latency, integrating additional data sources like weather and public transit schedules, and improving the interpretability of the model's spatial reasoning for urban planners.
Summary updated