An Explainable DistilBERT-BiLSTM-Attention Framework for Binary and Multi-Class Hate Speech Detection

An Explainable DistilBERT-BiLSTM-Attention Framework for Binary and Multi-Class Hate Speech Detection

一种用于二分类和多分类仇恨言论检测的可解释 DistilBERT-BiLSTM-Attention 框架

Abstract: Hate speech on social media poses serious risks to social harmony, mental well-being, and public safety, making its timely and accurate detection essential for content moderation systems. Most existing studies focus on binary classification, evaluated their frameworks on a single dataset, and provide limited insight into how decisions are made, which limits their real-world applicability. In addition, limited work is done on the explainability of their predictive inference.

摘要: 社交媒体上的仇恨言论对社会和谐、心理健康和公共安全构成了严重威胁,因此,内容审核系统必须能够及时且准确地检测出此类言论。目前大多数研究侧重于二分类,且仅在单一数据集上评估其框架,同时对决策过程的洞察有限,这限制了其在现实世界中的应用。此外,关于预测推理可解释性的研究也相对较少。

To address these challenges, this study proposes a multilevel and explainable hate speech detection framework. The proposed model integrates DistilBERT (Distilled Bidirectional Encoder Representations from Transformers) embeddings with a Bi-LSTM (Bidirectional Long Short-Term Memory) model, and an attention mechanism to capture both contextual meaning and sequential dependencies in text. To enhance trust and transparency, LIME (Local Interpretable Model-agnostic Explanations) is employed to explain model predictions by highlighting influential textual features.

为了应对这些挑战,本研究提出了一种多层次且可解释的仇恨言论检测框架。该模型集成了 DistilBERT(蒸馏双向编码器表示转换器)嵌入、Bi-LSTM(双向长短期记忆网络)模型以及注意力机制,以捕捉文本中的上下文含义和序列依赖关系。为了增强信任度和透明度,研究采用了 LIME(局部可解释模型无关解释)技术,通过突出显示具有影响力的文本特征来解释模型的预测结果。

The framework is evaluated on two benchmark datasets using both binary and multi-class classification to examine robustness and generalization. In addition, an ablation study is presented to highlight the significance of various components of proposed framework. For binary classification, the proposed model achieves F1-scores of 96.78% on the Davidson dataset and 99.53% on the SMHS dataset. In the multi-class setting, it attains F1-scores of 97.00% and 94.99% on the Davidson and SMHS datasets, respectively, outperforming existing baseline approaches.

该框架在两个基准数据集上进行了二分类和多分类评估,以检验其鲁棒性和泛化能力。此外,文中还进行了消融研究,以强调所提框架中各个组件的重要性。在二分类任务中,该模型在 Davidson 数据集上达到了 96.78% 的 F1 分数,在 SMHS 数据集上达到了 99.53%。在多分类设置中,其在 Davidson 和 SMHS 数据集上的 F1 分数分别为 97.00% 和 94.99%,优于现有的基准方法。

The results demonstrate that multilevel evaluation improves the reliability that the proposed framework effectively balances performance and efficiency. This makes the framework suitable for practical hate speech moderation systems that require accurate, generalizable, and explainable decisions.

结果表明,多层次评估提高了可靠性,证明了该框架能够有效平衡性能与效率。这使得该框架非常适合需要准确、可泛化且可解释决策的实际仇恨言论审核系统。