Abstract
Sentiment analysis is a crucial task in natural language processing (NLP) that involves the computational understanding and classification of emotions expressed in textual data. This paper presents a novel approach by fine-tuning the Llama 3 transformer model for sentiment analysis and leveraging AWS cloud infrastructure for enhanced performance and scalability. Our methodology employs advanced fine-tuning techniques, including parameter-efficient fine-tuning (PEFT) and hyperparameter optimization, to maximize the model’s efficacy in sentiment classification tasks. Our experimental results demonstrate substantial improvements across all evaluation metrics after fine-tuning. Specifically, the model’s accuracy increased from 0.333 to 0.923, precision from 0.33 to 0.92, recall from 0.98 to 0.89, and F1 score from 0.50 to 0.91. Comparative analysis with state-of-the-art models, such as BERT, RoBERTa, XLNet, and DistilBERT, highlights the superior performance of the proposed Llama 3 model. The integration of AWS infrastructure addresses the scalability and computational challenges inherent in sentiment analysis by ensuring efficient processing of large-scale datasets and reducing computational overhead. Additionally, our research systematically identifies existing gaps in the sentiment analysis literature, demonstrating how our innovative approach effectively bridges these gaps through the combination of cutting-edge fine-tuning techniques and cloud-based infrastructure. This work not only highlights the potential of Llama 3 for handling complex sentiment analysis tasks but also sets a new benchmark for future research in this domain. Our results have important implications for using advanced transformer models in NLP, making it possible to do a wide range of sentiment analysis tasks in a reliable and scalable way.



Similar content being viewed by others
Explore related subjects
Discover the latest articles, news and stories from top researchers in related subjects.Data availability
The dataset utilized for this research is publicly accessible on both Hugging Face and Kaggle. The references are provided below for your convenience: Kaggle Dataset: https://www.kaggle.com/datasets/sbhatti/financial-sentiment-analysis and Hugging Face Dataset: https://huggingface.co/datasets/takala/financial_phrasebank.
References
Dash DP, Kolekar M, Chakraborty C, Khosravi MR. Review of machine and deep learning techniques in epileptic seizure detection using physiological signals and sentiment analysis. ACM Trans Asian Low-Resour Lang Inf Process. 2024;23(1):1–29.
Rasappan P, Premkumar M, Sinha G, Chandrasekaran K. Transforming sentiment analysis for e-commerce product reviews: Hybrid deep learning model with an innovative term weighting and feature selection. Inf Process Manag. 2024;61(3): 103654.
Mao Y, Liu Q, Zhang Y. Sentiment analysis methods, applications, and challenges: a systematic literature review. J King Saud Univ-Comput Inf Sci. 2024;102048.
Jim JR, Talukder MAR, Malakar P, Kabir MM, Nur K, Mridha M. Recent advancements and challenges of nlp-based sentiment analysis: a state-of-the-art review. Nat Lang Process J. 2024;100059.
Wan B, Wu P, Yeo CK, Li G. Emotion-cognitive reasoning integrated bert for sentiment analysis of online public opinions on emergencies. Inf Process Manag. 2024;61(2): 103609.
Chauhan GS, Nahta R, Meena YK, Gopalani D. Aspect based sentiment analysis using deep learning approaches: a survey. Comput Sci Rev. 2023;49: 100576.
Subramanian M, Sathiskumar VE, Deepalakshmi G, Cho J, Manikandan G. A survey on hate speech detection and sentiment analysis using machine learning and deep learning models. Alex Eng J. 2023;80:110–21.
Bello A, Ng S-C, Leung M-F. A bert framework to sentiment analysis of tweets. Sensors. 2023;23(1):506.
Tan KL, Lee CP, Lim KM. Roberta-gru: A hybrid deep learning model for enhanced sentiment analysis. Appl Sci. 2023;13(6):3915.
Danyal MM, Khan SS, Khan M, Ullah S, Mehmood F, Ali I. Proposing sentiment analysis model based on bert and xlnet for movie reviews. Multimed Tools Appl. 2024;1–25.
Ghorbanali A, Sohrabi MK. A comprehensive survey on deep learning-based approaches for multimodal sentiment analysis. Artif Intell Rev. 2023;56(Suppl 1):1479–512.
Kora R, Mohammed A. An enhanced approach for sentiment analysis based on meta-ensemble deep learning. Soc Netw Anal Mining. 2023;13(1):38.
Sharma S, Vardhan M. Advancing precision agriculture: Enhanced weed detection using the optimized yolov8t model. Arab J Sci Eng. 2024;1–18.
Sharma S, Vardhan M. Mtjnet: Multi-task joint learning network for advancing medicinal plant and leaf classification. Knowl-Based Syst. 2024;112147.
Aziz K, Ji D, Chakrabarti P, Chakrabarti T, Iqbal MS, Abbasi R. Unifying aspect-based sentiment analysis bert and multi-layered graph convolutional networks for comprehensive sentiment dissection. Sci Rep. 2024;14(1):14646.
Alslaity A, Orji R. Machine learning techniques for emotion detection and sentiment analysis: current state, challenges, and future directions. Behav Inf Technol. 2024;43(1):139–64.
Alqaryouti O, Siyam N, Abdel Monem A, Shaalan K. Aspect-based sentiment analysis using smart government review data. Appl Comput Inform. 2024;20(1/2):142–61.
Miah MSU, Kabir MM, Sarwar TB, Safran M, Alfarhood S, Mridha M. A multimodal approach to cross-lingual sentiment analysis with ensemble of transformer and llm. Sci Rep. 2024;14(1):9603.
Malo P, Sinha A, Korhonen P, Wallenius J, Takala P. Good debt or bad debt: Detecting semantic orientations in economic texts. J Assoc Inf Sci Technol. 2014;65(4):782–96.
Talaat AS. Sentiment analysis classification system using hybrid bert models. J Big Data. 2023;10(1):110.
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Conflict of interest
There is no conflict of interest.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Kumar, S., Singh, S. Fine-Tuning Llama 3 for Sentiment Analysis: Leveraging AWS Cloud for Enhanced Performance. SN COMPUT. SCI. 5, 1161 (2024). https://doi.org/10.1007/s42979-024-03473-1
Received:
Accepted:
Published:
DOI: https://doi.org/10.1007/s42979-024-03473-1