Fine-Tuning Large Language Models with QLoRA for Offensive Language Detection in Roman Urdu-English Code-Mixed Text

📄 arXiv: 2510.03683v2 📥 PDF

作者: Nisar Hussain, Amna Qasim, Gull Mehak, Muhammad Zain, Momina Hafeez, Grigori Sidorov

分类: cs.CL

发布日期: 2025-10-04 (更新: 2025-10-10)

备注: 25 pages, 22 figures


💡 一句话要点

提出基于QLoRA微调LLaMA3的框架,提升在Roman Urdu-English混合文本中攻击性语言检测性能。

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 攻击性语言检测 Roman Urdu 代码混合 大型语言模型 QLoRA 低资源 微调 机器翻译

📋 核心要点

  1. 现有方法难以处理Roman Urdu等混合编码语言中攻击性语言检测,主要挑战在于语法不规范、拼写不一致和缺乏标注数据。
  2. 论文提出基于QLoRA的微调框架,通过将Roman Urdu-English文本翻译成英文,利用英文LLM进行攻击性语言检测。
  3. 实验结果表明,Meta LLaMA 3 8B模型在Roman Urdu攻击性语言检测任务上取得了最高的F1分数91.45,优于传统Transformer模型。

📝 摘要(中文)

由于语法不规范、拼写不一致以及缺乏标注数据,在诸如Roman Urdu等混合编码语言中使用贬义词对自然语言处理系统提出了挑战。本文提出了一种基于QLoRA的微调框架,以提高Roman Urdu-English文本中攻击性语言的检测性能。为了利用英文大型语言模型(LLM),我们使用谷歌翻译将Roman Urdu-English混合编码数据集翻译成英文,但同时也承认这种翻译会减少对混合编码特征的直接利用。我们的重点是使用英文翻译的低资源输入进行分类性能评估。我们使用QLoRA微调了多个Transformer和大型语言模型,包括Meta LLaMA 3 8B、Mistral 7B v0.1、LLaMA 2 7B、ModernBERT和RoBERTa,以实现内存高效的适配。模型在手动标注的Roman Urdu数据集上进行训练和评估,以区分攻击性内容和非攻击性内容。在所有测试模型中,Meta LLaMA 3 8B获得了最高的F1分数91.45,其次是Mistral 7B,为89.66,超过了传统的Transformer基线。这些结果证明了QLoRA在微调高性能模型以适应混合编码攻击性语言检测等低资源环境中的有效性,并证实了LLM在该任务中的潜力。这项工作推进了一种可扩展的Roman Urdu内容审核方法,并为未来基于LLM的多语言攻击性检测系统铺平了道路。

🔬 方法详解

问题定义:论文旨在解决Roman Urdu-English混合文本中攻击性语言检测的问题。现有方法在处理这种低资源、混合编码的语言时,面临着数据稀缺、语法不规范和拼写不一致等挑战,导致检测性能不佳。

核心思路:论文的核心思路是将Roman Urdu-English混合文本翻译成英文,然后利用预训练的英文大型语言模型(LLM)进行微调。通过迁移学习,可以克服数据稀缺的问题,并利用LLM强大的语言理解能力来提高检测性能。使用QLoRA方法进行高效微调,降低计算资源需求。

技术框架:整体框架包括以下几个主要步骤:1) 数据预处理:将Roman Urdu-English混合文本数据集进行清洗和标注。2) 机器翻译:使用Google Translate将Roman Urdu-English文本翻译成英文。3) 模型选择:选择Meta LLaMA 3 8B、Mistral 7B v0.1、LLaMA 2 7B、ModernBERT和RoBERTa等模型作为基础模型。4) QLoRA微调:使用QLoRA方法对选定的模型进行微调,以适应攻击性语言检测任务。5) 模型评估:在测试集上评估微调后的模型性能,并与基线模型进行比较。

关键创新:论文的关键创新在于:1) 将机器翻译与LLM微调相结合,解决低资源混合编码语言的攻击性语言检测问题。2) 使用QLoRA方法进行高效微调,降低了计算资源需求,使得在有限的硬件条件下也能训练大型语言模型。3) 实验结果表明,基于QLoRA微调的LLM在Roman Urdu攻击性语言检测任务上取得了显著的性能提升。

关键设计:论文的关键设计包括:1) 使用Google Translate进行机器翻译,虽然可能损失部分混合编码信息,但可以有效利用英文LLM的知识。2) 使用QLoRA进行微调,通过量化模型权重,降低了内存占用,使得可以在消费级GPU上进行训练。3) 实验中使用了F1分数作为评估指标,以综合考虑模型的精确率和召回率。

📊 实验亮点

实验结果表明,Meta LLaMA 3 8B模型在Roman Urdu攻击性语言检测任务上取得了最高的F1分数91.45,其次是Mistral 7B,为89.66,显著优于传统的Transformer模型,证明了QLoRA微调LLM在低资源环境下的有效性。

🎯 应用场景

该研究成果可应用于社交媒体平台、在线论坛等场景,用于自动检测和过滤Roman Urdu-English混合文本中的攻击性言论,维护网络社区的健康环境。此外,该方法也可以推广到其他低资源、混合编码语言的攻击性语言检测任务中,具有广泛的应用前景。

📄 摘要(原文)

The use of derogatory terms in languages that employ code mixing, such as Roman Urdu, presents challenges for Natural Language Processing systems due to unstated grammar, inconsistent spelling, and a scarcity of labeled data. In this work, we propose a QLoRA based fine tuning framework to improve offensive language detection in Roman Urdu-English text. We translated the Roman Urdu-English code mixed dataset into English using Google Translate to leverage English LLMs, while acknowledging that this translation reduces direct engagement with code mixing features. Our focus is on classification performance using English translated low resource inputs. We fine tuned several transformers and large language models, including Meta LLaMA 3 8B, Mistral 7B v0.1, LLaMA 2 7B, ModernBERT, and RoBERTa, with QLoRA for memory efficient adaptation. Models were trained and evaluated on a manually annotated Roman Urdu dataset for offensive vs non offensive content. Of all tested models, the highest F1 score of 91.45 was attained by Meta LLaMA 3 8B, followed by Mistral 7B at 89.66, surpassing traditional transformer baselines. These results demonstrate the efficacy of QLoRA in fine tuning high performing models for low resource environments such as code mixed offensive language detection, and confirm the potential of LLMs for this task. This work advances a scalable approach to Roman Urdu moderation and paves the way for future multilingual offensive detection systems based on LLMs.