Traditional Machine Learning and DistilBERT for Sentiment Analysis
Abstract
Sentiment analysis identifies opinion polarity in textual data and supports decision-making in review-rich digital environments. This study compares three approaches for binary sentiment classification on the Internet Movie Database (IMDb) movie review dataset, namely Term Frequency-Inverse Document Frequency (TF-IDF)+Naive Bayes, TF-IDF+Logistic Regression, and DistilBERT, a distilled version of Bidirectional Encoder Representations from Transformers (BERT). The comparison focuses on the performance-efficiency trade-off rather than accuracy alone. Models are evaluated by accuracy, precision, recall, F1 score, training time, and inference time under 20%, 50%, and 100% training-data settings. A representative rule-based error analysis is also conducted. Under the full training-data setting, DistilBERT achieves the highest F1 score of 0.914496, ahead of Logistic Regression at 0.883284 and Naive Bayes at 0.846688. However, relative to Logistic Regression, DistilBERT is approximately 175.69 times slower in training and 51.05 times slower in inference. DistilBERT trained with only 20% of the training data still exceeds the full-data F1 scores of both traditional baselines. The findings indicate that model selection should jointly consider effectiveness, efficiency, data scale, and error characteristics.
References
- Mao, Y., Liu, Q., & Zhang, Y. (2024). Sentiment analysis methods, applications, and challenges: A systematic literature review. Journal of King Saud University - Computer and Information Sciences, 36(4), Article 102048.
- Cui, J., Wang, Z., Ho, S.-B., & Cambria, E. (2023). Survey on sentiment analysis: Evolution of research methods and topics. Artificial Intelligence Review, 56, 8469–8510.
- Bordoloi, M., & Biswas, S. K. (2023). Sentiment analysis: A survey on design framework, applications and future scopes. Artificial Intelligence Review, 56(11), 12505–12560.
- Bashiri, H., & Naderi, H. (2024). Comprehensive review and comparative analysis of transformer models in sentiment analysis. Knowledge and Information Systems, 66, 7305–7361.
- Maas, A. L., Daly, R. E., Pham, P. T., Huang, D., Ng, A. Y., & Potts, C. (2011). Learning word vectors for sentiment analysis. In Proceedings of ACL-HLT 2011 (pp. 142–150).
- Salton, G., & Buckley, C. (1988). Term-weighting approaches in automatic text retrieval. Information Processing & Management, 24(5), 513–523.
- McCallum, A., & Nigam, K. (1998). A comparison of event models for naive Bayes text classification. In AAAI Workshop on Learning for Text Categorization (pp. 41–48).
- Fan, R.-E., Chang, K.-W., Hsieh, C.-J., Wang, X.-R., & Lin, C.-J. (2008). LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9, 1871–1874.
- Devlin, J., Chang, M.-W., Lee, K., & Toutanova, K. (2019). BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of NAACL-HLT 2019 (pp. 4171–4186).
- Sanh, V., Debut, L., Chaumond, J., & Wolf, T. (2019). DistilBERT, a distilled version of BERT: Smaller, faster, cheaper and lighter. arXiv preprint arXiv: 1910.01108.
- Pedregosa, F., et al. (2011). Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12, 2825–2830.
- Chitty-Venkata, K. T., Mittal, S., Emani, M., Vishwanath, V., & Somani, A. K. (2023). A survey of techniques for optimizing transformer inference. Journal of Systems Architecture, 144, Article 102990.
- Zhuang, B., Liu, J., Pan, Z., He, H., Weng, Y., & Shen, C. (2023). A survey on efficient training of transformers. In Proceedings of IJCAI-23 (pp. 6823–6831).
- Bolon-Canedo, V., Moran-Fernandez, L., Cancela, B., & Alonso-Betanzos, A. (2024). A review of green artificial intelligence: Towards a more sustainable future. Neurocomputing, 599, Article 128096.
- Chen, W., Lin, F., Li, G., & Liu, B. (2024). A survey of automatic sarcasm detection: Fundamental theories, formulation, datasets, detection methods, and opportunities. Neurocomputing, 578, Article 127428.
- Diwali, A., Saeedi, K., Dashtipour, K., Gogate, M., Cambria, E., & Hussain, A. (2024). Sentiment analysis meets explainable artificial intelligence: A survey on explainable sentiment analysis. IEEE Transactions on Affective Computing, 15(3), 837–846.
- Ilmawan, L. B., Muladi, & Prasetya, D. D. (2024). Negation handling for sentiment analysis task: Approaches and performance analysis. International Journal of Electrical and Computer Engineering, 14(3), 3382–3393.
- Nuci, K. P., Landes, P., & Di Eugenio, B. (2024). RoBERTa low resource fine tuning for sentiment analysis in Albanian. In Proceedings of LREC-COLING 2024 (pp. 14146–14151).
- Tay, Y., Dehghani, M., Bahri, D., & Metzler, D. (2022). Efficient transformers: A survey. ACM Computing Surveys, 55(6), Article 109, 1–28.