File size: 6,863 Bytes
c4b87d2
 
 
 
1b89a8e
 
 
 
 
 
 
 
 
 
 
 
 
c4b87d2
 
 
 
 
1b89a8e
c4b87d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24e5642
c4b87d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1b89a8e
c4b87d2
1b89a8e
 
 
c4b87d2
1b89a8e
 
 
c4b87d2
1b89a8e
 
 
c4b87d2
1b89a8e
 
c4b87d2
1b89a8e
 
 
c4b87d2
1b89a8e
c4b87d2
 
1b89a8e
c4b87d2
 
 
 
 
1b89a8e
c4b87d2
1b89a8e
c4b87d2
1b89a8e
c4b87d2
 
 
 
 
 
 
 
 
 
 
1b89a8e
 
c4b87d2
1b89a8e
c4b87d2
 
1b89a8e
c4b87d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
license: apache-2.0
library_name: tempo-pfn
tags:
  - TempoPFN
  - time-series
  - forecasting
  - time-series-forecasting
  - foundation models
  - pretrained models
  - zero-shot
  - synthetic-data
  - rnn
  - linear-rnn
leaderboards:
  - Salesforce/GIFT-Eval
pipeline_tag: time-series-forecasting
arxiv: 2510.25502
---

# TempoPFN: Synthetic Pre-Training of Linear RNNs for Zero-Shot Time Series Forecasting

