arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2604.19124cs.CL
收藏

LLM去毒化:从数据集本身开始

Detoxification for LLM: From Dataset Itself

State Key Laboratory of AI Safety(人工智能安全国家重点实验室);Institute of Computing Technology, Chinese Academy of Sciences(中国科学院计算技术研究所);University of Chinese Academy of Sciences(中国科学院大学)

Wei Shao, Yihang Wang, Gaoyu Zhu, Ziqiang Cheng, Lei Yu, Jiafeng Guo, Xueqi Cheng

AI总结:

本文提出HSPD方法,通过在原始语料上进行语义保留的改写,有效降低模型毒性,提升数据效用,减少后续调整成本。

摘要:

现有的LLM去毒化方法主要集中在训练后或推理阶段,而本文尝试直接对原始语料进行去毒化,通过SoCD方法指导LLM定位并重写有毒片段,保留语义,构建HSPD流程,生成可替代原数据集的去毒化语料。在GPT2-XL上,HSPD将毒性概率从0.42降至0.18,预期最大毒性从0.43降至0.20。在LLaMA2-7B、OPT-6.7B和Falcon-7B上也取得最佳结果,证明HSPD在保持数据效用的同时有效抑制下游毒性,实现无缝源级缓解,降低后续模型行为调整成本。 (代码见:https://github.com/ntsw2001/data_detox_for_llm)

英文摘要:

Existing detoxification methods for large language models mainly focus on post-training stage or inference time, while few tackle the source of toxicity, namely, the dataset itself. Such training-based or controllable decoding approaches cannot completely suppress the model's inherent toxicity, whereas detoxifying the pretraining dataset can fundamentally reduce the toxicity that the model learns during training. Hence, we attempt to detoxify directly on raw corpora with SoCD (Soft Contrastive Decoding), which guides an LLM to localize and rewrite toxic spans in raw data while preserving semantics, in our proposed HSPD (Hierarchical Semantic-Preserving Detoxification) pipeline, yielding a detoxified corpus that can drop-in replace the original for fine-tuning or other training. On GPT2-XL, HSPD attains state-of-the-art detoxification, reducing Toxicity Probability (TP) from 0.42 to 0.18 and Expected Maximum Toxicity (EMT) from 0.43 to 0.20. We further validate consistent best-in-class results on LLaMA2-7B, OPT-6.7B, and Falcon-7B. These findings show that semantics-preserving, corpus-level rewriting with HSPD effectively suppresses downstream toxicity while retaining data utility and allowing seamless source-level mitigation, thereby reducing the cost of later model behavior adjustment. (Code is available at: https://github.com/ntsw2001/data_detox_for_llm)

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