Skip to content
SK Subham KumarTSF Hub · time-series forecasting
Deep learning2023MLPCovariatesLong horizon

TiDE

Time-series Dense Encoder

A plain MLP encoder–decoder with residual blocks that matches Transformers on long-horizon benchmarks at a fraction of the cost, and uses future covariates naturally.

Overview

TiDE shows how far a well-designed MLP can go. Past values, past covariates, future covariates (calendar, prices, planned promotions) and static attributes are projected and flattened into one vector. A stack of residual MLP blocks encodes it, and a decoder produces a representation per future step. A final temporal decoder combines each step’s representation with that step’s covariates.

A linear skip connection from the look-back window to the horizon guarantees the model can at least learn a linear forecast. Training and inference scale linearly with the horizon.

How it works

With past window \(y_{1:L}\), projected covariates \(\tilde x_{1:L+H}\) and static attributes \(a\):

\[e=\mathrm{Encoder}\big(y_{1:L},\,\tilde x_{1:L+H},\,a\big),\qquad g=\mathrm{Decoder}(e)\in\mathbb R^{H\times p}\] \[\hat y_{L+t}=\mathrm{TemporalDecoder}\big(g_t,\,\tilde x_{L+t}\big)+\big(W\,y_{1:L}\big)_t\]

Every block is a residual MLP: dense → ReLU → dense, with dropout, layer norm and a linear skip.

When to use it

Use it for

  • Demand or load forecasting with calendar, price or weather covariates
  • Long horizons on large datasets
  • A fast alternative to Transformer models

Avoid it for

  • Tiny datasets
  • Covariates that won’t be known at forecast time (they leak)

Key settings

SettingWhat it controlsTypical value
input_sizeLook-back window336–720 for hourly
hidden_sizeWidth of residual blocks128–512
decoder_output_dimPer-step representation size8–32
futr_exog_listCovariates known in the futurecalendar, planned events

Python example

Follows the library’s documented API · needs PyTorch/TensorFlow, not run hereDownload tide.py
# pip install neuralforecast   (needs PyTorch)
import pandas as pd
from neuralforecast import NeuralForecast
from neuralforecast.models import TiDE

# ETTh1: hourly electricity-transformer data, a standard long-horizon benchmark
URL = "https://raw.githubusercontent.com/zhouhaoyi/ETDataset/main/ETT-small/ETTh1.csv"
raw = pd.read_csv(URL, parse_dates=["date"])
df = raw.rename(columns={"date": "ds", "OT": "y"}).assign(unique_id="ETTh1")
df["hour"] = df["ds"].dt.hour                    # known-in-advance (future) covariate
H = 96                                           # forecast four days ahead
train, test = df.iloc[:-H], df.iloc[-H:]

model = TiDE(h=H, input_size=336, hidden_size=256, decoder_output_dim=16,
             futr_exog_list=["hour"], scaler_type="standard", max_steps=1000, random_seed=1)
nf = NeuralForecast(models=[model], freq="h")
nf.fit(df=train[["unique_id", "ds", "y", "hour"]])
fc = nf.predict(futr_df=test[["unique_id", "ds", "hour"]])
print(f"TiDE MAE over 96 hours: {abs(test['y'].values - fc['TiDE'].values).mean():.3f}")

Tips & pitfalls

  • Only put a covariate in futr_exog_list if you will truly know it at forecast time.
  • Start with the paper’s defaults, then tune look-back and width.
  • The linear skip makes TiDE a strong default even when covariates add little.

References

  1. Das, A., Kong, W., Leach, A., Mathur, S., Sen, R., & Yu, R. (2023). Long-term Forecasting with TiDE: Time-series Dense Encoder. Transactions on Machine Learning Research.