arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2505.24445cs.LGcs.AI
收藏

学习大型语言模型的安全约束

Learning Safety Constraints for Large Language Models

Xin Chen, Yarden As, Andreas Krause

AI总结:

本文提出 SaP(Safety Polytope),一种在 LLM 表示空间中学习并执行多个安全约束的几何方法,通过多面体面识别安全区域以检测和纠正不安全输出,在不修改模型权重的前提下有效降低攻击成功率并保持标准任务性能。

摘要:

大型语言模型(LLMs)已成为强大的工具,但通过有害输出和对对抗性攻击的脆弱性构成了重大安全风险。我们提出 SaP(Safety Polytope,安全多面体),这是一种 LLM 安全的几何方法,直接在模型的表示空间中学习并执行多个安全约束。我们开发了一个框架,通过多面体的面识别安全和不安全区域,从而通过几何引导实现对不安全输出的检测和纠正。与修改模型权重的现有方法不同,SaP 在表示空间中进行事后操作,在执行安全约束的同时保留模型能力。在多个 LLM 上的实验表明,我们的方法能有效检测不道德输入,降低对抗性攻击成功率,同时在标准任务上保持性能,突出了为安全建立显式几何模型的重要性。对学习到的多面体面的分析揭示了在检测不同语义安全概念时的专业化涌现,为理解 LLMs 表示空间中如何捕获安全性提供了可解释的见解。

英文摘要:

Large language models (LLMs) have emerged as powerful tools but pose significant safety risks through harmful outputs and vulnerability to adversarial attacks. We propose SaP, short for Safety Polytope, a geometric approach to LLM safety that learns and enforces multiple safety constraints directly in the model's representation space. We develop a framework that identifies safe and unsafe regions via the polytope's facets, enabling both detection and correction of unsafe outputs through geometric steering. Unlike existing approaches that modify model weights, SaP operates post-hoc in the representation space, preserving model capabilities while enforcing safety constraints. Experiments across multiple LLMs demonstrate that our method can effectively detect unethical inputs, reduce adversarial attack success rates while maintaining performance on standard tasks, thus highlighting the importance of having an explicit geometric model for safety. Analysis of the learned polytope facets reveals emergence of specialization in detecting different semantic notions of safety, providing interpretable insights into how safety is captured in LLMs' representation space.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