Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

Temporal Fusion Transformers for Interpretable Multi-horizon Time Series Forecasting

Temporal Fusion Transformer forecasts many future steps with interpretable attention

  • Problem Multi-horizon forecasts mix static metadata, known future inputs and past-only inputs. Existing deep models are black boxes that do not handle this full mix.
  • Method TFT selects relevant features per input type with gating and variable selection networks. It then uses an LSTM layer and attention whose heads share one value projection, so attention weights can be read directly.
  • Results Averaged over the reported datasets, P50 loss is 7% lower and P90 loss 9% lower than the next best model; on Electricity the P50 loss is 0.055.

Why mixed inputs make multi-horizon forecasting hard

Multi-horizon forecasting predicts a target at several future steps at once, so a user can plan actions across the whole path rather than only the next step. Practical settings mix static metadata about each entity, inputs known in advance such as holiday dates, and series that are only observed up to the forecast time. Little is known beforehand about how these sources interact with the target, and that heterogeneity is what makes the problem hard.

Many recurrent and autoregressive models assume that every exogenous input is known into the future, which fails when some inputs are only observed in the past. Other models concatenate static covariates to each time-dependent feature at every step, which does not give the static information a distinct role. Post-hoc explanation methods such as LIME and SHAP ignore the time ordering of inputs, so their explanations of a forecast lose the dependence between time steps.

Attention in sequence models can point to relevant time steps, but in its conventional form it cannot say how important each feature is at a given step.

Each entity carries static covariates, time-dependent inputs that are either observed or known in advance, and a scalar target over its time steps. A quantile forecast for horizon τ at time t is produced by one function that reads the target and observed inputs over a look-back window, the known inputs over the window and horizon, and the static covariates.

\[ \hat{y}_i(q,t,\tau)=f_q(\tau,y_{i,t-k:t},z_{i,t-k:t},x_{i,t-k:t+\tau},s_i) \]

How the TFT components fit together

TFT builds a feature representation for each input type, static, known and observed, from a fixed set of components, and then routes these features through a temporal decoder. Its components are gating mechanisms that can skip unused parts, variable selection networks, static covariate encoders, and temporal processing that mixes a local sequence layer with an attention block for long-range effects.

\[ \mathrm{GRN}_\omega(a,c)=\mathrm{LayerNorm}\big(a+\mathrm{GLU}_\omega(\eta_1)\big) \] When the pre-activation is large and positive the ELU behaves as an identity, and when it is large and negative the ELU saturates to a constant, so the block can fall back to a linear layer.

The gated linear unit multiplies a sigmoid-gated projection by a second linear projection, so the gate can push the block's contribution toward zero and skip the nonlinear path. Without a context vector the GRN treats the context as zero, and dropout is applied before the gating layer and layer normalization.

Variable selection and static context

Each variable is first mapped to a vector of the model width, using entity embeddings for categorical variables and linear transforms for continuous ones. Selection weights come from a GRN fed with the flattened transformed inputs and a static context vector, followed by a softmax, so the weights vary from sample to sample. \[ v_{\chi t}=\mathrm{Softmax}\big(\mathrm{GRN}_{v_\chi}(\Xi_t,c_s)\big) \] For static variables the static context is omitted, because the selection already has access to the static inputs.

Each variable also passes through its own GRN, and the processed features are combined as a weighted sum using the softmax weights. The weights of these per-variable GRNs are shared across all time steps.

Static metadata is encoded by separate GRN encoders into four context vectors, one for temporal variable selection, two for local processing of temporal features, and one for enriching temporal features with static information. This wiring lets the static information condition the selection, the local layer and the enrichment step, instead of being concatenated to every time step.

Why attention is modified for interpretation

In standard scaled dot-product attention the weights multiply values, and in multi-head attention each head has its own value projection. Because each head then mixes different value projections, the individual attention weights do not indicate how much a particular feature matters.

TFT shares one value projection across all heads and averages the attention matrices of the heads, so the output is one attention matrix times one shared value matrix. \[ \tilde{H}=\frac{1}{H}\sum_{h=1}^{m_H}\mathrm{Attention}\big(QW_Q^{(h)},KW_K^{(h)},VW_V\big) \] Each head can learn a different temporal pattern while all heads attend to the same set of input features, so the averaged matrix acts as an ensemble over the heads.

