Papers
Topics
Authors
Recent
Search
2000 character limit reached

AutoHFormer: Efficient Time-Series Transformer

Updated 12 February 2026
  • The paper presents a hierarchical autoregressive modeling framework that decomposes forecasting into segment-level blocks to refine predictions and reduce error accumulation.
  • AutoHFormer introduces dynamic windowed masked attention with an exponential decay mechanism to enforce strict temporal causality and improve computational efficiency.
  • Empirical evaluations demonstrate that AutoHFormer achieves significant speedups, lower memory usage, and improved accuracy compared to full attention models on benchmark datasets.

AutoHFormer is a Transformer-based architecture for long-horizon time-series forecasting that simultaneously enforces strict temporal causality, achieves sub-quadratic complexity, and captures multi-scale temporal patterns. It is characterized by its hierarchical autoregressive generative mechanism, dynamic windowed masked attention with exponential decay, and a hybrid temporal encoding scheme. These design elements collectively address the fundamental requirements for reliable, scalable, and precise time-series prediction (Zhang et al., 19 Jun 2025).

1. Hierarchical Autoregressive Modeling Framework

AutoHFormer adopts a hierarchical generation scheme that decomposes the forecasting problem into segment-level blocks, with each block processed via an initial summary followed by step-wise autoregressive refinement. Given an input history X1:LRL×VX_{1:L}\in\mathbb{R}^{L\times V} and total forecast length Ttotal=KHT_{\text{total}}=K\cdot H (where KK is the number of segments and HH is the segment length), the model factorizes the predictive distribution as

p(Y^X1:L)=h=1Kp(Y^hX1:L,Y^1:h1)=h=1Kt=1Hp(y^(h1)H+tX1:L,Y^1:h1,y^(h1)H+1:(h1)H+t1)p(\hat{Y} \mid X_{1:L}) = \prod_{h=1}^K p(\hat{Y}_h \mid X_{1:L},\hat{Y}_{1:h-1}) = \prod_{h=1}^K \prod_{t=1}^H p(\hat{y}_{(h-1)H+t} \mid X_{1:L},\hat{Y}_{1:h-1},\hat{y}_{(h-1)H+1:(h-1)H+t-1})

Segment-level initialization is executed through a block-wise Transformer: Y^hinit=Fθ(Ch)RH×d\hat{Y}_h^{\text{init}} = \mathcal{F}_\theta(C_h) \in \mathbb{R}^{H \times d} where Ch=Concat(X1:L,Y^1:h1)R(L+(h1)H)×dC_h = \text{Concat}(X_{1:L}, \hat{Y}_{1:h-1}) \in \mathbb{R}^{(L + (h-1)H) \times d}. Within each segment hh, step-wise refinement generates each scalar forecast recursively: Cht=Concat(Ch,y^(h1)H+1,,y^(h1)H+t1)C_h^t = \text{Concat}(C_h, \hat{y}_{(h-1)H+1}, \ldots, \hat{y}_{(h-1)H+t-1})

ot=WindowedAttention(Cht,Cht,Cht;At)o_t = \text{WindowedAttention}(C_h^t, C_h^t, C_h^t;A_t)

Ttotal=KHT_{\text{total}}=K\cdot H0

Ttotal=KHT_{\text{total}}=K\cdot H1

This hybrid approach reduces error accumulation typical of sequential autoregression by correcting each step with windowed context and parameter sharing across segment steps.

2. Dynamic Windowed Masked Attention Mechanism

AutoHFormer replaces full self-attention with Dynamic Windowed Masked Attention (DWMA), wherein at each time step Ttotal=KHT_{\text{total}}=K\cdot H2 (of Ttotal=KHT_{\text{total}}=K\cdot H3), attention is restricted to a causal window: Ttotal=KHT_{\text{total}}=K\cdot H4 No anti-causal (future) information is leaked. Within this window, attention between Ttotal=KHT_{\text{total}}=K\cdot H5 and Ttotal=KHT_{\text{total}}=K\cdot H6 is modulated by an exponential decay kernel with a learnable rate Ttotal=KHT_{\text{total}}=K\cdot H7: Ttotal=KHT_{\text{total}}=K\cdot H8 The attention score matrix thus becomes: Ttotal=KHT_{\text{total}}=K\cdot H9 where KK0 and KK1 are the relative-position encodings. As KK2 positions attend to at most KK3 others, the time and space complexity is reduced to KK4, significantly below the KK5 of vanilla self-attention.

3. Adaptive Temporal Encoding

