arXiv:2410.05559cs.CL2024-10EMNLP被引 8

让大模型生成更安全内容,同时保持回答质量。

Attribute Controlled Fine-tuning for Large Language Models: A Case Study on Detoxification

  • 用约束学习控制模型输出,通过惩罚偏离目标分布的生成
  • 在毒性检测任务中减少不当回复,且在基准测试表现不降
  • 适合需要可控生成的场景,如内容安全、合规对话

我们提出一种带属性控制的大语言模型微调框架。给定训练语料和以序列级约束形式表达的控制标准,该方法在微调过程中增强模型输出对约束的满足度,同时最小化对模型实用性与生成质量的影响。具体而言,通过惩罚期望输出分布(满足约束)与模型后验分布之间的KL散度来正则化训练过程。该正则项可通过一个辅助模型近似计算,该模型将序列级约束分解为逐标记的指导信号,从而实现闭式表达。为提升效率,我们设计了并行更新机制,同步优化主模型与辅助模型。我们在训练大模型时控制毒性属性进行评估,结果表明,该方法能显著减少不当输出,同时在基准测试和毒性检测任务上保持竞争力。

原文摘要 · Abstract (English)

We propose a constraint learning schema for fine-tuning Large Language Models (LLMs) with attribute control. Given a training corpus and control criteria formulated as a sequence-level constraint on model outputs, our method fine-tunes the LLM on the training corpus while enhancing constraint satisfaction with minimal impact on its utility and generation quality. Specifically, our approach regularizes the LLM training by penalizing the KL divergence between the desired output distribution, which satisfies the constraints, and the LLM's posterior. This regularization term can be approximated by an auxiliary model trained to decompose the sequence-level constraints into token-level guidance, allowing the term to be measured by a closed-form formulation. To further improve efficiency, we design a parallel scheme for concurrently updating both the LLM and the auxiliary model. We evaluate the empirical performance of our approach by controlling the toxicity when training an LLM. We show that our approach leads to an LLM that produces fewer inappropriate responses while achieving competitive performance on benchmarks and a toxicity detection task.

大模型微调属性控制安全性

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。