Decoding Stock Trends: A Comparative Study of GRU, LSTM, and Transformer Models in Tech Sector Prediction - Sendi, Asaad; Hoque, Foyzul; Hoque, Md Tamjidul (Transactions on Engineering and Computing Sciences, 2025)
This study investigates the predictive capabilities of three state-of-the-art neural network architectures—Long Short-Term Memory (LSTM), Gated Recurrent Unit (GRU), and Transformer models—in forecasting stock prices for five leading technology companies: Apple Inc. (AAPL), Cisco Systems, Inc. (CSCO), Meta Platforms, Inc. (META), Microsoft Corporation (MSFT), and Tesla, Inc. (TSLA). The dataset spans from July 2019 to July 2023, with models evaluated using key performance metrics such as Mean Absolute Error (MAE), Root Mean Squared Error (RMSE), and R-squared (R²) values. The results show that GRU models consistently achieve the lowest MAE, indicating superior precision in stock price prediction. In contrast, LSTM models, while showing slightly higher error rates, are particularly effective in capturing long-term trends and the variance in stock prices, as evidenced by higher R² values. Transformer models, which utilize self-attention mechanisms, showed promise in handling complex relationships but struggled with the volatility of certain stocks, such as TSLA, leading to higher errors and lower R². These findings provide valuable insights for financial analysts and investment professionals, offering guidance on selecting the most suitable deep learning models based on specific market conditions and forecasting needs. This study also lays the groundwork for further exploration into model optimization and hybrid approaches for more robust financial forecasting.