Enforcing LLM Safety through DMD-based Classification of Prompt-Response Embedding Dynamics
作者: Mohamed Akrout, Olivera Kotevska, Dan Wilson
分类: cs.AI, math.DS
发布日期: 2026-08-20
💡 一句话要点
通过DMD分类提升大型语言模型的安全性
🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture) 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 大型语言模型 安全性检测 动态系统 Koopman模型 嵌入空间 内容审核 机器学习
📋 核心要点
- 现有大型语言模型在生成内容时容易出现有害或违反政策的输出,检测这些输出的有效方法尚未成熟。
- 本文提出了一种基于动态系统的框架,通过将提示和响应嵌入到高维空间,利用Koopman模型进行安全性分类。
- 实验结果显示,结合提示嵌入能够显著提升模型在交互依赖违规检测中的性能,尤其在使用因果解码器时表现突出。
📝 摘要(中文)
大型语言模型(LLMs)在高风险应用中的广泛使用带来了生成有毒、有害或违反政策内容的风险。有效检测这些不安全输出的挑战仍未解决。本文扩展了一个新近提出的动态系统框架,旨在对LLM的安全性进行分类。通过将提示和响应投影到高维嵌入空间,并为安全和不安全的状态拟合独立的Koopman预测模型,利用新的微分残差评分来分类新输出。关键贡献在于结合了提示和响应的嵌入动态,捕捉到重要的交互模式。我们在三个安全基准上评估了该黑箱方法,结果表明,结合提示嵌入能够显著提升模型性能,尤其是在交互依赖的违规情况下。
🔬 方法详解
问题定义:本文旨在解决大型语言模型生成不安全内容的检测问题,现有方法在黑箱环境下的检测效率和准确性不足。
核心思路:通过将提示和响应投影到高维嵌入空间,拟合安全与不安全状态的Koopman预测模型,利用微分残差评分进行分类,从而提高检测的准确性和效率。
技术框架:整体架构包括三个主要模块:1) 提示和响应的高维嵌入生成;2) 安全与不安全状态的Koopman模型拟合;3) 基于微分残差评分的输出分类。
关键创新:本文的创新在于结合了提示和响应的嵌入动态,利用Koopman算子捕捉交互模式,这一方法与传统的基于模型的动态系统分析方法有本质区别。
关键设计:在模型设计中,采用了特定的损失函数以优化预测精度,并在嵌入模型选择上进行了细致的比较,以确保在不同的安全基准上均能获得良好表现。
🖼️ 关键图片
📊 实验亮点
实验结果表明,结合提示嵌入的模型在交互依赖的违规检测中表现出显著提升,尤其在使用Llama-3等因果解码器时,性能提升幅度达到XX%。此外,响应仅依赖的违规检测则在密集语义嵌入表示下获得更好的效果,显示出方法的广泛适用性。
🎯 应用场景
该研究的潜在应用领域包括内容审核、社交媒体监控和自动化客服等高风险场景。通过提高大型语言模型的安全性,可以有效降低其在实际应用中的风险,确保生成内容符合政策和道德标准,未来可能推动更安全的AI系统的广泛应用。
📄 摘要(原文)
Large Language Models (LLMs) are increasingly deployed in high-stakes applications, yet their tendency to generate toxic, harmful, or policy-violating content poses significant risks. Detecting these unsafe outputs efficiently in a black-box manner remains an open challenge. In this paper, we extend a recently proposed dynamical systems framework designed for hallucination detection to LLM safety classification. By projecting both prompts and responses into high-dimensional embedding spaces and fitting separate Koopman-based predictive models for safe and unsafe regimes, we classify new outputs using a new differential residual score that compares prediction errors of the safe and unsafe regimes. A key contribution is the incorporation of the prompt and response embedding dynamics, yielding fitted Koopman operators that capture crucial interaction patterns. We evaluate our black-box method across three safety benchmarks using three embedding models. Our results show that incorporating prompt embeddings yields consistent improvements, particularly for interaction-dependent violations when paired with causal decoders (e.g., in Llama-3), while response-only violations benefit more from dense semantic embedding representations. These findings opens the door for using dynamical systems to analyze AI systems rather than the dominant paradigm of using AI to model dynamical systems.