Dissertations, Theses, and Capstone Projects

Date of Degree

2-2025

Document Type

Master's Capstone Project

Degree Name

Master of Science

Program

Data Analysis & Visualization

Advisor

Michelle A. McSweeney

Committee Members

Matthew K. Gold

Subject Categories

Data Science

Keywords

Toxicity, Large Language Models, API, Comments, LLMs, training, Perspective

Abstract

The current online environment is increasingly being polluted by polarization, echo chambers, and a lack of constructive dialogue between individuals with differing viewpoints. Social media algorithms, while intended to personalize user experiences and marketing areas, have been heavily criticized for inadvertently amplifying extremist content and contributing to the spread of toxic commentary. The current state of the internet hinders productive conversations, fuels misinformation, entices disinformation and contributes to online and offline societal division. This is fueled by algorithms that can create echo chambers and by the anonymity given by online platforms. While tools like the Perspective API exist to identify toxic language, there remains a need to understand how different approaches to toxicity detection align. This capstone project compares a fine-tuned DistilBERT model with the Perspective API using publicly available datasets. The LLM was fine-tuned on ~160,000 Wikipedia comments from the Toxic Comment Classification Kaggle Competition, labeled for various toxicity types. Comparison was performed on 100 comments from the Unhealthy Comments Corpus, which labels different forms of unhealthiness but lacks a direct "toxic" label, enabling comparison of how the two systems interpret toxicity. Both datasets underwent preprocessing (special character removal, lowercasing, tokenization). DistilBERT was fine-tuned for 4 epochs using AdamW and binary cross-entropy loss. Comparing classifications (using thresholds of 0.12 for DistilBERT and 0.5 for Perspective API) revealed 40% agreement and a weak positive correlation (0.208) between outputs. Qualitative analysis showed DistilBERT to be more sensitive to general negativity/criticism, often classifying such comments as potentially toxic while Perspective API did not. This suggests that the two models have different interpretations of toxicity, with DistilBERT exhibiting a higher false positive rate in this comparison. This project contributes to a better understanding of the nuances of toxicity detection methods, highlighting the importance of considering multiple perspectives and conducting qualitative analysis when evaluating different models, and ultimately aims to inform the development of tools that promote more constructive online conversations.

Included in

Data Science Commons

Share

COinS