通过可调控的潜在空间干预,让大模型更安全地拒绝攻击,同时保持有用性。
LatentGuard: Controllable Latent Steering for Robust Refusal of Attacks and Reliable Response Generation
- 用三阶段框架结合行为对齐与潜在空间控制,实现精准安全引导。
- 在Qwen3-8B上提升安全可控性与响应可解释性,不损失模型实用性。
- 适用于需要高安全性和可解释性的大模型部署场景。
在保持大语言模型(LLM)实用性的前提下实现鲁棒的安全对齐仍是根本挑战。现有方法往往难以在全面安全性与表示层面的细粒度可控性之间取得平衡。本文提出LATENTGUARD,一种结合行为对齐与监督式潜在空间控制的三阶段新框架,实现可解释且精确的安全引导。首先在包含理性化拒绝响应与正常响应的增强数据集上微调LLM,建立跨安全关键与效用保留场景的稳健行为先验。随后,在中间MLP激活层上训练结构化变分自编码器(VAE),并基于多标签标注(攻击类型、攻击方法、良性指标)进行监督,使VAE学习解耦的潜在表示,捕捉不同攻击特征的同时保持语义可解释性。通过针对性操控学习到的潜在维度,LATENTGUARD实现选择性拒绝行为,有效阻断有害请求,同时保留对合法使用场景的帮助性。在Qwen3-8B上的实验表明,该方法显著提升了安全可控性与响应可解释性,且未牺牲实用性。跨架构验证在Mistral-7B上确认了该潜在引导方法的泛化能力,显示其在不同模型族中均具一致有效性。结果表明,结构化的表示级干预为构建更安全且实用的LLM系统提供了有前景的路径。
原文摘要 · Abstract (English)
Achieving robust safety alignment in large language models (LLMs) while preserving their utility remains a fundamental challenge. Existing approaches often struggle to balance comprehensive safety with fine-grained controllability at the representation level. We introduce LATENTGUARD, a novel three-stage framework that combines behavioral alignment with supervised latent space control for interpretable and precise safety steering. Our approach begins by fine-tuning an LLM on rationalized datasets containing both reasoning-enhanced refusal responses to adversarial prompts and reasoning-enhanced normal responses to benign queries, establishing robust behavioral priors across both safety-critical and utility-preserving scenarios. We then train a structured variational autoencoder (VAE) on intermediate MLP activations, supervised by multi-label annotations including attack types, attack methods, and benign indicators. This supervision enables the VAE to learn disentangled latent representations that capture distinct adversarial characteristics while maintaining semantic interpretability. Through targeted manipulation of learned latent dimensions, LATENTGUARD achieves selective refusal behavior, effectively blocking harmful requests while preserving helpfulness for legitimate use cases. Experiments on Qwen3-8B demonstrate significant improvements in both safety controllability and response interpretability without compromising utility. Cross-architecture validation on Mistral-7B confirms the generalizability of our latent steering approach, showing consistent effectiveness across different model families. Our results suggest that structured representation-level intervention offers a promising pathway toward building safer yet practical LLM systems.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。