Manuscript Offprint
arXiv:2610.36572Learning from Points and Patches: A Pre-trained Hybrid Attention Transformer for Time Series Analysis
Abstract
Time-series data generated by Web services and connected systems support applications such as user activity analysis, service monitoring, and resource management. However, learning transferable representations from heterogeneous time series remains challenging due to diverse temporal patterns, variable sequence lengths, and limited high-quality annotations. Despite the success of pre-training in natural language processing and computer vision, effective time-series pre-training requires strategies tailored to temporal data. We propose TimeHAT (Hybrid Attention Transformer), a general-purpose pre-training framework for time-series analysis that addresses two complementary questions: what to learn and how to learn. For what to learn, we introduce a Unified Point-Patch Masking Strategy (UPPMS) that integrates point-level and patch-level supervision within a unified framework for contextual reconstruction and causal extrapolation, enabling the model to capture both fine-grained temporal variations and broader temporal patterns. For how to learn, we develop a Hybrid Attention Encoder (HAE) that combines prefix-constrained bidirectional attention in initial layers with directional hybrid attention in deeper layers, aiming to preserve effective contextual interactions while mitigating rank degeneration. We evaluate TimeHAT across real-world datasets and four downstream tasks: classification, long-term forecasting, imputation, and anomaly detection. Experiments cover fine-tuning, few-shot, and zero-shot transfer settings, demonstrating competitive performance across diverse time-series analysis tasks. Code is available at https://github.com/TangPeiwang/TimeHAT.
CCS Concepts
• Computing methodologies → Artificial intelligence.
1 Introduction
The World Wide Web continuously generates time-series signals through user interactions, network traffic, and service telemetry [47, 48, 53]. These signals underpin a wide range of Web applications, including sequential recommendation, user behavior modeling, traffic forecasting, resource management, and service anomaly detection [36, 50, 52]. Beyond Web systems, time-series data (TSD),

(a)

(b)
(c)
Figure 1: (a) Patch-level reconstruction can miss fine-grained temporal details; (b) Deep bidirectional attention risks representation homogenization; (c) Causal attention cannot access two-sided context.
collected across sequential time points to monitor dynamic phenomena, serve as a cornerstone for decision-making in diverse scientific and industrial domains [25, 43]. Despite their broad utility, real-world TSD are often heterogeneous across domains, exhibit diverse temporal patterns and pervasive noise, and frequently lack high-quality annotations [18]. These challenges motivate the development of general-purpose pre-training methods that can learn transferable representations from diverse time series and support a broad range of downstream tasks, including forecasting, classification, imputation, and anomaly detection.
A natural approach to learning such representations is to draw inspiration from the large-scale pre-training paradigm that has achieved remarkable success in natural language processing (NLP) [7] and computer vision (CV) [17]. However, directly transferring these paradigms to time-series analysis (TSA) remains challenging [14, 26]. Unlike NLP and CV, which benefit from large-scale corpora and established pre-training resources such as ImageNet [56], TSA faces substantial data scarcity and heterogeneity across datasets and domains. Consequently, existing pre-training strategies may fail to adequately capture the distinctive statistical properties of time series [3, 34]. This mismatch suggests that effective time-series pre-training requires not only sufficient data and model capacity, but also learning strategies and architectures tailored to temporal data [12, 31].
Despite recent progress, existing time-series pre-training methods face limitations in both reconstruction granularity and contextual modeling. (As illustrated in Figure 1). These limitations

(a) Point-level Masking
(b) Patch-level Masking
(c) Unified Point-Patch Masking
Figure 2: Comparison of Point-Level, Patch-Level, and Unified Point-Patch Masking Strategies for Time Series Data.
motivate two fundamental questions: what to learn from temporal data and how to learn it effectively.
Existing masking-based methods primarily reconstruct masked patches, providing supervision for segment-level temporal patterns [32, 35]. However, patch-level reconstruction does not explicitly supervise fine-grained variations within each patch, which may also carry important temporal information. Conversely, point-level masking provides finer-grained supervision but does not explicitly capture segment-level structure. Effective pre-training should therefore capture complementary temporal information at both point and patch granularities.
However, determining what temporal information to learn is only part of the challenge. The encoder must also integrate contextual information while preserving diverse representations across layers. Standard bidirectional attention (BiA), widely used in masked reconstruction, enables global token interactions but can suffer from representation homogenization and rank degeneration in deep networks [2, 9]. Directional attention can mitigate this degeneration, but applying directional masks from the initial layer may limit early global contextual competition. This motivates an encoder that combines global contextual integration in shallow layers with directionally structured attention in deeper layers.
To address these challenges, we propose TimeHAT (Hybrid Attention Transformer), a general-purpose pre-training framework for time-series analysis. For what to learn, we introduce a Unified Point-Patch Masking Strategy (UPPMS) that unifies contextual reconstruction and causal extrapolation, using point-level and patch-level supervision to capture complementary temporal information. For how to learn, we develop a Hybrid Attention Encoder (HAE) with a progressive attention architecture. It first employs prefix-constrained bidirectional attention to establish contextual representations, then introduces complementary forward and backward attention heads in deeper layers to mitigate rank degeneration while preserving causal constraints on predictive targets. We evaluate TimeHAT across diverse downstream tasks and transfer settings, and further investigate its effectiveness under limited-data conditions.
Our contributions are summarized as follows:
• We propose UPPMS, a unified masking framework that combines contextual reconstruction and causal extrapolation, incorporating point-level and patch-level supervision to capture complementary temporal information.
• We develop HAE, which combines prefix-constrained bidirectional attention in shallow layers with complementary directional attention in deeper layers, balancing contextual integration with rank stability.
• We evaluate TimeHAT across classification, long-term forecasting, imputation, and anomaly detection, including fine-tuning, few-shot, and zero-shot transfer settings. We further analyze its effectiveness under limited-data conditions.
2 Unified Point-Patch Masking Strategy
Recent masked time-series pre-training methods commonly reconstruct masked patches [32, 35]. While patch-level masking provides supervision for segment-level patterns, it does not explicitly supervise fine-grained variations within each patch. Combining point-level and patch-level masking can therefore provide complementary supervision for temporal representation learning.
To address this limitation, we propose a Unified Point-Patch Masking Strategy (UPPMS) that integrates point-level and patch-level masking within a unified pre-training framework (2). UPPMS further supports two complementary learning modes: contextual reconstruction from observed sequences and causal extrapolation toward future segments.
Given a univariate time series of length , we divide it into non-overlapping patches , each of length . Zero-padding is applied to the final patch when necessary.
2.1 Dual-mode Sampling
We define the perturbation set and the predictive target set to specify which patches are corrupted and which serve as prediction targets. The masked patch set is their disjoint union: , . During pre-training, UPPMS samples one of two modes according to a predefined sampling probability:
Learning from Points and Patches: A Pre-trained Hybrid Attention Transformer for Time Series Analysis

