Forecasting traffic in a newly instrumented city is hard because the city has only two or three days of history. The usual fix borrows knowledge from data-rich cities by meta-learning, which means training a model so that a few gradient steps on the new city adapt it well. These methods have only been shown to work on networks of a few hundred sensors. They break down at metropolitan scale, and their gradient steps on tiny datasets are exactly where few-shot models tend to memorize noise. We propose a different route. First, encode every sensor's history with a fixed, untrained random recurrent network combined with diffusion over the road graph. This encoder is identical for every city, so its output features mean the same thing everywhere. Second, adapt to the new city by solving a single regularized linear regression in closed form, with the regression weights pulled toward weights learned on source cities. Transfer thus becomes the choice of a prior for a linear readout. That choice can be computed exactly, costs time linear in the number of sensors, and involves no gradient steps on the scarce target data.
In two sentences: a random, untrained spatiotemporal encoder gives every city the same feature space, so readout weights fit in Los Angeles are directly usable as a starting point in Beijing. The new city then only has to solve a ridge regression that shrinks toward those source weights, which avoids both the overfitting of few-shot gradient descent and the quadratic cost of current cross-city methods.
Core Claim
The claim is that few-shot cross-city spatiotemporal forecasting can be reduced to empirical-Bayes linear regression on fixed features. When this is done with a hierarchical prior estimated from several source cities, it should match or beat meta-learned transfer methods on standard few-shot benchmarks. It should also extend, unchanged, to networks of 10,000 to 100,000 sensors, where those methods cannot run.
The encoder comes from Scalable Spatiotemporal Graph Neural Networks (SGP). SGP pairs a deep echo state network (a recurrent network whose weights are random and never trained) with sums over powers of the adjacency matrix. This turns forecasting into regression on precomputed per-node, per-time features. SGP was only studied with full training data and a gradient-trained decoder. The adaptation principle comes from Rethinking Few-Shot Image Classification: A Good Embedding is All You Need?, which reports that a linear classifier on frozen features beats meta-learning (82.14% vs. 78.63% for MetaOptNet on miniImageNet 5-shot). It is reinforced by Black-Box Tuning, which finds that gradient optimizers overfit few-shot support sets.
Tian et al.'s recipe does not transfer directly to graphs. A backbone trained on one city's graph does not apply to a different graph with different node counts, as SSMT and ST-GFSL both note. We avoid that problem because the encoder is never trained: the same random recurrent weights and the same diffusion rule, applied to the target city's own adjacency, define a feature space shared across cities.
Mechanism
Let $\Phi \in \mathbb{R}^{M \times D}$ hold the $D$-dimensional encoder features for the $M$ (node, time) training pairs in the target city. Let $Y$ hold the corresponding future values over the forecast horizon, and let $W$ be the linear readout. Given a prior mean $\mu$ and a prior precision $\Lambda$ (a matrix saying how strongly each feature direction is held near the prior) estimated from source cities, the target readout is
$$ \hat W = \arg\min_W \|Y - \Phi W\|^2 + (W-\mu)^\top \Lambda (W-\mu) = (\Phi^\top\Phi + \Lambda)^{-1}(\Phi^\top Y + \Lambda\mu). $$
With $S$ source cities, $\mu$ is the average of the source cities' individually fitted readouts. $\Lambda$ is the inverse of their between-city covariance, shrunk toward a scaled identity. Feature directions on which source cities agree are therefore held tightly to the prior. Directions on which source cities disagree are left for the target data to decide.
We add a second level to handle the node heterogeneity that A Critical Audit of Spatiotemporal Forecasting Benchmark Datasets and Baselines shows uniform graph models blur. Each node gets a deviation from the city-level readout, confined to the top $r$ principal directions of the source covariance and shrunk toward zero. Both shrinkage strengths are set by closed-form leave-one-day-out error on the target support set, so no target data is spent on a separate validation split.
The computation only ever needs the summary matrices $\Phi^\top\Phi$ and $\Phi^\top Y$, which can be accumulated as data streams in. This removes the host-memory burden that SGP itself flags for very large graphs. The few-shot regime also helps here: two or three days of target states fit comfortably in memory even at 100,000 nodes.
Research Program
The work has three parts.
The first part builds the transferable encoder. Diffusion uses a normalized adjacency matrix. Each node's history is standardized before entering the random recurrent network so that cities with different speed or flow scales produce comparable features. Because the readout prior needs a shared input space, the target city must use exactly the same random weights as the sources. We will measure how sensitive results are to the random seed and to the feature dimension $D$.
The second part is the prior. We compare four options: no prior, an isotropic prior centered on the source mean, the full between-city covariance prior, and the full prior plus per-node low-rank deviations. Moving from a single source city, as in SSMT, to four or five sources is what makes the covariance estimate meaningful. We will study how performance changes with the number of sources.
The third part is analysis. Learning curves over target history of 1, 2, 3, 7, and 14 days should show the prior's advantage shrinking as data grows, because shrinkage toward a prior matters less as the data term dominates. The analysis also checks when the graph term helps. Evaluating the Generalization Ability of Spatiotemporal Model in Urban Scenario reports that message passing can amplify spurious correlations under distribution shift. In contrast, Spatio-Temporal Graph Few-Shot Learning with Cross-City Knowledge Transfer uses graph reconstruction as a regularizer. Our design resolves this tension empirically: the learned prior decides how much weight the diffusion features receive, and we report that weight per city.
Baselines
The naive reference point is per-node ridge regression on that node's own raw lagged values, fit only on the target support days. It uses no graph and no source data. It anchors what two or three days of data can deliver unaided and implements the "spatial structure is unnecessary" view of the Critical Audit.
The strongest existing few-shot method on the standard protocol is ST-GFSL (Spatio-Temporal Graph Few-Shot Learning with Cross-City Knowledge Transfer). It meta-learns a GRU and graph-attention forecaster whose per-node parameters come from a hypernetwork, and it reports a short-term MAE of 2.355 on METR-LA with 3 days of target data, against 2.740 for a target-only model. We also run TPB (Cross-city Few-Shot Traffic Forecasting via Traffic Pattern Bank), which reports an average 8.4% RMSE reduction and up to 11.3% MAPE reduction over its baselines but gives no absolute scalar in our file. We also run SSMT (SSMT: Few-Shot Traffic Forecasting with Single Source Meta-Transfer), which reports a 2.84% MAE gain on METR-LA. All three will be rerun under one shared split: identical source and target cities, identical target days, horizons of 1, 3, and 6 steps, and the same hyperparameter-search budget measured in GPU-hours. We also quote their published numbers. Beating ST-GFSL means a lower METR-LA short-term MAE than our rerun of it, and no worse than its reported 2.355. Matching it at a fraction of the adaptation cost would also be a meaningful result.
At large scale, the reference is BigST (BigST: Linear Complexity Spatio-Temporal Graph Neural Network for Traffic Forecasting on Large-Scale Road Networks), a linear-complexity forecaster that reports 6.3%–8.4% gains on CALIFORNIA and 3.9%–9.3% on BEIJING with full data. There is no reported few-shot result on Lacuna for BigST, CALIFORNIA, or BEIJING. We will train BigST on the same few target days, both from scratch and initialized from source pretraining. Our method beats it if it achieves lower MAE at equal or lower wall-clock time.
Three ablations isolate the key ingredients. The first keeps our encoder but fine-tunes SGP's gradient-trained decoder on target data after source pretraining, with early stopping. This isolates closed-form shrinkage versus gradient adaptation. The second fits the closed-form readout on the target alone, with no prior, which isolates the value of transfer. The third replaces the reservoir-and-diffusion features with raw lags while keeping the source-derived prior, which isolates whether the shared random encoder earns its place.
Why not just…?
Why not just fit per-node autoregressive ridge models and ignore the graph? This is a real threat. The Critical Audit finds that neighbors add little once a node's own history is known, and that SARIMA beats graph models on WikiMaths. However, the same audit finds spatial signal persists on METR-LA and PEMS-BAY, where a graph model fit to SARIMA residuals reaches MAE 3.32. Separately, a high-order seasonal model fit on 48 hours is poorly identified. The raw-lag-with-prior ablation settles this: if it ties our full method, the honest conclusion is that the source prior, not the graph encoder, does the work, and we will report that.
Why not just pretrain a forecaster on source cities and fine-tune it? The gradient-decoder ablation tests this on identical features. Evidence from both Black-Box Tuning and Tian et al. predicts that fine-tuning overfits at two or three days. The ST-OOD audit reports 40%–116% RMSE degradation for trained spatiotemporal models under shift alone. If careful early stopping closes the gap, our contribution narrows to cost and simplicity, and the learning curves will show this.
Why not just add dropout to node embeddings? Evaluating the Generalization Ability of Spatiotemporal Model in Urban Scenario reports that 0.1–0.2 dropout cut out-of-distribution RMSE on FlowSC from 54 to 24, so we include a dropout-regularized BigST and a dropout-regularized gradient decoder. Dropout regularizes without telling the model which directions to trust. The source covariance prior does exactly that, and comparing these variants measures whether the difference matters.
Why not just use in-context operators? Graph In-Context Operator Networks for Generalizable Spatiotemporal Prediction adapts without weight updates. Its authors, however, report that specialized models still win on short horizons, and it has only been run on up to 228 stations. We run it on the 207–524-node benchmarks and report where it fails to fit in memory at scale.
Proposed Experiments
The first experiment is the standard cross-city protocol. METR-LA, PEMS-BAY, Didi-Chengdu, and Didi-Shenzhen take turns as the target with 3 days of history, while the other cities serve as sources. We report MAE, RMSE, and MAPE at 1, 3, and 6 steps, along with adaptation wall-clock time and peak memory.
The second experiment is the scale test, for which no prior few-shot protocol exists. We hold out CALIFORNIA districts as targets with 3 days of history, using the other districts and the four small cities as sources. BEIJING serves as a 99,716-segment target with sources drawn from the Didi cities. Here we report accuracy together with GPU memory, CPU memory, and time-to-adapt.
The third experiment is the decisive check. It consists of three comparisons on matched features: closed-form shrinkage versus gradient fine-tuning, prior versus no prior, and shared random encoder versus raw lags. Each is run across the 1-to-14-day learning curve. The proposal is supported if the prior and the closed-form solve each give consistent gains at 1–3 days that fade by 14 days, and if the full method stays within its accuracy margin when moving from 500 to 100,000 nodes. It is refuted if raw-lag ridge with a source prior matches the full method at all scales.
References
- Scalable Spatiotemporal Graph Neural Networks
- Rethinking Few-Shot Image Classification: A Good Embedding is All You Need?
- Black-Box Tuning for Language-Model-as-a-Service
- A Critical Audit of Spatiotemporal Forecasting Benchmark Datasets and Baselines
- Evaluating the Generalization Ability of Spatiotemporal Model in Urban Scenario
- Spatio-Temporal Graph Few-Shot Learning with Cross-City Knowledge Transfer
- Cross-city Few-Shot Traffic Forecasting via Traffic Pattern Bank
- SSMT: Few-Shot Traffic Forecasting with Single Source Meta-transfer
- BigST: Linear Complexity Spatio-Temporal Graph Neural Network for Traffic Forecasting on Large-Scale Road Networks
- Graph In-Context Operator Networks for Generalizable Spatiotemporal Prediction