Papers › A Time Series is Worth 64 Words: Long-term Forecasting with Transformers

A Time Series is Worth 64 Words: Long-term Forecasting with Transformers

27 Nov 2022arXiv:2211.14730archive 2025-07-28

Yuqi Nie, Nam H. Nguyen, Phanwadee Sinthong, Jayant Kalagnanam

We propose an efficient design of Transformer-based models for multivariate time series forecasting and self-supervised representation learning. It is based on two key components: (i) segmentation of time series into subseries-level patches which are served as input tokens to Transformer; (ii) channel-independence where each channel contains a single univariate time series that shares the same embedding and Transformer weights across all the series. Patching design naturally has three-fold benefit: local semantic information is retained in the embedding; computation and memory usage of the attention maps are quadratically reduced given the same look-back window; and the model can attend longer history. Our channel-independent patch time series Transformer (PatchTST) can improve the long-term forecasting accuracy significantly when compared with that of SOTA Transformer-based models. We also apply our model to self-supervised pre-training tasks and attain excellent fine-tuning performance, which outperforms supervised training on large datasets. Transferring of masked pre-trained representation on one dataset to others also produces SOTA forecasting accuracy. Code is available at: https://github.com/yuqinie98/PatchTST.

PaperPDFCodeCode Syntology ranMethod as code

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 30 code samples harvested from 6 repositories linked to this paper: 17 ran (of which 2 constructed an object rather than computing a result; 16 with no instrument failure: 0 honoured, 0 violated, 16 with no contract checked; 1 where Syntology's instrument failed) · 13 unverified. Where Syntology's instrument failed: 1 where our contract draft was wrong; failures of Syntology's instrument, not of the code.

By repository: official repository: 8 samples from 1 repository, 2 ran (2 with no instrument failure; 0 where Syntology's instrument failed); community (archive-listed): 22 samples from 5 repositories, 15 ran (14 with no instrument failure; 1 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

No sample is linked to this paper from 1 of its repositories that Syntology harvested for other papers:

Levels written between 2026-09-22 and 2026-09-25 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed.

yuqinie98/patchtst officialmentioned in papermentioned on GitHubpytorchApache-2.0Syntology: 8 samples, 2 ran (0 instrument-failed) · 6 unverified report
arclab-mit/sw-driver-forecaster mentioned on GitHubpytorchApache-2.0Syntology: 9 samples, 6 ran (0 instrument-failed) · 3 unverified report
romilbert/samformer mentioned on GitHubtfSyntology: 3 samples, 3 ran (1 instrument-failed) · 0 unverified report
thuml/iTransformer mentioned on GitHubpytorchSyntology: 1 sample, 0 ran · 1 unverified report
timeseriesAI/tsai mentioned on GitHubpytorchApache-2.0Syntology: 7 samples, 4 ran (0 instrument-failed) · 3 unverified report
MindCode-4/code-2 mindsporeSyntology: not harvested report
WenjieDu/PyPOTS pytorchSyntology: 2 samples, 2 ran (0 instrument-failed) · 0 unverified report
etna-team/etna pytorchSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to Time-Series Representation Learning via Temporal and Contextual Contrasting (arXiv:2106.14112; that paper's own run record: 2 ran (of which 1 constructed an object rather than computing a result; 1 with no instrument failure: 0 honoured, 0 violated, 1 with no contract checked; 1 where Syntology's instrument failed) · 0 unverified); nothing checks that they implement this paper's method. report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

A paper named beside a repository with no sample linked to this paper is shown with that paper's own run record, not this paper's: “ran” means executed on a synthesized input, not that the code is correct, and “where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Papers are listed in arXiv-id order, at most three per repository.

Code Syntology ran Syntology

30 samples harvested: 17 ran (of which 2 constructed an object rather than computing a result; 16 with no instrument failure: 0 honoured, 0 violated, 16 with no contract checked; 1 where Syntology's instrument failed) · 13 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page has not changed since , the first build that kept a record date for it; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

1ran · our draft was wrong
16ran
13unverified

Licence: 0 of the 30 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 6 repositories linked to this paper, official or community; the list below is grouped by repository, each group headed by its name and what it is to the paper. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of six reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.

yuqinie98/patchtst official repository 8 samples, 2 ran (0 instrument-failed) · 6 unverified
Flatten_Head in 6 papers PatchTST_supervised/layers/PatchTST_backbone.py ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 924854bdeb316b83 · report fixture: returned Flatten_Head · level recorded 2026-09-22
RevIN in 13 papers PatchTST_supervised/layers/PatchTST_backbone.py ran · metamorphic tier: deterministic Apache-2.0 (permissive) · a7b56d4ba3fc4e05 · report fixture: returned RevIN · level recorded 2026-09-22
PatchTST_backbone PatchTST_supervised/layers/PatchTST_backbone.py unverified Apache-2.0 (permissive) · 23dc6db25b8074c9 · report
TSTEncoder in 6 papers PatchTST_supervised/layers/PatchTST_backbone.py unverified Apache-2.0 (permissive) · 935deedae3555ede · report
TSTEncoderLayer in 6 papers PatchTST_supervised/layers/PatchTST_backbone.py unverified Apache-2.0 (permissive) · ce09df21971e2a59 · report
TSTiEncoder PatchTST_supervised/layers/PatchTST_backbone.py unverified Apache-2.0 (permissive) · 583948f80990e843 · report
_MultiheadAttention in 5 papers PatchTST_supervised/layers/PatchTST_backbone.py unverified Apache-2.0 (permissive) · db1784f091843709 · report
_ScaledDotProductAttention in 5 papers PatchTST_supervised/layers/PatchTST_backbone.py unverified Apache-2.0 (permissive) · 0caa47b3b62aada4 · report
arclab-mit/sw-driver-forecaster community (archive-listed) 9 samples, 6 ran (0 instrument-failed) · 3 unverified
bold_best swdf/plots.py ran Apache-2.0 (permissive) · 19fa411f0e0b205f · report fixture: signature X:ndarray/1/float, X_ref:ndarray/1/float, higher_better:bool/0/bool, bold_ref_too:bool/0/bool, bold_equal:bool/0/bool, use_abs:bool/0/bool · returned ndarray · level recorded 2026-09-25
forecast_error swdf/benchmark.py ran fingerprinted Apache-2.0 (permissive) · 5b63e338d455f44a · report fixture: signature y_true:Tensor/2/float, y_pred:Tensor/2/float, h:int/0/int · returned Tensor · level recorded 2026-09-25
get_classified_columns swdf/utils.py ran Apache-2.0 (permissive) · 0c4835b27ac129bc · report fixture: signature df:DataFrame/0/?, thresholds:dict/0/?, activity_levels:dict/0/? · returned DataFrame · level recorded 2026-09-25
get_idxs_per_solar_activity_level swdf/utils.py ran Apache-2.0 (permissive) · 82677ec6b39c1fda · report fixture: signature data:ndarray/2/float, thresholds:list/1/float · returned list · level recorded 2026-09-25
inverse_scale_values_below_threshold swdf/metrics.py ran Apache-2.0 (permissive) · b28a75229f1ab34d · report fixture: signature tensor:Tensor/1/float, threshold:float/0/float, lower_bound:float/0/float, upper_bound:float/0/float · returned Tensor · level recorded 2026-09-25
percent_forecast_error swdf/benchmark.py ran Apache-2.0 (permissive) · 984b7d634fd80a20 · report fixture: signature y_true:Tensor/2/float, y_pred:Tensor/2/float, h:int/0/int, epsilon:float/0/float · returned Tensor · level recorded 2026-09-25
euclidean_distance_dict swdf/utils.py unverified Apache-2.0 (permissive) · d0e642167565d536 · report
plot_predictions_performance swdf/plots.py unverified Apache-2.0 (permissive) · b462a292e7a87197 · report
prepare_tensor_to_forecast_histogram swdf/plots.py unverified Apache-2.0 (permissive) · 5ca0c802e78ccded · report
romilbert/samformer community (archive-listed) 3 samples, 3 ran (1 instrument-failed) · 0 unverified
RevIN in 13 papers samformer_pytorch/samformer/samformer.py ran · metamorphic tier: invariant Apache-2.0 (permissive) · 299bb76dee459375 · report fixture: signature x:Tensor/3/float, mode:str/0/str · returned Tensor · level recorded 2026-09-22
SAMFormerArchitecture samformer_pytorch/samformer/samformer.py ran Apache-2.0 (permissive) · d4cfb7ce9eee3e29 · report fixture: signature x:Tensor/3/float, flatten_output:bool/0/bool · returned Tensor · level recorded 2026-09-24
scaled_dot_product_attention in 43 papers samformer_pytorch/samformer/samformer.py ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 21d036b82013b9f5 · report fixture: signature query:Tensor/3/float, key:Tensor/3/float, value:Tensor/3/float, attn_mask:Tensor/2/bool, dropout_p:float/0/float, is_causal:bool/0/bool, scale:NoneType/0/? · returned Tensor · level recorded 2026-09-22
thuml/iTransformer community (archive-listed) 1 sample, 0 ran · 1 unverified
Model in 227 papers model/iTransformer.py unverified MIT (permissive) · d1fa32a7b86667ec · report
timeseriesAI/tsai community (archive-listed) 7 samples, 4 ran (0 instrument-failed) · 3 unverified
get_lds_kernel_window tsai/callback/core.py ran Apache-2.0 (permissive) · 2bbd4bfccd060fed · report fixture: signature lds_kernel:str/0/str, lds_ks:int/0/int, lds_sigma:float/0/float · returned ndarray · level recorded 2026-09-25
is_installed in 7 papers tsai/imports.py ran Apache-2.0 (permissive) · 9b5013e73b919955 · report fixture: signature module_name:str/0/str · returned bool · level recorded 2026-09-25
nb_name_to_py tsai/export.py ran fingerprinted Apache-2.0 (permissive) · bc18aebf89319382 · report fixture: signature nb_name:str/0/str · returned str · level recorded 2026-09-25
to_local_time tsai/imports.py ran Apache-2.0 (permissive) · aa4127e924213cb3 · report fixture: signature t:float/0/float, time_format:str/0/str · returned str · level recorded 2026-09-25
custom_doc_links in 10 papers tsai/_nbdev.py unverified Apache-2.0 (permissive) · c00f1d9594b0678a · report
prepare_LDS_weights tsai/callback/core.py unverified Apache-2.0 (permissive) · c2f4fa1e770585ff · report
py_last_saved tsai/imports.py unverified Apache-2.0 (permissive) · eafe0504957d2813 · report
WenjieDu/PyPOTS community (archive-listed) 2 samples, 2 ran (0 instrument-failed) · 0 unverified
PatchEmbedding in 25 papers pypots/nn/modules/patchtst/layers.py ran · metamorphic tier: invariant fingerprinted BSD-3-Clause (permissive) · 9bb8f29c7ede97fa · report fixture: signature x:Tensor/3/float · returned Tensor · level recorded 2026-09-22
PositionalEncoding in 126 papers
census: 13 implementations from 9 papers, 9 distinct outputs across 5 buckets, one shared input per bucket
pypots/nn/modules/patchtst/layers.py ran fingerprinted BSD-3-Clause (permissive) · 492dd85148f4f725 · report fixture: signature x:Tensor/3/float, dim:int/0/int, return_only_pos:bool/0/bool · returned Tensor · level recorded 2026-09-24

Method as code Syntology

What Syntology's graph records as this paper's claimed method, lifted into code: each assembly names its bricks (functions and classes), each with its own role and its own verification level. An assembly is not a check that the code implements the method correctly or reproduces the paper's results. Levels are each brick's own verification level in Syntology's graph (level 0: no recorded run), listed brick by brick and never combined into one level; “ran” means the brick executed on a synthesized input, not that its output is correct, and the instrument figure counts failures of Syntology's instrument, not of the code. Where a model read the code against the paper's claim, each assembly's label verdict is one model's judgement, kept in this page's JSON twin; it is not calibrated, so no card prints it. Siblings are assemblies lifted from this paper in the same batch for the same method: alternative readings kept side by side; none replaces or supersedes another.

3 assemblies on this paper: 3 harvested, 0 generated, listed in 1 groups (siblings lifted in one batch form one group).

3 sibling assemblies for PatchTST (harvested), lifted in the same batch on 2026-09-09: alternative readings kept side by side; none replaces or supersedes another.

harvested Assembly for PatchTST (graph method: PatchTST). 8 bricks; individually on a fixture: 2 ran (of which 2 constructed an object rather than computing a result; 2 with no instrument failure: 0 honoured, 0 violated, 2 with no contract checked; 0 where Syntology's instrument failed) · 6 unverified; every one of the 2 samples that ran constructed an object rather than computing a result. The assembly has not been run end-to-end.

one of 3 siblings

  1. PatchTST_backbone entry · level 0 · unverified · 23dc6db25b8074c9
  2. Flatten_Head model · level 1 · ran · 924854bdeb316b83
  3. RevIN helper · level 1 · ran · a7b56d4ba3fc4e05
  4. TSTiEncoder model · level 0 · unverified · 583948f80990e843
  5. TSTEncoder model · level 0 · unverified · 935deedae3555ede
  6. TSTEncoderLayer model · level 0 · unverified · ce09df21971e2a59
  7. _MultiheadAttention model · level 0 · unverified · db1784f091843709
  8. _ScaledDotProductAttention model · level 0 · unverified · 0caa47b3b62aada4

harvested Assembly for PatchTST (graph method: PatchTST). 2 bricks; individually on a fixture: 2 ran (of which 0 constructed an object rather than computing a result; 2 with no instrument failure: 0 honoured, 0 violated, 2 with no contract checked; 0 where Syntology's instrument failed) · 0 unverified. The assembly has not been run end-to-end.

one of 3 siblings

  1. PatchEmbedding entry · level 1 · ran · 9bb8f29c7ede97fa
  2. PositionalEncoding helper · level 1 · ran · 492dd85148f4f725

harvested Assembly for PatchTST (graph method: PatchTST). 3 bricks; individually on a fixture: 3 ran (of which 0 constructed an object rather than computing a result; 2 with no instrument failure: 0 honoured, 0 violated, 2 with no contract checked; 1 where Syntology's instrument failed) · 0 unverified. The assembly has not been run end-to-end.

one of 3 siblings

  1. SAMFormerArchitecture entry · level 1 · ran · d4cfb7ce9eee3e29
  2. RevIN helper · level 1 · ran · 299bb76dee459375
  3. scaled_dot_product_attention helper · level 1 · ran · our draft was wrong · 21d036b82013b9f5

Each brick ends with its code_sha256, Syntology's identity for that exact code; click one to copy the get_code call that returns it. For agents, on Syntology's MCP service: assembly(arxiv_id="2211.14730") returns these assemblies with each brick's role and wiring (how to connect).

Tasks

Multivariate Time Series ForecastingRepresentation LearningTime SeriesTime Series AnalysisTime Series Forecasting

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Time Series Forecasting ETTh1 (192) Multivariate PatchTST/64 MAE 0.429 #14 of 17 Archive leaderboard report
Time Series Forecasting ETTh1 (192) Multivariate PatchTST/64 MSE 0.413 #14 of 17 Archive leaderboard report
Time Series Forecasting ETTh1 (192) Univariate PatchTST/64 MAE 0.215 #5 of 5 Archive leaderboard report
Time Series Forecasting ETTh1 (192) Univariate PatchTST/64 MSE 0.074 #5 of 5 Archive leaderboard report
Time Series Forecasting ETTh1 (336) Multivariate PatchTST/64 MAE 0.44 #18 of 72 Archive leaderboard report
Time Series Forecasting ETTh1 (336) Multivariate PatchTST/64 MSE 0.422 #18 of 72 Archive leaderboard report
Time Series Forecasting ETTh1 (336) Univariate PatchTST/64 MAE 0.22 #2 of 10 Archive leaderboard report
Time Series Forecasting ETTh1 (336) Univariate PatchTST/64 MSE 0.076 #2 of 10 Archive leaderboard report
Time Series Forecasting ETTh1 (720) Multivariate PatchTST/64 MAE 0.468 #10 of 22 Archive leaderboard report
Time Series Forecasting ETTh1 (720) Multivariate PatchTST/64 MSE 0.447 #10 of 22 Archive leaderboard report
Time Series Forecasting ETTh1 (720) Univariate PatchTST/64 MAE 0.236 #4 of 12 Archive leaderboard report
Time Series Forecasting ETTh1 (720) Univariate PatchTST/64 MSE 0.087 #4 of 12 Archive leaderboard report
Time Series Forecasting ETTh1 (96) Multivariate PatchTST/64 MAE 0.4 #10 of 15 Archive leaderboard report
Time Series Forecasting ETTh1 (96) Multivariate PatchTST/64 MSE 0.37 #10 of 15 Archive leaderboard report
Time Series Forecasting ETTh1 (96) Univariate PatchTST/64 MAE 0.189 #6 of 6 Archive leaderboard report
Time Series Forecasting ETTh1 (96) Univariate PatchTST/64 MSE 0.059 #6 of 6 Archive leaderboard report
Time Series Forecasting ETTh2 (192) Multivariate PatchTST/64 MAE 0.382 #11 of 16 Archive leaderboard report
Time Series Forecasting ETTh2 (192) Multivariate PatchTST/64 MSE 0.341 #11 of 16 Archive leaderboard report
Time Series Forecasting ETTh2 (192) Univariate PatchTST/64 MAE 0.329 #4 of 6 Archive leaderboard report
Time Series Forecasting ETTh2 (192) Univariate PatchTST/64 MSE 0.171 #4 of 6 Archive leaderboard report
Time Series Forecasting ETTh2 (336) Multivariate PatchTST/64 MAE 0.384 #5 of 20 Archive leaderboard report
Time Series Forecasting ETTh2 (336) Multivariate PatchTST/64 MSE 0.329 #5 of 20 Archive leaderboard report
Time Series Forecasting ETTh2 (336) Univariate PatchTST/64 MAE 0.336 #4 of 10 Archive leaderboard report
Time Series Forecasting ETTh2 (336) Univariate PatchTST/64 MSE 0.171 #4 of 10 Archive leaderboard report
Time Series Forecasting ETTh2 (720) Multivariate PatchTST/64 MAE 0.422 #3 of 20 Archive leaderboard report
Time Series Forecasting ETTh2 (720) Multivariate PatchTST/64 MSE 0.379 #3 of 20 Archive leaderboard report
Time Series Forecasting ETTh2 (720) Univariate PatchTST/64 MAE 0.38 #5 of 11 Archive leaderboard report
Time Series Forecasting ETTh2 (720) Univariate PatchTST/64 MSE 0.223 #5 of 11 Archive leaderboard report
Time Series Forecasting ETTh2 (96) Multivariate PatchTST/64 MAE 0.337 #9 of 16 Archive leaderboard report
Time Series Forecasting ETTh2 (96) Multivariate PatchTST/64 MSE 0.274 #9 of 16 Archive leaderboard report
Time Series Forecasting ETTh2 (96) Univariate PatchTST/64 MAE 0.284 #5 of 6 Archive leaderboard report
Time Series Forecasting ETTh2 (96) Univariate PatchTST/64 MSE 0.131 #5 of 6 Archive leaderboard report
Time Series Forecasting Electricity (192) PatchTST/64 MSE 0.147 #4 of 8 Archive leaderboard report
Time Series Forecasting Electricity (336) PatchTST/64 MSE 0.163 #6 of 9 Archive leaderboard report
Time Series Forecasting Electricity (720) PatchTST/64 MSE 0.197 #5 of 8 Archive leaderboard report
Time Series Forecasting Electricity (96) PatchTST/64 MSE 0.129 #5 of 11 Archive leaderboard report
Time Series Forecasting Weather (192) PatchTST/64 MSE 0.194 #9 of 13 Archive leaderboard report
Time Series Forecasting Weather (336) PatchTST/64 MSE 0.245 #8 of 11 Archive leaderboard report
Time Series Forecasting Weather (720) PatchTST/64 MSE 0.314 #6 of 11 Archive leaderboard report
Time Series Forecasting Weather (96) PatchTST/64 MSE 0.149 #9 of 12 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections