[论文解读] Offensive Language Detection with BERT-based models, By Customizing Attention Probabilities
本文提出一种方法,通过使用基于多项式朴素贝叶斯概率计算出的攻击性分数来定制注意力掩码,以增强基于 BERT 的模型在攻击性语言检测中的性能。通过重新加权注意力概率以更关注具有攻击性的短语,该方法在波斯语数据集上将 F1-macro 分数最高提升 10%,在英语数据集上提升 2%,展示了在不同语言和模型架构下的有效性。
This paper describes a novel study on using `Attention Mask' input in transformers and using this approach for detecting offensive content in both English and Persian languages. The paper's principal focus is to suggest a methodology to enhance the performance of the BERT-based models on the `Offensive Language Detection' task. Therefore, we customize attention probabilities by changing the `Attention Mask' input to create more efficacious word embeddings. To do this, we firstly tokenize the training set of the exploited datasets (by BERT tokenizer). Then, we apply Multinomial Naive Bayes to map these tokens to two probabilities. These probabilities indicate the likelihood of making a text non-offensive or offensive, provided that it contains that token. Afterwards, we use these probabilities to define a new term, namely Offensive Score. Next, we create two separate (because of the differences in the types of the employed datasets) equations based on Offensive Scores for each language to re-distribute the `Attention Mask' input for paying more attention to more offensive phrases. Eventually, we put the F1-macro score as our evaluation metric and fine-tune several combinations of BERT with ANNs, CNNs and RNNs to examine the effect of using this methodology on various combinations. The results indicate that all models will enhance with this methodology. The most improvement was 2% and 10% for English and Persian languages, respectively.
研究动机与目标
- 通过动态调整注意力机制,提升基于 BERT 的模型在攻击性语言检测中的性能。
- 通过更关注高影响力攻击性短语,解决标准注意力机制在遗漏细微攻击性线索方面的局限性。
- 开发一种与语言无关的方法论,适用于英语和波斯语,并在不同数据集上进行验证。
- 探索使用统计概率估计方法对攻击性内容进行注意力掩码定制的影响。
- 在多种架构(CNN、RNN、ANN)上展示一致的性能提升,这些架构均通过所提出的注意力重加权方法进行微调。
提出的方法
- 使用 BERT 分词器对训练数据进行分词,并通过在攻击性与非攻击性标签的词元级概率上应用多项式朴素贝叶斯,计算攻击性分数。
- 定义语言特定的公式,基于攻击性分数重新分配注意力掩码值,以增加对高分词元的关注。
- 将修改后的注意力掩码集成到基于 BERT 的模型中,替换标准注意力输入,以引导注意力聚焦于攻击性短语。
- 在 OLID(英语)和 POLID(波斯语)数据集上,对 BERT 与前馈网络、CNN、RNN(BiLSTM、BiGRU)以及混合架构的各种组合进行微调。
- 使用 F1-macro 作为主要评估指标,评估在五折交叉验证中各折的模型性能。
- 进行错误分析,识别增强模型纠正标准模型误分类的案例,特别是涉及习语或语境性攻击性表达的情况。
实验结果
研究问题
- RQ1使用攻击性分数对注意力掩码进行重加权,能否提升基于 BERT 的模型在攻击性语言检测中的 F1-macro 性能?
- RQ2所提出的注意力定制方法对不同神经网络架构(如 CNN、RNN、前馈网络)的性能影响如何?
- RQ3该方法在不同语言之间(尤其是英语与波斯语之间)的泛化能力如何,考虑到其语言结构的差异?
- RQ4增强模型的失败案例是什么?在对罕见或模糊的攻击性词汇进行攻击性分数估计时存在哪些局限性?
- RQ5通过多项式朴素贝叶斯对攻击性概率进行统计估计,能否有效引导注意力重加权,而无需对每个词元进行人工标注?
主要发现
- 所提出的方法在波斯语 POLID 数据集上将 F1-macro 分数最高提升 10%,最佳模型(使用 CNN2D 与公式 6)平均 F1 达到 0.8630。
- 在英语 OLID 数据集上,该方法实现了 F1-macro 最高 2% 的提升,最佳模型(CNN2D + 公式 6)平均 F1 达到 0.8630。
- 所有测试的模型架构(BiLSTM、BiGRU、CNN2D、CNN-BiLSTM、KUISAIL)在使用定制注意力掩码时均表现出一致的性能提升。
- 错误分析确认,增强模型正确分类了涉及习语或语境性攻击性表达的样本(如波斯语习语 'muzmaars'),而标准模型则出现误分类。
- 当涉及低攻击性分数词元(如攻击性词汇得分约 0.53)时,模型出现失败,原因是多项式朴素贝叶斯的概率估计不足,表明在分数校准方面存在局限性。
- 该方法在多种架构中表现出鲁棒性,表明注意力掩码定制是攻击性语言检测中一种可泛化的增强方法。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。