A Comparative Analysis of Transformer Architectures for Sentiment and Emotion Classification
Abstract
This paper is a comparison of four Transformer model (BERT, ALBERT, T5, and XLNet) in the case of sentiment analysis of tasks based on data from social media. Used were two data sets: the X (Twitter) data set with tweets of messages related to games and the Emotion data set labeled in the anger, joy, and fear categories. Trained was the model in the same settings of preprocessing, training, as well as in the test settings for 3, 5, 7, and 10 epochs. Presented were results that indicated that the accuracy increased with the higher number of epochs. The maximum accuracies occurred in the case of the BERT model—88.63% in the case of the X data set as well as in the case of the Emotion data set, 97.05%. XLNet established great potential for long-range dependencies, and ALBERT obtained balanced performance due to lightweight architecture. On the contrary, performance of T5 was less in comparison to others. Generally, it could be inferred that Transformer architecture is superior to traditional machine learning technique in the context of sentiment analysis due to higher accuracy and better contextual understanding.
Keywords
References
- [1] P. Nandwani and R. Verma, “A review on sentiment analysis and emotion detection from text,” Soc Netw Anal Min, vol. 11, no. 1, p. 81, 2021.
- [2] S. Ghosh, A. Ekbal, and P. Bhattacharyya, “Natural language processing and sentiment analysis: perspectives from computational intelligence,” in Computational intelligence applications for text and sentiment data analysis, Elsevier, 2023, pp. 17–47.
- [3] E. Kına, “TRANSFORMER TABANLI DUYGU SINIFLANDIRMASI İLE SOSYAL MEDYADA RUH SAĞLIĞINA İLİŞKİN TÜRKÇE YORUMLARIN ANALİZİ,” Kahramanmaraş Sütçü İmam Üniversitesi Mühendislik Bilimleri Dergisi, vol. 28, no. 3, pp. 1499–1511, 2025.
- [4] E. Kına and E. Biçek, “Machine Learning Approach for Emotion Identification and Classification in Bitcoin Sentiment Analysis,” Yüzüncü Yıl Üniversitesi Fen Bilimleri Enstitüsü Dergisi, vol. 29, no. 3, pp. 913–926, 2024, doi: https://doi.org/10.53433/yyufbed.1532649.
- [5] E. Kına and E. Biçek, “Tweetlerin Duygu Analizi İçin Hibrit Bir Yaklaşım,” Doğu Fen Bilimleri Dergisi, vol. 6, no. 1, pp. 57–68, 2023, doi: 10.57244/DFBD.1314901.
- [6] H. Bashiri and H. Naderi, “Comprehensive review and comparative analysis of transformer models in sentiment analysis,” Knowl Inf Syst, vol. 66, no. 12, pp. 7305–7361, Dec. 2024, doi: 10.1007/S10115-024-02214-3/FIGURES/10.
- [7] F. A. Acheampong, H. Nunoo-Mensah, and W. Chen, “Transformer models for text-based emotion detection: a review of BERT-based approaches,” Artif Intell Rev, vol. 54, no. 8, pp. 5789–5829, Dec. 2021, doi: 10.1007/S10462-021-09958-2/TABLES/18.
- [8] A. Areshey and H. Mathkour, “Exploring transformer models for sentiment classification: A comparison of BERT, RoBERTa, ALBERT, DistilBERT, and XLNet,” Expert Syst, vol. 41, no. 11, p. e13701, Nov. 2024, doi: 10.1111/EXSY.13701.
Details
Primary Language
English
Subjects
Software Engineering (Other)
Journal Section
Research Article
Authors
Hayrullah Temel
This is me
0009-0008-2340-7934
Türkiye
Erol Kına
*
0000-0002-7785-646X
Türkiye
Publication Date
December 31, 2025
Submission Date
October 13, 2025
Acceptance Date
November 10, 2025
Published in Issue
Year 2025 Volume: 13 Number: 4
