Abstract
Long-term multivariate time series forecasting is critical for managing complex systems but is often hindered by the quadratic complexity of standard attention mechanisms and the assumption of uniform dynamics across different variables. We introduce Triformer, a novel Transformer-based architecture that achieves linear complexity $O(H)$ relative to sequence length. Triformer employs a triangular stacking of linear patch attentions and a lightweight parameter factorization method to capture distinct dynamics for individual variables. Our extensive evaluations on standard benchmarks demonstrate that Triformer consistently outperforms state-of-the-art models in both accuracy and computational efficiency, particularly for very long input sequences.
Introduction
Predicting the far future of complex systems, such as power grids, traffic networks, or climate patterns, requires models capable of capturing long-term dependencies across multiple variables. While Transformers have become the standard for sequence modeling, they face two significant hurdles in the context of long-term forecasting:
- Computational Inefficiency: The $O(H^2)$ complexity of canonical self-attention makes processing sequences of thousands of steps prohibitive.
- Variable-Agnostic Modeling: Most existing models use shared projection matrices for all variables, ignoring the unique temporal dynamics inherent in multivariate datasets (e.g., the differing patterns of temperature vs. humidity).
Triformer addresses these challenges through a hierarchical architecture and a novel approach to variable-specific parameterization.
Methodology
The Triformer architecture is defined by three core design innovations: Linear Patch Attention, Triangular Stacking, and Variable-Specific Modeling.
Linear Patch Attention (PA)
To overcome the quadratic bottleneck of standard self-attention, Triformer introduces Patch Attention. The input sequence is partitioned into patches of size $S$. For each patch, the model learns a pseudo timestamp that serves as the "Query." All real timestamps within the patch act as "Keys." Since there is only one Query per patch, the complexity of the attention operation is reduced from $O(S^2)$ to $O(S)$, resulting in overall linear complexity $O(H)$ for the sequence.
Triangular Stacking and Multi-Scale Aggregation
Triformer stacks these PA layers in a hierarchical "triangular" structure. At each layer, only the pseudo timestamps—which effectively summarize their respective patches—are passed to the next level. This causes the sequence length to shrink exponentially (by a factor of $S$) at each level. This structure ensures that the total computational cost across all layers remains $O(H)$.
Furthermore, Triformer aggregates pseudo-timestamps from all layers to form the final prediction. This multi-scale approach provides the predictor with features ranging from fine-grained to coarse temporal scales and creates "gradient short-paths" that enhance training stability.
Variable-Specific Modeling
To allow each variable to have distinct dynamics without an explosion in the number of parameters, Triformer utilizes a lightweight factorization. The projection matrices ($W_K, W_V$) are represented as a product of three matrices: $L \times B^{(i)} \times R$. While $L$ and $R$ are shared across all variables to capture common patterns, $B^{(i)}$ is a compact, variable-specific matrix generated from a unique learnable "memory vector." This allows the model to specialize for each variable while benefiting from shared knowledge.
Evaluation
Triformer was evaluated on four major long-term forecasting benchmarks: ETTh1, ETTm1, ECL (321 variables), and Weather data.
Key Results
- State-of-the-Art Performance: Triformer consistently achieved lower Mean Squared Error (MSE) than top-tier baselines like Informer, Autoformer, and LogTrans. Its performance was particularly notable on high-dimensional datasets like ECL.
- Computational Efficiency: In runtime benchmarks, Triformer maintained a nearly constant training speed as the historical sequence length ($H$) increased. In contrast, models like StemGNN showed exponential increases in training time.
- Robustness to Long Sequences: Triformer successfully handled input sequences of length 2048, a scale at which models like Autoformer frequently encountered out-of-memory (OOM) errors.
Conclusion and Future Work
Triformer demonstrates that a "Static Query" approach using learned pseudo-timestamps can significantly reduce the computational burden of long-term forecasting without sacrificing accuracy. The combination of triangular stacking and variable-specific factorization provides a scalable and expressive framework for multivariate time series. Future research will focus on supporting dynamic input lengths and exploring encoder-decoder structures to allow for more flexible forecasting horizons.
Summary updated