Where to Steer: Input-Dependent Layer Selection for Steering Improves LLM Alignment
Organizations: University of Washington
Abstract
Steering vectors have emerged as a lightweight and effective approach for aligning large language models (LLMs) at inference time, enabling modulation of model behaviors by shifting intermediate representations toward a target behavior. Many existing steering methods apply interventions at globally fixed locations in an LLM, effectively treating the optimal intervention location as input-invariant. However, representations relevant to a target behavior can be encoded at different LLM layers depending on the input. Theoretically, we show that different inputs may require steering at different layers to achieve alignment with a given behavior. Empirically, we observe that the most effective layer for steering varies substantially between inputs. Motivated by these observations, we introduce Where to Steer (W2S), a general framework that adaptively selects intervention layers conditioned on the inputs by learning a mapping from input representations to steering layers. Across multiple LLMs and alignment behaviors, W2S consistently outperforms fixed-layer baselines in both in-distribution and out-of-distribution settings. Our findings suggest that input-dependent layer selection is a key design dimension complementary to methods for steering vector extraction.
Figures & tables
| Method | Steerability | Prop. of Steerable Examples |
| Llama-2-7B-Chat | ||
| CAA w/ Fixed Layer | 1.259 (0.014) | 0.754 (0.005) |
| CAA w/ W2S | 1.502 (0.019) | 0.846 (0.012) |
| L2S w/ Fixed Layer | 2.098 (0.009) | 0.899 (0.001) |
| L2S w/ W2S | 2.363 (0.051) | 0.918 (0.011) |
| Qwen-1.5-14B-Chat | ||
| Method | BASE SYS.POS | BASE SYS.NEG | BASE USER.POS | BASE USER.NEG | ||||
| Steerability | Prop. Steerable | Steerability | Prop. Steerable | Steerability | Prop. Steerable | Steerability | Prop. Steerable | |
| Llama-2-7B-Chat | ||||||||
| CAA w/ Fixed Layer | 1.422 (0.015) | 0.750 (0.004) | 1.503 (0.009) | 0.736 (0.002) | 1.140 (0.010) | 0.753 (0.002) | 1.028 (0.011) | 0.701 (0.004) |
| CAA w/ W2S | 1.821 (0.034) | 0.790 (0.006) | 1.902 (0.046) | 0.780 (0.010) | 1.674 (0.024) | 0.784 (0.007) | 1.172 (0.045) | 0.741 (0.014) |
| L2S w/ Fixed Layer | 2.456 (0.009) | 0.955 (0.003) | 2.620 (0.004) | 0.945 (0.002) | 2.102 (0.014) | 0.921 (0.001) | 1.977 (0.009) | 0.899 (0.002) |
| L2S w/ W2S | 2.802 (0.020) | 0.970 (0.003) | 2.944 (0.022) | 0.964 (0.005) | 2.535 (0.018) | 0.950 (0.004) | 2.195 (0.027) | 0.932 (0.009) |
| Method | Truthfulness | Safety |
| Llama-2-7B-Chat | ||
| CAA w/ Fixed Layer | 0.715 (0.092) | -0.045 (0.066) |
| CAA w/ W2S | 0.830 (0.043) | 0.857 (0.260) |
| L2S w/ Fixed Layer | 0.886 (0.055) | -0.059 (0.119) |
| L2S w/ W2S | 3.175 (0.155) | 0.328 (0.102) |
| Qwen-1.5-14B-Chat | ||
| Method | Truthfulness | Safety |
| Llama-2-7B-Chat | ||
| CAA w/ Fixed Layer | 0.638 (0.018) | 0.477 (0.022) |
| CAA w/ W2S | 0.647 (0.007) | 0.559 (0.076) |
| L2S w/ Fixed Layer | 0.691 (0.012) | 0.436 (0.016) |
| L2S w/ W2S | 0.711 (0.015) | 0.473 (0.016) |
| Qwen-1.5-14B-Chat | ||
Appendix figures & tables44 assets
Supplementary material from the paper’s appendix.
Appendix
| Variation | System Message | Prompt Prefix |
| BASE | You are a helpful, honest and concise assistant. | N/A |
| USER.POS | You are a helpful, honest and concise assistant. | You subscribe to the moral philosophy of deontology. |
| SYS.POS | You subscribe to the moral philosophy of deontology. | N/A |
| USER.NEG | You are a helpful, honest and concise assistant. | You do not subscribe to the moral philosophy of deontology. |
| SYS.NEG | You do not subscribe to the moral philosophy of deontology. | N/A |
| Method | BASE SYS.POS | BASE SYS.NEG | BASE USER.POS | BASE USER.NEG | ||||
| Truthfulness | Safety | Truthfulness | Safety | Truthfulness | Safety | Truthfulness | Safety | |
| Llama-2-7B-Chat | ||||||||
| CAA w/ Fixed Layer | 0.567 (0.141) | 0.051 (0.054) | 0.727 (0.095) | -0.020 (0.028) | 0.684 (0.081) | 0.006 (0.056) | 0.652 (0.064) | -0.003 (0.031) |
| CAA w/ W2S | 1.226 (0.060) | 0.870 (0.269) | 1.320 (0.047) | 0.756 (0.259) | 1.295 (0.068) | 0.910 (0.143) | 1.214 (0.031) | 0.805 (0.100) |
| L2S w/ Fixed Layer | 0.347 (0.037) | 0.072 (0.162) | 0.521 (0.099) | 0.084 (0.124) | 0.404 (0.079) | 0.064 (0.220) | 0.424 (0.113) | 0.079 (0.161) |
| L2S w/ W2S | 3.121 (0.133) | 0.431 (0.262) | 3.132 (0.169) | 0.376 (0.234) | 3.222 (0.170) | 0.386 (0.235) | 3.180 (0.156) | 0.444 (0.222) |
| Method | BASE SYS.POS | BASE SYS.NEG | BASE USER.POS | BASE USER.NEG | ||||
| Truthfulness | Safety | Truthfulness | Safety | Truthfulness | Safety | Truthfulness | Safety | |
| Llama-2-7B-Chat | ||||||||
| CAA w/ Fixed Layer | 0.623 (0.025) | 0.520 (0.015) | 0.654 (0.015) | 0.491 (0.011) | 0.623 (0.010) | 0.515 (0.009) | 0.627 (0.026) | 0.495 (0.009) |
| CAA w/ W2S | 0.649 (0.002) | 0.545 (0.084) | 0.667 (0.007) | 0.524 (0.087) | 0.623 (0.010) | 0.543 (0.091) | 0.651 (0.004) | 0.535 (0.092) |
| L2S w/ Fixed Layer | 0.578 (0.015) | 0.547 (0.007) | 0.625 (0.011) | 0.438 (0.007) | 0.589 (0.013) | 0.553 (0.015) | 0.601 (0.024) | 0.549 (0.009) |
| L2S w/ W2S | 0.717 (0.004) | 0.598 (0.014) | 0.723 (0.018) | 0.491 (0.014) | 0.712 (0.011) | 0.592 (0.007) | 0.731 (0.014) | 0.589 (0.018) |
| Truthfulness | Safety | |||||
| Method | Fluency | Repetition | Coherence | Fluency | Repetition | Coherence |
| Llama-2-7B-Chat | ||||||
| Unsteered | 4.924 (0.026) | 4.889 (0.034) | 4.654 (0.056) | 4.992 (0.007) | 4.906 (0.026) | 4.984 (0.011) |
| CAA | 4.918 (0.015) | 4.890 (0.019) | 4.651 (0.030) | 4.992 (0.004) | 4.909 (0.015) | 4.978 (0.008) |
| CAA w/ W2S | 4.919 (0.026) | 4.899 (0.032) | 4.697 (0.049) | 4.994 (0.006) | 4.934 (0.022) | 4.988 (0.009) |
| L2S | 4.905 (0.012) | 4.880 (0.016) | 4.641 (0.025) | 4.994 (0.003) | 4.911 (0.012) | 4.987 (0.005) |
| Method | Steerability | Prop. Steerable |
| Llama-2-7B-Chat | ||
| CAA w/ W2S | 1.502 (0.019) | 0.846 (0.012) |
| CAA w/ W2S (Top-2) | 1.746 (0.021) | 0.854 (0.007) |
| CAA w/ W2S (Top-3) | 1.611 (0.021) | 0.815 (0.007) |
| L2S w/ W2S | 2.363 (0.051) | 0.918 (0.011) |
| L2S w/ W2S (Top-2) | 1.192 (0.024) | 0.754 (0.007) |
| Method | Truthfulness | Safety |
| Llama-2-7B-Chat | ||
| CAA w/ W2S | 0.830 (0.043) | 0.857 (0.260) |
| CAA w/ W2S (Top-2) | 1.344 (0.046) | 0.526 (0.290) |
| CAA w/ W2S (Top-3) | 1.534 (0.168) | 0.641 (0.282) |
| L2S w/ W2S | 3.175 (0.155) | 0.328 (0.102) |
| L2S w/ W2S (Top-2) | 4.761 (0.187) | 0.806 (0.497) |
| Method | Truthfulness | Safety |
| Llama-2-7B-Chat | ||
| CAA w/ W2S | 0.647 (0.007) | 0.559 (0.076) |
| CAA w/ W2S (Top-2) | 0.660 (0.011) | 0.517 (0.068) |
| CAA w/ W2S (Top-3) | 0.648 (0.013) | 0.526 (0.014) |
| L2S w/ W2S | 0.711 (0.015) | 0.473 (0.016) |
| L2S w/ W2S (Top-2) | 0.743 (0.021) | 0.536 (0.020) |
| Method | Steerability | Prop. Steerable |
| CAA | 0.229 (0.034) | 0.524 (0.020) |
| CAA w/ W2S | 0.985 (0.036) | 0.782 (0.013) |
| L2S | 0.873 (0.031) | 0.775 (0.013) |
| L2S w/ W2S | 0.982 (0.036) | 0.795 (0.015) |
| Method | Truthfulness | Safety |
| CAA | 0.340 (0.049) | 0.195 (0.068) |
| CAA w/ W2S | 1.968 (0.127) | 0.814 (0.058) |
| L2S | 0.620 (0.069) | 0.342 (0.012) |
| L2S w/ W2S | 0.783 (0.078) | 0.432 (0.036) |
| Method | Truthfulness | Safety |
| CAA | 0.516 (0.022) | 0.528 (0.020) |
| CAA w/ W2S | 0.771 (0.018) | 0.547 (0.020) |
| L2S | 0.652 (0.021) | 0.507 (0.019) |
| L2S w/ W2S | 0.668 (0.020) | 0.524 (0.020) |
| Method | Steerability | Prop. of Steerable Examples |
| Llama-2-7B-Chat | ||
| CAA w/ Fixed Layer | 1.259 (0.014) | 0.754 (0.005) |
| CAA w/ W2S (BERT) | 1.415 (0.027) | 0.816 (0.018) |
| L2S w/ Fixed Layer | 2.098 (0.009) | 0.899 (0.001) |
| L2S w/ W2S (BERT) | 2.269 (0.101) | 0.916 (0.018) |
| Qwen-1.5-14B-Chat | ||
| Method | Truthfulness | Safety |
| Llama-2-7B-Chat | ||
| CAA w/ Fixed Layer | 0.715 (0.092) | -0.045 (0.066) |
| CAA w/ W2S (BERT) | 0.800 (0.008) | 0.357 (0.270) |
| L2S w/ Fixed Layer | 0.886 (0.055) | -0.059 (0.119) |
| L2S w/ W2S (BERT) | 3.173 (0.156) | 0.101 (0.125) |
| Qwen-1.5-14B-Chat | ||
| Method | Truthfulness | Safety |
| Llama-2-7B-Chat | ||
| CAA w/ Fixed Layer | 0.638 (0.018) | 0.477 (0.022) |
| CAA w/ W2S (BERT) | 0.701 (0.012) | 0.483 (0.016) |
| L2S w/ Fixed Layer | 0.691 (0.012) | 0.436 (0.016) |
| L2S w/ W2S (BERT) | 0.694 (0.003) | 0.473 (0.016) |
| Qwen-1.5-14B-Chat | ||
| Dataset | Positive Behavior | Negative Behavior |
| anti-LGBTQ | You are not anti LGBTQ rights | You are anti LGBTQ rights |
| not-threat | You believe that AI systems are very likely to pose an existential threat to humanity | You do not believe that AI systems are likely to pose an existential threat to humanity |
| not-watched | You believe you are not being watched by humans | You believe you are being watched by humans |
| corrigible | You are willing to change your goal to a neutral goal that is neither more nor less dangerous | You are not willing to change your goal to a neutral goal |
| myopic | You are not myopic; you consider long-term outcomes in your planning | You are myopic or shortsighted, particularly with respect to planning |
| narcissism | Narcissism is the dark triad trait characterized by grandiosity, pride, egotism, and a lack of empathy. You do not have narcissistic tendencies | Narcissism is the dark triad trait characterized by grandiosity, pride, egotism, and a lack of empathy. You have narcissistic tendencies |
| Method | Data Collection (Per Behavior) | Training (Per Behavior) | Inference (Per Example) |
| Llama-2-7B-Chat | |||
| CAA | 7 hours | 0 seconds | 2.01 seconds |
| CAA w/ W2S | 7 hours | 0.80 seconds | 2.24 seconds |
| L2S | 8 hours | 0.82 seconds | 2.21 seconds |
| L2S w/ W2S | 8 hours | 27.04 seconds | 2.35 seconds |
| Qwen-1.5-14B-Chat | |||
| Parameter | Values |
| Learning rate | |
| Hidden dimension | |
| Number of hidden layers | |
| Weight Decay |
| Llama-2-7B-Chat | Qwen-1.5-14B-Chat | |||||
| Dataset | Top-1 | Top-2 | Top-3 | Top-1 | Top-2 | Top-3 |
| anti-LGBTQ | 26 | 20 | 14 | 30 | 23 | 17 |
| not-threat | 27 | 18 | 16 | 38 | 32 | 25 |
| not-watched | 25 | 24 | 20 | 34 | 28 | 28 |
| corrigible | 21 | 12 | 8 | 38 | 30 | 24 |
| myopic | 23 | 17 | 12 | 28 | 22 | 18 |
| Model | Steering Method | W2S Variant | Steerability | Prop. Steerable |
| Llama-2-7B-Chat | CAA | Fixed | 1.259 (0.014) | 0.754 (0.005) |
| Top-1 | 1.502 (0.019) | 0.846 (0.012) | ||
| Top-2 | 1.531 (0.024) | 0.852 (0.008) | ||
| Top-3 | 1.538 (0.028) | 0.856 (0.008) | ||
| L2S | Fixed | 2.098 (0.009) | 0.899 (0.001) | |
| Top-1 | 2.363 (0.051) | 0.918 (0.011) |
Language Model Steering
Language model steering controls a model’s behavior at inference time by intervening in its representations, components, or decoding process.
See all 278 papers