Abstract
This paper presents a novel framework for learning compact, fixed-dimensional embeddings for short-range vehicle trajectories. By utilizing a lightweight Transformer encoder trained with a contrastive triplet loss, the proposed "Contrast & Compress" method generates 16-dimensional representations that prioritize directional intent. Evaluation on the Argoverse 2 dataset demonstrates that Cosine-similarity-based objectives significantly outperform frequency-based methods and traditional heuristics, enabling efficient and semantically meaningful trajectory retrieval for autonomous driving applications.
Introduction
In the field of motion forecasting for autonomous vehicles, retrieving similar historical trajectories serves as a critical mechanism for generating motion priors or "anchors." Traditional approaches often rely on computationally expensive heuristics like Dynamic Time Warping (DTW) or Fréchet distance, which scale poorly ($O(N^2)$) and frequently fail to distinguish between semantically distinct maneuvers, such as a subtle lane change versus a sharp turn. While modern deep learning models often learn these representations implicitly, there is a growing need for compact, interpretable, and discriminative embeddings that can be used in real-time systems.
Methodology
The authors propose the "Contrast & Compress" framework, which transforms raw trajectory data into low-dimensional vectors.
Architecture and Preprocessing
The core of the framework is a lightweight Transformer encoder. Experiments revealed that shallower models (1-2 layers with 4 heads) are more effective and efficient for short trajectories (60 points) than deeper architectures, which tend to overfit on noise. Before encoding, trajectories are normalized by shifting the starting point to the origin and rotating the sequence to align with a canonical x-axis. This ensures the model focuses on the relative shape and intent of the motion rather than absolute global coordinates.
Contrastive Learning
The model is trained using a Triplet Loss objective. For each anchor trajectory, the loss pulls "positive" (similar) samples closer in the embedding space while pushing "negative" (dissimilar) samples away. The study compares two primary similarity metrics for defining these relationships:
- Cosine Similarity: Measures the angular alignment of displacement vectors to capture directional intent.
- FFT Similarity: Uses Fast Fourier Transforms to capture the frequency-based "shape" of the trajectory.
Training utilizes random negative mining from large batches, which was found to provide better stability and coverage of the trajectory manifold compared to complex hard-negative mining strategies.
Results and Analysis
The framework was evaluated using the Argoverse 2 (AV2) Motion Forecasting Dataset, comprising nearly 200,000 samples.
Retrieval Performance
The Cosine-similarity-based model achieved a minimum Average Displacement Error (minADE) of 0.3170 and a minimum Final Displacement Error (minFDE) of 0.4869 using only 16-dimensional embeddings. In contrast, FFT-based models performed significantly worse, with minADE scores often exceeding 1.0.
Semantic Clustering
Qualitative analysis via t-SNE visualizations confirms that the model naturally organizes trajectories into intuitive semantic clusters. Without explicit labels, the embedding space separates distinct behaviors such as sharp left turns, gradual right turns, and straight-line accelerations.
Discussion
A key finding is that for short-range maneuvers, directional intent is the primary factor in determining similarity. The 16-dimensional embedding space represents a "sweet spot" for compression, providing sufficient nuance for accurate retrieval while remaining lightweight enough for high-speed vector search using libraries like FAISS. This transition from $O(N^2)$ heuristic comparisons to $O(\log N)$ vector searches represents a significant leap in operational efficiency.
Conclusion
"Contrast & Compress" demonstrates that lightweight Transformers can learn highly effective trajectory embeddings through well-chosen contrastive objectives. Future work will explore incorporating environmental context (e.g., lane boundaries) and extending the framework to longer-range trajectories. These learned embeddings can serve as interpretable anchors within larger motion forecasting pipelines, enhancing both performance and transparency.
Summary updated