The model incorporates a hybrid positional encoding to simultaneously model short-term transients and long-term temporal dynamics. For position pair KK6, a fixed sinusoidal term is precomputed: KK7 for KK8. These are stored in a lookup table and provide continuous, shift-invariant encodings across lags. The learnable decay parameter KK9 is trained jointly, allowing the effective receptive field to adapt per dataset by tuning the influence of distal context: HH0

4. Enforcement of Strict Temporal Causality

Temporal causality is strictly enforced by two complementary mechanisms:

  • A hard attention mask HH1 zeroes all matrix entries where HH2 exceeds HH3 in both the segment-level and intra-segment passes, eliminating anti-causal dependencies.
  • The causal window HH4 only includes current and preceding time indices by construction.

Consequently, every forecast HH5 is a measurable function of only HH6 and HH7, preserving HH8.

5. Computational and Memory Efficiency

AutoHFormer achieves sub-quadratic runtime and space scaling owing to its windowed attention. The key complexities for various models are summarized as follows:

Model Time Complexity Space Complexity
Full Attention HH9 p(Y^X1:L)=h=1Kp(Y^hX1:L,Y^1:h1)=h=1Kt=1Hp(y^(h1)H+tX1:L,Y^1:h1,y^(h1)H+1:(h1)H+t1)p(\hat{Y} \mid X_{1:L}) = \prod_{h=1}^K p(\hat{Y}_h \mid X_{1:L},\hat{Y}_{1:h-1}) = \prod_{h=1}^K \prod_{t=1}^H p(\hat{y}_{(h-1)H+t} \mid X_{1:L},\hat{Y}_{1:h-1},\hat{y}_{(h-1)H+1:(h-1)H+t-1})0
AutoHFormer p(Y^X1:L)=h=1Kp(Y^hX1:L,Y^1:h1)=h=1Kt=1Hp(y^(h1)H+tX1:L,Y^1:h1,y^(h1)H+1:(h1)H+t1)p(\hat{Y} \mid X_{1:L}) = \prod_{h=1}^K p(\hat{Y}_h \mid X_{1:L},\hat{Y}_{1:h-1}) = \prod_{h=1}^K \prod_{t=1}^H p(\hat{y}_{(h-1)H+t} \mid X_{1:L},\hat{Y}_{1:h-1},\hat{y}_{(h-1)H+1:(h-1)H+t-1})1 p(Y^X1:L)=h=1Kp(Y^hX1:L,Y^1:h1)=h=1Kt=1Hp(y^(h1)H+tX1:L,Y^1:h1,y^(h1)H+1:(h1)H+t1)p(\hat{Y} \mid X_{1:L}) = \prod_{h=1}^K p(\hat{Y}_h \mid X_{1:L},\hat{Y}_{1:h-1}) = \prod_{h=1}^K \prod_{t=1}^H p(\hat{y}_{(h-1)H+t} \mid X_{1:L},\hat{Y}_{1:h-1},\hat{y}_{(h-1)H+1:(h-1)H+t-1})2
RNN-based p(Y^X1:L)=h=1Kp(Y^hX1:L,Y^1:h1)=h=1Kt=1Hp(y^(h1)H+tX1:L,Y^1:h1,y^(h1)H+1:(h1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t1)p(\hat{Y} \mid X_{1:L}) = \prod_{h=1}^K p(\hat{Y}_h \mid X_{1:L},\hat{Y}_{1:h-1}) = \prod_{h=1}^K \prod_{t=1}^H p(\hat{y}_{(h-1)H+t} \mid X_{1:L},\hat{Y}_{1:h-1},\hat{y}_{(h-1)H+1:(h-1)H+t-1})7, AutoHFormer achieves up to p(Y^X1:L)=h=1Kp(Y^hX1:L,Y^1:h1)=h=1Kt=1Hp(y^(h1)H+tX1:L,Y^1:h1,y^(h1)H+1:(h1)H+t1)p(\hat{Y} \mid X_{1:L}) = \prod_{h=1}^K p(\hat{Y}_h \mid X_{1:L},\hat{Y}_{1:h-1}) = \prod_{h=1}^K \prod_{t=1}^H p(\hat{y}_{(h-1)H+t} \mid X_{1:L},\hat{Y}_{1:h-1},\hat{y}_{(h-1)H+1:(h-1)H+t-1})8 speedups over full self-attention. On the PEMS08 dataset with p(Y^X1:L)=h=1Kp(Y^hX1:L,Y^1:h1)=h=1Kt=1Hp(y^(h1)H+tX1:L,Y^1:h1,y^(h1)H+1:(h1)H+t1)p(\hat{Y} \mid X_{1:L}) = \prod_{h=1}^K p(\hat{Y}_h \mid X_{1:L},\hat{Y}_{1:h-1}) = \prod_{h=1}^K \prod_{t=1}^H p(\hat{y}_{(h-1)H+t} \mid X_{1:L},\hat{Y}_{1:h-1},\hat{y}_{(h-1)H+1:(h-1)H+t-1})9, it is Y^hinit=Fθ(Ch)RH×d\hat{Y}_h^{\text{init}} = \mathcal{F}_\theta(C_h) \in \mathbb{R}^{H \times d}0 faster per epoch (4.58s vs. 49.3s) and uses Y^hinit=Fθ(Ch)RH×d\hat{Y}_h^{\text{init}} = \mathcal{F}_\theta(C_h) \in \mathbb{R}^{H \times d}1 less GPU memory (2.99 GB vs. 18.13 GB) than PatchTST, while maintaining or improving predictive accuracy (Zhang et al., 19 Jun 2025).

6. Empirical Performance and Benchmark Results

Comprehensive evaluations were performed on eight public benchmarks: ETTh1/2, ETTm1/2, PEMS04/08, Weather, and Electricity datasets, and four horizons Y^hinit=Fθ(Ch)RH×d\hat{Y}_h^{\text{init}} = \mathcal{F}_\theta(C_h) \in \mathbb{R}^{H \times d}2. Under autoregressive evaluation, AutoHFormer achieved first rank in Y^hinit=Fθ(Ch)RH×d\hat{Y}_h^{\text{init}} = \mathcal{F}_\theta(C_h) \in \mathbb{R}^{H \times d}3 cases. On PEMS08, it reported MSE/MAE of Y^hinit=Fθ(Ch)RH×d\hat{Y}_h^{\text{init}} = \mathcal{F}_\theta(C_h) \in \mathbb{R}^{H \times d}4 (versus PatchTST’s Y^hinit=Fθ(Ch)RH×d\hat{Y}_h^{\text{init}} = \mathcal{F}_\theta(C_h) \in \mathbb{R}^{H \times d}5), indicating Y^hinit=Fθ(Ch)RH×d\hat{Y}_h^{\text{init}} = \mathcal{F}_\theta(C_h) \in \mathbb{R}^{H \times d}6 and Y^hinit=Fθ(Ch)RH×d\hat{Y}_h^{\text{init}} = \mathcal{F}_\theta(C_h) \in \mathbb{R}^{H \times d}7 relative improvement. Hierarchical loss is defined by

Y^hinit=Fθ(Ch)RH×d\hat{Y}_h^{\text{init}} = \mathcal{F}_\theta(C_h) \in \mathbb{R}^{H \times d}8

with segment discount Y^hinit=Fθ(Ch)RH×d\hat{Y}_h^{\text{init}} = \mathcal{F}_\theta(C_h) \in \mathbb{R}^{H \times d}9, improving long-term prediction stability.

7. Limitations and Open Issues

Several limitations and avenues for future work exist:

  • Fixed Window Bound: Setting window size Ch=Concat(X1:L,Y^1:h1)R(L+(h1)H)×dC_h = \text{Concat}(X_{1:L}, \hat{Y}_{1:h-1}) \in \mathbb{R}^{(L + (h-1)H) \times d}0 trades off context coverage against efficiency. Small Ch=Concat(X1:L,Y^1:h1)R(L+(h1)H)×dC_h = \text{Concat}(X_{1:L}, \hat{Y}_{1:h-1}) \in \mathbb{R}^{(L + (h-1)H) \times d}1 may omit long-range dependencies.
  • Decay Parameter Sensitivity: Careful tuning of Ch=Concat(X1:L,Y^1:h1)R(L+(h1)H)×dC_h = \text{Concat}(X_{1:L}, \hat{Y}_{1:h-1}) \in \mathbb{R}^{(L + (h-1)H) \times d}2 is required. Large values flatten the decay, reducing discriminative context; small values focus attention on immediate past, possibly ignoring useful historical patterns.
  • Streaming and Non-stationarity: The architecture assumes a fixed look-back Ch=Concat(X1:L,Y^1:h1)R(L+(h1)H)×dC_h = \text{Concat}(X_{1:L}, \hat{Y}_{1:h-1}) \in \mathbb{R}^{(L + (h-1)H) \times d}3 and stationarity. Extending to streaming or non-stationary environments is an open research question.
  • Hierarchical Depth and Interpretability: Additional hierarchical layers may enhance expressivity, but their role in multi-scale pattern discovery merits further theoretical analysis.

In summary, AutoHFormer introduces a principled framework for strictly causal, efficient, and accurate long-horizon time-series forecasting by integrating hierarchical autoregressive modeling, dynamic windowed attention with decay, and adaptive temporal encodings (Zhang et al., 19 Jun 2025).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to AutoHFormer.