Decoder masking is applied so that each time step can only attend to earlier steps, which keeps the causal order of information. Because the averaged matrix is read directly as the weight that each earlier step receives, it supports the interpretation of which past steps the model uses.

Local processing, enrichment and self-attention in the decoder

A sequence-to-sequence layer, implemented as an LSTM encoder-decoder, takes the selected past features into the encoder and the known future features into the decoder. Its initial cell and hidden states come from two of the static context vectors, and a gated skip connection with layer normalization wraps the layer. This layer also replaces standard positional encoding, which supplies the time order of the inputs.

A static enrichment GRN then adds the static context vector to every temporal position. A masked interpretable multi-head attention layer follows, with a gated layer normalization on its output. A final position-wise GRN with a gated residual connection that also skips back to the sequence-to-sequence output yields the representation used for the forecast.

Quantile outputs, training loss and the test metric

Linear outputs from the decoder give one quantile forecast per chosen percentile at each horizon. The model is trained by minimizing the quantile loss summed across the output quantiles and the horizons, using the quantiles 0.1, 0.5 and 0.9. \[ QL(y,\hat{y},q)=q\,(y-\hat{y})_{+}+(1-q)\,(\hat{y}-y)_{+} \] Here the positive part is taken as the maximum of zero and its argument.

For testing, the q-Risk normalizes the summed quantile loss over all test samples and horizons by the sum of absolute target values, with a factor of 2 in the numerator. The evaluation focuses on the P50 and P90 versions of this metric, following earlier work.

Datasets and evaluation setup

Electricity covers the electricity consumption of 370 customers at hourly resolution, with the past 168 hours used to forecast the next 24 hours. Traffic describes the occupancy rate of 440 SF Bay Area freeways at hourly resolution, with the same look-back window and horizon as Electricity. Electricity and Traffic contain only known inputs alongside the target, which makes them simpler univariate benchmarks.

Retail is the Favorita Grocery Sales Dataset with about 130k entities, forecasting log product sales 30 days ahead from 90 days of past information. Volatility uses daily realized volatility of 31 stock indices, forecasting 5 business days from the past 252 business days.

Hyperparameters were chosen by random search, using 240 iterations for Volatility and 60 for the other datasets. The ConvTrans baseline keeps its fixed stack of 3 layers and 8 heads, while its kernel size is searched. Iterated baselines need all inputs in the future, so on the complex datasets their unknown inputs are filled with the last available value.

Benchmark results against prior models

On Electricity the P50 loss of TFT is 0.055, against 0.059 for ConvTrans and 0.067 for Seq2Seq. On Traffic the P50 loss is 0.095, against 0.105 for Seq2Seq and 0.117 for MQRNN.

On Retail the P50 loss of TFT is 0.354, against 0.379 for MQRNN, and its P90 loss is 0.147, against 0.152 for MQRNN. On Volatility the P90 loss is 0.020, against 0.021 for MQRNN and Seq2Seq. Averaged over the datasets, the authors report 7% lower P50 and 9% lower P90 losses than the next best model.

The authors attribute part of the gain to explicitly matching the architecture to multi-horizon forecasting, and to the value of quantile regression when the target is not well described by a Gaussian. On Traffic the target is strongly skewed, with more than 90% of occupancy rates between 0 and 0.1, which the authors cite as a case where direct quantile models do better.

The simpler univariate results for ARIMA, ETS, TRMF, DeepAR, DSSM and ConvTrans were reproduced from earlier work, so they are not a single controlled run with the TFT experiments.

Which components matter when removed

Five axes are ablated: gating layers replaced by linear layers with ELU, static covariate encoders set to zero, instance-wise variable selection replaced by trainable coefficients, self-attention replaced by a trainable matrix, and the sequence-to-sequence layer replaced by standard positional encoding. The ablated networks use the hyperparameters of Table 1 for each dataset.

The temporal components, local processing and self-attention, have the largest effect, with P90 loss increases above 6% on average and above 20% on some datasets. Removing local processing lowers the P50 loss on Electricity, which the authors read as local processing being detrimental there, while self-attention carries more of the work on that dataset.

