Manuscript Offprint

arXiv:2610.28997

Rethinking Time Series Tokenization from a Frequency Perspective

Zelong Tian, Ming Jin, Bo Du, Shirui Pan

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Tokenization that partitions time series into subsequences has become a foundational paradigm in modern time series modeling. However, we find that current tokenization strategies inherently introduce spectral distortions, forcing the learned representations to diverge from the true underlying patterns such as trend, periodicity, and seasonality, thereby impairing model performance. Through theoretical analysis from a frequency perspective, we derive the boundary conditions under which such distortions occur. To overcome this distortion, we propose TimeFT, a nearly distortion-free frequency-based tokenizer for time series data. TimeFT obtains tokens through frequency-domain partitioning, frequency shifting, and Nyquist sampling. The method is parameter-free, incurs negligible computational complexity, and can serve as a drop-in replacement for existing tokenizers. Our extensive experiments on diverse tasks such as forecasting, classification, and anomaly detection demonstrate that TimeFT consistently and significantly improves performance. The code has been made available at https://anonymous.4open.science/r/TimeFT-75E3/.

1 Introduction

Models [1] such as PatchTST [2], PatchMLP [3] and PhaseFormer [4] have established a tokenization paradigm [5, 6] for time series data by partitioning the raw sequence into a set of non-overlapping (or overlapping) segments:

Zpatch i:=X[∑j=1i−1Sj:∑j=1i−1Sj+Li]i∈{1,2,…,I}(1)\begin{aligned}\mathbf{Z}_{\mathrm{patch}\,i}:=&X\left[\sum_{j=1}^{i-1}S_{j}:\sum_{j=1}^{i-1}S_{j}+L_{i}\right]\\&i\in\{1,2,\ldots,I\}\end{aligned} \tag{1} Zphase i:=[X[j] for j=i,i+S,…]j≤N−1, i∈{0,1,2,…,I}(2)\begin{aligned}\mathbf{Z}_{\mathrm{phase}\,i}:=&\left[X[j]\ \mathrm{for}\ j=i,i+S,\ldots\right]\\&j\leq N-1,\ i\in\{0,1,2,\ldots,I\}\end{aligned} \tag{2}

Figure

Figure

Figure 1: Left: The processes of patch and phase tokenization in the time domain. Right: Spectral shifting moves the frequency spectrum, thereby preventing high frequency components from aliasing into low frequencies.

Preprint.

Figure

(a) Patch Token in Time Domain (Left), in Frequency Domain (Middle) and Reconstruction vs Origin (Right).

(b) Phase Token in Time Domain (Left), in Frequency Domain (Middle) and Reconstruction vs Origin (Right).

(c) TimeFT in Time Domain (Left), in Frequency Domain (Middle) and Reconstruction vs Origin (Right).

Figure 2: The comparison of tokenization methods across the time domain, frequency domain and reconstruction versus origin. (a) Patch tokens lead to a completely different frequency spectrum and cause the loss of all information outside the rectangular window. (b) Phase tokens cause frequency components above the Nyquist frequency to completely alias into the low frequencies, thereby exhibiting erroneous patterns. (c) Our TimeFT effectively solves the above issues and achieves almost distortion-free tokenization. The details of reconstruction methods are provided in the Appendix B.

where Zpatch iZ_{patch\ i} is the patch token [2] and Zphase iZ_{phase\ i} is the phase token [4], which represent two main classes of tokenization methods. X denotes the original input sequence of length N, LiL_i is the length of each patch, SiS_i or S is the stride, and I is the number of tokens. As shown in Figure 1, the patch tokenizer can be seen as segmenting the sequence in the time domain, and the phase tokenizer can be regarded as downsampling in the time domain. Extensive existing work shows that the tokenization paradigm has become a fundamental component of modern time series modeling (§5). However, the frequency domain effects of tokenization remain largely unexplored.

For patch tokens, rectangular window truncation in the time domain leads to issues such as information loss and spectral leakage in the frequency domain ( §A.1§A.1). For phase tokens, downsampling in the time domain leads to frequency aliasing in the frequency domain ( §A.2§A.2). These distortions in tokenization cause the patterns of tokens, such as trend, periodicity, and seasonality, to diverge significantly from those of the original time series, thereby leading the model to learn erroneous patterns and degrading model performance. The fundamental reason for this phenomenon lies in distortions caused by tokenization methods and the constraints that the sequence length imposes on the frequency. Towards this, we propose TimeFT, a nearly distortion-free frequency-based tokenizer for time series data in a model-agnostic and parameter-free manner.

ZTimeFT:=Reshape(NyquistSamplingS(FR−1(Shift(BlockK(FR(X))))))(3)\mathbf{Z}_{\mathrm{TimeFT}}:=\mathrm{Reshape}\left(\mathrm{Nyquist}\mathrm{Sampling}_{S}\left(\mathcal{F}_{\mathbb{R}}^{-1}\big(\mathrm{Shift}\left(\mathrm{Block}_{K}\left(\mathcal{F}_{\mathbb{R}}(X)\right)\right)\big)\right)\right) \tag{3}

where ZTimeFT\mathbf{Z}_{\text{TimeFT}} is the set of TimeFT tokens, SS is the sampling stride, and KK is the number of blocks. BlockK(⋅)\text{Block}_K(\cdot), Shift(⋅)\text{Shift}(\cdot), Nyquist SamplingS(⋅)\text{Nyquist Sampling}_S(\cdot) and Reshape(⋅)\text{Reshape}(\cdot) denote the operations 7, 9, 12 and 13 of TimeFT, which split the time series spectrum into multiple sub-bands that satisfy the alias-free condition, shift all of them to baseband, and then apply Nyquist sampling. FR\mathcal{F}_{\mathbb{R}} and FR−1\mathcal{F}_{\mathbb{R}}^{-1} denote the real-valued fast Fourier transform (RFFT) and its inverse transform. The comparison of three tokenization methods is illustrated in Figure 2.

As mentioned, TimeFT is a parameter-free method that can serve as a fundamental time series tokenization module for a wide range of models, and its time complexity is negligible ( §4.3§4.3). We prove that our method solves the above data distortion issue ( §A.4§A.4). As a result, TimeFT can consistently and effectively improve model performance in various tasks ( §4.2§4.2). The main contributions of this work are as follows.

• We find that the existing time series tokenization paradigm causes distortions in the frequency domain, which leads the data to exhibit erroneous temporal patterns. We then derive the transformation relationships in the time domain and the frequency domain during tokenization and further establish the boundary conditions of such distortions.

• We propose TimeFT based on the above boundary conditions, which generates tokens while preserving frequency information by employing frequency-domain partitioning, spectrum shifting, and Nyquist sampling. Our method effectively solves the frequency distortion issue during tokenization.

• Extensive experiments demonstrate that TimeFT achieves state-of-the-art performance compared to existing tokenization methods in forecasting, classification, and anomaly detection tasks. As a plug-in module, TimeFT results in an improvement of nearly 10% in many cases, and the time cost is consistently less than 1.4% of the training time per epoch.

References (51)