Figure 3: Overall architecture of TimeHAT. The model employs channel-independence for multivariate inputs. Sequences undergo a Unified Point-Patch Masking Strategy, patch tokenization, and MLP embedding. A two-stage encoder then captures temporal dynamics, utilizing Bidirectional Attention in early layers for global context, and Hybrid Attention in later layers for causal constraints. Finally, an MLP projection head reconstructs the output by modeling both patch- and point-level interactions.
-
Contextual Reconstruction. We uniformly sample patches from the historical positions to form , where is the patch-level perturbation ratio. The final patch is designated as the prediction target: . This mode reconstructs masked information from the historical context. The terminal target also serves as a [CLS]-like global readout for downstream tasks such as classification and anomaly detection.
-
Causal Extrapolation. We disable historical perturbation, , and select a contiguous tail of patches as prediction targets: , where . This mode learns to predict future segments under causal information constraints.
2.2 Masking Operations
2.2.1 Predictive Target Masking. For each target patch , its projected representation is replaced with a shared learnable query embedding . The query aggregates visible contextual information to reconstruct masked content or predict future segments.
2.2.2 Patch-level Masking. For each patch , we randomly apply one of three corruption operations according to predefined proportions: (i) zero replacement, which removes the patch content and encourages recovery of missing segment-level structure; (ii) mean replacement, which replaces the patch with the global scalar mean of all visible observations, providing a statistical reference while obscuring its original content; and (iii) internal shuffling, which randomly permutes the temporal order within , encouraging the model to learn local information beyond the original point ordering.
2.2.3 Point-level Masking. Point-level masking is applied only in contextual reconstruction mode, keeping the historical context unperturbed at the point level during causal extrapolation. For each patch , we uniformly sample a subset of size , where is the point-masking ratio. Each selected value , for , is replaced with either zero or a sample from . This operation provides fine-grained reconstruction supervision within otherwise visible patches.
2.3 Prefix-constrained Attention
The predictive target set defines a prefix constraint mask , where and index the query and key positions, respectively:
This mask prevents historical queries from accessing target tokens and enforces causal information flow among target tokens. In HAE, it is combined with layer-specific attention masks to determine the complete information flow, supporting both contextual reconstruction and causal extrapolation without target leakage.
3 TimeHAT
We represent a multivariate time series as , where is the sequence length and is the number of variables. TimeHAT adopts channel-independent temporal encoding, applying the same operations independently to each univariate series. This design focuses on learning temporal patterns within individual variables without relying on potentially unstable cross-variable dependencies.
For clarity, we describe the framework for a univariate series; the multivariate extension applies the same encoder independently across channels. As illustrated in Figure 3, TimeHAT adopts an encoder-only Transformer architecture inspired by masked pretraining methods such as MAE. A lightweight linear projection maps encoder representations to reconstruction targets, avoiding a separate Transformer decoder and keeping the architecture focused on temporal representation learning [4, 46].
3.1 Input Processing and Embedding
To mitigate distribution shifts across distinct time series and stabilize the optimization process, the raw input sequence x is first standardized via standard instance normalization. Following the UPPMS, the sequence is represented by a sequence of T non-overlapping patches
Each patch , whether it consists of uncorrupted historical data, stochastic perturbations, or the predictive query embedding , is linearly projected into a uniform -dimensional embedding space, yielding a sequence of tokens . Temporal order is then captured by Rotary Position Embedding (RoPE) applied to the attention queries and keys within the HA Encoder.
3.2 Hybrid Attention Encoder
To mitigate rank degeneration while preserving effective contextual information exchange, we develop a Hybrid Attention Encoder (HAE) with a progressive attention architecture. The first M layers employ prefix-constrained bidirectional attention (BiA) to integrate historical context, while the remaining layers employ directional hybrid attention to improve rank stability in deeper layers. Throughout the encoder, prefix constraints prevent historical tokens from accessing predictive targets and preserve causal information flow among target tokens.
3.2.1 Unified Formulation and Notation. Let denote the number of encoder layers, the number of input tokens, and the hidden dimension. We use an even number of attention heads, each with dimension . Let denote the input to layer . For each head , the query, key, and value matrices are computed as , , and , with projection matrices in . The attention scores are , and the head output is , where is the stage- and head-specific attention mask defined below.
Stage 1: Prefix-Constrained BiA Layers ( ). The first M layers apply bidirectional attention among non-target tokens while enforcing causal information flow for predictive targets. We use the prefix constraint mask defined in Section 2.3, setting for every attention head . This allows non-target tokens to interact bidirectionally, while each target token can access historical context and preceding target tokens, including itself, without accessing subsequent targets.
Stage 2: Directional Hybrid Attention Layers ( ). In deeper layers, we introduce complementary directional attention to mitigate rank degeneration. We evenly divide the attention heads into forward and backward subsets, and , with . The attention masks are defined by combining directional constraints with the prefix constraint:
The causal mask follows the standard lower-triangular constraint, whereas the anti-causal mask adapts to the target positions:
Thus, forward heads use causal attention throughout, while backward heads use anti-causal attention for historical queries and switch to causal attention for predictive targets. Combined with the prefix constraint, this design preserves access to historical context for all target queries while preventing information leakage from future targets. The resulting attention weight matrices are full-rank under these masking constraints, owing to their triangular or block-triangular structure and positive diagonal entries.
3.2.2 Layer Integration. For each layer, the outputs of all h attention heads are concatenated and projected to the model dimension:
where . The projected output is combined with the layer input through a residual connection, followed by the FFN and its residual connection, to obtain the layer output .
The directional hybrid attention layers use full-rank attention matrices to mitigate rank degeneration during deeper information exchange. Setting M = 0 yields an encoder composed entirely of directional hybrid-attention layers.
4 Experiments
We pre-train TimeHAT on UTSD-12G [31], a comprehensive corpus comprising 1 billion time points across diverse domains. For downstream evaluations, spanning forecasting, imputation, classification, and anomaly detection, we strictly follow the standardized protocols established by TimesNet [41].
Baselines: The baselines include CNN-based models: TimesNet [41], TimeMixer++[37]; MLP-based models: LightTS [51], DLinear [46], TimeMixer[38]; Transformer-based models: Timer-XL [28], MOMENT [13], GPT4TS[56], iTransformer [27], Autoformer [42], FEDformer [55], Non-stationary Transformer [30], ETSformer [40], PatchTST [32], TIMESBERT [49], Anomaly Transformer [44], Pyraformer [24]. Besides, Rocket [6], LSTNet [22], LSSL [15], TCN [11] and Flowformer [19] are used for classification.
4.1 Long-term Forecasting
We evaluate long-term forecasting across six benchmarks, reporting MSE and MAE averaged over . As detailed in Table 1, TimeHAT achieves competitive performance, achieves the best average performance on the reported benchmarks. Notably, it demonstrates a decisive advantage over both highly optimized forecasting architectures (e.g., TimeMixer++, iTransformer) and recent large-scale time series foundation models (e.g., MOMENT,
Learning from Points and Patches: A Pre-trained Hybrid Attention Transformer for Time Series Analysis
Table 1: Long-term forecasting task. Results are averaged over four prediction horizons: {96, 192, 336, 720}. Other models all adhere to the core research conclusions proposed in the original papers. The best results are represented in bold.
| Methods | TimeHAT | MOMENT | GPT4TS | TimesNet | PatchTST | Timer-XL | iTransformer | CrossLinear | TimeMixer | TimeMixer++ | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Metric | MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE |
| Weather | ||||||||||||||||||||
| Electricity | ||||||||||||||||||||
Table 2: Imputation task. We randomly mask the input time series at {12.5%, 25%, 37.5%, 50%}. The results are averaged from 4 different mask ratios. The best performance is shown in Bold.
| Methods | TimeHAT | GPT4TS | TimesNet | PatchTST | ETSformer | LightTS | DLinear | FEDformer | Non-Stationary | Autoformer | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Metric | MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE |
| Electricity | ||||||||||||||||||||
| Weather | ||||||||||||||||||||
GPT4TS). This superiority stems from three synergistic mechanisms: (1) Reconstructive Sampling masks the terminal token to enforce robust next-step prediction from noisy histories; (2) Extrapolative Sampling masks continuous future sequences, optimizing the global bottleneck for extended horizons; and (3) the Hybrid Attention Encoder structurally prevents depth-induced rank collapse. Together, they seamlessly translate full-rank contextual features into highly accurate long-term extrapolations.
4.2 Imputation
We evaluate the models using a fixed input length of 96, applying random masking at four distinct ratios: {12.5%, 25%, 37.5%, 50%}. As reported in Table 2, TimeHAT achieves the lowest averaged MSE and MAE across the six benchmarks, substantially outperforming several strong baselines such as GPT4TS. This reconstructive superiority validates our Reconstructive Sampling and prefix-constrained BiA layers. Preserving full-rank, unconstrained interactions within the observable context allows TimeHAT to leverage global contextual competition for precise interpolation of missing segments.
4.3 Anomaly Detection
We evaluate the capability of TimeHAT in identifying abnormal temporal patterns across five standard benchmarks: SMD, MSL, SMAP, SWaT, and PSM. Following standard protocols, the F1-score is adopted as the primary evaluation metric. As summarized in Table 3, TimeHAT consistently outperforms specialized architectures (e.g., Anomaly Transformer) and recent foundation models (e.g., TIMESBERT). This superiority stems directly from our pre-training paradigm: by simultaneously modeling high-frequency
Table 3: Anomaly detection task. We calculate the F1-score (as %) for each dataset. Bold represents the best.
| Methods | SMD | MSL | SMAP | SWaT | PSM | Average |
|---|---|---|---|---|---|---|
| TimeHAT | 86.95 | 89.46 | 76.36 | 94.64 | 97.71 | 89.02 |
| TIMESBERT | 86.04 | 88.07 | 75.69 | 93.95 | 98.27 | 88.40 |
| GPT4TS | 86.89 | 82.45 | 72.88 | 94.23 | 97.13 | 86.72 |
| TimesNet | 84.61 | 81.84 | 69.39 | 93.02 | 97.34 | 85.24 |
| Pyraformer | 83.04 | 84.86 | 71.09 | 91.78 | 82.08 | 82.57 |
| Anomaly Transformer | 85.49 | 83.31 | 71.18 | 83.10 | 79.40 | 80.50 |
| Informer | 81.65 | 84.06 | 69.92 | 81.43 | 77.10 | 78.83 |
| Reformer | 75.32 | 84.40 | 70.40 | 82.80 | 73.61 | 77.31 |
| LogTrans | 76.21 | 79.57 | 69.97 | 80.52 | 76.74 | 76.60 |
| Transformer | 79.56 | 78.68 | 69.70 | 80.37 | 76.07 | 76.88 |
micro-variations and macroscopic trends, the global representation bottleneck exhibits exceptional sensitivity to both structural deviations and localized anomalies.
4.4 Classification
To adapt the pre-trained TimeHAT for time series classification, we naturally leverage the terminal token, previously established as the global representation bottleneck, to serve as a [CLS]-equivalent semantic probe. For multivariate inputs, an additional MLP head is appended to the terminal representation, effectively fusing cross-variate dependencies and projecting the unified features into the

