timexer
Plain Transformer forecaster: patch tokens for the target, one token per exogenous series, a global bridge token.
Time series · 56 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Task
- Time series
- Parameters
- 14.7K
- Operations
- 56
- Framework
- PyTorch
- Recurrent
- No
- Published
- 2024
- Paper
- variate tokens
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m12191
- Graph hash
- 8ab4e0fb44288e106fc195eb9e7a7a198ce23b5e4e8a16656485f3cef8e4d90e
- Skeleton hash
- 1354baddf5bf3454db8c46f2d5e50a3b2a7183940de86ef3b9875465f660f6ba
- Architecture hash
- 068637f5a42acadf33466cf27eee8459d6a2f64ffcfafa6207229862cc1ddfbe
- Diagram SHA-256
- c6836560581d03d2754a9279244edaddee79b74d5f9aae470f49c275fb858520
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
TimeXer is a Transformer forecaster built for what the paper calls a more practical setting than plain univariate or multivariate forecasting: time series forecasting with exogenous variables. Exogenous variables feed the forecaster with context but are never themselves predicted. The motivating example is electricity prices, which depend on market supply and demand and cannot be predicted from their own history alone.
The model reuses the canonical Transformer without modifying any component; all the work is done by how the two kinds of series are embedded. The endogenous series is split into non-overlapping patches, each projected to a temporal token. Self-attention over these temporal tokens captures the patch-to-patch dependencies within the target. Each exogenous series is instead compressed into a single variate-level token, which copes with missing values, misaligned timestamps, different frequencies or mismatched look-back lengths. Because patch tokens and variate tokens live at different granularities, a learnable global token per endogenous variable serves as a macroscopic representation that talks to the exogenous variables. The idea of a learnable global token is borrowed from Vision Transformers. Exogenous information enters through cross-attention, with the endogenous variable as query and the exogenous variables as key and value. Multivariate forecasting falls out as a special case: each variable is treated as endogenous in turn, the rest as exogenous, with shared attention layers run in parallel.
Experiments cover twelve datasets in both univariate and multivariate settings. The short-term half is electricity price forecasting from five power markets, each with price as the endogenous variable and two exogenous variables. On those five price datasets TimeXer reaches state-of-the-art on every one. Swapping the exogenous variables for noise degrades results, which the authors read as evidence the model really uses that external information. Replacing the endogenous series with zeros or random values instead causes a significant decline, so performance is tied to the quality of the target's own history. A large-scale test forecasts the hourly temperature of 3,850 weather stations worldwide. The exogenous inputs are ERA5 meteorological indicators sampled every 3 hours, so the two sides run at different frequencies. Baselines cannot handle the mismatch and need the exogenous series interpolated to hourly values, and TimeXer surpasses them.
Key idea. TimeXer gives endogenous and exogenous series different embeddings, patch tokens for the target and one variate token per exogenous series, and links them through a learnable global token so a canonical Transformer can use external information without architectural changes.
- TimeXer
- time series forecasting with exogenous variables
- exogenous variables
- endogenous variable
- patch-wise self-attention
- variate-wise cross-attention
- global token
- Transformer forecaster
- electricity price forecasting
- multivariate forecasting
- NeuralForecast
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.