跳到正文
arXiv cs.CL· Xu Zhao, Xiting Wang, Weiran Shen·· 11 小时前AI 评分32

通过嵌入空间分离提升大语言模型安全性

Enhancing Safety of Large Language Models via Embedding Space Separation

AI 导读

研究者提出微调方法 ES2(Embedding Space Separation),通过拉大有害与无害嵌入向量之间的距离来增强 LLM 安全性,使对抗攻击需做更大嵌入偏移从而破坏语义。ES2 引入嵌入锚定损失和 KL 散度两项正则损失,避免损害模型能力。实验显示其对多种攻击方法具备优异防御表现,通用能力与基线模型相当,但部分任务出现一定性能下降。

正文 · 原文

View PDF HTML (experimental)

Abstract:Safety alignment does not fully prevent large language models (LLMs) from producing harmful content under adversarial attacks. We observe that existing attack methods typically move harmful embeddings toward regions of harmless embeddings. This motivates us to explore whether increasing the distance between harmful and harmless embeddings can improve the safety of LLMs, since greater separation requires attacks to make larger embedding shifts, which can destroy semantics. We propose Embedding Space Separation (ES2), a fine-tuning method that increases the distance between harmful and harmless embeddings. However, maximizing this distance alone can damage LLMs' capabilities. Thus, we use two regularization losses: an embedding anchor loss keeps harmless embeddings close in direction to those of a frozen base model and a KL-divergence loss keeps output distributions on harmless prompts close to those of the base model. Our experimental results demonstrate that ES2 has excellent defensive performance against various attack methods. LLMs fine-tuned with ES2 retain general capabilities comparable to those of the baseline models, though some performance degradation is observed on certain tasks. Our results indicate that ES2 is an effective way to enhance the safety of large language models, while maintaining comparable performance on general capabilities.
Subjects: Computation and Language (cs.CL); Artificial Intelligence (cs.AI)
Cite as: arXiv:2603.20206 [cs.CL]
  (or arXiv:2603.20206v2 [cs.CL] for this version)
  https://doi.org/10.48550/arXiv.2603.20206

arXiv-issued DOI via DataCite

Submission history

From: Xu Zhao [view email]
[v1] Sun, 1 Mar 2026 07:22:38 UTC (656 KB)
[v2] Fri, 30 Oct 2026 06:22:55 UTC (210 KB)

来源:arXiv cs.CL · arxiv.org