Pharmacist:针对大型语言模型抵御有害微调的安全对齐数据筛选
Pharmacist: Safety Alignment Data Curation for Large Language Models against Harmful Fine-tuning
AI总结:
提出安全对齐数据筛选方案Pharmacist,通过训练选择器筛选高质量安全关键数据子集,有效提升了大型语言模型抵御有害微调的防御与推理性能,并大幅降低训练时间。
摘要:
有害微调问题对大型语言模型的微调即服务构成了重大安全挑战。现有的对齐阶段防御方法(例如 Vaccine、Repnoise、Booster 和 T-Vaccine)通过在对齐阶段增强模型的鲁棒性来缓解有害微调问题。虽然这些方法已被提出用于缓解该问题,但它们往往忽略了一个关键的上游因素:原始安全对齐数据的作用。我们观察到,其防御性能和计算效率受到对齐数据集质量和组成的制约。为了解决这一局限性,我们提出了 Pharmacist,这是一种安全对齐数据筛选解决方案,通过从原始对齐数据中选择高质量且安全关键的核子集来增强对有害微调的防御。Pharmacist 的核心思想是训练一个对齐数据选择器来对对齐数据进行排序。具体而言,上调高质量且安全关键的对齐数据,下调低质量且非安全关键的数据。实证结果表明,使用 Pharmacist 选择的数据集训练的模型,在防御和推理性能上均优于使用现有选择方法选择的数据集训练的模型。此外,Pharmacist 可以有效地与主流对齐阶段防御方法集成。例如,应用于 RepNoise 和 T-Vaccine 时,使用 Pharmacist 选择的数据集代替完整数据集,分别使防御性能提升了 2.60% 和 3.30%,推理性能提升了 3.50% 和 1.10%。值得注意的是,它分别将训练时间减少了 56.83% 和 57.63%。我们的代码可在 https://github.com/Lslland/Pharmacist 获取。
英文摘要:
Harmful fine-tuning issues present significant safety challenges for fine-tuning-as-a-service in large language models. Existing alignment-stage defenses, e.g., Vaccine, Repnoise, Booster, and T-Vaccine, mitigate harmful fine-tuning issues by enhancing the model's robustness during the alignment phase. While these methods have been proposed to mitigate the issue, they often overlook a critical upstream factor: the role of the original safety-alignment data. We observe that their defense performance and computational efficiency remain constrained by the quality and composition of the alignment dataset. To address this limitation, we propose Pharmacist, a safety alignment data curation solution that enhances defense against harmful fine-tuning by selecting a high-quality and safety-critical core subset from the original alignment data. The core idea of Pharmacist is to train an alignment data selector to rank alignment data. Specifically, up-ranking high-quality and safety-critical alignment data, down-ranking low-quality and non-safety-critical data. Empirical results indicate that models trained on datasets selected by Pharmacist outperform those trained on datasets selected by existing selection methods in both defense and inference performance. In addition, Pharmacist can be effectively integrated with mainstream alignment-stage defense methods. For example, when applied to RepNoise and T-Vaccine, using the dataset selected by Pharmacist instead of the full dataset leads to improvements in defense performance by 2.60\% and 3.30\%, respectively, and enhances inference performance by 3.50\% and 1.10\%. Notably, it reduces training time by 56.83\% and 57.63\%, respectively. Our code is available at https://github.com/Lslland/Pharmacist.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。