The authors attribute this to daily seasonality dominating the Electricity dataset, with Table B.4 showing that hour of day has the largest variable importance among temporal inputs.

Static covariate encoders and variable selection increase P90 loss by more than 2.6% and 4.1% on average, with the largest effects on Electricity. Across datasets the maximum increase ranges from 3.6% to 23.4% for P50 loss and from 4.1% to 28.4% for P90 loss.

Variable importance on the Retail dataset

Selection weights are aggregated over the entire test set and summarized by their 10th, 50th and 90th percentiles. Among static covariates, Item Num has the highest median weight at 0.230, followed by Store Num at 0.161. Among past inputs, the target Log Sales has the highest median at 0.324. Among future inputs, On-promotion has a median of 0.170 and National Hol a median of 0.220.

Static identifiers dominate because they uniquely separate the entities, and the authors read the future inputs as tracking promotion periods and national holidays. The authors read the result as the model extracting only a subset of key inputs.

Persistent temporal patterns in attention

For each horizon τ, the output is an attention-weighted sum of lower-level features over the past positions, so the weight on position n shows how much that earlier step contributes. Averaging these weights over time and entities gives one pattern per horizon, which separates lag effects from the sample-specific attention cases shown in other work.

\[ \beta(t,\tau)=\sum_{n=-k}^{\tau_{max}}\alpha(t,n,\tau)\,\tilde{\theta}(t,n) \]

Electricity and Traffic show attention spikes at daily intervals, and Retail shows a weaker weekly pattern together with a decaying trend in which the last few days dominate. Volatility has no strong persistent pattern, with attention roughly equal across positions. The authors suggest that this flat pattern resembles a moving average filter, which may help extract a trend from high-frequency noise.

Regime shifts measured by attention distance

Patterns are compared with the Bhattacharyya distance, computed as the square root of one minus the Bhattacharyya coefficient between two probability vectors. \[ \kappa(p,q)=\sqrt{1-\rho(p,q)}, \qquad \rho(p,q)=\sum_j \sqrt{p_j q_j} \] The distance dist(t) averages this quantity over the horizons, dividing the sum by the maximum horizon.

A threshold of dist(t) above 0.3 marks significant regimes, and the authors compare attention within such a regime with the normal regime. The authors report that TFT places roughly equal attention across past inputs when volatility is low and attends more to sharp trend changes when volatility is high.

Limitations

To keep the attention interpretable, the study uses a single interpretable multi-head attention layer, with the head count searched only over 1 and 4. Hyperparameter search runs 60 iterations for the Electricity, Traffic and Retail datasets and 240 for Volatility. Timing figures for TFT come from a single V100 GPU on Electricity, with training just over 6 hours and batched inference on 50,000 validation samples taking 8 minutes.

Iterated baselines on the complex datasets are given imputed future inputs, which the authors state as a constraint of that comparison. The regime analysis is applied to one index and relies on visual reading of the attention distance plot. Removing local processing improves Electricity P50 loss, so the component's effect is not uniform across datasets.

Paper info

Authors
Bryan Lim, Sercan O. Arik, Nicolas Loeff, Tomas Pfister
Venue
arXiv · Preprint
First published
2019-12-19
Added
2026-11-12
Updated
2020-9-27
Version
v3
arXiv
1912.09363
Category
stat.ML · cs.LG
Original paper terms
arXiv non-exclusive 1.0
What we show
Paper info and commentary

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Quote from the paper

Bryan Lim, Sercan O. Arik, Nicolas Loeff, Tomas Pfister (2019). Temporal Fusion Transformers for Interpretable Multi-horizon Time Series Forecasting. arXiv:1912.09363v3. https://arxiv.org/abs/1912.09363v3

BibTeX
@misc{lim2019temporal,
  title = {{Temporal Fusion Transformers for Interpretable Multi-horizon Time Series Forecasting}},
  author = {Bryan Lim and Sercan O. Arik and Nicolas Loeff and Tomas Pfister},
  year = {2019},
  eprint = {1912.09363},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1912.09363v3}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up