Manuscript Offprint
arXiv:2611.08703Foundation-Model Residuals as Signals of Urban Bus Irregularity
CSABA I. SIDLÓ¹,*, JAMIL J. GHAZAL¹, DOMONKOS RÓZSAY¹, RITA RÓNAI¹, AND ANDRÁS J. MOLNÁR¹
¹Institute for Computer Science and Control, Hungarian Research Network, Hungary *sidlo@sztaki.hu
Pretrained trajectory models encode mobility patterns learned across cities, but their errors when transferred to a new city are usually treated only as performance limitations. We instead ask whether these residuals reveal systematic local conditions. Architectures such as UniTraj [1] and TrajFM [2] learn transferable trajectory representations, although cross-context transfer remains challenging [3]. Using the NetMob26 bus location, ticketing, weather, network, and socioeconomic data for Niterói [4], we analyze spatial and travel-time residuals of these recent trajectory foundation models. We test whether high residuals concentrate spatially, whether spatial and travel-time residuals overlap, and which urban-context variables explain their distribution.
We interpret high residuals as candidate proxy signals of transit irregularity rather than direct evidence of service disruption, and analyze their contextual associations using Explainable AI (XAI) [5]. Insights into such varied environments are increasingly valuable for evaluating new urban paradigms; for instance, the 15-minute-city perspective [6] serves as a key motivation for our approach, guiding our methods and expanding the analysis beyond standard mobility metrics.
1. DATA AND ANALYTICAL METHODOLOGY
We first process and extend the NetMob dataset, then generate behavioral benchmarks using pretrained foundation models, and subsequently apply XAI to analyze the systemic drivers behind the prediction residuals.
The Niterói dataset contains GPS traces, ticketing, route, weather, and socioeconomic data for spatial cells. Points-of-interest (POIs) are added with 15-minute-city indicators, counting POI categories within 15-minute walk. Schedule-based metrics are omitted due to widespread data gaps.
For comparison, we trained task-matched local baselines exclusively on the Niterói data. For trajectory reconstruction we used linear regression, Ridge and Lasso models based on recent spatial coordinates, with and without temporal features. For travel-time prediction we used the same locally trained regression family. Default hyperparameters were used, as these models serve as simple local references.
Pretrained TrajFM [2] is evaluated for travel-time estimation, with errors measured in minutes. We evaluate both zero-shot and locally fine-tuned UniTraj [1] for spatial trajectory reconstruction. Comparative testing between sliding-window prefix continuation and masked segment reconstruction showed that the masked approach yielded superior performance. The final setup used windows with 200 locations, 30 points masked or predicted. Figure 1 illustrates the setup: UniTraj reconstructs a hidden segment of an observed bus trajectory, and the residual distance becomes the local irregularity signal.
Features and predictions are aggregated to 1,236 distinct spatial H3 resolution-9 hexagonal cells (with H3 resolution 10 used for sensitivity analysis). After filtering out unique identifiers, target variables, raw counts, center-distance proxies, and uninformative generic aggregates, the final explanatory model retains

Fig. 1. Example UniTraj masked-segment imputation.
39 contextual features with five distinct thematic families: transit demand and rider composition, localized speed and congestion, road network geometry, 15-minute city accessibility indicators, and census-derived socioeconomic status (SES).
We explain per-cell errors with XGBoost using urban features as inputs and aggregated model error as target. SHAP values [5] provide global importance and, for each cell, the dominant feature family behind the local irregularity score. We sum absolute SHAP contributions within predefined feature families and assign each mapped cell to the family with the largest total absolute contribution. This way we visualize local explanatory context, not only a citywide ranking. To reduce target circularity, we omit closely related speed-derived variables from one explanatory specification; remaining speed/congestion features are operationally useful but are treated as associative rather than independent causal evidence.
Across 7,092 test trips, TrajFM achieved an MAE of 5.12 min and a MAPE of 9.47%, outperforming the best local baseline MAE of 5.94 min. Its mean bias of -1.14 min indicates a modest tendency to underestimate trip duration.
The TrajFM meta-model has limited explanatory power (); its SHAP results should therefore be interpreted cautiously. Within this weakly predictive model, passenger-demand features (free-pass ridership share) show the largest associations, followed by 15-minute accessibility and congestion metrics.
UniTraj and TrajFM cell-level errors are moderately correlated
*Accepted as a poster at the NetMob 2026 Data Challenge but not presented.
Abstract
2

