UniTime: A Language-Empowered Unified Model for Cross-Domain Time Series Forecasting

Xu Liu, Junfeng Hu, Yuan Li, Shizhe Diao, Yuxuan Liang, Bryan Hooi, Roger Zimmermann

TL;DR

UniTime is a novel unified model for cross-domain time series forecasting that leverages natural language instructions and a pretrained GPT-2 backbone. By treating time series as a modality that can be aligned with language, UniTime achieves state-of-the-art performance across diverse datasets and demonstrates remarkable zero-shot transferability to unseen domains.

What Problem Does This Paper Address?

In the world of time series forecasting, the standard practice has been to train dedicated, specialized models for every individual dataset or application domain—be it weather, electricity, or economics. While effective, this "one model per domain" approach is siloed and inefficient. It fails to leverage shared temporal patterns (like seasonality or trends) that exist across different types of data.

The authors identify three major hurdles to building a truly unified cross-domain model:

  1. Varying Data Characteristics: Different domains have different numbers of variables (channels) and different lookback/prediction lengths, which rigid traditional architectures can't handle.
  2. Domain Confusion: Without explicit context, a model might struggle to distinguish between a volatile weather sequence and a stable exchange rate, leading to "confused" and inaccurate predictions.
  3. Convergence Speed Imbalance: Simple datasets converge quickly and start overfitting, while complex ones are still learning. This makes training a single model on multiple datasets simultaneously very difficult.

Methods

UniTime addresses these challenges through a "language-empowered" architecture. Instead of just feeding raw numbers into a neural network, it treats time series forecasting as a multi-modal task.

Figure 1: (a) Specialized models are separately trained on time series domains with notable distribution differences. For instance, weather time series constantly fluctuate due to the chaotic influence of natural factors, while economic data, such as exchange rates, tends to remain relatively stable. Disease data, like seasonal cold patterns, typically demonstrate periodicity over extended time periods. (b) The proposed cross-domain learning approach handles time series data from distinct domains and utilizes natural language as domain instructions to provide domain-specific information.

Key components include:

  • Channel-Independence: To handle varying numbers of variables, UniTime processes each univariate time series separately.
  • Time Series Tokenizer: Raw signals are broken into "patches" (similar to tokens in language or patches in vision) to capture local semantics and reduce computational load.
  • Domain Instructions: This is the "secret sauce." Humans provide simple natural language descriptions (e.g., "Electricity transformer data with one hour sample rate") for each domain.
  • Language-TS Transformer: The model uses a pretrained GPT-2 backbone. The domain instructions are placed before the time series tokens. Because GPT-2 uses causal masking, the model "reads" the domain context first, which guides how it interprets the subsequent numerical data.
  • Masking & Gated Fusion: To solve the convergence imbalance, UniTime randomly masks parts of the input. This prevents the model from simply "memorizing" easy patterns and forces it to learn more robust, generalizable features.
Figure 2: UniTime overview from the perspective of a univariate time series.

Datasets

The researchers evaluated UniTime on eight widely-used real-world benchmarks covering diverse fields:

  • ETT (m1, m2, h1, h2): Electricity transformer monitoring.
  • Electricity: Hourly power consumption for 321 clients.
  • Exchange: Daily foreign exchange rates.
  • Weather: Meteorological indicators (temperature, humidity, etc.).
  • Illness: Weekly influenza-like illness rates.

Key Insights and Ideas

  • Language as a Domain Identifier: The use of text instructions effectively solves the "domain confusion" issue. t-SNE visualizations show that with instructions, the model's internal representations of different domains cluster neatly, whereas without them, they are a jumbled mess.
  • LLMs as Universal Computers: The paper builds on the emerging idea that pretrained Large Language Models (LLMs) possess a "universal computing" ability. Their self-attention modules, trained on vast amounts of text, are surprisingly good at processing numerical sequences once they are aligned to the same latent space.
  • The Power of Pretraining: UniTime performs significantly better when initialized with pretrained GPT-2 weights compared to random initialization, proving that linguistic knowledge helps in numerical forecasting.
  • Zero-Shot Transfer: Because the model understands domain descriptions, it can forecast on entirely new datasets it has never seen before. By testing a few different instructions on a tiny sample of the new data, the model can "pick" the best context to use for zero-shot prediction.

Key Results

UniTime was compared against eight state-of-the-art (SOTA) baselines, including specialized models like PatchTST and TimesNet.

  • Dominance in Unified Training: When trained across all datasets, UniTime achieved the best performance in 79 out of 80 experimental settings.
  • Competitive with Specialists: Even though UniTime is a single model handling everything, it often outperformed specialized models that were custom-tuned for just one dataset.
  • Robust Zero-Shot: In zero-shot tests (training on electricity data and testing on weather data, for example), UniTime consistently beat baselines, showing it truly learns general temporal principles rather than just memorizing specific datasets.

Limitations and Future Work

The authors acknowledge a few constraints:

  • Hardware Limits: Due to GPU memory constraints, they were limited to a 6-layer GPT-2 backbone. Scaling up to larger models (like GPT-3 or Llama) could yield even better results.
  • Instruction Selection: The current zero-shot transfer protocol requires a small amount of target data to "select" the best instruction. A more automated, purely text-based instruction generation or selection process would be a logical next step.
  • Data Diversity: While eight datasets were used, the "foundation model" for time series would ideally be trained on thousands of diverse domains to reach the same level of generalization seen in LLMs for text.

Summary updated

BibTeX
@inproceedings{liu2023unitime,
  author = {Xu Liu and Junfeng Hu and Yuan Li and Shizhe Diao and Yuxuan Liang and Bryan Hooi and Roger Zimmermann},
  title = {{UniTime: A Language-Empowered Unified Model for Cross-Domain Time Series Forecasting}},
  booktitle = {The Web Conference},
  year = {2023},
}
Figure