File size: 4,250 Bytes
294e473
 
 
 
 
 
 
 
48ad5d8
294e473
 
 
 
 
 
145a7ae
 
48ad5d8
 
145a7ae
294e473
3b384e4
 
 
294e473
3b384e4
294e473
0ae2468
 
 
3b384e4
 
 
294e473
3b384e4
 
 
 
 
 
 
294e473
 
 
44f1747
424674f
44f1747
 
 
 
 
294e473
 
 
 
 
3b384e4
294e473
 
3b384e4
 
294e473
 
3b384e4
 
294e473
 
3b384e4
294e473
 
 
3b384e4
 
 
 
 
 
 
 
 
 
 
 
 
145a7ae
 
 
 
 
48ad5d8
 
 
 
 
 
 
145a7ae
 
 
0ae2468
 
 
 
145a7ae
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
---
license: apache-2.0
tags:
  - time-series
  - forecasting
  - foundation-model
  - macroeconomics
  - fred-md
  - arxiv:2606.28670
library_name: tempopfn
pipeline_tag: time-series-forecasting
---

# MacroCast

**Paper:** Carriero, Pettenuzzo & Shekhar (2026), *MACROCAST: A Vintage-Consistent
Time Series Foundation Model for Real-Time Macroeconomic Forecasting* —
[arXiv:2606.28670](https://arxiv.org/abs/2606.28670)
([SSRN](https://ssrn.com/abstract=7004218)).

**MacroCast** is a compact (~1.2M-parameter) time-series foundation model for
**macroeconomic forecasting**. It forecasts a full panel of monthly
indicators in a **single forward pass** (no autoregressive windowing) and returns
**probabilistic** (9-quantile) forecasts.

It is trained in two stages:

1. Base model: A ~1.2M-parameter linear-RNN backbone (built on
   [TempoPFN](https://github.com/automl/TempoPFN), Apache-2.0), trained from
   scratch **entirely on synthetic data** (no real macro data).
2. **MacroCast** — Base model **fine-tuned** on FRED-MD via an expanding-window,
   real-time-vintage procedure, using a mixture of macro-calibrated synthetic
   panels (block-bootstrap, per-variable AR, Dynamic Factor Model, and BVAR).

## Vintages (real-time fine-tuning)
This repo ships **one checkpoint per fine-tuning vintage** (in `models/`). Each
checkpoint is MacroCast fine-tuned on only the FRED-MD data available *through that
cutoff* — e.g. the 2010 vintage has never seen post-2010 data — so you can choose how
much history the model has seen and run **leak-free real-time / backtesting**
experiments. The available vintages, their data cutoffs, and per-vintage variable
counts are listed in `manifest.json` (`default_year` is used when no year is given).

## Usage

**Install dependencies** (needs a **GPU**). On Colab/Jupyter prefix with `!`;
`torch` is already present on Colab, otherwise install the build:

```bash
pip install flash-linear-attention==0.5.0 transformers==5.8.1 einops gluonts huggingface_hub
```

```python
from huggingface_hub import snapshot_download
import sys

local = snapshot_download(repo_id="shubhranshu/MacroCast")
sys.path.insert(0, local)                 # for forecast.py
from forecast import MacroCastForecaster

# List vintages, then load MacroCast for one (year=None -> latest):
print(MacroCastForecaster.available_years(local))     # e.g. [1998, ..., 2023]
f = MacroCastForecaster.from_pretrained(local, year=2023)

# history: np.ndarray of shape [T, N]  (T monthly steps, N FRED-MD variables)
point, quantiles = f.predict(history, horizon=12, freq="M")
```

- `point`: `[horizon, N]` median (0.5-quantile) forecast.
- `quantiles`: `[horizon, N, 9]` forecasts for quantiles 0.1 … 0.9.


## Model details
- **Architecture**: GatedDeltaProduct linear-RNN, `embed=128`, 3 layers, ~1.2M params.
- **Objective**: 9-quantile (0.1…0.9) pinball loss.
- **Pre-training**: synthetic priors only (GP, kernel, Ornstein–Uhlenbeck,
  ForecastPFN, CauKer, sine/sawtooth/step, …) — no real macro data.
- **MacroCast fine-tuning**: FRED-MD real-time vintages expanded into a synthetic
  mixture — `real` + `block-bootstraps`, `arima` (per-variable AR), `dfm`
  (Dynamic Factor Model), and `bvar_clust` / `bvar_full` (Minnesota BVAR).

## Intended use and limitations
- Built for **monthly macroeconomic** panels. Feed transformed/stationary inputs.
- Forecasts are statistical outputs, **not financial or policy advice**.

## Citation
If you use MacroCast, please cite:

```bibtex
@misc{carriero2026macrocast,
  title         = {{MACROCAST}: A Vintage-Consistent Time Series Foundation Model for Real-Time Macroeconomic Forecasting},
  author        = {Carriero, Andrea and Pettenuzzo, Davide and Shekhar, Shubhranshu},
  year          = {2026},
  eprint        = {2606.28670},
  archivePrefix = {arXiv},
  primaryClass  = {econ.EM},
  url           = {https://arxiv.org/abs/2606.28670}
}
```

## Acknowledgements & license
Built on [TempoPFN](https://github.com/automl/TempoPFN) (Apache-2.0): the model
backbone, trainer, and synthetic-data generators are vendored from that project
and modified for macroeconomic forecasting. Released under Apache-2.0. Please
also cite TempoPFN (Moroshan et al., 2025, arXiv 2510.25502).