Explainable by Design: SHAPformer Makes AI Power Forecasts Transparent in Under a Second

A new method from a KIT team, developed with Helmholtz AI's DRACOS group, shows exactly which factors drive an AI power forecast, without slowing the forecast down.
Solar panels, electric vehicles, and heat pumps are making electricity consumption harder to predict, right as the grid comes to depend more on AI to do exactly that: forecast demand, anticipate prices, and keep supply and consumption in balance. In critical infrastructure like the power grid, accuracy alone isn't enough — a forecasting model also needs to show its work. As Schäfer put it, this is especially true in energy, where errors can have serious consequences, and where the EU's AI Act now mandates transparency and human oversight.
Published in Nature Communications, a team led by Matthias Hertel, together with Sebastian Pütz (Helmholtz AI, Schäfer Team), Ralf Mikut (Helmholtz AI Associate), Veit Hagenmeyer, and Benjamin Schäfer (Helmholtz AI Principal Investigator, Energy Unit Head at KIT and Steering Board Member), introduces SHAPformer — a forecasting model that produces exact, trustworthy explanations for its own predictions in less than a second. All five authors are based at the Institute for Automation and Applied Informatics (IAI), Karlsruhe Institute of Technology (KIT), where Schäfer leads the Helmholtz AI Young Investigator Group DRACOS (Data-Driven Analysis of Complex Systems).
In plain terms
When an AI model forecasts tomorrow's electricity demand or price, a widely used technique called SHAP can break that single number down into contributions: how much did the outside temperature add, how much did the fact that it's a public holiday subtract, how much did last week's consumption pattern carry over. The trouble is that computing these contributions for modern "Transformer" models (the same architecture behind today's large language models) normally means running the model over and over on randomly resampled versions of the input, which is slow, and can generate unrealistic scenarios in the process, e.g. a summer heatwave inserted into a winter week.
SHAPformer sidesteps this. It is trained from the start to make accurate predictions from any subset of its input features, so at prediction time, it can compute the exact contribution of every feature directly, with no resampling and no need for a substitute "baseline" value.
For the experts
SHAPformer groups related inputs — the past week's load into daily blocks, each exogenous variable into its own group — and uses attention manipulation to mask specific groups during training and inference alike. Because roughly half of all feature groups are masked at random in each training step, the model learns to forecast reliably from partial information, which makes it possible to evaluate all 2ᴺ feature-group coalitions directly and compute exact Shapley values from the standard combinatorial formula, rather than approximating them.
The gains are substantial: on real electricity load and price data, SHAPformer generates a full explanation 800–1,000× faster than the commonly used PermutationSHAP method, and still 50× faster on synthetic benchmark data, all in under a second per forecast. Validated against known ground-truth explanations on synthetic data, SHAPformer's feature-importance estimates come three to four times closer to the ground truth than the next-best method (WindowSHAP), while forecast accuracy stays on par with a standard Transformer.
Applied to real grid data from transmission system operator TransnetBW, SHAPformer identifies the previous week's load, the day of the week, and the hour of day as the dominant drivers of electricity demand, with temperature stepping in strongly on unusually cold days. On day-ahead electricity price data, wind speed emerges as a strong negative driver, consistent with the well-known effect of renewable generation pushing prices down.
Open by design
The authors have released SHAPformer as a Python package, alongside the synthetic benchmark dataset and its ground-truth explanations, so other researchers can evaluate and build on the method directly (GitHub: KIT-IAI/SHAPformer).
Benjamin Schäfer was recently featured on our channels for a different reason: his work on data-driven electricity load profiles earned him the Viktor & Sigrid Dulger Foundation's Ecology Prize 2026. SHAPformer continues that same thread: using AI to make the energy transition more predictable, and more transparent about how. We put two questions to Schäfer about what that means in practice.
SHAPformer takes longer to train than a standard Transformer, because it has to learn from partial, masked inputs but pays that back with near-instant explanations afterward. Once a model like this is actually running in a control room, which side of that trade-off matters more?
Frontloading the effort into training is highly desired when deploying AI methods in time-critical environments. For power systems, we might need to make decisions quickly, i.e. within minutes or even seconds. In such a case, having not only a forecast but also an explanation ready to support decision-making is essential and the cost of longer training time becomes almost irrelevant.
You've pointed to the AI Act as one reason explainability is becoming non-negotiable in energy systems. Beyond compliance, what could a grid operator or utility actually do differently once they can see, in real time, exactly which factors are driving a forecast?
We are constantly in touch with industry experts and try to understand their needs. If you are an experienced operator and someone tells you to blindly trust a new AI models that is going to be a tough sale. Overall, transparency is not only relevant to comply with the EU AI Act but also to increase chances that AI methods are being used by domain experts. Finally, as an AI method developer, having access to explanations makes it much easier to debug and improve upon the algorithm.
Read the paper: Explainable time-series forecasting with sampling-free SHAP for Transformers, Nature Communications (2026). DOI: 10.1038/s41467-026-73243-5
Media
- KIT press release: "Erklärbare KI für Energiesysteme" (KIT, 8 June 2026, German)
- TechXplore: "Explainable AI outlines forecasts behind grid and price decisions" (8 June 2026, English)
- Mirage News: "Explainable AI For Energy Systems" (English)
- openPR/idw syndication: "Erklärbare KI für Energiesysteme" (German)
- ee-news.ch: "KIT: Erklärbare KI für Energiesysteme" (German)
- datensicherheit.de: "Energiesysteme: Nachvollziehbare Entscheidungen mittels Erklärbarer KI" (German)
- architekturblatt.de: "Erklärbare KI macht Energieprognosen transparenter" (German)
- 50komma2.de: "Die KI erklärt sich" (German)