Patch-Level Tokenization with CNN Encoders and Attention for Improved Transformer Time-Series Forecasting
Organizations: School of Computer Science and Engineering, VIT-AP University, Amaravati, Andhra Pradesh, 522241, India
Abstract
Transformer-based models have shown strong performance in time-series forecasting by leveraging self-attention to model long-range temporal dependencies. However, their effectiveness depends critically on the quality and structure of input representations derived from raw multivariate time-series data, particularly as sequence length and data scale increase. This paper proposes a two-stage forecasting framework that explicitly separates local temporal representation learning from global dependency modelling. In the proposed approach, a convolutional neural network operates on fixed-length temporal patches to extract short-range temporal dynamics and non-linear feature interactions, producing compact patch-level token embeddings. Token-level self-attention is applied during representation learning to refine these embeddings, after which a Transformer encoder models inter-patch temporal dependencies to generate forecasts. The method is evaluated on a synthetic multivariate time-series dataset with controlled static and dynamic factors, using an extended sequence length and a larger number of samples. Experimental results demonstrate that the proposed framework consistently outperforms a convolutional baseline under increased temporal context and remains competitive with a strong patch-based Transformer model. These findings indicate that structured patch-level tokenization provides a scalable and effective representation for multivariate time-series forecasting, particularly when longer input sequences are considered.
Figures & tables
| 1 | -5.36 | 0.36 | 2 | 16.43 | 3 | 3 |
| 2 | -4.52 | 6.41 | 2 | 16.43 | 3 | 3 |
| 3 | -2.87 | 3.73 | 2 | 16.43 | 3 | 3 |
| 4 | -1.38 | 2.48 | 2 | 16.43 | 3 | 3 |
| 5 | -2.02 | 6.28 | 2 | 16.43 | 3 | 3 |
| 6 | -1.76 | 2.45 | 2 | 16.43 | 3 | 3 |
| Parameter | Value |
| Number of input features | 6 |
| Sequence length ( ) | 160 |
| Patch size ( ) | 8 |
| Number of patches ( ) | 20 |
| Forecasting granularity | Patch-level |
| Model | Architecture | Layers | Attention Heads | Learning Rate | Epochs | Batch Size |
|---|---|---|---|---|---|---|
| Proposed | CNN Patch Encoder | – | – | 2000 | 32 | |
| Transformer Encoder | 4 | 16 | 300 | 32 | ||
| TCN | Temporal Conv. Network | 4 | – | 300 | 32 | |
| PatchTST | Patch-based Transformer | 4 | 16 | 300 | 32 |
| Horizon | Model | MSE | MAE | RMSE |
|---|---|---|---|---|
| (8 steps) | Proposed CNN–Attention–Transformer | 0.076000 | 0.205000 | 0.275681 |
| TCN | 0.238000 | 0.355000 | 0.487852 | |
| PatchTST | 0.095000 | 0.218000 | 0.308221 | |
| (24 steps) | Proposed CNN–Attention–Transformer | 0.058860 | 0.190912 | 0.242611 |
| TCN | 0.105902 | 0.218461 | 0.325426 | |
| PatchTST | 0.101054 | 0.242811 | 0.317890 |
| Model | MSE | MAE | RMSE |
|---|---|---|---|
| Proposed model | 0.090665 | 0.142513 | 0.301105 |
| TCN | 0.145150 | 0.195749 | 0.380985 |
| PatchTST | 0.128451 | 0.187312 | 0.358400 |
| Configuration | MSE | MAE | RMSE |
|---|---|---|---|
| Full model | 0.097670 | 0.222652 | 0.312522 |
| No dense connections | 1.304764 | 0.781693 | 1.142263 |
| Mean pooling (no attention pool) | 2.029864 | 0.810744 | 1.424733 |
| No token attention | 0.546755 | 0.445993 | 0.739429 |
Multivariate Time Series Forecasting
Multivariate time series forecasting predicts future values across related variables by learning their temporal and cross-variable dependencies.
See all 289 papers