Comparative Analysis of Stock Price Prediction Using LSTM and GPT-2 Models

Stock price prediction is a challenging task in both financial and academic sectors, as stock prices often behave unpredictably and nonlinearly within complex systems. This research presents a comparative study of two models: LSTM and GPT-2 which are applied to stock price prediction using Apple Inc.’s open-source data from Yahoo Finance, covering the period from 2000 to 2024. The LSTM model produces more accurate results and is better at handling long-term dependencies compared to GPT-2. The GPT-2 model from Hugging Face struggles with temporal modeling, generating inconsistent and unpredictable outputs due to its lack of design for time series data. LSTM excels at finding patterns in the complex financial data, making it a more suitable choice for this project. The LSTM model benefits from the data preparation steps that include feature selection, normalization, handling missing values and all factors that can influence its prediction. GPT-2 shows a weakness in capturing the nonlinear time series stock prices. Its reliance on pre-trained language modeling makes it not suitable for modeling stock data without the specialized adaptations. GPT-2’s outputs often differ from the real time stock data because of its lack of temporal awareness which results in unpredictable predictions. This study shows the strengths and limitations of the two models and emphasizes LSTM’s capability in finding and producing consistent stock price predictions. While GPT-2 performs well in broader contexts, this study demonstrates that LSTM is more effective for stock price prediction. This research shows how machine learning systems can improve and help with future directions of stock price predictions. The work presented in this paper by no means provides any guidance for stock purchasing but is an effort to integrate AI and Machine learning techniques to understand the process of stock price prediction that can be improved by incorporating sophisticated techniques.

Authors

Publication Details

Published
2025-03-15
DOI
https://doi.org/10.1109/isec64801.2025.11147253
Primary Topic
Stock Market Forecasting Methods
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Comparative Analysis of Stock Price Prediction Using LSTM and GPT-2 Models

JJ Po-An Hsieh, K Prithvi, Sohail Zaidi, Vivienne Ko
Stock Market Forecasting Methods
article

Comparative Analysis of Stock Price Prediction Using LSTM and GPT-2 Models

JJ Po-An Hsieh, K Prithvi, Sohail Zaidi, Vivienne Ko
article en

Abstract

Stock price prediction is a challenging task in both financial and academic sectors, as stock prices often behave unpredictably and nonlinearly within complex systems. This research presents a comparative study of two models: LSTM and GPT-2 which are applied to stock price prediction using Apple Inc.’s open-source data from Yahoo Finance, covering the period from 2000 to 2024. The LSTM model produces more accurate results and is better at handling long-term dependencies compared to GPT-2. The GPT-2 model from Hugging Face struggles with temporal modeling, generating inconsistent and unpredictable outputs due to its lack of design for time series data. LSTM excels at finding patterns in the complex financial data, making it a more suitable choice for this project. The LSTM model benefits from the data preparation steps that include feature selection, normalization, handling missing values and all factors that can influence its prediction. GPT-2 shows a weakness in capturing the nonlinear time series stock prices. Its reliance on pre-trained language modeling makes it not suitable for modeling stock data without the specialized adaptations. GPT-2’s outputs often differ from the real time stock data because of its lack of temporal awareness which results in unpredictable predictions. This study shows the strengths and limitations of the two models and emphasizes LSTM’s capability in finding and producing consistent stock price predictions. While GPT-2 performs well in broader contexts, this study demonstrates that LSTM is more effective for stock price prediction. This research shows how machine learning systems can improve and help with future directions of stock price predictions. The work presented in this paper by no means provides any guidance for stock purchasing but is an effort to integrate AI and Machine learning techniques to understand the process of stock price prediction that can be improved by incorporating sophisticated techniques.

Openalex Percentile: Top 72%
Stock Market Forecasting Methods
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.