Introduction
In the era of smart cities and ubiquitous GPS, trajectory data has become a cornerstone for urban planning, traffic management, and anomaly detection. A fundamental task in analyzing this data is calculating the similarity between movement paths. While "learnable" similarity measures—which map paths into a vector space for efficient comparison—have emerged, they face three significant hurdles:
- The Semantic Gap: Trajectories are often represented at two scales: fine-grained GPS coordinates and coarse-grained grid cells. Existing models frequently fail to align these, leading to "many-to-one" mapping issues where distinct movement patterns become indistinguishable after discretization.
- Noise Sensitivity: GPS data is inherently noisy. Small measurement errors can be amplified during grid quantization, obscuring true motion patterns.
- Local vs. Global Focus: Most models optimize for point-wise or pair-wise distances, ignoring the global ranking structure—the holistic order of which trajectories in a database are most similar to a query.
Methodology
To address these challenges, we propose TrajDiff, a framework built on three innovative pillars: the Semantic Alignment Module (SAM), DDBM-based noise-robust pre-training, and ranking-aware regularization.
Semantic Alignment Module (SAM)
Instead of simply aggregating GPS and grid features, SAM employs a "Dual Semantic Alignment Attention" mechanism. It treats GPS features as queries and grid features as keys/values (and vice versa) to iteratively align the two scales. An adaptive fusion mechanism then merges these into a unified representation, effectively bridging the semantic gap.
DDBM-based Noise-robust Pre-Training
The "secret sauce" of TrajDiff is the use of Denoising Diffusion Bridge Models (DDBM). Unlike standard diffusion models that generate data from pure noise, DDBM learns the transition between two real trajectories. By training the model to progressively denoise intermediate states between a starting path and a target path, it captures underlying motion dynamics while becoming highly resilient to local GPS noise.
Ranking-aware Regularization
To move beyond simple distance matching, TrajDiff incorporates ListNet and a novel Rank-Decay ListNet into the loss function. This approach forces the model to prioritize the accuracy of top-ranked results, which is critical for real-world retrieval tasks. By applying a logarithmic weight to the loss, the model focuses its "attention" on accurately ranking the most similar trajectories.
Experimental Setup
The model was evaluated on three widely used public datasets:
- Porto: 1.7 million taxi trajectories from Porto, Portugal.
- Geolife: Trajectories from 182 users in Beijing, capturing diverse transportation modes.
- T-Drive: GPS data from over 10,000 taxis in Beijing.
Standard heuristic measures (SSPD, Frechet, and Hausdorff distances) served as ground-truth labels for training and testing.
Results
TrajDiff consistently outperformed eight state-of-the-art baselines, including TrajCL and KGTS, across all datasets.
- Accuracy: The model achieved an average HR@1 (Hit Ratio at 1) gain of 33.38% across all evaluation metrics. On the T-Drive dataset, it showed a significant 92.99% improvement under the SSPD metric.
- Robustness: Performance gains were most pronounced on the Geolife and T-Drive datasets, which are inherently noisier than Porto, validating the effectiveness of DDBM pre-training.
- Efficiency: Despite the complexity of training, the final model uses a single-layer SAM for inference. This makes it 10.86% faster than the next-best baseline, achieving $O(1)$ time complexity for pairwise similarity once embeddings are generated.
Conclusion
TrajDiff redefines trajectory similarity computation by bridging the gap between raw GPS data and grid-based representations. While highly effective at spatial alignment, future work could more explicitly integrate temporal dynamics, such as varying velocities or time-of-day patterns, into the diffusion bridge. Additionally, optimizing the computationally intensive pre-training phase remains an area for further development.
Summary updated