arXiv:2603.20206cs.CLcs.AI2026-03被引 2

通过拉大有害与安全文本的嵌入距离,提升大模型安全性。

Enhancing Safety of Large Language Models via Embedding Space Separation

  • 在嵌入空间中显式增大有害与安全表示的距离。
  • 在多个基准上显著提升安全性,同时保持通用能力。
  • 适合关注大模型安全对齐的研究者和工程师。

大语言模型(LLMs)虽具备强大能力,但防范有害提示仍面临挑战。已有研究发现,有害与安全查询的隐层表示通常具有线性可分性,攻击者可通过扰动有害查询的嵌入使其靠近安全子空间。受此启发,我们提出一种表示层面的微调方法——嵌入空间分离(ES2),通过显式扩大嵌入空间中有害与安全表示的距离来增强模型安全性。为避免模型通用能力退化,我们在损失函数中引入了Kullback-Leibler(KL)散度正则项,约束微调后模型在无害输入上的输出概率分布与原始基模型保持一致。我们在多个开源LLM上使用标准安全基准进行评估,实验结果表明,该方法显著提升了模型安全性,同时维持了相近的通用性能。

原文摘要 · Abstract (English)

Large language models (LLMs) have achieved impressive capabilities, yet ensuring their safety against harmful prompts remains a critical challenge. Recent work has revealed that the latent representations (embeddings) of harmful and safe queries in LLMs typically exhibit linear separability, a property that has been exploited to construct attacks by perturbing the embeddings of harmful queries towards the safe subspace. Motivated by this observation, we propose a representation-level fine-tuning approach, named Embedding Space Separation (ES2), which improves LLM safety by explicitly enlarging the distance between harmful and safe representations in the embedding space. To prevent degradation of model's general capabilities, we introduce a Kullback-Leibler (KL) divergence regularization term into the loss function, which constrains the logits of the fine-tuned model to align with those of the original base model on harmless inputs. We evaluate our method on several open-source LLMs using standard safety benchmarks. Extensive experimental results demonstrate that our approach substantially improves model safety while maintaining comparable general capabilities.

大模型安全嵌入空间微调

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