Moving through physical space leaves a distinct digital footprint. Whether it is a sequence of GPS coordinates from a vehicle, a series of egocentric video frames from a navigating robot, or tracking coordinates from maritime vessels, spatiotemporal trajectories capture how entities interact with the physical world. However, raw trajectory data is notoriously difficult to work with: it is often highly sparse, corrupted by sensor noise, and completely devoid of semantic labels.
Traditionally, understanding these paths required extensive manual labeling or rigid, hand-crafted geometric heuristics. A rapidly growing body of research circumvents these limitations through self-supervised learning (SSL). By designing clever "pretext tasks" that require no human annotation, models can learn the underlying physics, constraints, and structural grammar of an environment directly from raw, unlabeled movement sequences.
Two primary paradigms drive this field: Masked Trajectory Modeling (learning by filling in the blanks) and Contrastive Trajectory Learning (learning by recognizing a path despite distortions).
Masked Trajectory Modeling: Learning Spatial Grammar
The intuition behind masked modeling borrows from natural language processing. In a sentence, if you remove a word ("The cat sat on the [blank]"), a model must understand English syntax and real-world context to guess the missing word. Trajectories possess a similar structural grammar dictated by geography and physical barriers; a car cannot instantly teleport across a river, nor can a robot walk through a wall.
By intentionally hiding segments of a trajectory and forcing a neural network to reconstruct them, the network implicitly internalizes the connectivity and constraints of the physical space.
Raw Trajectory: [Point A] -> [Point B] -> [Point C] -> [Point D]
Masked Input: [Point A] -> [ ??? ] -> [Point C] -> [Point D]
Model Task: Predict [Point B] based on surrounding context
This approach has been successfully adapted across several spatial domains:
- Urban Mobility: Lin et al. developed a masked language modeling objective tailored for dense mobility data, treating sequences of locations as contextual units to learn complex transition patterns. Taking this a step further, Tsiligkaridis et al. tokenized GPS coordinates using Sequence Transformers. They demonstrated that by predicting hidden locations in a sequence, the system can discover environmental structures and functional layouts entirely from scratch, without needing external map data.
- Semantic Context: Trajectories are rarely just coordinates; they are tied to real-world destinations. Zhou et al. combined trajectory reconstruction with point-of-interest (POI) data, forcing their model to learn the underlying correlations between raw movement patterns and geographic semantics.
- Visual Navigation: In embodied AI, agents must navigate using visual inputs. Dou et al. introduced Masked Path Modeling, where an agent masks intermediate visual observations along a path and must reconstruct the corresponding action sequence. Similarly, Sun et al. utilized masked trajectory completion and context restoration to accurately predict future human paths from only momentary observations.
Contrastive Trajectory Learning: Invariance Under Noise
While masked modeling forces a model to understand local connectivity, contrastive learning teaches a model global invariance.
Consider a vehicle driving from an office to a home. If the GPS tracker drops every third point, or if the driver takes a slightly different lane, the fundamental identity of the trip does not change. Contrastive learning exploits this by taking a single trajectory, creating multiple distorted "views" of it via data augmentation, and training a neural network to maximize the similarity between these views while pushing entirely different trips apart.
Original Path --------> Augmentation A (Drop Points) -----\
+--> Maximize Similarity
--------> Augmentation B (Spatial Shift) ---/
To make this work, researchers design domain-specific augmentations that mimic real-world noise:
- Geometric Distortions: Qi et al. utilized point masking and path simplification to force networks to recognize invariant features across different views of the same path without human-labeled similarity metrics.
- Advanced Perturbations: Tong et al. and Zhang et al. expanded the augmentation toolkit to include spatial shifting, random point removal, prefix/suffix truncation, and coordinate simplification via the Douglas-Peucker algorithm.
As highlighted by Shang et al., this contrastive framework allows models to learn highly robust representations even when the underlying source data is incredibly sparse, making it highly effective for downstream recommendation systems.
Cross-Modal Alignment and Behavioral Constraints
The most recent advancements in trajectory pre-training combine these generative and contrastive insights, or bridge entirely different spatial modalities.
For example, urban movement can be viewed either as a continuous path through a road network or as a sequence of discrete grid cells. Shang demonstrated that these two expressions are highly complementary. By utilizing a dual-encoder architecture that hides segments of a road path and forces the model to reconstruct them using grid-based data, the system learns to align different spatial modalities into a unified representation.
In specialized domains like maritime tracking, self-supervision can also leverage physics-based pretext tasks. Bernabé et al. trained models to predict a ship's future heading or verify the logical sequence of movement data, successfully encoding domain-specific behavioral patterns and physical constraints. On a macro scale, Liu et al. combined masked attribute prediction with trajectory contrastive learning to capture the general physics of massive transportation networks.
Why It Works: Internalizing Spatial Intuition
Why do these self-supervised tasks translate so effectively to complex downstream applications? The answer lies in the acquisition of spatial priors.
When a model is forced to predict what an unseen part of an environment looks like based on a random-walk trajectory—as explored by Ramakrishnan et al.—or when it learns to reconstruct maps from partial observations as shown by Zhang et al., it is not just memorizing coordinates. It is internalizing the "spatial grammar" of layouts and mobility.
Once the model understands how space is structured, it requires significantly less data to master complex downstream tasks. A robot pre-trained on uncurated walkthrough videos becomes orders of magnitude more efficient at navigating unfamiliar homes. Similarly, an urban analytics model pre-trained on raw GPS streams can instantly pinpoint traffic anomalies (Sun et al.) or estimate travel times without relying on brittle, hand-engineered map features.
Key Foundational Work
Contrastive Trajectory Similarity Learning with Dual-Feature Attention (2022) — contributed 2 concept elements to this direction.
Human Trajectory Prediction with Momentary Observation (2022) — contributed 1 concept elements to this direction.
Pre-training Context and Time Aware Location Embeddings from Spatial-Temporal Trajectories for User Next Location Prediction (2021) — contributed 1 concept elements to this direction.