让大模型按需拒绝回答,精准控制响应行为
Programming Refusal with Conditional Activation Steering
- 根据输入内容动态决定是否启用激活调控
- 可实现如'涉仇恨言论则拒绝'的规则化响应
- 无需修改模型权重,适合内容审核等场景
大语言模型虽表现出强大能力,但精确控制其响应行为仍具挑战。现有激活调控方法会无差别改变模型行为,限制了在内容审核或领域专用助手等需要选择性响应场景的应用。本文提出条件激活调控(CAST),通过分析推理过程中模型隐藏状态的激活模式,依据输入上下文选择性地应用或跳过激活调控。我们发现不同类别提示会引发模型隐藏状态中不同的激活模式。借助CAST,可系统性地设置规则,如'若输入涉及仇恨言论或成人内容,则拒绝回应'或'若非法律咨询,则拒绝回应'。该方法可在保持其他内容正常响应的同时,对特定内容实施响应控制,且无需进行权重优化。代码已开源:github.com/IBM/activation-steering。
原文摘要 · Abstract (English)
LLMs have shown remarkable capabilities, but precisely controlling their response behavior remains challenging. Existing activation steering methods alter LLM behavior indiscriminately, limiting their practical applicability in settings where selective responses are essential, such as content moderation or domain-specific assistants. In this paper, we propose Conditional Activation Steering (CAST), which analyzes LLM activation patterns during inference to selectively apply or withhold activation steering based on the input context. Our method is based on the observation that different categories of prompts activate distinct patterns in the model's hidden states. Using CAST, one can systematically control LLM behavior with rules like "if input is about hate speech or adult content, then refuse" or "if input is not about legal advice, then refuse." This allows for selective modification of responses to specific content while maintaining normal responses to other content, all without requiring weight optimization. We release an open-source implementation of our framework at github.com/IBM/activation-steering .
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。