Introduction: The Rigidity of Fixed-Length Patching
Transformers have significantly advanced time series analysis, primarily by addressing the computational inefficiency of point-wise attention through "patching"—grouping adjacent time points into segments. However, standard patching methods, such as those used in PatchTST, are temporally agnostic. They slice data into fixed lengths regardless of the underlying signal dynamics.
This rigid approach introduces two critical issues:
- Fractured Coherence: Natural transitions or regime shifts (e.g., sudden spikes or trend reversals) are often split across patches, destroying local context.
- Train-Inference Mismatch: Fixed grids cause identical patterns to appear at different positions within a patch across samples, leading to inconsistent representations.
Methodology: Entropy-Guided Dynamic Patching
To overcome these limitations, we introduce EntroPE (Entropy-Guided Dynamic Patch Encoder). EntroPE allows time series to "breathe" by dynamically adjusting patch boundaries based on information-theoretic principles. The framework operates in three distinct phases:
1. Entropy Model Pre-training
A lightweight causal transformer is pre-trained on quantized versions of the time series. Its objective is to predict the next token, effectively learning the underlying probability distribution of the data.
2. Entropy-based Dynamic Patcher (EDP)
During inference, the frozen entropy model calculates the conditional entropy at each time step. High entropy indicates predictive uncertainty, typically corresponding to regime shifts or natural transition points. EntroPE places patch boundaries at these entropy peaks, ensuring that each patch captures a semantically coherent segment of the signal.
3. Adaptive Patch Encoder (APE) and Fusion Decoder (FD)
Because dynamic patching results in variable-length segments, a specialized encoder is required. The Adaptive Patch Encoder (APE) uses max-pooling to project variable-length patches into fixed-size embeddings. It then employs cross-attention, allowing the embedding to refine itself by attending back to the raw time points within its boundaries. Finally, a Fusion Decoder (FD) integrates these embeddings to produce the final forecast.
Core Innovations
- Uncertainty as a Structural Guide: EntroPE leverages predictive uncertainty (entropy) as a feature to identify meaningful data boundaries. Points of maximum confusion for the model are treated as the most informative locations for patch transitions.
- Precision-Preserving Quantization: Unlike models that perform forecasting in a discrete space, EntroPE uses quantization solely for boundary detection. The actual forecasting is performed on continuous values, maintaining high-precision information.
- Information-Theoretic Adaptability: The model automatically scales patch lengths based on data volatility—longer patches for stable regions and shorter, denser patches for volatile ones.
Experimental Setup and Results
EntroPE was evaluated across standard benchmarks for long-term forecasting (ETT, Weather, Electricity), classification (UEA archive), and anomaly detection (SMD, MSL, SWaT).
Performance Evaluation
- Forecasting Accuracy: EntroPE achieved a 10% average improvement over PatchTST. Notably, it demonstrated a 20% reduction in Mean Squared Error (MSE) on the ETTh1 dataset.
- Parameter Efficiency: Despite its high performance, EntroPE is remarkably efficient. It matches the accuracy of large-scale foundation models (e.g., LangTime) while utilizing 500–1000x fewer parameters (ranging from 100k to 1M).
- Versatility: The model set new state-of-the-art or competitive benchmarks in classification (77.13% avg accuracy) and anomaly detection (87.72% avg F1 score).
- Modularity: The dynamic patcher is "plug-and-play," providing immediate performance gains when integrated into existing architectures like PatchTST.
Conclusion and Future Directions
EntroPE demonstrates that dynamic, entropy-guided patching significantly improves the representation of temporal patterns in time series transformers. While the current iteration requires a small pre-training phase for the entropy model and introduces a threshold hyperparameter, its gains in accuracy and efficiency are substantial. Future research will explore cross-channel entropy to detect simultaneous shifts across multivariate variables, further refining the model's ability to capture complex system dynamics.
Summary updated