USTC's GTM Handles Forecasting, Anomaly Detection and Imputation With One Checkpoint
A new decoder-only time-series foundation model uses Fourier attention and hybrid masking to handle forecasting, imputation, and anomaly detection without any task-specific tweaks.
ProTakeaways
- GTM is the first time-series foundation model claiming true generative-task-agnostic adaptation across forecasting, imputation, and anomaly detection.
- A new Fourier attention module conditions frequency-domain projections on data granularity from milliseconds to days.
- Hybrid masking merges span reconstruction and tail forecasting into one pretraining loss, no per-task head swaps needed.
- Beats SOTA on ETT, Weather, Electricity, Traffic, plus five anomaly datasets and ten UEA classification benchmarks.
- 35.7M parameters, sub-100ms per-item inference on A100, with clear scaling behavior across depth, width, and data.
- Code, weights and UTSD-12G pretraining pipeline are open at github.com/MMTS4All/GTM.
Time-series foundation models have been catching up with their language-model cousins, but they still stumble on one thing that seems basic: doing more than one job with a single set of weights. A new model called GTM (General Time-series Model) takes a direct swing at that problem, and pairs it with a rethink of how these models should actually look at time-series data in the first place.
The core claim from the University of Science and Technology of China team is a mouthful but worth unpacking: GTM is established as the first generative-task-agnostic model for time-series analysis, enabling seamless adaptation to various generative tasks without any task-specific modifications. In plain terms, the same pre-trained checkpoint handles forecasting, imputation, and anomaly detection with only trivial preprocessing changes, and it can be extended to classification by swapping the output head.
Why one model for many tasks is harder than it sounds
Existing time-series foundation models fall roughly into two camps. Forecasting-only systems like Lag-Llama, TimesFM, MOIRAI, and Time-MOE lean on lag features and adaptive patches to predict future values. Multi-task systems like Timer, UP2ME, TimeSiam, and UniTS aim broader but pay a tax: these models require task-specific modifications at the tokenization (e.g., UniTS), pre-training strategy (e.g., Timer), or model level (e.g., UP2ME, TimeSiam, LPTM) to achieve strong downstream performance.
That tax matters. If you have to change tokens, retrain, or bolt on new heads for every downstream job, the whole point of a foundation model gets diluted. GTM's argument is that a single pretraining objective, combined with a richer view of the signal, can dissolve that constraint.
The frequency-domain insight
Before designing anything, the authors ran a distributional analysis. Using FFT plus 2D kernel density estimation on the joint amplitude-frequency and phase-frequency distributions of multi-domain time series, they observed that these distributions differ significantly depending on the sampling granularity, whether the data comes in milliseconds, minutes, or hours. That empirical gap becomes the design lever.
Instead of treating a series as a bag of scalar values indexed by time, GTM explicitly conditions its attention on granularity. Time granularity is encoded as a quintuple of (day, hour, minute, second, millisecond). For example, the ETTm dataset is encoded as [0, 0, 15, 0, 0]. Five learnable key embeddings, one per typical granularity, get compared against this quintuple to produce attention weights that mix five low-rank frequency-learning matrices, plus a global always-on module for patterns that ignore granularity.
How the architecture fits together
GTM is a decoder-only Transformer where every block contains two attention stages:
- A standard temporal self-attention layer that models dependencies across patches in time.
- A Fourier attention module that runs a column-wise FFT on the temporal output, applies the granularity-weighted mix of low-rank frequency projections plus a full-connection global module, and then applies an inverse FFT to return to the time domain.
The default configuration stacks 12 of these blocks with a 768-dimensional embedding, landing at 35.7M parameters. Inputs are reversibly normalized, split channel-independent, and patched with a patch length of 96 over a 1440-timestep lookback window.
Hybrid masking unifies reconstruction and forecasting
The second big design choice sits in pretraining. Inspired by GLM's blank-infilling approach from NLP, GTM samples random span masks, permutes them, wraps them with learnable [START] and [END] tokens, and reconstructs them autoregressively. With probability pred_ratio (set to 0.3), it instead masks a contiguous tail of the sequence, mimicking a pure forecasting objective.
Two smaller ingredients keep this from collapsing: 2D positional encoding tells the backbone how long each masked span is when generating, and full attention is used for masked reconstruction while causal attention is used for autoregressive generation to prevent leakage. The net effect is one training loss (patch-level MSE) that teaches both representation and prediction skills at the same time.
Benchmarks and where GTM lands
Pretraining used the UTSD-12G corpus covering seven domains from energy to web, with no overlap with the downstream test sets. Evaluations span five long-horizon forecasting datasets (ETTh, ETTm, Weather, Electricity, Traffic), five anomaly-detection datasets (MSL, SMAP, SMD, SWaT, PSM), and ten UEA classification datasets.
The headline results:
- On long-term forecasting across prediction lengths of 96, 192, 336, and 720, GTM tops the SOTA count, with PatchTST as the closest competitor.
- On imputation, against the second-best model GTM cuts MSE by 23.1% and MAE by 12.1% on ETTh1, and 25.0% MSE / 8.6% MAE on ETTm1.
- On anomaly detection, GTM leads on average F1 with improvements ranging from 0.33% over GPT4TS to 10.38% over Informer.
- On classification across 10 UEA datasets, GTM takes 5 best and 4 second-best slots against multi-task TSFMs like UniTS and TimesNet.
- In zero-shot forecasting, GTM ranks first on average MSE across 5 datasets with a forecasting length of 96 in zero-shot, beating Timer-1B, MOIRAI-S, MOMENT, TimesFM, and Chronos-S1.
Scaling behavior looks familiar to anyone from the LLM world: deeper and wider models keep improving MSE, and pretraining on more data helps too, though widening without enough depth stalls.
Efficiency and where it breaks
At 35.7M parameters, GTM lands well below GPT-2-based baselines and Time-MOE (base) at 50M. Inference clocks 0.165 seconds per iteration, and per-item latency on an A100 stays around 43 milliseconds for univariate data with a 1440-point input. The Fourier attention module is the dominant cost inside that, but FFT and iFFT themselves add less than a millisecond, and even with 20 modules, latency stays below 0.1s/item, meeting the demands of real-time applications.
The authors are candid about limits. GTM's architecture leans on periodicity and trend structure, so its robustness on low signal-to-noise or highly irregular series is not yet established. Their planned fix is a Mixture-of-Experts extension with gated frequency-domain granularity modules and pretraining on the larger GIFT dataset.
Why this matters
The real breakthrough here is not another leaderboard sweep. It is that a single generative pretraining objective, combined with granularity-aware frequency modeling, is enough to unify three tasks that the field has historically siloed. If you deploy time-series models in production for forecasting today and anomaly detection tomorrow, GTM is one of the first foundation models where the answer to "can I reuse the same checkpoint" is genuinely yes, with code, weights, and pretraining data available in the official repo.