Toxicity Detection Using Large Language Models
摘要
Social media has reached unprecedented levels within the 21st century. Platforms such as Instagram, TikTok, Twitter/X, and Reddit enable hundreds of millions to billions of users to socialize with one another, share ideas, and engage with content. However, high volume of user activity on these platforms consists of a significant amount of harmful behavior, including the user of offensive language that can be considered toxic. To address this issue, algorithms have been developed to help mitigate this problem, with various solutions integrated into modern day systems. With the growing capabilities of artificial intelligence (AI), the usage of these AI related tools has shown promise in toxicity detection, intriguing interested companies, especially small businesses seeking to improve their customer support. Despite this, excessive cost associated with development and deployment of these models becomes a major challenge for small businesses and large companies. This paper evaluates three GPT-based models along a large-scale toxicity classification dataset to assess their baseline metrics. We then integrate prompt engineering techniques including role-prompting, followed with few-shot learning and various nuance detailing to construct more effective prompts to significantly improve model performance. Additionally, we fine-tune each model to further enhance their accuracy and implement a Retrieval Augmented Generation (RAG) approach to demonstrate further improvements in classification results. Lastly, we compare our enhanced models against their baseline counterparts and evaluate their generalizability capabilities using out-of-distribution datasets across multiple performance metrics.