微调大模型时防止安全退化,保持性能不下降。
Safe Delta: Consistently Preserving Safety when Fine-Tuning LLMs on Diverse Datasets
- 通过调整微调前后参数差值(delta)来增强安全性
- 在多种数据集上均保持安全且不损失有用性
- 适合企业级模型定制服务中的安全防护
大语言模型在多个领域展现出作为通用AI助手的巨大潜力。为在具体应用中充分释放这一潜力,许多公司提供微调API服务,允许用户上传自有数据进行模型定制。然而,微调服务引入了新的安全风险:无论数据是否有害,都可能破坏模型对齐,导致输出不安全。此外,现有防御方法难以应对微调数据集的多样性(如规模、任务差异),常在安全与效用间妥协。为此,我们提出Safe Delta,一种面向安全的后训练防御方法,通过调整微调过程中的参数变化量(delta)。具体地,该方法估计安全退化程度,选择能最大化效用同时控制整体安全损失的参数,并施加安全补偿向量以缓解残余风险。在四个不同数据集、多种设置下的实验表明,该方法能持续保障安全性,同时确保来自良性数据集的性能提升不受影响。
原文摘要 · Abstract (English)
Large language models (LLMs) have shown great potential as general-purpose AI assistants across various domains. To fully leverage this potential in specific applications, many companies provide fine-tuning API services, enabling users to upload their own data for LLM customization. However, fine-tuning services introduce a new safety threat: user-uploaded data, whether harmful or benign, can break the model's alignment, leading to unsafe outputs. Moreover, existing defense methods struggle to address the diversity of fine-tuning datasets (e.g., varying sizes, tasks), often sacrificing utility for safety or vice versa. To address this issue, we propose Safe Delta, a safety-aware post-training defense method that adjusts the delta parameters (i.e., the parameter change before and after fine-tuning). Specifically, Safe Delta estimates the safety degradation, selects delta parameters to maximize utility while limiting overall safety loss, and applies a safety compensation vector to mitigate residual safety loss. Through extensive experiments on four diverse datasets with varying settings, our approach consistently preserves safety while ensuring that the utility gain from benign datasets remains unaffected.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。