Open Access Journal Article

An AI-Enhanced Forecasting Framework: Integrating LSTM and Transformer-Based Sentiment for Stock Price Prediction

by Diego Vallarino a,*
a
Independent Researcher, Atlanta, GA, US
*
Author to whom correspondence should be addressed.
JEA  2025 4(3):109; https://doi.org/10.58567/jea04030001
Received: 2 October 2024 / Accepted: 21 April 2025 / Published Online: 9 May 2025

Abstract

Forecasting stock prices remains a fundamental yet complex challenge in financial economics due to the nonlinearity, volatility, and exogenous shocks characterizing market behavior. This paper proposes a hybrid deep learning framework that integrates Long Short-Term Memory (LSTM) networks for time-series modeling with Transformer-based architectures for textual sentiment extraction from financial news. The goal is to enhance predictive accuracy by combining structured historical data with unstructured semantic signals. Using three years of daily data from Apple Inc. (AAPL), the model captures endogenous price dynamics via LSTM and incorporates contemporaneous market sentiment through FinBERT, a Transformer model pretrained on financial text. Empirical results show that the hybrid model outperforms price-only baselines across multiple evaluation metrics, including mean squared error (MSE) and directional accuracy. The incorporation of sentiment features proves particularly valuable around earnings announcements and event-driven volatility regimes. This study contributes to the literature on machine learning in finance by demonstrating the complementary strengths of multimodal learning, offering a more interpretable and robust framework for stock price prediction. The findings also open avenues for future research in real-time forecasting, reinforcement learning integration, and the application of hybrid models across diverse asset classes.


Copyright: © 2025 by Vallarino. This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY) (Creative Commons Attribution 4.0 International License). The use, distribution or reproduction in other forums is permitted, provided the original author(s) or licensor are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.
Cite This Paper
APA Style
Vallarino, D. (2025). An AI-Enhanced Forecasting Framework: Integrating LSTM and Transformer-Based Sentiment for Stock Price Prediction. Journal of Economic Analysis, 4(3), 109. doi:10.58567/jea04030001
ACS Style
Vallarino, D. An AI-Enhanced Forecasting Framework: Integrating LSTM and Transformer-Based Sentiment for Stock Price Prediction. Journal of Economic Analysis, 2025, 4, 109. doi:10.58567/jea04030001
AMA Style
Vallarino D. An AI-Enhanced Forecasting Framework: Integrating LSTM and Transformer-Based Sentiment for Stock Price Prediction. Journal of Economic Analysis; 2025, 4(3):109. doi:10.58567/jea04030001
Chicago/Turabian Style
Vallarino, Diego 2025. "An AI-Enhanced Forecasting Framework: Integrating LSTM and Transformer-Based Sentiment for Stock Price Prediction" Journal of Economic Analysis 4, no.3:109. doi:10.58567/jea04030001

Share and Cite

ACS Style
Vallarino, D. An AI-Enhanced Forecasting Framework: Integrating LSTM and Transformer-Based Sentiment for Stock Price Prediction. Journal of Economic Analysis, 2025, 4, 109. doi:10.58567/jea04030001
AMA Style
Vallarino D. An AI-Enhanced Forecasting Framework: Integrating LSTM and Transformer-Based Sentiment for Stock Price Prediction. Journal of Economic Analysis; 2025, 4(3):109. doi:10.58567/jea04030001
Chicago/Turabian Style
Vallarino, Diego 2025. "An AI-Enhanced Forecasting Framework: Integrating LSTM and Transformer-Based Sentiment for Stock Price Prediction" Journal of Economic Analysis 4, no.3:109. doi:10.58567/jea04030001
APA style
Vallarino, D. (2025). An AI-Enhanced Forecasting Framework: Integrating LSTM and Transformer-Based Sentiment for Stock Price Prediction. Journal of Economic Analysis, 4(3), 109. doi:10.58567/jea04030001

Article Metrics

Article Access Statistics

