Skip to main content
QUICK REVIEW

[论文解读] Fine-Tuning Llama 2 Large Language Models for Detecting Online Sexual Predatory Chats and Abusive Texts

Thanh Thi Nguyen, Campbell Wilson|arXiv (Cornell University)|Aug 28, 2023
Hate Speech and Cyberbullying Detection被引用 5
一句话总结

本文提出通过LoRA微调开源的Llama 2 7B大语言模型,以检测英语、罗马乌尔都语和乌尔都语数据集中的在线性诱骗聊天和攻击性文本。该方法在不同数据规模、类别不平衡程度和语言之间均表现出强大且一致的性能,即使在非英语数据极少的情况下也优于传统方法,展示了适用于多语言数字安全应用中有害内容检测的通用、自动化解决方案。

ABSTRACT

Detecting online sexual predatory behaviours and abusive language on social media platforms has become a critical area of research due to the growing concerns about online safety, especially for vulnerable populations such as children and adolescents. Researchers have been exploring various techniques and approaches to develop effective detection systems that can identify and mitigate these risks. Recent development of large language models (LLMs) has opened a new opportunity to address this problem more effectively. This paper proposes an approach to detection of online sexual predatory chats and abusive language using the open-source pretrained Llama 2 7B-parameter model, recently released by Meta GenAI. We fine-tune the LLM using datasets with different sizes, imbalance degrees, and languages (i.e., English, Roman Urdu and Urdu). Based on the power of LLMs, our approach is generic and automated without a manual search for a synergy between feature extraction and classifier design steps like conventional methods in this domain. Experimental results show a strong performance of the proposed approach, which performs proficiently and consistently across three distinct datasets with five sets of experiments. This study's outcomes indicate that the proposed method can be implemented in real-world applications (even with non-English languages) for flagging sexual predators, offensive or toxic content, hate speech, and discriminatory language in online discussions and comments to maintain respectful internet or digital communities. Furthermore, it can be employed for solving text classification problems with other potential applications such as sentiment analysis, spam and phishing detection, sorting legal documents, fake news detection, language identification, user intent recognition, text-based product categorization, medical record analysis, and resume screening.

研究动机与目标

  • 解决传统文本分类方法在不同数据集上需要大量超参数调优和手动特征工程的局限性。
  • 开发一种通用、自动化的基于大语言模型(LLM)的方法,用于检测在线性诱骗行为和攻击性语言。
  • 评估微调后的Llama 2在不同数据特征(包括语言:英语、罗马乌尔都语、乌尔都语,数据规模,类别不平衡)下的性能表现。
  • 证明在低资源数据集(尤其是使用与英语不同书写系统的语言,如乌尔都语)中使用大语言模型检测有害内容的可行性。
  • 建立一种可扩展的、通用的解决方案,适用于现实世界中的数字安全应用,而不仅限于性诱骗聊天检测。

提出的方法

  • 使用LoRA(低秩适应)技术微调Llama 2 7B大语言模型,以高效适应文本分类任务。
  • 在三个不同数据集上进行训练:英语、罗马乌尔都语和乌尔都语,涵盖不同的数据规模和类别不平衡水平。
  • 采用从零样本到少样本的微调策略,利用大语言模型预训练的世界知识和上下文理解能力。
  • 使用标准的文本分类头和交叉熵损失函数,预测有害或攻击性内容的标签。
  • 通过标准NLP指标(准确率、精确率、召回率和F1分数)在所有数据集和语言变体上评估性能。
  • 应用提示工程和指令微调,使模型行为与检测任务对齐,而无需大量重新训练。

实验结果

研究问题

  • RQ1微调后的Llama 2 7B大语言模型是否能在不同数据规模、类别不平衡程度和语言的多样化数据集上实现一致且高性能的表现?
  • RQ2基于大语言模型的方法是否优于依赖手动特征工程和分类器选择的传统机器学习流水线?
  • RQ3在乌尔都语等低资源语言中,该大语言模型方法在检测攻击性和诱骗内容方面的有效性如何,尤其是其使用与英语不同的书写系统?
  • RQ4微调后的大语言模型能否在不同文本长度和类型(如简短聊天和较长的攻击性信息)上实现良好泛化?
  • RQ5LoRA微调在适应大语言模型至特定检测任务的同时,能在多大程度上保留其通用知识?

主要发现

  • 微调后的Llama 2 7B模型在罗马乌尔都语数据集上取得了99.2%的F1分数,优于先前研究中的最先进模型(如CNN的91.6%和LogitBoost的99.2%)。
  • 在仅含1,736个训练样本的乌尔都语数据集中,尽管处于低资源设置,模型仍表现出强劲性能,优于大多数传统方法。
  • 该模型在所有三个数据集(英语、罗马乌尔都语、乌尔都语)上均表现出一致的性能,无论数据规模、类别不平衡程度或语言如何。
  • 基于大语言模型的方法消除了对手动特征工程和分类器选择的需求,提供了一条通用且自动化的处理流程。
  • 该方法在不同文本长度上表现出鲁棒性,表明其适用于短消息聊天和较长的攻击性内容。
  • 结果表明,通过LoRA微调的Llama 2可有效部署于现实世界中的多语言在线安全应用,包括仇恨言论、网络诱骗和有害内容检测。

更好的研究,从现在开始

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

无需绑定信用卡

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