Programming Refusal with Conditional Activation Steering

Bruce W. Lee,Inkit Padhi,Karthikeyan Natesan Ramamurthy,Erik Miehling,Pierre Dognin,Manish Nagireddy,Amit Dhurandhar
2024-09-06
Abstract: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.
Machine Learning,Artificial Intelligence,Computation and Language
What problem does this paper attempt to address?
### What problem does this paper attempt to solve? This paper aims to solve the problem of the lack of conditional control in the activation steering methods in large - language models (LLMs). The existing activation steering techniques are indiscriminate when changing the behavior of LLMs, which limits their practical applications in scenarios requiring selective responses, such as content moderation or domain - specific assistants. #### Specific problem description: 1. **Indiscriminate behavior modification**: The existing activation steering methods will change the model's behavior indiscriminately on all inputs, for example, increasing the rejection rate, which makes the model unable to distinguish between harmful and harmless content when dealing with harmful content. 2. **Lack of flexibility**: The current methods cannot selectively apply or not apply activation steering according to the input context, resulting in the model over - rejecting or being unable to reject in some cases. 3. **Limited practicality**: Due to the lack of conditional control, these methods are difficult to be effectively applied in scenarios requiring fine - grained control of responses, such as content moderation, medical consultation, etc. ### Proposed solution: To solve the above problems, the authors propose the **Conditional Activation Steering (CAST)** method. CAST selectively applies or does not apply activation steering based on the input context by analyzing the changes in the activation patterns of LLMs during the inference process. Specifically, CAST introduces a new vector - the condition vector - which is used to detect specific types of inputs and decide whether to apply the behavior vector to modify the model's response. #### Main contributions: 1. **Expand the activation steering framework**: CAST adds the function of conditional control on the basis of the existing activation steering methods, enabling more fine - grained control of the behavior of LLMs. 2. **Fine - grained control**: By using the condition vector, CAST can effectively divide the input space into different categories and perform targeted behavior modification on specific - category inputs. 3. **Logical combination of conditions**: CAST allows creating complex rejection conditions by logically combining multiple condition vectors, thereby achieving programmatic control of the model's behavior. 4. **Open - source implementation**: The authors release a general - purpose activation steering library that implements the CAST method, facilitating use by other researchers and developers. ### Application scenarios: CAST can be applied to multiple scenarios, such as: - **Content moderation**: Automatically reject requests involving hate speech or adult content according to the input content. - **Domain - specific assistants**: Ensure that the model only provides responses within a specific domain (such as legal consultation) and rejects other irrelevant requests. - **Medical consultation**: In a medical chatbot, ensure that the model only provides help in an appropriate medical context and avoids generating harmful content in inappropriate situations. Through these improvements, CAST enables LLMs to deal with harmful content more intelligently and flexibly while maintaining normal responses, enhancing the practicality and security of the model in practical applications.