Prompt-based fine-tuning with multilingual transformers for language-independent sentiment analysis
- PMID: 40595680
- PMCID: PMC12215489
- DOI: 10.1038/s41598-025-03559-7
Prompt-based fine-tuning with multilingual transformers for language-independent sentiment analysis
Abstract
In the era of global digital communication, understanding user sentiment across multiple languages is a critical challenge with wide-ranging applications in opinion mining, customer feedback analysis, and social media monitoring. This study advances the field of language-independent sentiment analysis by leveraging prompt-based fine-tuning with state-of-the-art transformer models. The performance of classical machine learning approaches, hybrid deep learning architectures, and multilingual transformer models is evaluated across eight typologically diverse languages: Arabic, English, French, German, Hindi, Italian, Portuguese, and Spanish. Baseline models are established using traditional machine learning approaches such as Support Vector Machines (SVM) and Logistic Regression, with feature extraction methods like TF-IDF. A hybrid deep learning model is introduced, combining Long Short-Term Memory (LSTM) and Convolutional Neural Networks (CNNs) to capture local and sequential text patterns. Building on these, pre-trained multilingual transformer models, specifically BERT-base-multilingual and XLM-RoBERTa, are fine-tuned for language-independent sentiment classification tasks. The key contribution lies in the implementation of prompt-based fine-tuning strategies for language independent sentiment analysis. Using (1) prefix prompts and (2) cloze-style prompts, a unified framework is established that employs templates designed in one language and evaluates their performance on data from the remaining languages. Experimental results demonstrate that transformer models, particularly XLM-RoBERTa with prompt-based fine-tuning outperform both classical and deep learning methods. With only 32 training examples per class, prefix prompts produce results comparable to standard fine-tuning, which typically uses 70-80% of the data for training. This highlights the potential of prompt-based learning for scalable, multilingual sentiment analysis in diverse language settings.
© 2025. The Author(s).
Conflict of interest statement
Declarations. Competing interests: The authors declare no competing interests.
Figures



Similar articles
-
Sentiment analysis in multilingual context: Comparative analysis of machine learning and hybrid deep learning models.Heliyon. 2023 Sep 19;9(9):e20281. doi: 10.1016/j.heliyon.2023.e20281. eCollection 2023 Sep. Heliyon. 2023. PMID: 37809397 Free PMC article.
-
Trajectory-Ordered Objectives for Self-Supervised Representation Learning of Temporal Healthcare Data Using Transformers: Model Development and Evaluation Study.JMIR Med Inform. 2025 Jun 4;13:e68138. doi: 10.2196/68138. JMIR Med Inform. 2025. PMID: 40465350 Free PMC article.
-
Multilingual identification of nuanced dimensions of hope speech in social media texts.Sci Rep. 2025 Jul 23;15(1):26783. doi: 10.1038/s41598-025-10683-x. Sci Rep. 2025. PMID: 40702008 Free PMC article.
-
Health professionals' experience of teamwork education in acute hospital settings: a systematic review of qualitative literature.JBI Database System Rev Implement Rep. 2016 Apr;14(4):96-137. doi: 10.11124/JBISRIR-2016-1843. JBI Database System Rev Implement Rep. 2016. PMID: 27532314
-
Signs and symptoms to determine if a patient presenting in primary care or hospital outpatient settings has COVID-19.Cochrane Database Syst Rev. 2022 May 20;5(5):CD013665. doi: 10.1002/14651858.CD013665.pub3. Cochrane Database Syst Rev. 2022. PMID: 35593186 Free PMC article.
References
-
- Chang, T. A. & Bergen, B. K. Language model behavior: A comprehensive survey. Comput. Linguistics50, 293–350 (2024).
-
- Varda, A. G. D. & Marelli, M. Data-driven cross-lingual syntax: An agreement study with massively multilingual models. Comput. Linguistics49, 261–299. 10.1162/coli_a_00472 (2023).
-
- Mohammad, S. M. Ethics sheet for automatic emotion recognition and sentiment analysis. Comput. Linguistics48, 239–278 (2022).
LinkOut - more resources
Full Text Sources
Miscellaneous