Fig. 2. Irregularity hotspots: highlighted cells fall within the top quartile for UniTraj spatial or TrajFM travel-time error.

Fig. 3. Dominant SHAP feature family within joint-hotspot cells.
(). Their respective top-quartile hotspot sets overlap in 39 cells, referred as “joint hotspots” (Fig. 2). Hotspot locations remained stable across alternative feature subsets, H3 cell resolutions, and trajectory-masking strategies, indicating that the spatial patterns were not artifacts of a modeling configuration.
A tuned binary XGBoost classifier distinguishing joint hotspots from all other cells achieved an out-of-fold ROC AUC of 0.87 and an average precision of 0.46 against an 11.5% base positive rate. Global SHAP analysis links these combined hotspots to explanatory features. Fig. 4 displays the joint hotspot SHAP profile: hotspots remain strongly associated with passenger pass composition, population density, and educational accessibility. The observed associations differ between the two residual types: UniTraj errors are more strongly associated with geometry and accessibility, whereas TrajFM errors show weaker associations, primarily with passenger and timing-related context.
Joint hotspots are distinguished primarily by low population density (Kruskal-Wallis H=27.84, p<0.0001 across the four hotspot categories) rather than income (H=6.07, p=0.11, not significant) — suggesting a stronger association with low-density peripheral urban structure than with income deprivation. Fig. 5 illustrates how further top non-speed and non-population variables systematically differ across hotspot classes.
Fig. 3 maps each cell's dominant SHAP driver: population density, 15-minute accessibility, and fare composition, highlighting areas where generic mobility priors fit poorly and targeted operational validation is most needed.

Fig. 4. SHAP beeswarm with the top features for the joint hotspot class. Higher SHAP values indicate a greater predicted probability of joint-hotspot membership.

Fig. 5. Observed feature profiles across hotspot categories for the top contextual variables (red: above average, blue: below).
3. CONCLUSION AND FUTURE WORK
Transferred trajectory foundation models produced spatially structured, interpretable residuals that may serve as proxy signals of transit irregularity in Niterói's bus network.
UniTraj and TrajFM outperformed local baselines, while their overlapping high-error cells were consistently associated with population density, accessibility, and passenger composition. These residuals should be interpreted as candidate irregularity indicators rather than verified disruptions, but they provide a useful way to prioritize operational investigation. Future work will validate hotspots against route-normalized variability and agency records and assess performance under spatially blocked cross-validation.
REFERENCES
- Y. Zhu, J. Yu, X. Zhao, et al., "Unitraj: Learning a universal trajectory foundation model from billion-scale worldwide traces," in Advances in Neural Information Processing Systems, vol. 38 D. Belgrave, C. Zhang, H. Lin, et al., eds. (Curran Associates, Inc., 2025), pp. 42258–42295.
- Y. Lin, T. Wei, Z. Zhou, et al., "TrajFM: A vehicle trajectory foundation model for region and task transferability," (2024).
- S. Gao, "Issues on pre-training and applications of urban mobility foundation models," in Proceedings of the 1st ACM SIGSPATIAL International Workshop on Urban Mobility Foundation Models, (Association for Computing Machinery, New York, NY, USA, 2025), UMFM '25, p. 1–3.
- F. Domingos, H. T. Marques-Neto, B. Pereira, et al., "The netmob26 dataset: A high-resolution multi-source view of public bus mobility in niterói," (2026).
- S. M. Lundberg and S.-I. Lee, "A unified approach to interpreting model predictions," in Advances in Neural Information Processing Systems 30, I. Guyon, U. V. Luxburg, S. Bengio, et al., eds. (Curran Associates, Inc., 2017), pp. 4765–4774.
- C. Moreno, Z. Allam, D. Chabaud, et al., Smart Cities 4, 93 (2021).