References

  1. Araci, D. (2019). FinBERT: Financial sentiment analysis with pre-trained language models, arXiv. https://arxiv.org/abs/1908.10063
  2. Cui, P., Shen, Z., Li, S., Yao, L., Li, Y., Chu, Z., and Gao, J. (2020). Causal inference meets machine learning. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, 3527–3528. https://doi.org/10.1145/3394486.3406460
  3. Fischer, T., and Krauss, C. (2018). Deep learning with long short-term memory networks for financial market predictions. European Journal of Operational Research, 270(2), 654–669. https://doi.org/10.1016/j.ejor.2017.11.054
  4. Goodfellow, I., Bengio, Y., and Courville, A. (2016). Deep learning, MIT Press.
  5. Hochreiter, S., and Schmidhuber, J. (1997). Long short-term memory. Neural Computation, 9(8), 1735–1780. https://doi.org/10.1162/neco.1997.9.8.1735
  6. Kingma, D. P., and Ba, J. (2015). Adam: A method for stochastic optimization. In Proceedings of the 3rd International Conference on Learning Representations (ICLR). https://arxiv.org/abs/1412.6980
  7. Lim, B., Arık, S. Ö., Loeff, N., and Pfister, T. (2021). Temporal fusion transformers for interpretable multi-horizon time series forecasting. International Journal of Forecasting, 37(4), 1748–1764. https://doi.org/10.1016/j.ijforecast.2021.03.012
  8. Liu, Y., Ott, M., Goyal, N., Du, J., Joshi, M., Chen, D., Levy, O., Lewis, M., Zettlemoyer, L., and Stoyanov, V. (2020). RoBERTa: A robustly optimized BERT pretraining approach, arXiv. https://arxiv.org/abs/1907.11692
  9. Lopez de Prado, M. (2018). Advances in financial machine learning, Wiley.
  10. Ryan, J. A., and Ulrich, J. M. (2023). quantmod: Quantitative financial modelling framework (R package version 0.4-21). https://CRAN.R-project.org/package=quantmod
  11. Sun, Y., Ni, R., and Zhao, Y. (2022). ET: Edge-enhanced Transformer for image splicing detection. IEEE Signal Processing Letters, 29, 1232–1236. https://doi.org/10.1109/LSP.2022.3172617
  12. Vallarino, D. (2025). Detecting Financial Fraud with Hybrid Deep Learning: A Mix-of-Experts Approach to Sequential and Anomalous Patterns. arXiv preprint arXiv:2504.03750.
  13. Vallarino, D. (2024). Dynamic Portfolio Rebalancing: A Hybrid new Model Using GNNs and Pathfinding for Cost Efficiency. ArXiv preprint arXiv:2410.01864. https://doi.org/10.48550/arXiv.2410.01864
  14. Vallarino, D. (2024). Modeling Adaptive Fraud Patterns: An Agent-Centric Hybrid Framework with MoE and Deep Learning. Available at SSRN 5001848. http://dx.doi.org/10.2139/ssrn.5001848
  15. Vallarino, D. (2024). A Dynamic Approach to Stock Price Prediction: Comparing RNN and Mixture of Experts Models Across Different Volatility Profiles. arXiv preprint arXiv:2410.07234. https://doi.org/10.48550/arXiv.2410.07234
  16. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, Ł., and Polosukhin, I. (2017). Attention is all you need. In Advances in Neural Information Processing Systems, 30, 5998–6008. https://arxiv.org/abs/1706.03762
  17. Wen, Q., Zhou, T., Zhang, C., Chen, W., Ma, Z., Yan, J., and Sun, L. (2023). Transformers in time series: A survey. In Proceedings of the 32nd International Joint Conference on Artificial Intelligence (IJCAI 2023), 6778–6786. https://doi.org/10.48550/arXiv.2202.07125
  18. Zhang, X., Qu, S., Huang, J., Fang, B., and Yu, P. (2018). Stock market prediction via multi-source multiple instance learning. IEEE Access, 6, 50720–50728. https://doi.org/10.1109/ACCESS.2018.2869735