Hate Speech Detection: Leveraging LLM-GPT2 with Fine-Tuning and Multi-Shot Techniques

Hate Speech can be referred as any type of communication that can degrade, discriminates against or prejudice or incites violence against groups or individual based on certain factors such as religion, race, nationality, skin color, gender etc. It is very crucial to detect hate speech to stop the harm or violence against targeted individuals or groups and to create safe and inclusive environment. In this paper, the performance of two large language model-based approaches were investigated. In the first approach, fine-tuning of GPT-2 model was performed using a hate-speech dataset and then evaluated the fine-tuned GPT model for hate speech detection. In the second approach, n-shot learning based approaches were used for value of n as zero, one and two, where prompt designing was done first and then ask the GPT model to detect if the given text is expressing hate based on the given prompt on test data. All the experiments were carried out on publicly available ‘HatEval’ dataset. Experimental results show that few(n) shot learning does not necessarily surpass lesser(<n) shot learning techniques in GPT-2 because it depends on the prompt, which contains instruction and selected examples for shots as zero-shot technique has better performance than one and two-shot. Also, the fine-tuning the GPT-2 model performs better than zero-shot technique in this task. Source code and other data is available at https://github.com/mahimacs/GPT2-for-Hate-Speech-Detection .

Authors

Institutions

Publication Details

Journal
Procedia Computer Science
Published
2025-01-01
DOI
https://doi.org/10.1016/j.procs.2025.04.542
Citations
7
Primary Topic
Hate Speech and Cyberbullying Detection
Type
article
Field-Weighted Citation Impact
17.37
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Hate Speech Detection: Leveraging LLM-GPT2 with Fine-Tuning and Multi-Shot Techniques

Vishnu Goyal, Mahima Choudhary, Basant Agarwal
7 citations
Procedia Computer Science
Hate Speech and Cyberbullying Detection
17.37
article

Hate Speech Detection: Leveraging LLM-GPT2 with Fine-Tuning and Multi-Shot Techniques

Vishnu Goyal, Mahima Choudhary, Basant Agarwal
article en
7 citations

Abstract

Hate Speech can be referred as any type of communication that can degrade, discriminates against or prejudice or incites violence against groups or individual based on certain factors such as religion, race, nationality, skin color, gender etc. It is very crucial to detect hate speech to stop the harm or violence against targeted individuals or groups and to create safe and inclusive environment. In this paper, the performance of two large language model-based approaches were investigated. In the first approach, fine-tuning of GPT-2 model was performed using a hate-speech dataset and then evaluated the fine-tuned GPT model for hate speech detection. In the second approach, n-shot learning based approaches were used for value of n as zero, one and two, where prompt designing was done first and then ask the GPT model to detect if the given text is expressing hate based on the given prompt on test data. All the experiments were carried out on publicly available ‘HatEval’ dataset. Experimental results show that few(n) shot learning does not necessarily surpass lesser(<n) shot learning techniques in GPT-2 because it depends on the prompt, which contains instruction and selected examples for shots as zero-shot technique has better performance than one and two-shot. Also, the fine-tuning the GPT-2 model performs better than zero-shot technique in this task. Source code and other data is available at https://github.com/mahimacs/GPT2-for-Hate-Speech-Detection .

Procedia Computer ScienceVol. 258
The Federal Polytechnic, Ado-Ekiti (NG), Central University of Rajasthan (IN)
Peace, Justice and strong institutions
Openalex Percentile: Top 1%
Hate Speech and Cyberbullying Detection
17.37
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.