Figure 4: Model comparison in classification.
target class space. We comprehensively fine-tune the pre-trained model on 10 benchmark datasets from the UEA Multivariate Time Series Classification Archive, which encompass a diverse range of application scenarios. Utilizing classification accuracy as the primary evaluation metric, empirical results validate the superior generalization capability of our architecture. As illustrated in Figure 4, TimeHAT achieves the highest average classification accuracy across all 10 evaluated datasets.
4.5 Zero-shot and Few-shot Forecasting
Table 4: Zero-shot capability (MSE).
| Dataset | TimeHAT | GTM | Timer | Moirai | MOMENT |
|---|---|---|---|---|---|
| ETTh1 | 0.399 | 0.407 | 0.438 | 0.441 | 0.674 |
| ETTm1 | 0.558 | 0.593 | 0.690 | 0.562 | 0.670 |
| Weather | 0.170 | 0.172 | 0.181 | 0.195 | 0.255 |
| Electricity | 0.176 | 0.187 | 0.192 | 0.212 | 0.744 |
| Traffic | 0.447 | 0.542 | 0.458 | 0.616 | 1.293 |

Figure 5: Few-shot capability of TimeHAT compared to baselines.
To evaluate generalization and data efficiency, Table 4 details TimeHAT's zero-shot performance against GTM [16], Timer [31], Moirai [39], and MOMENT [13]. Figure 5 illustrates its few-shot capabilities: the left compares MSE across varying forecast lengths against GTM and TimesFM [5], while the right demonstrates the performance improvement over Timer as training data decreases. Overall, TimeHAT consistently outperforms all baselines, proving its robust generalization in data-scarce settings.
4.6 Pretraining Methods Analysis
4.6.1 Direct versus Recursive Forecasting. We compare direct forecasting, which predicts the entire target horizon in one pass, with recursive forecasting, which repeatedly predicts 96 steps and feeds the predictions back as input to extend the forecast. Figure 6 shows that recursive forecasting reduces MSE across all evaluated schemes on both datasets. On ETTh1, MSE decreases by , with MAE reductions of . These results support recursive forecasting for downstream evaluation. It also allows the pre-trained reconstruction head to be reused, preserving consistency between pre-training and downstream prediction without reinitializing the head for different forecasting horizons.