[![preprint](https://img.shields.io/static/v1?label=Paper&message=2510.25502&color=B31B1B&logo=arXiv)](https://arxiv.org/abs/2510.25502) [![GIFT-Eval](https://img.shields.io/badge/%F0%9F%8F%86%20GIFT--Eval-Leaderboard-0078D4)](https://huggingface.co/spaces/Salesforce/GIFT-Eval) [![github](https://img.shields.io/badge/%F0%9F%92%BB%20GitHub-Repo-grey)](https://github.com/automl/TempoPFN) [![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://github.com/automl/TempoPFN/blob/main/LICENSE)

---

**TempoPFN** introduced in [TempoPFN: Synthetic Pre-Training of Linear RNNs for Zero-Shot Time Series Forecasting](https://arxiv.org/abs/2510.25502), is a univariate time series foundation model pretrained **entirely on synthetic data**. It delivers top-tier zero-shot forecasting accuracy while remaining fully reproducible and free from real-data leakage.

Built on a **Linear RNN (GatedDeltaProduct)** backbone, TempoPFN performs end-to-end forecasting without patching or windowing. Its design enables fully parallelizable training and inference while maintaining stable temporal state-tracking across long sequences. The GatedDeltaProduct architecture is based on [DeltaProduct](https://arxiv.org/html/2502.10297v3), extended with state-weaving for time series forecasting. For detailed information about the architecture and custom modifications, see [`src/models/gated_deltaproduct/README.md`](src/models/gated_deltaproduct/README.md).

This repository includes the **pretrained 38M parameter model** (`models/checkpoint_38M.pth`), all training and inference code, and the **complete synthetic data generation pipeline** used for pretraining.

## โœจ Why TempoPFN?

* **High Performance, No Real Data:** Achieves top-tier competitive results on **GIFT-Eval, outperforming all existing synthetic-only approaches** and **surpassing the vast majority of models trained on real-world data**. This ensures full reproducibility and eliminates benchmark leakage.
* **Parallel and Efficient:** The linear recurrence design enables full-sequence parallelization. This gives us the best of both worlds: the linear efficiency of an RNN, but with the training parallelism of a Transformer.
* **Open and Reproducible:** Includes the full synthetic data pipeline, configurations, and scripts to reproduce training from scratch.
* **State-Tracking Stability:** The GatedDeltaProduct recurrence and *state-weaving* mechanism preserve temporal continuity and information flow across long horizons, improving robustness without non-linear recurrence.

![TempoPFN Overview](https://iili.io/KDCHpou.png)

## โš™๏ธ Installation

> **Note on Model Weights:** This repository uses [Git LFS](https://git-lfs.github.com/) to store the model checkpoint (`.pth` file). You **must** have Git LFS installed to clone the repository correctly.
>
> ```bash
> # Install Git LFS (e.g., on Ubuntu)
> sudo apt-get install git-lfs
> git lfs install
> ```

1.  **Clone the repository:**
```bash
    git clone https://huggingface.co/AutoML-org/TempoPFN
    cd TempoPFN
```

2.  **Set up the environment:**
```bash
python -m venv venv && source venv/bin/activate

# 1. Install PyTorch version matching your CUDA version
# Example for CUDA 12.8:
pip install torch --index-url https://download.pytorch.org/whl/cu128

# 2. Clone the Hugging Face repository
git clone https://huggingface.co/AutoML-org/TempoPFN
cd TempoPFN

# 3. Set up the environment
python3.12 -m venv venv & source venv/bin/activate
export PYTHONPATH=$PWD

# 4. Install PyTorch version matching your CUDA version
pip install torch --index-url https://download.pytorch.org/whl/cu128

# 5. Install dependencies
pip install .
pip install .[dev]

# 4. Run the Quick Start Script 
python examples/quick_start_tempo_pfn.py

# 5. Alternatively, you can run the Notebook version
jupyter notebook examples/quick_start_tempo_pfn.ipynb
```

### Hardware & Performance Tips

**GPU Required:** Inference requires a CUDA-capable GPU with a matching PyTorch version installed. Tested on NVIDIA A100/H100.

**First Run:** The first inference for a new sequence length will be slow due to Triton kernel compilation. Subsequent runs will be fast.

**Cache Tip:** If using a network filesystem, prevent slowdowns by routing caches to a local directory (like `/tmp`) *before* running:
```bash
LOCAL_CACHE_BASE="${TMPDIR:-/tmp}/tsf-$(date +%s)"
mkdir -p "${LOCAL_CACHE_BASE}/triton" "${LOCAL_CACHE_BASE}/torchinductor"
export TRITON_CACHE_DIR="${LOCAL_CACHE_BASE}/triton"
export TORCHINDUCTOR_CACHE_DIR="${LOCAL_CACHE_BASE}/torchinductor"

python examples/quick_start_tempo_pfn.py
```

## ๐Ÿš‚ Training

All training and model parameters are controlled via YAML files in `configs/`.  

```bash
# Single-GPU (Debug)
torchrun --standalone --nproc_per_node=1 src/training/trainer_dist.py --config ./configs/train.yaml

# Multi-GPU (e.g., 8 GPUs)
torchrun --standalone --nproc_per_node=8 src/training/trainer_dist.py --config ./configs/train.yaml
```


## ๐Ÿ’พ Synthetic Data Generation

A core contribution of this work is our open-source synthetic data pipeline, located in `src/synthetic_generation/`. It combines diverse generators with a powerful augmentation cascade.

**Generators Used:**

* **Adapted Priors:** ForecastPFN, KernelSynth, GaussianProcess (GP), and CauKer (Structural Causal Models).
* **Novel Priors:** SDE (a flexible regime-switching Ornstein-Uhlenbeck process), Sawtooth, StepFunction, Anomaly, Spikes, SineWave, and Audio-Inspired generators (Stochastic Rhythms, Financial Volatility, Network Topology, Multi-Scale Fractals).

You can easily generate your own data by installing the development dependencies and instantiating a generator wrapper. See `examples/generate_synthetic_data.py` for a minimal script, or inspect the generator code in `src/synthetic_generation/`.

## ๐Ÿค License

This project is licensed under the Apache 2.0 License. See the LICENSE file for details. This permissive license allows for both academic and commercial use.

## ๐Ÿ“š Citation

If you find TempoPFN useful in your research, please consider citing our paper:
```bibtex
@misc{moroshan2025tempopfn,
  title={TempoPFN: Synthetic Pre-training of Linear RNNs for Zero-Shot Time Series Forecasting}, 
  author={Vladyslav Moroshan and Julien Siems and Arber Zela and Timur Carstensen and Frank Hutter},
  year={2025},
  eprint={2510.25502},
  archivePrefix={arXiv},
  primaryClass={cs.LG}
}
```