SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.16877 · NeurIPS · 2024

Are Self-Attentions Effective for Time Series Forecasting?

Hoki Kim, Jinseong Park, Jaewook Lee, Dongbin Kim

arXiv · PDF · Open in the Atlas

Code that ran

5 of 13 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 0 failures of our instrument; 8 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2405.16877.json · badge: /api/ran/2405.16877.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
dongbeank/cats canonical (classifier label)
classifier basis: classifier_2025
4 ran · 3 no recorded run
dongbeank/CATS canonical (classifier label)
classifier basis: census
1 ran · 5 no recorded run
FunctionStatusWhere it lives
DecoderLayer Ran
ran on a synthesized input
dongbeank/cats/models/CATS.py
code served (permissive licence) · get_code("5b900d79dd00feb4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from scipy import stats

INIT_ARGS = {
    'seq_patch_num': 3,
    'd_model': 4,
    'pred_patch_num': 2,
    'n_heads': 2,
    'd_ff': 8,
    'store_attn': False,
    'QAM_start': 0.1,
    'QAM_end': 0.5,
    'attn_dropout': 0.0,
    'dropout': 0.0,
    'bias': True,
    'res_attention': False
}

ARGS = {
    'seq': torch.randn(2, 3, 4),
    'pred': torch.randn(2, 2, 4),
    'prev': None
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
Projection Ran
ran on a synthesized input
dongbeank/cats/models/CATS.py
code served (permissive licence) · get_code("c9e915f73a989d19")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float, shape (2, 15) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

INIT_ARGS = {
    'd_model': 4,
    'patch_len': 3,
}

ARGS = {
    'x': torch.randn(2, 5, 4),
}

projection = nn.Module.__new__(nn.Module)
projection.__class__ = type('Projection', (nn.Module,), {
    '__init__': lambda self, d_model, patch_len: (
        super(type(self), self).__init__(),
        setattr(self, 'linear', nn.Linear(d_model, patch_len)),
        setattr(self, 'flatten', nn.Flatten(start_dim=-2))
    ),
    'forward': lambda self, x: self.flatten(self.linear(x))
})

projection.__init__(**INIT_ARGS)
output = projection(**ARGS)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 15) — shape (2, 15) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
QueryAdaptiveMasking Ran
ran on a synthesized input
dongbeank/cats/models/CATS.py
code served (permissive licence) · get_code("51cadb0ea6fdf45c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 4, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

class QueryAdaptiveMasking(nn.Module):

    def __init__(self, dim=1, start_prob=0.1, end_prob=0.5):
        super().__init__()
        self.dim = dim
        self.start_prob = start_prob
        self.end_prob = end_prob

    def forward(self, x):
        if not self.training:
            return x
        else:
            size = x.shape[self.dim]
            dropout_prob = torch.linspace(self.start_prob, self.end_prob, steps=size, device=x.device).view([-1 if i == self.dim else 1 for i in range(x.dim())])
            mask = torch.bernoulli(1 - dropout_prob).expand_as(x)
            return x * mask


INIT_ARGS = {
    'dim': 1,
    'start_prob': 0.1,
    'end_prob': 0.5,
}

ARGS = {
    'x': torch.randn(2, 4, 3),
}

if __name__ == '__main__':
    module = QueryAdaptiveMasking(**INIT_ARGS)
    module.train()
    output = module(**ARGS)
    print(f"Input shape: {ARGS['x'].shape}")
    print(f"Output shape: {output.shape}")
    print(f"Output:\n{output}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 4, 3) — shape (2, 4, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
_MultiheadAttention Ran
ran on a synthesized input
dongbeank/cats/models/CATS.py
code served (permissive licence) · get_code("928f4380b09f0830")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor

class _MultiheadAttention(nn.Module):

    def __init__(self, d_model, n_heads, res_attention=False, attn_dropout=0.0, proj_dropout=0.0, qkv_bias=True):
        """Multi Head Attention Layer
        Input shape:
            Q:       [batch_size (bs) x pred_patch_num x d_model]
            K, V:    [batch_size (bs) x seq_patch_num x d_model]
        """
        super().__init__()
        d_h = d_model // n_heads
        self.scale = d_h ** (-0.5)
        self.n_heads, self.d_h = (n_heads, d_h)
        self.W_Q = nn.Linear(d_model, d_h * n_heads, bias=qkv_bias)
        self.W_K = nn.Linear(d_model, d_h * n_heads, bias=qkv_bias)
        self.W_V = nn.Linear(d_model, d_h * n_heads, bias=qkv_bias)
        self.res_attention = res_attention
        self.attn_dropout = nn.Dropout(attn_dropout)
        self.to_out = nn.Sequential(nn.Linear(n_heads * d_h, d_model), nn.Dropout(proj_dropout))

    def forward(self, Q: Tensor, K: Tensor, V: Tensor, prev=None):
        bs = Q.size(0)
        q_s = self.W_Q(Q).view(bs, -1, self.n_heads, self.d_h)
        k_s = self.W_K(K).view(bs, -1, self.n_heads, self.d_h)
        v_s = self.W_V(V).view(bs, -1, self.n_heads, self.d_h)
        attn_scores = torch.einsum('bphd, bshd -> bphs', q_s, k_s) * self.scale
        if prev is not None:
            attn_scores = attn_scores + prev
        attn_weights = F.softmax(attn_scores, dim=-1)
        attn_weights = self.attn_dropout(attn_weights)
        output = torch.einsum('bphs, bshd -> bphd', attn_weights, v_s)
        output = output.contiguous().view(bs, -1, self.n_heads * self.d_h)
        output = self.to_out(output)
        if self.res_attention:
            return (output, attn_weights, attn_scores)
        else:
            return (output, attn_weights)


INIT_ARGS = {
    'd_model': 8,
    'n_heads': 2,
    'res_attention': False,
    'attn_dropout': 0.1,
    'proj_dropout': 0.1,
    'qkv_bias': True,
}

ARGS = {
    'Q': torch.randn(2, 3, 8),
    'K': torch.randn(2, 5, 8),
    'V': torch.randn(2, 5, 8),
    'prev': None,
}

if __name__ == '__main__':
    model = _MultiheadAttention(**INIT_ARGS)
    result = model(**ARGS)
    print(f"Output shape: {result[0].shape}")
    print(f"Attention weights shape: {result[1].shape}")
    print(f"Number of outputs: {len(result)}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
parse_ratios Ran
ran, honoured the contract we drafted
dongbeank/CATS/utils/tools.py
code served (permissive licence) · get_code("cb391e8599bbce03")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import argparse

def parse_ratios(ratio_string):
    try:
        ratios = [float(x) for x in ratio_string.split(',')]
        if len(ratios) != 3 or abs(sum(ratios) - 1.0) > 1e-06:
            raise ValueError('Three values are required and they must sum to 1.')
        return ratios
    except ValueError as e:
        raise argparse.ArgumentTypeError(str(e))

ARGS = {
    'ratio_string': '0.6,0.2,0.2'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
CORR Not yet run
unverified (harvested, no recorded run)
dongbeank/CATS/utils/metrics.py
pointer only (licence: MIT); the stored copy get_code serves, from shangzongjiang/Ada-MSHyper, is pointer only (licence: NONE) · get_code("8c76ef42a9443f81")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from shangzongjiang/Ada-MSHyper, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Decoder Not yet run
unverified (harvested, no recorded run)
dongbeank/cats/models/CATS.py
code served (permissive licence) · get_code("1a7ac87e34d772f5")
How it ran

no invocation recorded.

Dummy_Embedding Not yet run
unverified (harvested, no recorded run)
dongbeank/cats/models/CATS.py
code served (permissive licence) · get_code("9362e3c7bb8cc5f2")
How it ran

no invocation recorded.

MAE Not yet run
unverified (harvested, no recorded run)
dongbeank/CATS/utils/metrics.py
pointer only (licence: MIT); the stored copy get_code serves, from shangzongjiang/Ada-MSHyper, is pointer only (licence: NONE) · get_code("75f44993b096bf76")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from shangzongjiang/Ada-MSHyper, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Model_backbone Not yet run
unverified (harvested, no recorded run)
dongbeank/cats/models/CATS.py
code served (permissive licence) · get_code("d682a61115f944df")
How it ran

no invocation recorded.

RSE Not yet run
unverified (harvested, no recorded run)
dongbeank/CATS/utils/metrics.py
pointer only (licence: MIT); the stored copy get_code serves, from shangzongjiang/Ada-MSHyper, is pointer only (licence: NONE) · get_code("b40a11875ebd0cd2")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from shangzongjiang/Ada-MSHyper, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

time_features Not yet run
unverified (harvested, no recorded run)
dongbeank/CATS/utils/timefeatures.py
code served (permissive licence) · get_code("9a5fcd4ebfc55d03")
How it ran

no invocation recorded.

time_features_from_frequency_str Not yet run
unverified (harvested, no recorded run)
dongbeank/CATS/utils/timefeatures.py
code served (permissive licence) · get_code("f8544563682146e5")
How it ran

no invocation recorded. this sample carries JSON test cases instead of a setup block; get_reference_implementation serves them with the level they back.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 1 the same month, 5 later) and 8 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
time_features_from_frequency_str 19 other papers
11 dated earlier, 8 later
2203.05167 (2022-03)
TiSAT: Time Series Anomaly Transformer
2208.04933 (2022-08)
Simplified State Space Layers for Sequence Modeling
2305.10721 (2023-05)
Revisiting Long-term Time Series Forecasting: An Investigation on Linear Mapping
and 16 more not named here
RSE 18 other papers
11 dated earlier, 1 the same month, 6 later
2202.01381 (2022-02)
ETSformer: Exponential Smoothing Transformers for Time-series Forecasting
2203.05167 (2022-03)
TiSAT: Time Series Anomaly Transformer
2207.10941 (2022-07)
Respecting Time Series Properties Makes Deep Time Series Forecasting Perfect
and 15 more not named here
MAE 17 other papers
10 dated earlier, 7 later
2202.01381 (2022-02)
ETSformer: Exponential Smoothing Transformers for Time-series Forecasting
2203.05167 (2022-03)
TiSAT: Time Series Anomaly Transformer
2207.10941 (2022-07)
Respecting Time Series Properties Makes Deep Time Series Forecasting Perfect
and 14 more not named here
time_features 12 other papers
6 dated earlier, 6 later
2305.10721 (2023-05)
Revisiting Long-term Time Series Forecasting: An Investigation on Linear Mapping
2305.18803 (2023-05)
Koopa: Learning Non-stationary Time Series Dynamics with Koopman Predictors
2308.08469 (2023-08)
LLM4TS: Aligning Pre-Trained LLMs as Data-Efficient Time-Series Forecasters
and 9 more not named here
CORR 2 other papers
1 dated earlier, 1 later
2403.09898 (2024-03)
TimeMachine: A Time Series is Worth 4 Mambas for Long-term Forecasting
2410.23992 (2024-10)
Ada-MSHyper: Adaptive Multi-Scale Hypergraph Transformer for Time Series Forecasting

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Time series forecasting is crucial for applications across multiple domains and various scenarios. Although Transformers have dramatically advanced the landscape of forecasting, their effectiveness remains debated. Recent findings have indicated that simpler linear models might outperform complex Transformer-based approaches, highlighting the potential for more streamlined architectures. In this paper, we shift the focus from evaluating the overall Transformer architecture to specifically examining the effectiveness of self-attention for time series forecasting. To this end, we introduce a new architecture, Cross-Attention-only Time Series transformer (CATS), that rethinks the traditional transformer framework by eliminating self-attention and leveraging cross-attention mechanisms instead. By establishing future horizon-dependent parameters as queries and enhanced parameter sharing, our model not only improves long-term forecasting accuracy but also reduces the number of parameters and memory usage. Extensive experiment across various datasets demonstrates that our model achieves superior performance with the lowest mean squared error and uses fewer parameters compared to existing models. The implementation of our model is available at: https://github.com/dongbeank/CATS.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2405.16877")
get_code_for_paper("2405.16877")
have("2405.16877")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2405.16877.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2405.16877.svg)](https://syntology.ai/paper/2405.16877)

Connect an agent — have() is free.