Figure 6: Relative error changes of recursive versus direct forecasting across pre-training schemes on ETTh1 and ETTm2. Recon: Contextual Reconstruction; Tail: Causal Extrapolation; Joint: joint objectives; Full: full UPPMS.
Table 5: Relative changes in forecasting errors under UPPMS ablations (%). Positive values indicate higher errors than the full method. LPR: w/o last-patch recovery; LPA: w/o left-padding augmentation; PO: patch-only masking; ZO: zero-only replacement; FTL: fixed tail length.
| Variant | ETTh2 | ETTm1 | ETTm2 | Weather | ||||
|---|---|---|---|---|---|---|---|---|
| MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | |
| LPR | +2.05 | +0.79 | -0.39 | +0.01 | +0.80 | -0.16 | -0.31 | -0.25 |
| LPA | +1.55 | +0.45 | +0.02 | -0.09 | -0.45 | -0.79 | +0.17 | -0.08 |
| PO | +1.79 | +0.31 | -0.37 | -0.20 | +0.40 | -0.26 | -0.70 | -0.88 |
| ZO | -1.00 | -0.46 | +0.36 | +0.27 | +1.06 | +0.27 | +0.10 | +0.07 |
| FTL | -0.92 | -0.61 | +0.40 | +0.07 | +1.52 | -1.08 | -0.07 | -0.22 |
4.6.2 Sensitivity to UPPMS Design Choices. We compare the full UPPMS with variants that remove or simplify individual masking mechanisms on four datasets. Table 5 reports relative changes in MSE and MAE averaged over three fine-tuning seeds, with positive values indicating higher errors after ablation. The results reveal dataset-dependent sensitivity to masking design. Removing last-patch recovery or restricting masking to patches increases MSE on ETTh2, while zero-only replacement degrades both metrics on three of the four datasets. Other simplifications yield mixed effects across datasets and metrics. Overall, no single simplification consistently improves both metrics across all datasets, supporting the
Learning from Points and Patches: A Pre-trained Hybrid Attention Transformer for Time Series Analysis
use of complementary masking mechanisms in UPPMS to achieve balanced performance across diverse time series.
4.6.3 Effect of Pre-training Objectives. We compare four pre-training schemes under the same six-layer encoder and fine-tuning protocol, using the final historical token to forecast 96 future steps. Each scheme is pre-trained on the training split, and results are averaged over three fine-tuning seeds. As shown in Table 6, the full method achieves the lowest MSE on all five datasets and the lowest MAE on four. The improvements are particularly notable on ETTh2, while ETTm1 shows a slight MAE advantage for Causal Extrapolation. These results demonstrate the benefits of the full UPPMS for downstream forecasting.
Table 6: Forecasting performance of different pre-training objectives. Full: full UPPMS; Tail: Causal Extrapolation; Joint: joint objectives; Random: Contextual Reconstruction.
| Dataset | Full | Tail | Joint | Random | ||||
|---|---|---|---|---|---|---|---|---|
| MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | |
| ETTh1 | 0.384 | 0.409 | 0.390 | 0.413 | 0.386 | 0.410 | 0.387 | 0.410 |
| ETTh2 | 0.300 | 0.353 | 0.321 | 0.364 | 0.307 | 0.356 | 0.308 | 0.356 |
| ETTm1 | 0.294 | 0.355 | 0.297 | 0.353 | 0.301 | 0.360 | 0.298 | 0.357 |
| ETTm2 | 0.177 | 0.266 | 0.179 | 0.269 | 0.178 | 0.268 | 0.177 | 0.268 |
| Weather | 0.152 | 0.202 | 0.153 | 0.203 | 0.154 | 0.204 | 0.153 | 0.203 |
4.6.4 Effect of Pre-training Mode Balance. We vary the probability of assigning a pre-training sample to tail recovery, , with the remaining samples assigned to random reconstruction. Here, corresponds to pure random reconstruction, whereas corresponds to pure tail recovery. Models are pre-trained and fine-tuned on the same dataset to evaluate how the balance between the two pre-training modes affects downstream forecasting. Table 7 shows that intermediate probabilities generally yield better results than pure tail recovery. Overall, combining random reconstruction and tail recovery provides a more effective balance than relying exclusively on tail recovery.
Table 7: Forecasting performance under different tail-task probabilities.
| Dataset | Metric | 0 | 0.25 | 0.40 | 0.50 | 0.75 | 1 |
|---|---|---|---|---|---|---|---|
| ETTh1 | MSE | 0.403 | 0.394 | 0.396 | 0.395 | 0.396 | 0.402 |
| MAE | 0.412 | 0.411 | 0.412 | 0.411 | 0.412 | 0.416 | |
| ETTm2 | MSE | 0.176 | 0.176 | 0.173 | 0.173 | 0.178 | 0.177 |
| MAE | 0.257 | 0.258 | 0.258 | 0.257 | 0.258 | 0.263 | |
| Weather | MSE | 0.150 | 0.150 | 0.149 | 0.149 | 0.149 | 0.152 |
| MAE | 0.195 | 0.195 | 0.193 | 0.193 | 0.192 | 0.195 |
4.7 Hybrid Attention Encoder Analysis
4.7.1 Attention Performance Across Forecast Horizons and Depth. We compare BiA, causal attention, anti-causal attention, and HA across forecast horizons and network depths. Figure 7 shows that HA achieves the lowest MSE across the evaluated horizons on ETTh1 and ETTm1. On ETTm1, it reduces MSE by 26.5%–33.3% relative to BiA, demonstrating its strong forecasting performance across different prediction lengths. Figure 8 examines the effect of increasing attention depth from one to six layers on ETTh2 and ETTm2. BiA exhibits substantial performance degradation as depth increases, whereas HA maintains more stable performance and achieves the lowest MSE with six layers on both datasets. Causal and anti-causal attention also exhibit greater depth robustness than BiA, suggesting that directional masking helps mitigate depth-related performance degradation. Notably, HA further improves as depth increases on ETTm2, while maintaining stable performance on ETTh2. Overall, HA achieves strong forecasting performance across prediction horizons and exhibits greater robustness to increasing attention depth than the other attention mechanisms.

Figure 7: Forecasting MSE of different attention mechanisms across prediction horizons on ETTh1 and ETTm1.

Figure 8: Forecasting MSE of different attention mechanisms across network depths on ETTh2 and ETTm2.
4.7.2 Effect of Attention Composition. We investigate how the number and arrangement of prefix-constrained BiA and Mix layers affect forecasting performance. Figure 9 shows that ETTh2 maintains relatively stable performance with up to two BiA layers at longer horizons, while Weather benefits from a small number of BiA layers across several horizons. Increasing the BiA proportion beyond this range can lead to performance degradation. Table 8 shows that the all-Mix configuration achieves the best results on the three ETT datasets, while mixed configurations yield slightly better results on Weather. These results demonstrate the effectiveness of Mix and show that incorporating a limited number of BiA layers can retain competitive forecasting performance, with additional benefits on some datasets.

Figure 9: Forecasting MSE with different numbers of prefix-constrained BiA layers on ETTh2 and Weather.
Table 8: Forecasting performance of different BiA-HA layer configurations. B and M denote BiA and HA, respectively.
| Config | ETTh1 | ETTm1 | ETTm2 | Weather | ||||
|---|---|---|---|---|---|---|---|---|
| MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | |
| MMMMMM | 0.507 | 0.492 | 0.437 | 0.440 | 0.278 | 0.337 | 0.242 | 0.280 |
| BBBMMM | 0.598 | 0.541 | 0.486 | 0.464 | 0.287 | 0.345 | 0.241 | 0.280 |
| BBBBBB | 0.721 | 0.596 | 0.622 | 0.527 | 0.310 | 0.364 | 0.252 | 0.292 |
| MMMBBB | 0.538 | 0.508 | 0.444 | 0.444 | 0.280 | 0.339 | 0.249 | 0.285 |
| BMBMBM | 0.683 | 0.574 | 0.442 | 0.443 | 0.286 | 0.343 | 0.241 | 0.280 |
| MBMBMB | 0.663 | 0.562 | 0.450 | 0.447 | 0.287 | 0.346 | 0.252 | 0.288 |
4.7.3 Sensitivity to Readout Strategy. We compare different attention mechanisms under two readout settings. We compare Flatten-Linear and Last-Token prediction across four forecasting horizons, and First-Token and Last-Token readouts at a prediction horizon of 96. Figure 10 shows that HA exhibits small performance differences across readout strategies in both settings. In particular, Last-Token prediction achieves results close to Flatten-Linear, indicating that the final token captures much of the predictive information available across the sequence. HA Attention also shows the smallest First- versus Last-Token MSE gap in the standard encoder. These results suggest that HA provides effective contextual representations with relatively low sensitivity to the choice of readout position.

Figure 10: Sensitivity to readout strategies across attention mechanisms.
4.7.4 Effect of the Causal-Head Ratio in Hybrid Attention. To investigate the impact of the CA proportion in HA, we adjusted the CA ratio , while keeping all other hyperparameters unchanged. Here, and 1 indicate that all heads adopt Anti-Causal and CA, respectively. As shown in Figure 11: when , the model achieves the best performance on the Exchange and ETTh2 datasets, indicating that a balanced bidirectional information flow contributes to improved forecasting accuracy.

