Enhancing sarcasm detection on social media: A comprehensive study using LLMs and BERT with multi-headed attention on SARC


Zhang L. Faseeh M. Ali Naqvi S.S. Hu L. Ghani A.
November 2025Public Library of Science

PLOS ONE
2025#20Issue 11 November

Sarcasm detection in natural language processing (NLP) remains a complex challenge, especially in social media, where contextual clues are often subtle. This study addresses this challenge by leveraging transformer-based models, including BERT, GPT-3, Claude-2, and Llama-2, for sarcasm detection on a large dataset from the Self-Annotated Reddit Corpus (SARC). The proposed method utilizes multi-head attention mechanisms to enhance model performance by capturing nuanced contextual relationships in the text. Fine-tuning of BERT, GPT-3, and Llama-2 was conducted to ensure a fair comparison and to provide a more detailed understanding of sarcasm in context. Our BERT-based model achieved state-of-the-art performance, with precision, recall, F1 score, and accuracy of 0.918, 0.917, 0.917, and 0.917, respectively, outperforming the other models. The effectiveness of our approach is demonstrated through rigorous statistical validation, ablation studies, and error analysis, providing robust evidence of its superiority. This study also highlights the significance of fine-tuning, machine translation, and multi-head attention in improving sarcasm detection.



Text of the article Перейти на текст статьи

School of Foreign Studies, Hunan First Normal University, Hunan, Changsha, China
Department of Computer Science, COMSATS University Islamabad, Attock Campus, Punjab, Pakistan
Department of Electrical Engineering, COMSATS University Islamabad, Attock Campus, Punjab, Pakistan
Department of Computer Science, International Islamic University, Islamabad, Pakistan
Department of Computer Science, School of Engineering and Digital Sciences, Nazarbayev University, Astana, Kazakhstan

School of Foreign Studies
Department of Computer Science
Department of Electrical Engineering
Department of Computer Science
Department of Computer Science

10 лет помогаем публиковать статьи Международный издатель

Книга Публикация научной статьи Волощук 2026 Book Publication of a scientific article 2026