MovSemCL: Movement-Semantics Contrastive Learning for Trajectory Similarity (Extension)

Zhichen Lai, Hua Lu, Huan Li, Jialiang Li, Christian S. JensenarXiv 2025 · DOI

Abstract

Trajectory similarity computation is a cornerstone of spatial data science, yet existing deep learning approaches often struggle with semantic representation and computational scalability. We present MovSemCL, a contrastive learning framework that leverages hierarchical movement semantics and a patch-based attention mechanism. By incorporating curvature-guided data augmentation, MovSemCL captures critical driving behaviors while reducing attention complexity from quadratic to near-linear. Experimental results on large-scale taxi and inter-city datasets demonstrate that MovSemCL achieves state-of-the-art accuracy with significantly higher throughput and inference speed.

Introduction

Determining the similarity between vehicle trajectories is essential for applications ranging from ride-sharing optimization to anomaly detection. Traditional metrics like Fréchet distance or Dynamic Time Warping (DTW) are mathematically robust but computationally expensive and often fail to capture the underlying semantic behavior of a trip. While deep learning models have attempted to embed trajectories into latent spaces, they face three primary challenges: semantic blindness (treating paths as flat coordinate lists), quadratic computational complexity ($O(L^2)$), and unrealistic data augmentation techniques that ignore physical constraints.

The MovSemCL Framework

MovSemCL addresses these limitations through a three-stage hierarchical pipeline designed to extract and learn from movement semantics rather than raw geometric points.

Overview of the MovSemCL framework showing the three levels of encoding and contrastive learning.

1. Movement-Semantics Encoding (L1)

Instead of relying solely on raw GPS coordinates, MovSemCL extracts displacement vectors ($dx, dy$), heading angles ($\theta$), and spatial context. It utilizes a Node2Vec embedding on a grid-based graph of the urban environment to provide each point with a "neighborhood" context, capturing the local road network structure.

2. Hierarchical Semantics Encoding (L2)

To overcome the quadratic scaling bottleneck of standard Transformers, MovSemCL segments trajectories into "patches"—local units representing specific maneuvers. The model employs Intra-Patch Attention to capture local dynamics and Inter-Patch Attention to model the global trip intent. This hierarchical approach reduces complexity from $O(L^2)$ to near-linear scaling.

Comparison of computational complexity between traditional point-based self-attention and the proposed hierarchical patch-based attention.

3. Curvature-Guided Augmentation (CGA) (L3)

Contrastive learning typically relies on data augmentation, such as random point dropping. However, random dropping can destroy critical semantic information like sharp turns. MovSemCL introduces Curvature-Guided Augmentation, which calculates the path's curvature and preferentially retains high-curvature points (turns and intersections) while masking redundant straight-line segments. This ensures the model learns the "behavioral DNA" of a route.

Experimental Evaluation

The framework was evaluated on two large-scale datasets: the Porto taxi dataset (1.37 million trajectories) and a German inter-city dataset (420,000 trajectories).

Key Results

  • Accuracy: MovSemCL consistently outperformed state-of-the-art models like TrajCL and CLEAR in similarity search tasks. It achieved up to a 20.3% improvement in approximating traditional distance measures like EDR or Fréchet distance.
  • Efficiency: The hierarchical attention mechanism resulted in 43.4% faster inference and 76.6% higher throughput compared to standard Transformer-based architectures.
  • Robustness: The model maintained high performance even when trajectories were down-sampled by 50%, demonstrating the resilience of its semantic features over raw geometric data.

Conclusion

MovSemCL demonstrates that focusing on movement hierarchy and behavioral signatures (like turns) provides a more robust and efficient path to trajectory similarity than raw coordinate processing. By reducing computational complexity without sacrificing accuracy, it enables the processing of longer, more complex trips at scale.

Summary updated

BibTeX
@misc{lai2025movsemcl,
  author = {Zhichen Lai and Hua Lu and Huan Li and Jialiang Li and Christian S. Jensen},
  title = {{MovSemCL: Movement-Semantics Contrastive Learning for Trajectory Similarity (Extension)}},
  year = {2025},
  eprint = {2511.12061},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.12061},
}
Figure