Skip to main content
QUICK REVIEW

[论文解读] Offensive Language and Hate Speech Detection with Deep Learning and Transfer Learning

Bencheng Wei, Jason Li|arXiv (Cornell University)|Aug 6, 2021
Hate Speech and Cyberbullying Detection参考文献 1被引用 19
一句话总结

本文提出了一种结合双向LSTM与迁移学习(使用BERT、DistilBERT和GPT-2)的深度学习方法,用于将推文分类为仇恨言论、冒犯性语言或两者皆非。基于一个包含24,783条推文的公开数据集,经过超参数调优后,作者实现了超过92%的准确率,其中ALBERT模型在各类迁移学习架构中表现最佳。

ABSTRACT

Toxic online speech has become a crucial problem nowadays due to an exponential increase in the use of internet by people from different cultures and educational backgrounds. Differentiating if a text message belongs to hate speech and offensive language is a key challenge in automatic detection of toxic text content. In this paper, we propose an approach to automatically classify tweets into three classes: Hate, offensive and Neither. Using public tweet data set, we first perform experiments to build BI-LSTM models from empty embedding and then we also try the same neural network architecture with pre-trained Glove embedding. Next, we introduce a transfer learning approach for hate speech detection using an existing pre-trained language model BERT (Bidirectional Encoder Representations from Transformers), DistilBert (Distilled version of BERT) and GPT-2 (Generative Pre-Training). We perform hyper parameters tuning analysis of our best model (BI-LSTM) considering different neural network architectures, learn-ratings and normalization methods etc. After tuning the model and with the best combination of parameters, we achieve over 92 percent accuracy upon evaluating it on test data. We also create a class module which contains main functionality including text classification, sentiment checking and text data augmentation. This model could serve as an intermediate module between user and Twitter.

研究动机与目标

  • 为应对日益严峻的网络有毒言论挑战,特别是社交媒体内容中的仇恨言论与冒犯性语言问题。
  • 开发一种自动化、可扩展的解决方案,将推文分类为三类:仇恨言论、冒犯性语言或两者皆非。
  • 通过利用预训练语言模型(如BERT、DistilBERT和GPT-2)进行迁移学习,提升分类准确率。
  • 通过Keras Tuner进行超参数调优,重点优化学习率、dropout率和全连接层配置,以优化模型性能。
  • 构建一个可重用、模块化的NLP流水线,用于文本分类、情感分析及品牌安全应用中的数据增强。

提出的方法

  • 作者使用随机初始化和预训练的GloVe词向量训练双向LSTM模型,以建立文本分类的基线性能。
  • 采用三种预训练模型(BERT、DistilBERT和GPT-2)进行迁移学习,对三分类仇恨言论分类任务进行微调。
  • 使用Keras Tuner库进行超参数调优,优化LSTM和全连接层的隐藏单元数、dropout率和学习率。
  • 模型以批量大小128和20个周期进行训练,使用Adam优化器和分类交叉熵损失函数。
  • 开发了一个自定义类模块,支持文本分类、通过TextBlob进行情感分析,以及数据增强以提升模型鲁棒性。
  • 通过测试数据评估模型性能,采用准确率、混淆矩阵,以及假阳性和假阴性预测的成本效益分析进行综合评估。

实验结果

研究问题

  • RQ1BERT、DistilBERT和GPT-2等迁移学习模型是否能在分类冒犯性语言和仇恨言论方面优于使用随机或GloVe词向量的传统双向LSTM模型?
  • RQ2在该数据集上,如何确定最大化分类准确率的最优超参数组合(如学习率、dropout率、隐藏单元数)?
  • RQ3假阳性和假阴性预测对品牌安全有何影响?如何通过优化模型性能来最小化高成本的误分类?
  • RQ4数据不平衡在多大程度上影响模型性能?数据增强与归一化技术在缓解该问题方面效果如何?
  • RQ5是否可以构建一个模块化、可重用的NLP流水线,以支持社交媒体监控中的实时冒犯性语言检测?

主要发现

  • 表现最佳的模型为微调后的ALBERT基线迁移学习模型,在测试集上准确率超过92%,优于使用随机词向量的双向LSTM模型及其他迁移学习模型。
  • 超参数调优显著提升了模型性能,最优配置包括352和320个LSTM单元、0.65和0.80的dropout率,以及0.0001的学习率。
  • 在所有迁移学习模型中,基础ALBERT模型表现最佳,其次为DistilBERT和GPT-2,表明小型、蒸馏模型在本任务中具有优异性能。
  • 使用TextBlob进行情感分析发现,仇恨言论和冒犯性语言类推文的主观性(≈0.4)相近,但极性更负,高于中性推文(主观性≈0.3)。
  • 模型在区分冒犯性语言与中性内容方面表现出色,但类别0(仇恨言论)与类别1(冒犯性语言)存在词汇重叠,增加了分类难度。
  • 提供了一个公开的GitHub仓库,包含Jupyter笔记本,支持ALBERT基模型的可复现性与在真实品牌安全应用中的部署。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。