Introduction: Accurate stock prediction faces significant hurdles due to market volatility and complex temporal dependencies. Existing deep learning models struggle to balance local feature extraction and global pattern capture. Methods: Introduce AttnFuse to model multi-scale financial time-series patterns while synergistically improving robustness. The architecture integrates two core components: an improved DA-RNN incorporating Multi-Head Attention and Residual Connections for refined feature selection, and a lightweight Transformer with time embeddings for efficient long-range dependency modeling. Predictions from both modules are dynamically weighted using an MLP with residual correction. Four stock datasets are used, with evaluation metrics including RMSE, MAE, MAPE, and R². The model is compared against benchmarks such as CNN, LSTM, DARNN, and CNN-LSTM. Results: The AttnFuse model achieves state-of-the-art performance across all four stock datasets, delivering the lowest error rates and highest predictive accuracy. It significantly outperforms benchmarks (CNN, LSTM, DA-RNN, CNN-LSTM) with optimal metrics including RMSE, MAE, MAPE, and R2 . Ablation studies confirm critical contributions of all components: removing Multi-Head Attention increases RMSE by 1.1–7.5%, disabling residual connections elevates MAE by 4.6–29.2%, replacing the lightweight Transformer degrades RMSE by 7.7–45.6%, and excluding dynamic fusion raises MAPE by 0.8–22.9%. Discussion: Experiments across four different stock indices show that AttnFuse consistently outperforms the benchmark model on RMSE, MAE, MAPE, and other metrics. The results confirm its effectiveness in capturing complex dependencies in highly volatile financial time series. Conclusion: AttnFuse establishes a new state-of-the-art for stock forecasting through synergistic attention-based fusion. Its dynamic weighting mechanism and computational efficiency provide a robust solution for volatile markets
Tao et al. (Wed,) studied this question.