Figure 11: Performance of Different Proportions of Causal Attention in Hybrid Attention.
4.7.5 Effect of Pre-training Attention Rules. We evaluate the impact of pre-training attention rules on downstream forecasting by comparing the default configuration with variants that remove task-specific constraints or modify information flow. Table 9 shows that the default rules achieve the lowest MSE across all four ETT datasets and the lowest MAE on three. Removing task-specific rules or disabling direction switching consistently increases forecasting errors. Allowing historical queries to attend to forecast tokens also increases MSE across all four datasets, although it slightly improves MAE on ETTm2. These results highlight the importance of task-specific attention constraints in pre-training, particularly for maintaining appropriate information flow and improving downstream forecasting performance.
Table 9: Downstream forecasting performance under different pre-training attention rules. TSR: task-specific rules; Hist→F: historical queries can attend to forecast tokens; DS: direction switching for forecast queries.
| Attention Rule | ETTh1 | ETTh2 | ETTm1 | ETTm2 | ||||
|---|---|---|---|---|---|---|---|---|
| MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | |
| Default | 0.386 | 0.410 | 0.307 | 0.355 | 0.298 | 0.357 | 0.177 | 0.268 |
| w/o TSR | 0.389 | 0.413 | 0.310 | 0.359 | 0.304 | 0.362 | 0.183 | 0.267 |
| Hist→F | 0.387 | 0.410 | 0.308 | 0.356 | 0.301 | 0.359 | 0.179 | 0.267 |
| w/o DS | 0.388 | 0.413 | 0.310 | 0.359 | 0.300 | 0.359 | 0.179 | 0.267 |
5 Conclusion
We propose TimeHAT, a general-purpose pre-training framework for time-series analysis. Its Unified Point-Patch Masking Strategy (UPPMS) integrates point-level and patch-level supervision through contextual reconstruction and causal extrapolation, enabling the model to learn complementary temporal patterns at different granularities. Its Hybrid Attention Encoder (HAE) combines prefix-constrained bidirectional attention in initial layers with directional hybrid attention in deeper layers, facilitating contextual information exchange while mitigating rank degeneration. Extensive experiments across classification, long-term forecasting, imputation, and anomaly detection demonstrate competitive performance in fine-tuning, few-shot, and zero-shot transfer settings.
Learning from Points and Patches: A Pre-trained Hybrid Attention Transformer for Time Series Analysis
References
[1] Muhammad Awais, Muzammal Naseer, Salman Khan, Rao Muhammad Anwer, Hisham Cholakkal, Mubarak Shah, Ming-Hsuan Yang, and Fahad Shahbaz Khan. 2025. Foundation models defining a new era in vision: a survey and outlook. IEEE Transactions on Pattern Analysis and Machine Intelligence (2025).
[2] Srinadh Bhojanapalli, Chulhee Yun, Ankit Singh Rawat, Sashank Reddi, and Sanjiv Kumar. 2020. Low-rank bottleneck in multi-head attention models. In International conference on machine learning. PMLR, 864–873.
[3] Ching Chang, Wei-Yao Wang, Wen-Chih Peng, and Tien-Fu Chen. 2025. Llm4ts: Aligning pre-trained llms as data-efficient time-series forecasters. ACM Transactions on Intelligent Systems and Technology 16, 3 (2025), 1–20.
[4] Si-An Chen, Chun-Liang Li, Nate Yoder, Sercan O Arik, and Tomas Pfister. 2023. Tsmixer: An all-mlp architecture for time series forecasting. arXiv preprint arXiv:2303.06053 (2023).
[5] Abhimanyu Das, Weihao Kong, Rajat Sen, and Yichen Zhou. 2024. A decoder-only foundation model for time-series forecasting. In Forty-first International Conference on Machine Learning, ICML 2024, Vienna, Austria, July 21-27, 2024 (Proceedings of Machine Learning Research, Vol. 235). 10148–10167.
[6] Angus Dempster, François Petitjean, and Geoffrey I Webb. 2020. ROCKET: exceptionally fast and accurate time series classification using random convolutional kernels. Data Mining and Knowledge Discovery 34, 5 (2020), 1454–1495.
[7] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. Bert: Pre-training of deep bidirectional transformers for language understanding. Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers) (2019), 4171–4186.
[8] Jiaxiang Dong, Haixu Wu, Haoran Zhang, Li Zhang, Jianmin Wang, and Mingsheng Long. 2023. SimMTM: A Simple Pre-Training Framework for Masked Time-Series Modeling. In Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems 2023, NeurIPS 2023, New Orleans, LA, USA, December 10 - 16, 2023.
[9] Yihe Dong, Jean-Baptiste Cordonnier, and Andreas Loukas. 2021. Attention is not all you need: Pure attention loses rank doubly exponentially with depth. In International Conference on Machine Learning. PMLR, 2793–2803.
[10] Vijay Ekambaram, Arindam Jati, Nam Nguyen, Phanwadee Sinthong, and Jayant Kalagnanam. 2023. TSMixer: Lightweight MLP-Mixer Model for Multivariate Time Series Forecasting. In Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, KDD 2023, Long Beach, CA, USA, August 6-10, 2023. ACM, 459–469.
[11] Jean-Yves Franceschi, Aymeric Dieuleveut, and Martin Jaggi. 2019. Unsupervised scalable representation learning for multivariate time series. Advances in neural information processing systems 32 (2019).
[12] Shanghua Gao, Teddy Koker, Owen Queen, Tom Hartvigsen, Theodoros Tsiligkaridis, and Marinka Zitnik. 2024. Units: A unified multi-task time series model. Advances in Neural Information Processing Systems 37 (2024), 140589–140631.
[13] Mononito Goswami, Konrad Szafer, Arjun Choudhry, Yifu Cai, Shuo Li, and Artur Dubrawski. 2024. MOMENT: A Family of Open Time-series Foundation Models. In Forty-first International Conference on Machine Learning, ICML 2024, Vienna, Austria, July 21-27, 2024 (Proceedings of Machine Learning Research, Vol. 235). 16115–16152.
[14] Nate Gruver, Marc Finzi, Shikai Qiu, and Andrew G Wilson. 2023. Large language models are zero-shot time series forecasters. Advances in Neural Information Processing Systems 36 (2023), 19622–19635.
[15] Albert Gu, Karan Goel, and Christopher Ré. 2022. Efficiently Modeling Long Sequences with Structured State Spaces. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022.
[16] Cheng He, Xu Huang, Gangwei Jiang, Zhaoyi Li, Defu Lian, Hong Xie, Enhong Chen, Xijie Liang, and Zengrong Zheng. 2026. GTM: A General Time-series Model for Enhanced Representation Learning of Time-Series data. In The Fourteenth International Conference on Learning Representations.
[17] Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollár, and Ross Girshick. 2022. Masked autoencoders are scalable vision learners. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition. 16000–16009.
[18] Qihe Huang, Zhengyang Zhou, Kuo Yang, and Yang Wang. 2025. Exploiting Language Power for Time Series Forecasting with Exogenous Variables. In Proceedings of the ACM on Web Conference 2025. 4043–4052.
[19] Zhaoyang Huang, Xiaoyu Shi, Chao Zhang, Qiang Wang, Ka Chun Cheung, Hongwei Qin, Jifeng Dai, and Hongsheng Li. 2022. Flowformer: A transformer architecture for optical flow. In European Conference on Computer Vision. Springer, 668–685.
[20] Ming Jin, Shiyu Wang, Lintao Ma, Zhixuan Chu, James Zhang, Xiaoming Shi, Pin-Yu Chen, Yuxuan Liang, Yuan-fang Li, Shirui Pan, et al. 2024. Time-LLM: Time Series Forecasting by Reprogramming Large Language Models. In International Conference on Learning Representations.
[21] Ming Jin, Qingsong Wen, Yuxuan Liang, Chaoli Zhang, Siqiao Xue, Xue Wang, James Zhang, Yi Wang, Haifeng Chen, Xiaoli Li, et al. 2023. Large models for time series and spatio-temporal data: A survey and outlook. arXiv preprint arXiv:2310.10196 (2023).
[22] Guokun Lai, Wei-Cheng Chang, Yiming Yang, and Hanxiao Liu. 2018. Modeling long-and short-term temporal patterns with deep neural networks. In The 41st international ACM SIGIR conference on research & development in information retrieval. 95–104.
[23] Chenghao Liu, Taha Aksu, Juncheng Liu, Xu Liu, Hanshu Yan, Quang Pham, Silvio Savarese, Doyen Sahoo, Caiming Xiong, and Junnan Li. 2025. Moirai 2.0: When less is more for time series forecasting. arXiv preprint arXiv:2511.11698 (2025).
[24] Shizhan Liu, Hang Yu, Cong Liao, Jianguo Li, Weiyao Lin, Alex X Liu, and Schahram Dustdar. 2021. Pyraformer: Low-complexity pyramidal attention for long-range time series modeling and forecasting. In International conference on learning representations.
[25] Xu Liu, Junfeng Hu, Yuan Li, Shizhe Diao, Yuxuan Liang, Bryan Hooi, and Roger Zimmermann. 2024. Unitime: A language-empowered unified model for cross-domain time series forecasting. In Proceedings of the ACM Web Conference 2024. 4095–4106.
[26] Xin Liu, Daniel McDuff, Geza Kovacs, Isaac Galatzer-Levy, Jacob Sunshine, Jiening Zhan, Ming-Zher Poh, Shun Liao, Paolo Di Achille, and Shwetak Patel. 2023. Large Language Models are Few-Shot Health Learners. arXiv preprint arXiv:2305.15525 (2023).
[27] Yong Liu, Tengge Hu, Haoran Zhang, Haixu Wu, Shiyu Wang, Lintao Ma, and Mingsheng Long. 2024. iTransformer: Inverted Transformers Are Effective for Time Series Forecasting. In The Twelfth International Conference on Learning Representations, ICLR 2024, Vienna, Austria, May 7-11, 2024.
[28] Yong Liu, Guo Qin, Xiangdong Huang, Jianmin Wang, and Mingsheng Long. 2025. Timer-XL: Long-Context Transformers for Unified Time Series Forecasting. In The Thirteenth International Conference on Learning Representations.
[29] Yong Liu, Guo Qin, Zhiyuan Shi, Zhi Chen, Caiyin Yang, Xiangdong Huang, Jianmin Wang, and Mingsheng Long. 2025. Sundial: A Family of Highly Capable Time Series Foundation Models. In Forty-second International Conference on Machine Learning.
[30] Yong Liu, Haixu Wu, Jianmin Wang, and Mingsheng Long. 2022. Non-stationary transformers: Rethinking the stationarity in time series forecasting. arXiv preprint arXiv:2205.14415 (2022).
[31] Yong Liu, Haoran Zhang, Chenyu Li, Xiangdong Huang, Jianmin Wang, and Mingsheng Long. 2024. Timer: generative pre-trained transformers are large time series models. In Proceedings of the 41st International Conference on Machine Learning. 32369–32399.
[32] Yuqi Nie, Nam H. Nguyen, Phanwadee Sinthong, and Jayant Kalagnanam. 2023. A Time Series is Worth 64 Words: Long-term Forecasting with Transformers. In The Eleventh International Conference on Learning Representations, ICLR 2023, Kigali, Rwanda, May 1-5, 2023.
[33] Xiaoming Shi, Shiyu Wang, Yuqi Nie, Dianqi Li, Zhou Ye, Qingsong Wen, and Ming Jin. 2025. Time-MoE: Billion-Scale Time Series Foundation Models with Mixture of Experts. In The Thirteenth International Conference on Learning Representations, ICLR 2025, Singapore, April 24-28, 2025.
[34] Chenxi Sun, Hongyan Li, Yaliang Li, and Shenda Hong. 2024. TEST: Text Prototype Aligned Embedding to Activate LLM's Ability for Time Series. In The Twelfth International Conference on Learning Representations, ICLR 2024, Vienna, Austria, May 7-11, 2024.
[35] Peiwang Tang and Xianchao Zhang. 2022. MTSMAE: Masked Autoencoders for Multivariate Time-Series Forecasting. In 2022 IEEE 34th International Conference on Tools with Artificial Intelligence (ICTAI). IEEE, 982–989.
[36] Hua Wang, Jinghao Lu, and Fan Zhang. 2026. Eeo-tfv: Escape-explore optimizer for web-scale time-series forecasting and vision analysis. In Proceedings of the ACM Web Conference 2026. 7271–7282.
[37] Shiyu Wang, Jiawei Li, Xiaoming Shi, Zhou Ye, Baichuan Mo, Wenzé Lin, Ju Shengtong, Zhixuan Chu, and Ming Jin. 2025. TimeMixer++: A General Time Series Pattern Machine for Universal Predictive Analysis. In ICLR 2025: The Thirteenth International Conference on Learning Representations. International Conference on Learning Representations.
[38] Shiyu Wang, Haixu Wu, Xiaoming Shi, Tengge Hu, Huakun Luo, Lintao Ma, James Y. Zhang, and Jun Zhou. 2024. TimeMixer: Decomposable Multiscale Mixing for Time Series Forecasting. In The Twelfth International Conference on Learning Representations, ICLR 2024, Vienna, Austria, May 7-11, 2024.
[39] Gerald Woo, Chenghao Liu, Akshat Kumar, Caiming Xiong, Silvio Savarese, and Doyen Sahoo. 2024. Unified Training of Universal Time Series Forecasting Transformers. Proceedings of Machine Learning Research 235 (2024), 53140–53164.
[40] Gerald Woo, Chenghao Liu, Doyen Sahoo, Akshat Kumar, and Steven Hoi. 2022. Etsformer: Exponential smoothing transformers for time-series forecasting. arXiv preprint arXiv:2202.01381 (2022).
[41] Haixu Wu, Tengge Hu, Yong Liu, Hang Zhou, Jianmin Wang, and Mingsheng Long. 2023. TimesNet: Temporal 2D-Variation Modeling for General Time Series Analysis. In The Eleventh International Conference on Learning Representations,
ICLR 2023, Kigali, Rwanda, May 1-5, 2023.
[42] Haixu Wu, Jiehui Xu, Jianmin Wang, and Mingsheng Long. 2021. Autoformer: Decomposition transformers with auto-correlation for long-term series forecasting. Advances in Neural Information Processing Systems 34 (2021), 22419–22430.
[43] Yongzheng Xie, Hongyu Zhang, and Muhammad Ali Babar. 2025. Multivariate Time Series Anomaly Detection by Capturing Coarse-Grained Intra-and Inter-Variate Dependencies. In Proceedings of the ACM on Web Conference 2025. 697–705.
[44] Jiehui Xu, Haixu Wu, Jianmin Wang, and Mingsheng Long. 2022. Anomaly Transformer: Time Series Anomaly Detection with Association Discrepancy. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022.
[45] Hao Xue and Flora D Salim. 2023. Promptcast: A new prompt-based learning paradigm for time series forecasting. IEEE Transactions on Knowledge and Data Engineering (2023).
[46] Ailing Zeng, Muxi Chen, Lei Zhang, and Qiang Xu. 2023. Are transformers effective for time series forecasting?. In Proceedings of the AAAI conference on artificial intelligence, Vol. 37. 11121–11128.
[47] Boning Zhang, Haishuai Wang, Zehong Hu, Jiajun Wang, Hongyi Zhang, and Jia Jia. 2026. Re-Diffusion: Modeling Latent Residuals with Diffusion for Time-Series Forecasting. In Proceedings of the ACM Web Conference 2026. 7390–7400.
[48] Fan Zhang, Shiming Fan, and Hua Wang. 2026. Time-tk: A multi-offset temporal interaction framework combining transformer and kolmogorov-arnold networks for time series forecasting. In Proceedings of the ACM Web Conference 2026. 7495–7506.
[49] Haoran Zhang, Yong Liu, Yunzhong Qiu, Haixuan Liu, Zhongyi Pei, Jianmin Wang, and Mingsheng Long. 2025. Timesbert: A bert-style foundation model for time series understanding. In Proceedings of the 33rd ACM International Conference on Multimedia. 10975–10983.
[50] Jianqi Zhang, Jingyao Wang, Wenwen Qiang, Fanjiang Xu, and Changwen Zheng. 2026. Enhancing large language models for time-series forecasting via vector-injected in-context learning. In Proceedings of the ACM Web Conference 2026. 7211–7222.
[51] Tianping Zhang, Yizhuo Zhang, Wei Cao, Jiang Bian, Xiaohan Yi, Shun Zheng, and Jian Li. 2022. Less is more: Fast multivariate time series forecasting with light sampling-oriented mlp structures. arXiv preprint arXiv:2207.01186 (2022).
[52] Xu Zhang, Peng Wang, Yichen Li, and Wei Wang. 2026. Amortized predictability-aware training framework for time series forecasting and classification. In Proceedings of the ACM Web Conference 2026. 5624–5635.
[53] Xu Zhang, Qitong Wang, Peng Wang, and Wei Wang. 2026. Semixer: Semantics enhanced mlp-mixer for multiscale mixing and long-term time series forecasting. In Proceedings of the ACM Web Conference 2026. 5636–5647.
[54] Wayne Xin Zhao, Kun Zhou, Junyi Li, Tianyi Tang, Xiaolei Wang, Yupeng Hou, Yingqian Min, Beichen Zhang, Junjie Zhang, Zican Dong, et al. 2023. A survey of large language models. arXiv preprint arXiv:2303.18223 (2023).
[55] Tian Zhou, Ziqing Ma, Qingsong Wen, Xue Wang, Liang Sun, and Rong Jin. 2022. Fedformer: Frequency enhanced decomposed transformer for long-term series forecasting. In International Conference on Machine Learning. PMLR, 27268–27286.
[56] Tian Zhou, Peisong Niu, Liang Sun, Rong Jin, et al. 2023. One fits all: Power general time series analysis by pretrained lm. Advances in neural information processing systems 36 (2023), 43322–43355.
A Related Work
Large Language Models in Time Series: Recent advances have explored applying large models like Large Language Models (LLMs) to TSA due to their ability to capture long-term dependencies and handle high-dimensional data [1, 54]. Frameworks such as PromptCast [45], GPT4TS [56], TIME-LLM [20], and LLM4TS [3] adapt language models for time series forecasting by leveraging numerical-to-text transformations, patching mechanisms, and embedding techniques. TEST [34] enhances time series tokenization and embedding through contrastive learning, while UniTime [25] leverages domain instructions, modality alignment, and masking strategies to achieve efficient generalization and transfer in cross-domain time series forecasting. Despite their promising results, most of these models focus primarily on forecasting tasks, while broader applications of LLMs in TSA, such as anomaly detection and classification, remain underexplored.
Pre-trining Models in Time Series: Beyond LLMs, time series-specific pre-training frameworks have gained attention for their potential in learning foundational representations [21]. This trend is exemplified by foundation models released alongside large-scale datasets, such as MOMENT[13], Timer[31], TIME-MOE [33], and Sundial [29], with subsequent works expanding along dimensions like scale (Moirai [23, 39]), and task unification (UNITS [12]). Other methods, such as TimeMixer++ [37], MTSMAE [35], SimMTM [8], PatchTST [32], and TSMixer [10], focus on tasks like forecasting, reconstruction, and capturing spatio-temporal patterns through advanced techniques like masking, patch embedding, and lightweight architectures. These approaches demonstrate strong potential in TSA, addressing challenges such as memory efficiency, long-term forecasting, and inter-channel correlations.
B Pre-Training and Downstream Training Settings
B.1 Dataset
Timer has curated the Unified Time Series Dataset (UTSD) [31], which encompasses seven domains and includes up to 1 billion time points, organized in a hierarchical four-volume structure to facilitate research and pre-training of large models in the time series field. The Unified Time Series Dataset (UTSD) is meticulously compiled from a combination of publicly accessible online data repositories and empirical data derived from real-world machine operations. All datasets are classified into seven distinct domains by their sources: Energy, Environment, Health, Internet of Things (IoT), Nature, Transportation, and Web, with diverse sampling frequencies. UTSD is structured with hierarchical capacities, namely UTSD-1G, UTSD-2G, UTSD-4G, and UTSD-12G, where each smaller dataset is a subset of the larger ones. A larger subset means greater data difficulty and diversity. For our pre-training tasks, we directly utilized data from the UTSD-12G.
Table 10: Long-term forecasting dataset descriptions. The Dataset Splitting is organized in (Train,Validation,Test).
| Dataset | Dim | Input Length | Prediction Length | Time Points | Dataset Splitting | Frequency |
|---|---|---|---|---|---|---|
| ETTm1 ETTm2 | 7 | 336 | {96,192,336,720} | 69,680 | 6:2:2 | 15 mins |
| ETTh1 ETTh2 | 7 | 336 | {96,192,336,720} | 17,420 | 6:2:2 | Hourly |
| Electricity | 321 | 336 | {96,192,336,720} | 26,304 | 7:1:2 | Hourly |
| Traffic | 862 | 336 | {96,192,336,720} | 17,544 | 7:1:2 | Hourly |
| Weather | 21 | 336 | {96,192,336,720} | 52,696 | 7:1:2 | 10 mins |
| Exchange | 8 | 336 | {96,192,336,720} | 7,588 | 7:1:2 | Daily |
Timer has curated the Unified Time Series Dataset (UTSD) [31], which encompasses seven domains and includes up to 1 billion time points, organized in a hierarchical four-volume structure to facilitate research and pre-training of large models in the time series field. The Unified Time Series Dataset (UTSD) is meticulously compiled from a combination of publicly accessible online data
Learning from Points and Patches: A Pre-trained Hybrid Attention Transformer for Time Series Analysis
Table 11: Other dataset descriptions. The dataset size is organized in (Train,Validation,Test).
| Tasks | Dataset | Dim | Series Length | Dataset Size |
|---|---|---|---|---|
| Imputation | ETTm1,ETTm2 (Electricity) | 7 | 96 | (34465,11521,11521) |
| ETTh1,ETTh2 (Electricity) | 7 | 96 | (8545,2881,2881) | |
| Electricity | 321 | 96 | (18317,2633,5261) | |
| Weather | 21 | 96 | (36792,5271,10540) | |
| Classification (UEA) | EthanolConcentration (Alcohol Industry) | 3 | 1751 | (261,0,263) |
| FaceDetection (Face) | 144 | 62 | (5890,0,3524) | |
| Handwriting | 3 | 152 | (150,0.850) | |
| Heartbeat (Heart Beat) | 61 | 405 | (204,0,205) | |
| JapaneseVowels (Voice) | 12 | 29 | (270,0,370) | |
| PEMS-SF (Transportation) | 963 | 144 | (267,0,173) | |
| SelfRegulationSCP1 (Health) | 6 | 896 | (268,0,293) | |
| SelfRegulationSCP2 (Health) | 7 | 1152 | (200,0,180) | |
| SpokenArabicDigits (Voice) | 13 | 93 | (6599,0,2199) | |
| UWaveGestureLibrary (Gesture) | 3 | 315 | (120,0,320) | |
| Anomaly Detection | SMD (Server Machine) | 38 | 100 | (566724,141681,708420) |
| MSL (Spacecraft) | 55 | 100 | (44653,11664,73729) | |
| SMAP (Spacecraft) | 25 | 100 | (108146,27037,427617) | |
| SWaT (Infrastructure) | 51 | 100 | (396000,99000,449919) | |
| PSM (Server Machine) | 25 | 100 | (105984,26497,87841) |
repositories and empirical data derived from real-world machine operations. All datasets are classified into seven distinct domains by their sources: Energy, Environment, Health, Internet of Things (IoT), Nature, Transportation, and Web, with diverse sampling frequencies. UTSD is structured with hierarchical capacities, namely UTSD-1G, UTSD-2G, UTSD-4G, and UTSD-12G, where each smaller dataset is a subset of the larger ones. A larger subset means greater data difficulty and diversity. For our pre-training tasks, we directly utilized data from the UTSD-12G.
The datasets for downstream tasks include multiple types of test datasets, mainly covering long-term time series forecasting, imputation, classification, and anomaly detection tasks. The datasets for long-term time series forecasting include Electricity, Weather, Traffic, and the ETT family (comprising ETTh1, ETTh2, ETTm1, and ETTm2), which are utilized to evaluate long-term performance in scenarios such as energy consumption, weather forecasting, and traffic flow analysis. The imputation task datasets include Electricity, Weather, and the ETT family, focusing on solving missing data issues. The time series classification datasets are sourced from the UEA database and encompass tasks from various fields, such as EthanolConcentration (alcohol industry), Heartbeat (health monitoring), JapaneseVowels (speech recognition), PEMS-SF (traffic and transportation), and more. Anomaly detection tasks are based on five standard time series anomaly detection datasets, including SMD (server machines), MSL and SMAP (spacecraft), SWaT (infrastructure systems), and PSM (server machines). These datasets span diverse application domains, including energy, transportation, healthcare, industrial control, and space science, providing comprehensive test scenarios for various tasks.
B.2 Pre-training Configuration
TimeHAT is instantiated with a total of attention layers, comprising prefix-constrained BiA layers at the bottom and 5 decoupled HA layers at the top stages. We set the hidden dimension , feed-forward dimension , and the number of attention heads . For temporal tokenization, the input context length is fixed at with a patch size of . The resulting model contains approximately 67M trainable parameters.
We pre-train the model on the UTSD-12G dataset using UPPMS, which Reconstructive Sampling objective with a masking ratio. The optimization is performed using AdamW with a weight decay of 0.01. Given the extreme sparsity of the reconstructive objective and the massive scale of the pre-training corpus, we employ a large global batch size of 10,240 to stabilize the gradient variance. Correspondingly, rather than relying on computationally expensive empirical grid search, we determine the peak learning rate via the Square Root Scaling Rule tailored for adaptive optimizers. Adopting the widely accepted empirical baseline of for a standard batch size of , the scaled learning rate is computed as:
While the scaling rule provides a theoretical baseline, masked reconstructive objectives typically suffer from gradient sparsity during the early stages. To compensate for this sparsity and the rapid descent nature of the cosine schedule, we empirically anchor the final peak learning rate slightly higher at . To prevent early gradient shock under this elevated learning rate, we apply a strict linear warmup of 4,000 steps, which eventually decays to a minimum of of the peak.
The maximum training duration is set to 20 epochs. Given the extreme scale of the pre-training corpus, we adopt a high-frequency, step-based evaluation strategy rather than epoch-based validation. Specifically, the validation loss is evaluated every 5,000 steps. Training is halted via an early stopping mechanism if the validation loss does not decrease for 10 consecutive evaluations. All pre-training runs are executed using Distributed Data Parallel (DDP) across four NVIDIA RTX 5090 (32GB) GPUs.
Table 12: Forecasting performance with embedding and encoder transfer. denotes the embedding patch size. Scratch: training from scratch; Patch: patch-level masking; Point: point-level masking.
| Dataset | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Scratch | Patch | Point | Scratch | Patch | Point | |||||||
| MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | |
| ETTh1 | 0.465 | 0.466 | 0.465 | 0.468 | 0.466 | 0.469 | 0.458 | 0.453 | 0.447 | 0.445 | 0.444 | 0.444 |
| ETTh2 | 0.406 | 0.422 | 0.405 | 0.424 | 0.401 | 0.422 | 0.386 | 0.410 | 0.385 | 0.410 | 0.387 | 0.410 |
| ETTm1 | 0.403 | 0.415 | 0.408 | 0.419 | 0.403 | 0.417 | 0.393 | 0.406 | 0.383 | 0.402 | 0.383 | 0.401 |
| ETTm2 | 0.294 | 0.339 | 0.306 | 0.349 | 0.298 | 0.343 | 0.290 | 0.336 | 0.291 | 0.337 | 0.289 | 0.334 |
| Weather | 0.257 | 0.281 | 0.255 | 0.281 | 0.255 | 0.280 | 0.255 | 0.277 | 0.253 | 0.276 | 0.254 | 0.276 |
Table 13: Forecasting performance with encoder-only transfer. All downstream models use a newly initialized embedding and prediction head. denotes the embedding patch size. Patch and Point denote patch-level and point-level masking, respectively.
| Dataset | Patch | Patch | Point | Point | ||||
|---|---|---|---|---|---|---|---|---|
| MSE | MAE | MSE | MAE | MSE | MAE | MSE | MAE | |
| ETTh1 | 0.450 | 0.449 | 0.448 | 0.445 | 0.456 | 0.452 | 0.447 | 0.445 |
| ETTh2 | 0.389 | 0.411 | 0.385 | 0.410 | 0.387 | 0.411 | 0.387 | 0.410 |
| ETTm1 | 0.392 | 0.405 | 0.386 | 0.403 | 0.393 | 0.407 | 0.387 | 0.404 |
| ETTm2 | 0.288 | 0.334 | 0.288 | 0.333 | 0.288 | 0.334 | 0.286 | 0.332 |
| Weather | 0.254 | 0.277 | 0.254 | 0.277 | 0.254 | 0.277 | 0.253 | 0.276 |
B.3 Downstream Tasks
Unlike conventional paradigms that discard the pre-training head, we retain both the pre-trained TimeHAT backbone and its projection head for sequence-to-sequence downstream tasks (i.e., forecasting, imputation, and anomaly detection). This unified architecture maximizes the direct transferability of the learned reconstructive representations. An additional classification head is appended exclusively for the classification task.
To ensure stable adaptation and mitigate the catastrophic forgetting of pre-trained representations, we employ a differential learning rate strategy during fine-tuning. Specifically, the optimizer is re-initialized with a conservative peak learning rate for the pre-trained backbone (), while a relatively higher learning rate is allocated to the task-specific projection and classification heads (). This optimization is paired with a short linear warmup comprising 5% of the total steps. The fine-tuning process spans a maximum of 20 epochs, governed by an early stopping mechanism with a patience of 5 epochs.
C Effect of Masking Granularity and Embedding Size
We compare point-level and patch-level masking with embedding patch sizes and under two transfer protocols: transferring both the embedding and encoder, and transferring only the encoder to a common downstream embedding. Results are averaged over four prediction horizons and three fine-tuning seeds.
Tables 12 and 13 show that patch embeddings () generally yield better forecasting performance than point-wise embeddings (), particularly under encoder-only transfer. Notably, point-level masking remains effective with , achieving the best results on several datasets. These findings indicate that fine-grained masking supervision can be combined with patch-based representations, without requiring point-wise tokenization.

Figure 12: Qualitative reconstruction examples under block and point masking on five datasets. Each row shows the same selected sequence and vertical scale.
We compare block-level and point-level masking on five datasets using matched masking ratios. Figure 12 shows that both approaches recover the major temporal patterns, but block masking often underestimates peak and trough amplitudes and misses fine-grained variations, particularly on ETTh1 and ETTm1. Point masking generally produces reconstructions closer to the ground truth, with clearer preservation of local details.