- The paper introduces TrajDLM, a block diffusion language model that combines road-network embeddings with topology-constrained sampling to generate valid, map-matched trajectories in parallelizable blocks.
- TrajDLM achieves the best or second-best scores on 13 of 15 metrics across Beijing, Porto, and San Francisco, including substantially improved DTW similarity and inference up to 2.8× faster than HOSER.
- The paper shows that road-level representations improve ablation and zero-shot transfer results, while topology-constrained sampling strengthens global consistency, although scalability, temporal modeling, and performance on structured cities remain open challenges.
Motivation and problem setting
Synthetic GPS trajectory generation must satisfy two competing requirements: distributional fidelity at the population level and fine-grained local similarity of individual routes, all while respecting road network topology. Existing approaches occupy two ends of a trade-off. Continuous-space generators such as DiffTraj and TrajFlow produce trajectories quickly but do not model the road network, allowing generated coordinates to fall off valid roads. Topology-aware models such as TS-TrajGen and HOSER represent trajectories as sequences of road segments and encode the road graph, but their decoding depends on an iterative classical search algorithm that is inherently non-batchable and slow.
TrajDLM addresses this gap by applying block diffusion LLMs (BD3-LMs) to trajectory generation. Trajectories are modeled as sequences of discrete road segment tokens over a directed graph G=⟨V,E⟩, and generation is performed via semi-autoregressive block-wise denoising conditioned on an origin, destination, departure time, and trip-level attributes (distance, average segment distance, duration, average speed). The paper claims this is the first application of BD3-LMs to topology-constrained trajectory synthesis.
Method
The framework combines three components.
Block diffusion backbone. The forward process follows D3PM-style masked diffusion: tokens are independently replaced by a mask token [M] with step-dependent rate βt. The reverse process is parameterized by a BDLM initialized from Qwen3-0.6B adapted as a block diffusion model (Qwen3-0.6B-diffusion-bd3lm-v0.1). A trajectory is partitioned into B contiguous blocks of length L′; the likelihood factorizes autoregressively across blocks while each block is denoised in parallel via the tractable D3PM posterior marginalizing over predicted clean tokens. Training minimizes the standard noise-conditioned evidence lower bound (NELBO) summed over blocks. Road segment IDs are added to the tokenizer vocabulary.
Road network encoder (RNE). Adapting HOSER's encoder, each road segment is represented by concatenated embeddings of its ID, length, highway type, longitude, and latitude; ordered edge representations include reachability indicators and steering-angle embeddings derived from bearing differences. A two-layer GATv2 fuses these representations, and a two-layer MLP projects them into the LLM's input embedding space, replacing default token embeddings for road tokens. Notably, the authors drop HOSER's zone-level component, retaining only road-level semantics — a design choice validated empirically rather than assumed.
Topology-constrained sampling (TCS). Because the NELBO objective does not guarantee that reverse-diffusion outputs respect connectivity, TCS augments sampling with an adjacency penalty matrix P (zero for valid transitions, large negative otherwise), applied to logits during left-to-right decoding within each block with temperature-scaled Gumbel-max sampling. This guarantees every committed transition satisfies (r^i−1,r^i)∈E. Confidence-based commitment follows the BD3-LM schedule, committing only top-kt positions per step. After all blocks are denoised, the sequence is truncated at the first occurrence of the destination, ensuring valid termination. Classifier-free guidance is applied before the adjacency penalty.
Main results
Across Beijing, Porto, and San Francisco (using HOSER's preprocessed map-matched datasets and splits), TrajDLM achieves the best score on 8 of 15 metrics and second-best on 5. The strongest results are on DTW: on Beijing it attains 3.98 versus 5.98 for HOSER, and it outperforms HOSER on Porto (6.71 vs 7.45) and San Francisco (7.80 vs 8.50). On Porto it also achieves the best global Distance JSD (0.0003). However, on Beijing it underperforms HOSER on global metrics (Distance 0.0289 vs 0.0002; Radius 0.0056 vs 0.0001), which the authors attribute to difficulty capturing global patterns in smaller, more structured cities. This is a genuine weakness rather than a uniform win. Classical baselines (Markov, Dijkstra) remain competitive, consistent with prior observations that real navigation approximates shortest paths, yet TrajDLM exceeds them on local similarity, indicating learned mobility dynamics beyond shortest-path behavior.
Efficiency. Against ablated variants sharing the identical Qwen3-0.6B backbone, RNE, and TCS — differing only in decoding paradigm — TrajDLM dominates both autoregressive (AR) and masked diffusion (MDLM) backbones on fidelity (e.g., Beijing DTW 2.78 vs 15.39 for AR and 40.22 for MDLM). It is up to 2.8× faster than HOSER despite a far larger parameter count (600M vs 2–5M), because HOSER's search-based decoding is not batchable. Latency figures are concrete: 0.40 s/trajectory on Beijing versus 1.01 s for AR and HOSER. The efficiency claim is therefore well-controlled, though it is specific to the search-based bottleneck of HOSER rather than a general statement about all topology-aware decoders.
Zero-shot transfer. Transferring models trained on 2015 Beijing taxi data to GeoLife (2007–2011, mixed transport modes including bike, walk, bus), TrajDLM achieves the best Hausdorff (0.3733 vs 0.4894 for HOSER) and DTW (3.30 vs 7.75), and second-best EDR, while TrajFlow and HOSER retain better global metrics. The transfer result supports the claim that road-level-only RNE features generalize better than trajectory-dependent zone-level aggregates.
Ablations
Three ablations clarify the source of gains:
- RNE variant: the simplified road-only RNE outperforms the full road+zone encoder on most metrics (Beijing DTW improves from 5.26 to 3.98; Hausdorff from 0.454 to 0.364), while removing any dependence on trajectory-derived zone statistics. No-RNE degrades sharply (Beijing DTW 11.97), confirming topology injection matters — but even the no-RNE variant beats TS-TrajGen, indicating the BDLM backbone contributes independently.
- Block length: optimal L′ tracks mean trajectory length ([M]0 for Beijing, [M]1 for Porto/San Francisco); mismatching costs measurable fidelity (Beijing DTW 4.77 → 3.98 when corrected).
- TCS and CFG: TCS primarily improves global consistency, reducing Distance JSD by roughly an order of magnitude on longer-trajectory cities (Porto 0.0020 → 0.0004; San Francisco 0.0032 → 0.0007), with smaller or mixed effects on local metrics. Increasing CFG scale [M]2 from 0 to 0.5 consistently improves local metrics without shifting global distributions.
Limitations and open questions
The authors state several limitations explicitly. First, the method requires map-matched trajectories at both training and inference time, coupling performance to upstream map-matching quality — continuous-space models avoid this dependency. Second, experiments are confined to city-scale graphs of at most ~40,000 segments; scaling to networks such as Sydney's (>200,000 segments) would exceed the backbone's original tokenizer vocabulary and likely require larger or hierarchical block schemes, which remain unexplored. Third, evaluation uses a single backbone family at a single scale (Qwen3-0.6B), so backbone- and scale-dependence of the trade-offs is unverified. Fourth, the model generates spatial sequences only, with no explicit temporal modeling, limiting applicability where temporally realistic traces are required. Finally, the Beijing global-metric gap relative to HOSER indicates that population-level distribution matching in structured road networks is not fully solved by this approach.
Conclusion
TrajDLM demonstrates that block-wise discrete diffusion, combined with graph-based road embeddings and constrained sampling, can match or exceed search-based autoregressive topology-aware generators on fine-grained local fidelity while offering substantially faster, batchable inference, and that its road-level representations transfer zero-shot across temporal and modal domain shifts. Its principal open problems are scalability beyond mid-sized road graphs, robustness to backbone choice, and extension to spatio-temporal generation.