arXiv:2410.02684cs.CL2024-10ACL被引 16

让大模型精准识别并替换敏感内容,而非简单拒绝

HiddenGuard: Fine-Grained Safe Generation with Specialized Representation Router

  • 用中间隐藏状态实时检测每条词元的有害信息
  • 在保持回答有用性的同时,90%以上准确率红移有害内容
  • 适合需要精细内容管控的应用场景

随着大语言模型能力不断增强,确保其安全与人类价值观对齐仍是一大挑战。理想情况下,模型应提供有用回应,同时避免泄露有害或敏感信息。然而,当前依赖拒绝策略(如完全拒绝有害请求或使用粗粒度过滤)的方法存在二元性局限:要么全盘拒绝,要么无差别放行,导致反应过于保守或难以识别隐蔽有害内容。例如,因滥用风险,模型可能拒绝提供药物的公开基础信息。此外,这些方法难以处理混合内容,且无法适应上下文敏感性,常造成对良性内容的过度审查。为此,我们提出HiddenGuard框架,引入Prism(用于流式内容审核的表示路由器),通过分析模型中间隐藏状态,在生成过程中实现细粒度、实时的有害内容检测与删改。该方法支持选择性地替换或删除敏感信息,而非直接拒绝。我们还构建了一个涵盖多种场景、具有词元级标注的综合性数据集。实验表明,HiddenGuard在检测与删改有害内容上达到超过90%的F1分数,同时有效保留了模型输出的整体可用性与信息量。

原文摘要 · Abstract (English)

As Large Language Models (LLMs) grow increasingly powerful, ensuring their safety and alignment with human values remains a critical challenge. Ideally, LLMs should provide informative responses while avoiding the disclosure of harmful or sensitive information. However, current alignment approaches, which rely heavily on refusal strategies, such as training models to completely reject harmful prompts or applying coarse filters are limited by their binary nature. These methods either fully deny access to information or grant it without sufficient nuance, leading to overly cautious responses or failures to detect subtle harmful content. For example, LLMs may refuse to provide basic, public information about medication due to misuse concerns. Moreover, these refusal-based methods struggle to handle mixed-content scenarios and lack the ability to adapt to context-dependent sensitivities, which can result in over-censorship of benign content. To overcome these challenges, we introduce HiddenGuard, a novel framework for fine-grained, safe generation in LLMs. HiddenGuard incorporates Prism (rePresentation Router for In-Stream Moderation), which operates alongside the LLM to enable real-time, token-level detection and redaction of harmful content by leveraging intermediate hidden states. This fine-grained approach allows for more nuanced, context-aware moderation, enabling the model to generate informative responses while selectively redacting or replacing sensitive information, rather than outright refusal. We also contribute a comprehensive dataset with token-level fine-grained annotations of potentially harmful information across diverse contexts. Our experiments demonstrate that HiddenGuard achieves over 90% in F1 score for detecting and redacting harmful content while preserving the overall utility and informativeness of the model's responses.

大模型安全内容过滤细粒度控制

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