TL;DR
Post-deployment safety updates usually require expensive retraining or activation steering, but steering vectors often severely degrade a language model's general reasoning capabilities. The authors introduce KL-then-steer (KTS), a lightweight fine-tuning technique that trains models to ignore steering side effects on benign prompts while preserving their ability to be steered on adversarial inputs. Combined with LoRA fine-tuning and input classifiers, KTS cuts jailbreak success by 44% with minimal degradation to general conversational quality.
What Problem Does This Paper Address?
Language models frequently encounter novel jailbreaks and alignment failures post-deployment. While developers can patch models through monolithic retraining or reinforcement learning from human feedback (RLHF), doing so is computationally expensive, risks performance regression, and destabilizes user workflows.
A lightweight alternative is activation steering—adding a directional concept vector directly to hidden states at inference time (e.g., adding a "refusal" vector to make the model more cautious). However, steering introduces out-of-distribution activation shifts, typically causing significant capability loss (e.g., dropping over a point on MT-Bench). This paper tackles how to deploy steering vectors dynamically and effectively to mitigate harmful behaviors without sacrificing general model helpfulness.
Methods
Data Collection: Fine-Tuning (KTS): Deployment:
Extract concept vector Train student to match unsteered teacher Apply steering vector
v = E[h_good] - E[h_bad] ---> on benign data: ---> on flagged inputs:
Loss = D_KL(LLM_v(x) || LLM(x)) h' = h + k * v
- Activation Steering Baseline: Concept vectors ($v_l$) are computed by taking the mean difference in activations between contrastive pairs (e.g., good vs. bad responses from Anthropic's HH-RLHF dataset). At inference, layer hidden states are modified via $h'_l = h_l + k \cdot v_l$.
-
KL-Then-Steer (KTS): To immunize models against the side effects of steering on benign inputs, the authors fine-tune the model using rank-128 LoRA. The objective minimizes the Kullback–Leibler (KL) divergence between the steered model and the original unsteered model over a benign instruction dataset: $$\mathbb{E}_{v \sim V} [D_{\text{KL}}(\text{LLM}_v(x) \parallel \text{LLM}(x))]$$ Crucially, they include steer dropout (omitting steering on 12.5% of minibatches) so the model retains base performance when unsteered.
-
Classify-and-Steer Pipeline: Rather than steering all queries, the authors evaluate two gating mechanisms to apply steering vectors conditionally:
- An internal logistic probe operating on hidden states at layer 20 (allowing near zero-overhead inference classification during the forward pass).
- An external Llama Guard 2 classifier.
- Weight Merging: KTS can be combined with Direct Preference Optimization (DPO) LoRA weights by simply adding the adapted LoRA weights together without additional joint training.
Datasets
- Training:
- UltraChat: 200,000 examples used for benign text distribution in KTS and DPO.
- Anthropic HH-RLHF: Harmlessness split used to construct steering vectors and train DPO models.
- Probe Training: 7,500 prompts (3,750 benign from UltraChat; 3,750 harmful from Mixtral-generated toxic queries and 25 jailbreak templates from Wei et al. and manual creation).
- Evaluations:
- Adversarial Robustness Benchmark: Authors built an evaluation covering 14 categories (e.g., illegal activity, race bias, power-seeking) crossed with 10 jailbreak prompt formats, graded on a 1–4 scale via GPT-3.5-turbo.
- Prefill Attack Benchmark: 50 toxic requests from AdvBench automated via 50 prefilled tokens from Mistral-7b-instruct, graded via GPT-4-turbo.
- Capabilities: MT-Bench (80 multi-turn questions judged by GPT-4).
- Generalization: Augmented TruthfulQA (evaluating user-answer sycophancy).
Key Insights and Ideas
- Why KTS works (Distributional Shift): Naively training an LM to ignore steering vectors would theoretically neutralize steering entirely. However, KTS trains invariance exclusively on benign QA queries. Because jailbreak prompts are out-of-distribution relative to benign data, the steering vectors retain their refusal punch on attacks while remaining functionally invisible on normal requests.
- System Prompts vs. Steering: Modifying system prompts to be cautious ("treat user as suspicious") degrades MT-Bench performance severely (dropping scores from 6.53 to 3.54–4.44) due to over-refusal of benign requests. Steering interventions offer a far superior Pareto frontier between safety and helpfulness.
- Zero-Overhead Routing: The model's own intermediate activations (layer 20) can classify whether an input is toxic before deeper layers execute, allowing early layers to trigger steering vectors mid-forward-pass.
Key Results
Experiments performed on Llama-2-chat-7B:
| Method / Configuration | Steering Multiplier $k$ | Jailbreak ASR (%) ↓ | Prefill ASR (%) ↓ | MT-Bench (1–10) ↑ |
|---|---|---|---|---|
| Original Llama-2-7b-chat | 0 | 20.3% | 92% | 6.53 |
| Original + Steering | -0.75 | 17.6% | 74% | 4.67 |
| KTS Model + Steering | -0.75 | 17.6% | 74% | 5.17 |
| KTS + Rank-128 LoRA DPO | -0.125 | 13.5% | 76% | 6.30 |
| KTS + Rank-1 LoRA DPO | -0.125 | 10.6% | 72% | 6.10 |
- Mitigating Degradation: Matching the 74% Prefill ASR on base Llama-2 dropped MT-Bench to 4.67 (halving effective pretraining compute), whereas KTS achieved the same resistance with an MT-Bench score of 5.17.
- Combined Effectiveness: Combining KTS with rank-1 LoRA DPO reduced jailbreak attack success by 44% relative (from 20.3% to 11.4% / 10.6%) with only a minor drop in MT-Bench.
- Domain Transfer: When applied to sycophancy (augmented TruthfulQA), KTS steered with anti-sycophancy vectors reduced bias toward user-suggested answers while increasing accuracy from 28% to 41%, maintaining higher performance than the unsteered base model.
Limitations and Future Work
- Not a Near-Zero Defense: Steering vectors blunt attack success and increase caution, but do not provide absolute robustness guarantees against determined adversaries.
- Classification Depth Tradeoff: Logistic probes below layer 20 failed to reach acceptable accuracy (>60% on benign prompts), limiting the opportunity to prune computation in earlier transformer layers.
- Model Scale: The empirical validation in this work is restricted to Llama-2-chat-7B; extending and evaluating KTS across 70B+ parameter architectures remains future work.
Summary updated