Financial Sentiment Analysis and Classification: A Comparative Study of Fine-Tuned Deep Learning Models
Abstract
:1. Introduction
2. Literature Review
2.1. Transformer-Based Models for Financial Sentiment Analysis
2.2. Retrieval-Augmented and Instruction-Tuned Approaches
2.3. Domain-Specific Fine-Tuning and Lexicon-Based Methods
2.4. Semantic and Syntactic Enhancements
2.5. Multi-Agent and Hybrid Frameworks
2.6. Multimodal and Social Media–Focused Approaches
2.7. Adversarial Attacks and Model Robustness
2.8. Synthesis and Future Directions
3. Materials and Methods
3.1. Data Preprocessing Phase
3.1.1. Understanding the Dataset
3.1.2. Dataset Preprocessing
3.2. Fine-Tuning and Sentiment Analysis Phase
3.2.1. SVM Sentiment Classification with Hyperparameter Optimization
3.2.2. Random Forest Optimization and Evaluation
3.2.3. Logistic Regression Optimization and Evaluation
3.2.4. Fine-Tuning and Predictive Analysis of BERT Model
3.2.5. Fine-Tuning and Predictive Analysis of FinBERT Model
3.2.6. Fine-Tuning and Predictive Analysis of GPT Models
- Model-Agnostic Content Design: The prompt was formulated to be adaptable across different LLM architectures, ensuring that it was not reliant on any specific model framework. This approach enabled seamless integration with multiple LLMs by emphasizing clear task communication with contextually relevant instructions.
- Structured Output for Enhanced Accessibility: To ensure both human readability and machine interpretability, the response format adhered to standardized coding and accessibility principles. The output was structured in compliance with the JSON standard, facilitating logical organization and seamless processing by automated systems.
Listing 1. Model-agnostic prompt. | |||
conversation.append({ | (1) | ||
‘role’: ’user’, ‘content’: | |||
‘You are an AI assistant specializing in financial sentiment classification. Your task is to analyze each financial sentence and classify it as negative, positive, or neutral. Provide your final classification in the following JSON format without explanations: {“Sentiment”: “sentiment_tag”}}. \nFinancial sentence: …’ | |||
}) |
Listing 2. Prompt and completion pairs—JSONL files. | ||
{“messages”: [ | (2) | |
{“role”: “system”,”content”: “You are an AI assistant specializing in financial sentiment classification.”}, {“role”: “user”, “content”: “You are an AI assistant specializing in financial sentiment classification. Your task is to analyze each financial sentence and classify it as negative, positive, or neutral. Provide your final classification in the following JSON format without explanations: {\”Sentiment\”: \”sentiment_tag\”}}. \nFinancial sentence: …”}, {“role”: “assistant”, “content”: “{\”Sentiment\”: \”neutral\”}”} | ||
]} |
4. Results
4.1. Zero-Shot Evaluation of GPT-4o and GPT-4o-Mini
4.2. Post Fine-Tuning Evaluation
4.2.1. GPT-4o vs. GPT-4o-Mini
4.2.2. BERT vs. Finbert
- Dataset size and diversity: BERT’s pretraining on a massive corpus of general text may give it robust semantic coverage, which can be advantageous for recognizing nuanced linguistic structures present in financial texts.
- Quality of financial pretraining: Although FinBERT is adapted for financial language, the specific pretraining corpus and domain coverage may not align perfectly with the style or topics in the fine-tuning dataset, leading to less benefit than expected.
- Adaptability limitations: BERT’s broader pretraining might enable greater flexibility and generalization during fine-tuning, whereas FinBERT, though domain-specific, may have overemphasized certain financial phraseologies that do not generalize fully to the test set.
4.2.3. Traditional Machine Learning Algorithms
4.3. Additional Insights
4.3.1. Performance Differences Across Sentiment Classes
4.3.2. Model Robustness and Class Balance
4.3.3. Overfitting and Underfitting Considerations
4.3.4. Computational Trade-Offs
4.4. Prediction Time and Computational Cost Analysis
5. Discussion
5.1. Heatmap Analysis of Sentiment Classification
5.2. Research Findings and Limitations
6. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Agarwal, P., & Gupta, A. (2024, April 24–26). Strategic business insights through enhanced financial sentiment analysis: A fine-tuned llama 2 approach. 7th International Conference on Inventive Computation Technologies, ICICT 2024 (pp. 1446–1453), Kathmandu, Nepal. [Google Scholar] [CrossRef]
- Arami, M., Balina, S., Chang, V., Kim, J., Kim, H.-S., & Choi, S.-Y. (2023). Forecasting the S&P 500 index using mathematical-based sentiment analysis and deep learning models: A FinBERT transformer model and LSTM. Axioms, 12(9), 835. [Google Scholar] [CrossRef]
- Baghavathi Priya, S., Kumar, M., Nitheesh Prakash, J. D., & Krithika, N. (2025, February 5–7). Advanced financial sentiment analysis using FinBERT to explore sentiment dynamics. 3rd International Conference on Intelligent Data Communication Technologies and Internet of Things, IDCIoT 2025 (pp. 889–897), Bengaluru, India. [Google Scholar] [CrossRef]
- Consoli, S., Barbaglia, L., & Manzan, S. (2022). Fine-grained, aspect-based sentiment analysis on economic and financial lexicon. Knowledge-Based Systems, 247, 108781. [Google Scholar] [CrossRef]
- Daudert, T. (2021). Exploiting textual and relationship information for fine-grained financial sentiment analysis. Knowledge-Based Systems, 230, 107389. [Google Scholar] [CrossRef]
- Deng, X., Bashlovkina, V., Han, F., Baumgartner, S., & Bendersky, M. (2023, April 30–May 4). LLMs to the moon? Reddit market sentiment analysis with large language models. ACM Web Conference 2023—Companion of the World Wide Web Conference, WWW 2023 (pp. 1014–1019), New York, NY, USA. [Google Scholar] [CrossRef]
- Dmonte, A., Ko, E., & Zampieri, M. (2024, December 15–18). An evaluation of large language models in financial sentiment analysis. 2024 IEEE international Conference on Big Data (BigData) (pp. 4869–4874), Washington DC, USA. [Google Scholar] [CrossRef]
- Du, K., Xing, F., & Cambria, E. (2023). Incorporating multiple knowledge sources for targeted aspect-based financial sentiment analysis. ACM Transactions on Management Information Systems, 14(3), 23. [Google Scholar] [CrossRef]
- Du, K., Xing, F., Mao, R., & Cambria, E. (2024). Financial Sentiment analysis: Techniques and applications. ACM Computing Surveys, 56(9), 220. [Google Scholar] [CrossRef]
- Duan, G., Yan, S., & Zhang, M. (2024). A hybrid neural network model for sentiment analysis of financial texts using topic extraction, pre-trained model, and enhanced attention mechanism methods. IEEE Access, 12, 98207–98224. [Google Scholar] [CrossRef]
- Farimani, S. A., Jahan, M. V., Fard, A. M., & Haffari, G. (2021, October 6–9). Leveraging latent economic concepts and sentiments in the news for market prediction. 2021 IEEE 8th International Conference on Data Science and Advanced Analytics, DSAA 2021, Porto, Portugal. [Google Scholar] [CrossRef]
- Fatouros, G., Soldatos, J., Kouroumali, K., Makridis, G., & Kyriazis, D. (2023). Transforming sentiment analysis in the financial domain with ChatGPT. Machine Learning with Applications, 14, 100508. [Google Scholar] [CrossRef]
- Gutiérrez-Fandiño, A., Kolm, P. N., Alonso, M. N. I., & Armengol-Estapé, J. (2021). FinEAS: Financial embedding analysis of sentiment. Journal of Financial Data Science, 4(3), 45–53. [Google Scholar] [CrossRef]
- Hajek, P., & Munk, M. (2023). Speech emotion recognition and text sentiment analysis for financial distress prediction. Neural Computing and Applications, 35(29), 21463–21477. [Google Scholar] [CrossRef]
- Howarth, J. (2025). Number of parameters in GPT-4 (latest data). Available online: https://explodingtopics.com/blog/gpt-parameters (accessed on 20 April 2025).
- Huang, A. H., Wang, H., & Yang, Y. (2023). FinBERT: A large language model for extracting information from financial text. Contemporary Accounting Research, 40(2), 806–841. [Google Scholar] [CrossRef]
- Hugging Face. (2025). bert-base-uncased hugging face. Available online: https://huggingface.co/bert-base-uncased (accessed on 20 April 2025).
- Leippold, M. (2023). Sentiment spin: Attacking financial sentiment with GPT-3. Finance Research Letters, 55, 103957. [Google Scholar] [CrossRef]
- Liu, Z., Huang, D., Huang, K., Li, Z., & Zhao, J. (2020, July 11–17). FinBERT: A pre-trained financial language representation model for financial text mining. Twenty-Ninth International Joint Conference on Artificial Intelligence Special Track on AI in FinTech, Yokohama, Japan. Available online: https://dl.acm.org/doi/abs/10.5555/3491440.3492062 (accessed on 20 April 2025).
- Malo, P., & Sinha, A. (2024). takala/financial_phrasebank datasets at hugging face. Available online: https://huggingface.co/datasets/takala/financial_phrasebank (accessed on 20 April 2025).
- Malo, P., Sinha, A., Korhonen, P., Wallenius, J., & Takala, P. (2014). Good debt or bad debt: Detecting semantic orientations in economic texts. Journal of the Association for Information Science and Technology, 65(4), 782–796. [Google Scholar] [CrossRef]
- Mathebula, M., Modupe, A., & Marivate, V. (2024). Fine-tuning retrieval-augmented generation with an auto-regressive language model for sentiment analysis in financial reviews. Applied Sciences, 14(23), 10782. [Google Scholar] [CrossRef]
- Nasiopoulos, D., Roumeliotis, K., Sakas, D., Toudas, K., & Reklitis, P. (2025). GitHub—Applied-AI-research-lab/financial-sentiment-analysis-and-classification-deep-learning-models. Available online: https://github.com/Applied-AI-Research-Lab/Financial-Sentiment-Analysis-and-Classification-Deep-Learning-Models (accessed on 20 April 2025).
- Pretrained models. (2025). Pretrained models—transformers 3.3.0 documentation. Available online: https://huggingface.co/transformers/v3.3.1/pretrained_models.html (accessed on 20 April 2025).
- Qian, C., Mathur, N., Zakaria, N. H., Arora, R., Gupta, V., & Ali, M. (2022). Understanding public opinions on social media for financial sentiment analysis using AI-based techniques. Information Processing & Management, 59(6), 103098. [Google Scholar] [CrossRef]
- Roumeliotis, K. I., Tselikas, N. D., & Nasiopoulos, D. K. (2024). LLMs and NLP models in cryptocurrency sentiment analysis: A comparative classification study. Big Data and Cognitive Computing, 8(6), 63. [Google Scholar] [CrossRef]
- Roumeliotis, K. I., Tselikas, N. D., & Nasiopoulos, D. K. (2025). Fake news detection and classification: A comparative study of convolutional neural networks, large language models, and natural language processing models. Future Internet, 17(1), 28. [Google Scholar] [CrossRef]
- Sbhatti. (2021). Financial sentiment analysis. Available online: https://www.kaggle.com/datasets/sbhatti/financial-sentiment-analysis (accessed on 20 April 2025).
- Shobayo, O., Adeyemi-Longe, S., Popoola, O., & Ogunleye, B. (2024). Innovative sentiment analysis and prediction of stock price using FinBERT, GPT-4 and logistic regression: A data-driven approach. Big Data and Cognitive Computing, 8(11), 143. [Google Scholar] [CrossRef]
- Sidogi, T., Mbuvha, R., & Marwala, T. (2021, October 17–20). Stock price prediction using sentiment analysis. Conference Proceedings—IEEE International Conference on Systems, Man and Cybernetics (pp. 46–51), Melbourne, Australia. [Google Scholar] [CrossRef]
- Sy, E., Peng, T.-C., Lin, H.-Y., Huang, S.-H., Chang, Y.-C., & Chung, C.-P. (2025). Ensemble BERT techniques for financial sentiment analysis and argument understanding with linguistic features in social media Analytics. Journal of Information Science and Engineering, 41(3), 579–599. [Google Scholar] [CrossRef]
- Štrimaitis, R., Stefanovič, P., Ramanauskaitė, S., & Slotkienė, A. (2021). Financial context news sentiment analysis for the lithuanian language. Applied Sciences, 11(10), 4443. [Google Scholar] [CrossRef]
- Todd, A., Bowden, J., & Moshfeghi, Y. (2024). Text-based sentiment analysis in finance: Synthesising the existing literature and exploring future directions. Intelligent Systems in Accounting, Finance and Management, 31(1), e1549. [Google Scholar] [CrossRef]
- Xiang, C., Zhang, J., Li, F., Fei, H., & Ji, D. (2022). A semantic and syntactic enhanced neural model for financial sentiment analysis. Information Processing & Management, 59(4), 102943. [Google Scholar] [CrossRef]
- Xing, F. (2024). Designing heterogeneous LLM agents for financial sentiment analysis. ACM Transactions on Management Information Systems, 16(5), 24. [Google Scholar] [CrossRef]
- Yang, J., Wang, Y., & Li, X. (2022). Prediction of stock price direction using the LASSO-LSTM model combines technical indicators and financial sentiment analysis. PeerJ Computer Science, 8, e1148. [Google Scholar] [CrossRef]
- Yang, Y., Christopher, M., UY, S., & Huang, A. (2020a). GitHub—yya518/FinBERT: A pretrained BERT model for financial communications. Available online: https://github.com/yya518/FinBERT (accessed on 20 April 2025).
- Yang, Y., Christopher, M., Uy, S., & Huang, A. (2020b, July 11–17). FinBERT: A pretrained language model for financial communications. Twenty-Ninth International Joint Conference on Artificial Intelligence Special Track on AI in FinTech, Yokohama, Japan. Available online: https://arxiv.org/abs/2006.08097v2 (accessed on 20 April 2025).
- Yekrangi, M., & Abdolvand, N. (2021). Financial markets sentiment analysis: Developing a specialized Lexicon. Journal of Intelligent Information Systems, 57(1), 127–146. [Google Scholar] [CrossRef]
- Zhang, B., Yang, H., & Liu, X.-Y. (2023). Instruct-FinGPT: Financial sentiment analysis by instruction tuning of general-purpose large language models. SSRN Electronic Journal. [Google Scholar] [CrossRef]
- Zhang, K., Zhou, F., Wu, L., Xie, N., & He, Z. (2024). Semantic understanding and prompt engineering for large-scale traffic data imputation. Information Fusion, 102, 102038. [Google Scholar] [CrossRef]
- Zhao, L., Li, L., Zheng, X., & Zhang, J. (2021, May 5–7). A BERT based sentiment analysis and key entity detection approach for online financial texts. 2021 IEEE 24th International Conference on Computer Supported Cooperative Work in Design, CSCWD 2021 (pp. 1233–1238), Dalian, China. [Google Scholar] [CrossRef]
- Zhao, S., Guo, Y., Sheng, Q., & Shyr, Y. (2014). Advanced heat map and clustering analysis using Heatmap3. BioMed Research International, 2014(1), 986048. [Google Scholar] [CrossRef]
Authors (Year) | Topic | Key Findings |
---|---|---|
(Dmonte et al., 2024) | Transformer-Based Models for FSA |
|
(Fatouros et al., 2023) | Transformer-Based Models for FSA |
|
(Sidogi et al., 2021) | Transformer-Based Models for FSA |
|
(Farimani et al., 2021) | Transformer-Based Models for FSA |
|
(B. Zhang et al., 2023) | Retrieval-Augmented and Instruction-Tuned Approaches |
|
(L. Zhao et al., 2021) | Retrieval-Augmented and Instruction-Tuned Approaches |
|
(Mathebula et al., 2024) | Retrieval-Augmented and Instruction-Tuned Approaches |
|
(Agarwal & Gupta, 2024) | Retrieval-Augmented and Instruction-Tuned Approaches |
|
(Gutiérrez-Fandiño et al., 2021) | Domain-Specific Fine-Tuning and Lexicon-Based Methods |
|
(Consoli et al., 2022) | Domain-Specific Fine-Tuning and Lexicon-Based Methods |
|
(Yekrangi & Abdolvand, 2021) | Domain-Specific Fine-Tuning and Lexicon-Based Methods |
|
(Štrimaitis et al., 2021) | Domain-Specific Fine-Tuning and Lexicon-Based Methods |
|
(Xiang et al., 2022) | Semantic and Syntactic Enhancements |
|
(Daudert, 2021) | Semantic and Syntactic Enhancements |
|
(Xing, 2024) | Multi-Agent and Hybrid Frameworks |
|
(J. Yang et al., 2022) | Multi-Agent and Hybrid Frameworks |
|
(Duan et al., 2024) | Multi-Agent and Hybrid Frameworks |
|
(Qian et al., 2022) | Multimodal and Social Media–Focused Approaches |
|
(Deng et al., 2023) | Multimodal and Social Media–Focused Approaches |
|
(Todd et al., 2024) | Multimodal and Social Media–Focused Approaches |
|
(Hajek & Munk, 2023) | Multimodal and Social Media–Focused Approaches |
|
(Sy et al., 2025) | Multimodal and Social Media–Focused Approaches |
|
(Leippold, 2023) | Adversarial Attacks and Model Robustness |
|
Model | Accuracy | Precision | Recall | F1 |
---|---|---|---|---|
base:gpt-4o-2024-08-06 | 0.7984 | 0.8171 | 0.7984 | 0.7997 |
ft:gpt-4o | 0.8779 | 0.8786 | 0.8779 | 0.8769 |
base:gpt-4o-mini-2024-07-18 | 0.7752 | 0.7909 | 0.7752 | 0.7766 |
ft:gpt-4o-mini | 0.8779 | 0.8774 | 0.8779 | 0.8773 |
ft:bert | 0.812 | 0.815 | 0.812 | 0.8116 |
ft:finbert | 0.8004 | 0.8004 | 0.8004 | 0.8004 |
t:svm | 0.6453 | 0.6568 | 0.6453 | 0.6438 |
t:random-forest | 0.6531 | 0.6555 | 0.6531 | 0.6531 |
t:logistic-regression | 0.6492 | 0.6589 | 0.6492 | 0.6474 |
Model | Mean Prediction Time | Total Time (for 516 Sentences) | Prediction Cost ($) |
---|---|---|---|
base:gpt-4o-2024-08-06 | 1.26 | 650.92 | 0.17 |
ft:gpt-4o | 1.89 | 976.28 | 0.25 |
base:gpt-4o-mini-2024-07-18 | 0.73 | 374.83 | 0.02 |
ft:gpt-4o-mini | 0.78 | 404.15 | 0.03 |
ft:bert | 0.01 | 5.94 | 0 |
ft:finbert | 0.01 | 6.05 | 0 |
t:svm | 0.002 | 0.92 | 0 |
t:random-forest | 0.04 | 22.18 | 0 |
t:logistic-regression | 0.0008 | 0.43 | 0 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Nasiopoulos, D.K.; Roumeliotis, K.I.; Sakas, D.P.; Toudas, K.; Reklitis, P. Financial Sentiment Analysis and Classification: A Comparative Study of Fine-Tuned Deep Learning Models. Int. J. Financial Stud. 2025, 13, 75. https://doi.org/10.3390/ijfs13020075
Nasiopoulos DK, Roumeliotis KI, Sakas DP, Toudas K, Reklitis P. Financial Sentiment Analysis and Classification: A Comparative Study of Fine-Tuned Deep Learning Models. International Journal of Financial Studies. 2025; 13(2):75. https://doi.org/10.3390/ijfs13020075
Chicago/Turabian StyleNasiopoulos, Dimitrios K., Konstantinos I. Roumeliotis, Damianos P. Sakas, Kanellos Toudas, and Panagiotis Reklitis. 2025. "Financial Sentiment Analysis and Classification: A Comparative Study of Fine-Tuned Deep Learning Models" International Journal of Financial Studies 13, no. 2: 75. https://doi.org/10.3390/ijfs13020075
APA StyleNasiopoulos, D. K., Roumeliotis, K. I., Sakas, D. P., Toudas, K., & Reklitis, P. (2025). Financial Sentiment Analysis and Classification: A Comparative Study of Fine-Tuned Deep Learning Models. International Journal of Financial Studies, 13(2), 75. https://doi.org/10.3390/ijfs13020075