Overview
N-HiTS keeps N-BEATS’ stacks of fully connected blocks with backcast/forecast residual links, and adds two ideas. Multi-rate input sampling: each stack max-pools the input window with a different kernel, so early stacks see a coarse, smoothed view and later stacks see full detail. Hierarchical interpolation: each stack predicts only a few coefficients and interpolates them up to the full horizon, so low-frequency stacks produce smooth long-range shapes and high-frequency stacks add detail.
Because each stack outputs far fewer values, N-HiTS trains much faster than N-BEATS and Transformer models while matching or beating them on long-horizon benchmarks.
How it works
Stack \(s\) pools the input with kernel \(k_s\), passes it through an MLP, and outputs coefficients \(\theta_s\) at reduced resolution \(H/r_s\), which an interpolation \(g\) maps back to the horizon:
\[\hat y_{t+1:t+H}=\sum_{s=1}^{S}g\big(\theta_s\big),\qquad \theta_s=\mathrm{MLP}_s\big(\mathrm{MaxPool}_{k_s}(y_{t-L+1:t})\big)\]Within a stack, blocks are chained by residuals: each removes the part of the input it explained (its backcast).
When to use it
Use it for
- Long horizons (days to weeks of hourly data)
- Many series trained as one global model
- When Transformers are too slow
Avoid it for
- Very short series
- When you need exogenous effects to be interpretable
Key settings
| Setting | What it controls | Typical value |
|---|---|---|
input_size | Look-back window | 2–5 × horizon |
n_pool_kernel_size | Pooling per stack | [4, 2, 1] or [8, 4, 1] |
n_freq_downsample | Output downsampling per stack | [4, 2, 1] up to [24, 12, 1] |
scaler_type | Per-window scaling | 'robust' or 'standard' |
Python example
# pip install neuralforecast (needs PyTorch) import pandas as pd from neuralforecast import NeuralForecast from neuralforecast.models import NHITS, NBEATS URL = "https://raw.githubusercontent.com/jbrownlee/Datasets/master/airline-passengers.csv" raw = pd.read_csv(URL) df = pd.DataFrame({"unique_id": "air", "ds": pd.to_datetime(raw["Month"]), "y": raw["Passengers"]}) train, test = df.iloc[:-12], df.iloc[-12:] models = [ # three stacks pool the input at different rates (4, 2, 1) and forecast at matching resolutions NHITS(h=12, input_size=36, n_pool_kernel_size=[4, 2, 1], n_freq_downsample=[4, 2, 1], scaler_type="robust", max_steps=500, random_seed=1), NBEATS(h=12, input_size=36, scaler_type="robust", max_steps=500, random_seed=1), ] nf = NeuralForecast(models=models, freq="MS") nf.fit(df=train) fc = nf.predict().merge(test, on=["unique_id", "ds"]) for m in ["NHITS", "NBEATS"]: print(f"{m:7s} MAE {(fc['y'] - fc[m]).abs().mean():.1f}")
Tips & pitfalls
- Match downsampling to seasonality: for hourly data, [24, 12, 1] separates daily structure.
- Use a quantile or distribution loss in neuralforecast for intervals.
- Compare against N-BEATS, DLinear and a seasonal naive baseline on the same split.
References
- Challu, C., Olivares, K. G., Oreshkin, B. N., Garza Ramírez, F., Mergenthaler Canseco, M., & Dubrawski, A. (2023). N-HiTS: Neural Hierarchical Interpolation for Time Series Forecasting. Proceedings of the AAAI Conference on Artificial Intelligence, 37(6), 6989–6997.