Pre-Training General Trajectory Embeddings With Maximum Multi-View Entropy Coding

Yan Lin, Huaiyu Wan, Shengnan Guo, Jilin Hu, Christian S. Jensen, Youfang Lin

Introduction

Spatio-temporal trajectories—sequences of (location, time) pairs—form the backbone of modern urban services, from ride-hailing to logistics. To leverage this data for machine learning, raw GPS points must be transformed into fixed-length vectors, or embeddings. However, existing representation learning methods face three critical challenges: task bias (where models favor either generative or contrastive objectives), incomplete information (failing to integrate both road semantics and movement dynamics), and computational inefficiency when dealing with long, irregularly sampled sequences.

To address these issues, this paper introduces Maximum Multi-view Trajectory Entropy Coding (MMTEC). MMTEC is a novel pre-training framework designed to generate unbiased, general-purpose trajectory embeddings. By maximizing the entropy of multi-view representations, the model ensures that the resulting embedding space is highly expressive and versatile across diverse downstream tasks.

Methodology

The MMTEC architecture is built upon a dual-view approach that captures both the discrete semantics of the road network and the continuous nature of physical movement. These views are fused during pre-training using a specialized loss function.

Dual-View Encoding

  1. The Semantic View (Discrete Encoder): This component processes trajectories map-matched to road segments. To overcome the quadratic complexity of standard Transformers ($O(N^2)$), the authors implement Induced Attention. This mechanism uses a small set of globally shared "anchors" to calculate attention, reducing complexity to $O(N)$ and enabling the efficient processing of long trajectories.
  2. The Continuous View (Continuous Encoder): Recognizing that trajectories represent continuous physical processes, this encoder treats the path as a continuous function using cubic splines. It employs Neural Controlled Differential Equations (NeuralCDE) to model underlying dynamics, effectively handling the irregular sampling intervals common in GPS data.
The MMTEC framework architecture, illustrating the dual-view approach combining discrete semantic encoding with continuous spatio-temporal modeling.

Maximum Multi-view Entropy Coding Loss

The core innovation is the MMTEC Loss. Unlike standard reconstruction or contrastive losses, this objective is rooted in the principle of Maximum Entropy Coding. It aims to maximize the information content (entropy) of the embeddings while ensuring consistency between the semantic and continuous views. This approach prevents the model from over-fitting to specific task quirks, resulting in more "universal" representations.

Experimental Evaluation

The model was evaluated using two massive real-world taxi trajectory datasets from Chengdu and Xian, provided by DiDi Chuxing. These datasets comprise hundreds of thousands of trajectories and millions of records. The authors tested MMTEC across three distinct downstream tasks: Similar Trajectory Search (STS), Travel Time Estimation (TTE), and Destination Prediction (DP).

Key Results

MMTEC consistently outperformed six state-of-the-art baselines, including t2vec, TremBR, and Toast, across all tasks and datasets.

  • Task Versatility: As shown in the radar charts below, MMTEC maintains a balanced and superior performance profile across TTE, STS, and DP, whereas baseline models often show significant bias toward specific tasks.
  • Accuracy and Precision: On the Chengdu dataset, MMTEC achieved an Acc@1 of 84.27% for trajectory search, significantly higher than the 78.67% achieved by Toast. In travel time estimation, it reduced the Mean Absolute Percentage Error (MAPE) to 26.02%.
  • Efficiency: MMTEC is remarkably computationally efficient. It trained at 0.371 min/epoch, nearly 8x faster than Toast (2.733 min/epoch), while maintaining a compact model footprint of approximately 1.7MB.
Radar charts comparing MMTEC against state-of-the-art baselines across three downstream tasks (TTE, STS, DP) in Chengdu and Xian.

Discussion and Future Work

MMTEC demonstrates that entropy maximization is a powerful neutral objective for pre-training. By treating trajectories as both discrete semantic sequences and continuous physical paths, the model captures a more holistic representation of movement. The use of "Induced Attention" and NeuralCDEs further ensures that the model remains scalable and robust to irregular data.

However, some limitations remain. The model currently relies on accurate map-matching for its semantic view, which can be difficult in dense urban environments. Additionally, while the pre-trained embeddings are strong, fine-tuning on labeled data is still necessary for optimal performance. Future research could explore integrating external context—such as weather, traffic incidents, or driver profiles—to further enhance predictive accuracy.

Summary updated

BibTeX
@article{lin2022pre,
  author = {Yan Lin and Huaiyu Wan and Shengnan Guo and Jilin Hu and Christian S. Jensen and Youfang Lin},
  title = {{Pre-Training General Trajectory Embeddings With Maximum Multi-View Entropy Coding}},
  journal = {IEEE Trans. Knowl. Data Eng.},
  year = {2022},
}
Figure