Explainable time-series forecasting with sampling-free SHAP for Transformers

M Matthias Hertel S Sebastian Pütz R Ralf Mikut V Veit Hagenmeyer B Benjamin Schäfer

Abstract

Abstract Time-series forecasting is essential for planning and decision-making across domains, and model explainability is critical for fostering user trust and satisfying transparency requirements. We introduce SHAPformer, an accurate, fast and explainable time-series forecasting model based on the Transformer architecture and Shapley Additive Explanations (SHAP). SHAPformer leverages attention manipulation to make predictions using feature subsets, thereby eliminating the need for sampling from background data required by established SHAP algorithms. As a result, it produces exact explanations in less than one second, achieving speedups of 50–1000 × compared to PermutationSHAP. On synthetic data with known ground-truth explanations, SHAPformer generates explanations that are true to the data. When applied to electrical load data and electricity price data, it achieves competitive predictive performance while providing meaningful local and global insights, including the identification of the past target as the key predictor and the detection of distinct load forecasting behavior during the Christmas period.

Article Details

Volume / Issue Vol. 17, Issue 1
Published May 27, 2026
ISSN 2041-1723
Publisher Nature Portfolio

Journal Info

Nature Communications

Nature Portfolio

ISSN: 2041-1723 Open Access Life Sciences

Authors (5)

M

Matthias Hertel

S

Sebastian Pütz

R

Ralf Mikut

V

Veit Hagenmeyer

B

Benjamin Schäfer