SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2602.11550 · 2026

TS-Memory: Plug-and-Play Memory for Time Series Foundation Models

Qingsong Wen, Yuxuan Liang, Weilin Ruan, Qingxiang Liu, Siru Zhong, Sisuo Lyu, Tiegang Chen, Taiqiang Lv, Raymond Chi-Wing Wong

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 0 failures of our instrument; 0 no recorded run), measured 2026-11-22; 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/2602.11550.json · badge: /api/ran/2602.11550.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
sisuolv/TS-Memory community
Papers with Code archive
3 ran · 0 no recorded run
FunctionStatusWhere it lives
InstanceNorm Ran
ran on a synthesized input
sisuolv/TS-Memory/src/models/memory_ts_quantile.py
code served (permissive licence) · get_code("6a8cf45ffffc94c9")
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
from typing import Optional, Tuple

class InstanceNorm(nn.Module):
    """
    Same InstanceNorm logic as ChronosBolt (models/ChronosBolt.py), but kept local to avoid heavy imports.
    """

    def __init__(self, eps: float=1e-05) -> None:
        super().__init__()
        self.eps = eps

    def forward(self, x: torch.Tensor, loc_scale: Optional[Tuple[torch.Tensor, torch.Tensor]]=None) -> Tuple[torch.Tensor, Tuple[torch.Tensor, torch.Tensor]]:
        if loc_scale is None:
            loc = torch.nan_to_num(torch.nanmean(x, dim=-1, keepdim=True), nan=0.0)
            scale = torch.nan_to_num((x - loc).square().nanmean(dim=-1, keepdim=True).sqrt(), nan=1.0)
            is_constant = torch.all(x == x[..., :1], dim=-1, keepdim=True)
            scale = torch.where(is_constant, torch.ones_like(scale), scale)
        else:
            loc, scale = loc_scale
        normalized = (x - loc) / scale
        is_constant = torch.all(x == x[..., :1], dim=-1, keepdim=True) if loc_scale is None else scale == 1
        normalized = torch.where(is_constant, torch.ones_like(normalized), normalized)
        return (normalized, (loc, scale))

    def inverse(self, x: torch.Tensor, loc_scale: Tuple[torch.Tensor, torch.Tensor]) -> torch.Tensor:
        loc, scale = loc_scale
        is_constant = scale == 1
        return torch.where(is_constant, loc, x * scale + loc)


INIT_ARGS = {
    'eps': 1e-05
}

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

if __name__ == '__main__':
    instance_norm = InstanceNorm(**INIT_ARGS)
    normalized, loc_scale = instance_norm(**ARGS)
    print("Normalized shape:", normalized.shape)
    print("Loc shape:", loc_scale[0].shape)
    print("Scale shape:", loc_scale[1].shape)
    
    inverse_result = instance_norm.inverse(normalized, loc_scale)
    print("Inverse result shape:", inverse_result.shape)
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)
MemoryTSQuantile Ran
ran on a synthesized input · constructed an object; no result was computed
sisuolv/TS-Memory/src/models/memory_ts_quantile.py
code served (permissive licence) · get_code("d2f2165e0314ec0c")
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 an instance of its own class, MemoryTSQuantile: the run constructed the object and did not call it, so no result was computed. 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 math
from dataclasses import dataclass
from typing import Optional, Tuple

torch.manual_seed(0)

@dataclass
class MemoryTSQuantileConfig:
    context_len: int = 512
    pred_len: int = 64
    num_quantiles: int = 9
    d_model: int = 256
    n_heads: int = 8
    n_layers: int = 4
    n_decoder_layers: int = 2
    patch_len: int = 16
    dropout: float = 0.1

config = MemoryTSQuantileConfig(
    context_len=128,
    pred_len=32,
    num_quantiles=5,
    d_model=64,
    n_heads=4,
    n_layers=2,
    n_decoder_layers=1,
    patch_len=16,
    dropout=0.1
)

ARGS = {
    "config": config
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MemoryTSQuantile — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MemoryTSQuantile output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not 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: none by the harness; any seed is in the setup block
MemoryTSQuantileConfig Ran
ran on a synthesized input · constructed an object; no result was computed
sisuolv/TS-Memory/src/models/memory_ts_quantile.py
code served (permissive licence) · get_code("73fb46a8fb01be90")
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 an instance of its own class, MemoryTSQuantileConfig: the run constructed the object and did not call it, so no result was computed. 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
from dataclasses import dataclass

torch.manual_seed(0)

@dataclass
class MemoryTSQuantileConfig:
    context_len: int = 512
    pred_len: int = 64
    num_quantiles: int = 9
    d_model: int = 256
    n_heads: int = 8
    n_layers: int = 4
    n_decoder_layers: int = 2
    patch_len: int = 16
    dropout: float = 0.1

ARGS = {
    "context_len": 512,
    "pred_len": 64,
    "num_quantiles": 9,
    "d_model": 256,
    "n_heads": 8,
    "n_layers": 4,
    "n_decoder_layers": 2,
    "patch_len": 16,
    "dropout": 0.1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MemoryTSQuantileConfig — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MemoryTSQuantileConfig output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not 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: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 3 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.

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-22.

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 Foundation Models (TSFMs) achieve strong zero-shot forecasting through large-scale pre-training, but adapting them to downstream domains under distribution shift remains challenging. Existing solutions face a trade-off: Parametric Adaptation can cause catastrophic forgetting and requires costly multi-domain maintenance, while Non-Parametric Retrieval improves forecasts but incurs high inference latency due to datastore search. We propose Parametric Memory Distillation and implement it as TS-Memory, a lightweight memory adapter that augments frozen TSFMs. TS-Memory is trained in two stages. First, we construct an offline, retrieval-leakage-safe 𝑘NN teacher that synthesizes confidenceaware quantile targets from retrieved futures. Second, we distill this retrieval-induced distributional correction into a lightweight memory adapter via confidence-gated supervision. During inference, TS-Memory fuses memory and backbone predictions with constant-time overhead, enabling retrieval-free deployment. Experiments across diverse TSFMs and benchmarks demonstrate consistent improvements in both point and probabilistic forecasting over representative adaptation methods, with efficiency comparable to the frozen backbone. Code: https://github.com/sisuolv/TS-Memory. • Mathematics of computing → Time series analysis; • Computing methodologies → Machine learning.

For agents

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

get_harvested_code_for_paper("2602.11550")
get_code_for_paper("2602.11550")
have("2602.11550")

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

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

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

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

Connect an agent — have() is free.