CNN-TFT-SHAP-MHAW: Hybrid Forecasting & Interpretability
- The paper introduces a hybrid model that integrates CNN for local pattern extraction, TFT for long-range dependency modeling, and SHAP-MHAW for interpretable forecasts, achieving a best MAPE of 2.2%.
- The methodology combines a causal convolutional encoder with a modified Temporal Fusion Transformer, emphasizing adaptive covariate selection and robust self-attention mechanisms.
- The SHAP-MHAW explainability component fuses Shapley values with averaged multi-head attention weights to reliably attribute the influence of each time step on the prediction.
Searching arXiv for the specified paper to ground the article in the cited source. CNN-TFT-SHAP-MHAW is a hybrid framework for multivariate time series forecasting that combines a convolutional neural network (CNN) front end, a Temporal Fusion Transformer (TFT) backbone, and an interpretability layer that fuses Shapley additive explanations with multi-head attention weights. It is introduced in "CNN-TFT explained by SHAP with multi-head attention weights for time series forecasting" (Stefenon et al., 8 Oct 2025). The model is designed to exploit the complementary inductive biases of convolution and self-attention: the CNN extracts salient local temporal patterns from sliding windows of raw observations, while the TFT machinery performs adaptive covariate weighting and long-range dependency modeling. The framework also proposes SHAP-MHAW, an attribution mechanism intended to identify time steps that are both causally influential under SHAP and emphasized by the transformer's attention mechanism (Stefenon et al., 8 Oct 2025).
1. Concept and naming
The designation CNN-TFT-SHAP-MHAW denotes a composite architecture with three functional layers. The first is a CNN-based causal convolutional encoder. The second is a modified TFT backbone that retains the TFT’s variable-selection and gating components while replacing its recurrent core with the convolutional encoder plus self-attention. The third is an explainability method, SHAP-MHAW, that combines Shapley values with averaged multi-head attention weights to form per-lag attributions (Stefenon et al., 8 Oct 2025).
Within the formulation reported in the source, the CNN component addresses local pattern extraction and noise reduction, whereas the TFT component models both short- and long-term dependencies and adaptively weighs relevant covariates. The interpretability layer is motivated by a distinction between two notions of importance: SHAP measures average marginal contribution, while attention weights indicate where the model allocates focus. Their product yields a combined attribution score for each lag (Stefenon et al., 8 Oct 2025).
This suggests that the framework is not merely a stacked forecaster but an integrated forecasting-and-interpretation system. A plausible implication is that its intended use extends beyond raw predictive accuracy to settings where operational trust and lag-wise diagnostic analysis are required.
2. Input representation and causal convolutional encoder
The reported input is a univariate time series observed for . Forecasting is performed from sliding windows of length , so that at prediction time the model consumes
This window is processed by a stack of three causal one-dimensional convolutional layers. If and is the output of layer , then for ,
with 0 filters, kernel width 1, stride one, causal padding, and a learned bias term (Stefenon et al., 8 Oct 2025). In index form, for time step 2 and output channel 3,
4
The source characterizes this hierarchy as a local-pattern extractor: early layers detect fine-grained motifs, deeper layers encode increasingly abstract temporal features, and causal padding preserves autoregressive structure by preventing leakage of future information into the past (Stefenon et al., 8 Oct 2025).
The explicit use of causal convolutions is central to the model’s temporal semantics. Unlike non-causal convolutions, the reported design preserves a forecasting regime in which every representation at time 5 is constructed only from current and preceding inputs. This makes the encoder compatible with downstream attention blocks without violating chronological ordering.
3. Modified Temporal Fusion Transformer backbone
The feature maps 6 produced by the convolutional stack are passed into a modified TFT backbone. In the formulation given in the source, the architecture retains the TFT’s selection and gating machinery, but substitutes the recurrent core with the convolutional encoder plus self-attention (Stefenon et al., 8 Oct 2025).
Variable-selection networks operate on a vector 7 of known or observed features at each time step. In the reported setup this corresponds to the single channel of 8. The selection network computes
9
where each 0 is a Gated Residual Network (Stefenon et al., 8 Oct 2025). A standard GRN is specified as a two-layer MLP with ELU activation, followed by a gating layer 1, skip connection, and layer normalization:
2
The source also presents the GRN in decomposed form:
3
4
These networks re-scale and select the most relevant covariates at each time step (Stefenon et al., 8 Oct 2025). In this architecture, variable selection is therefore not peripheral; it mediates the interface between local features extracted by the CNN and the dependency structure learned by the attention mechanism.
4. Self-attention, fusion, and forecast generation
After variable selection and gating, the TFT applies multi-head self-attention to capture long-range dependencies. Given the gated input sequence 5, the linear projections are
6
with 7 (Stefenon et al., 8 Oct 2025). For one attention head,
8
For 9 parallel heads,
0
and the outputs are concatenated and projected:
1
The attention block is followed by a residual connection and dropout, then a position-wise feedforward network and a second residual connection:
2
where
3
The source identifies this dual residual structure—attention, residual, feedforward, residual—as key to stable deep-attention training (Stefenon et al., 8 Oct 2025).
For final prediction, the convolutional features and transformer features are concatenated along the channel dimension:
4
A global average over time produces
5
which is passed through a single dense layer,
6
to predict 7 (Stefenon et al., 8 Oct 2025).
This fusion stage is structurally important. Rather than discarding the CNN representation after attention processing, the model concatenates the direct convolutional path with the attention-refined path before temporal pooling. This suggests an attempt to preserve local-pattern information that may otherwise be diluted by global contextualization.
5. SHAP-MHAW explainability mechanism
The explainability component, SHAP-MHAW, is introduced to obtain model explanations by combining Shapley additive explanations with multi-head attention weights (Stefenon et al., 8 Oct 2025). In the reported formulation, SHAP attributes to each input feature a value 8 representing its average marginal contribution. For a function 9 and feature set 0, the Shapley value of feature 1 is
2
In the time-series setting used here, each feature corresponds to a lagged observation 3, and 4 is approximated via Kernel SHAP using a background of training-window samples (Stefenon et al., 8 Oct 2025).
To incorporate what the transformer attends to, let 5 be the attention weight matrix for head 6. The method first averages attention across heads and query positions to obtain a per-lag weight
7
The combined attribution for lag 8 is then defined as
9
or in vector form,
0
An optional smoothing step is applied via
1
with the source describing this as a small Gaussian smoothing used to produce a visually interpretable influence map (Stefenon et al., 8 Oct 2025).
The distinction between SHAP and attention is explicit in the formulation. SHAP quantifies causal impact, whereas attention alone does not reveal whether a focused time step materially changes the forecast. The product 2 therefore enforces a conjunctive criterion: a lag is treated as important when it is both influential under Shapley attribution and attended to by the model (Stefenon et al., 8 Oct 2025). This suggests an attempt to reduce interpretive ambiguity that can arise when attention scores and feature-attribution scores disagree.
6. Dataset, training protocol, and empirical results
The reported empirical evaluation uses daily natural inflow records from the Tucuruí hydroelectric plant in Brazil, spanning January 2, 1998 to July 9, 2023, for a total of 9,321 points (Stefenon et al., 8 Oct 2025). All experiments employ a sliding window whose length equals the forecast horizon, with the example 3 used to predict 15 days ahead. The data split is 80% train and 20% test, and 10% of the training set is used for validation (Stefenon et al., 8 Oct 2025).
Hyperparameter tuning is performed via Bayesian optimization with a Gaussian-process surrogate and Expected Improvement acquisition. The final settings reported are summarized below.
| Component | Setting |
|---|---|
| Causal Conv1D stack | 3 layers, 238 filters, kernel size 4 |
| Multi-head attention | 4 heads, 5 |
| Optimization | Adam, learning rate 6, batch size 32 |
| Training schedule | 100 epochs, early stopping on validation RMSE |
The model is benchmarked against MLP, NHITS, NBEATSx, LSTM, GRU, DeepAR, TFT, Informer, PatchTST, FEDformer, TCN, and TimesNet. The evaluation metrics are RMSE, MAE, MAPE, and MSLE over forecasting horizons 7 (Stefenon et al., 8 Oct 2025).
For the 15-day horizon, CNN-TFT-SHAP-MHAW achieves RMSE 8, MAE 9, MAPE 0, and MSLE 1, outperforming all baselines. The source further states that at 30- and 60-day horizons the model leads in all four error measures, while at 120 days it is a close second (Stefenon et al., 8 Oct 2025). The abstract separately summarizes performance as a mean absolute percentage error of up to 2.2% and describes the architecture as outperforming well-established deep learning models on the hydroelectric natural flow series (Stefenon et al., 8 Oct 2025).
The key finding section characterizes the result as leveraging the CNN’s local-pattern inductive bias together with the TFT’s long-range attention, and identifies a best-ever MAPE of 2.20% (Stefenon et al., 8 Oct 2025). Within the bounds of the reported experiment, this indicates that the hybridization strategy was effective on the Tucuruí inflow forecasting task.
7. Interpretability findings, scope, and limitations
The reported interpretability analysis indicates that most causal impact resides in the last 6–10 lags, while attention spreads moderately to seasonal lags further back (Stefenon et al., 8 Oct 2025). The source states that this pattern matches domain intuition that recent flows dominate predictions. By fusing SHAP and attention, the method yields an influence curve that highlights time steps that the model both focuses on and that actually move the forecast, and the paper presents this as a trustworthy interpretability tool for practitioners (Stefenon et al., 8 Oct 2025).
A common misconception in sequence-model interpretation is that attention alone is equivalent to explanation. The formulation of SHAP-MHAW directly addresses that issue by distinguishing between focus and effect. In the reported framework, attention matrices 2 encode where the transformer "looked," whereas Shapley values 3 estimate average marginal contribution. Their fusion therefore narrows the attribution to lags satisfying both criteria (Stefenon et al., 8 Oct 2025).
The framework is also described as promising for applications requiring high-fidelity, multivariate time series forecasts, and the implementation is stated to be available for future analysis at the linked repository (Stefenon et al., 8 Oct 2025). At the same time, the empirical evidence presented in the source is tied to a single hydroelectric natural flow dataset and to horizons 4. A plausible implication is that broader claims about generalization across domains, sampling frequencies, or exogenous-variable regimes would require additional validation beyond what is reported.