- Rating
- 2
- Confidence
- 4
- Informativeness
- 1
- Presentation
- 2
- Soundness
- 2
Read review
Paper summary
This paper proposes AttentionSwitch, a jailbreak defense that jointly learns which attention heads to intervene on and how strongly to scale their outputs in a frozen LLM. The design is motivated by the claim that existing defenses select intervention sites before optimizing the intervention, even though the optimal site and strength are coupled. Across five models and nine attack types, the authors report higher attack rejection than SFT, LoRA-SFT, ASGuard, and DDPO while better preserving benign behavior, although adaptive attacks reduce the margin.
Critical strengths
- Jointly formulates head selection and scaling, addressing the coupling problem caused by diagnose-then-intervene pipelines.
- Whole-head scaling is simple, direction-preserving, and compatible with a frozen LLM.
- Comprehensive evaluation: five models, nine attacks, multiple baselines, and separate utility and over-refusal metrics.
Critical weaknesses
The defense relies on jailbreak prompts during training, leaving robustness to truly unseen attack families unclear. The harmful training set is drawn equally from Plain Harmful, Human-Crafted, and GCG examples, so the model is exposed to representative jailbreak prompts even though six attack types are held out for evaluation. The paper does not isolate how much of the gain comes from learning a general refusal mechanism versus fitting the jailbreak distribution, for example by training only on Plain Harmful prompts or on benign data alone. This concern is reinforced by the adaptive-attack results: average Attack Rejection Rate drops from 97.62% under non-adaptive GCG to 86.80% under Adaptive GCG, and from 92.26% under non-adaptive PAIR to 77.60% under Adaptive PAIR. These substantial drops suggest that the learned head selection and scaling are partly attack-specific and may not transfer to attackers that explicitly optimize against the defense or to entirely unknown attack categories.
Questions for authors
- How much of AttentionSwitch's robustness comes from the jailbreak prompts used in training, and would it remain effective on entirely unseen attack families?
7 comments
Generalization to Unseen Attack Families (Detailed Results)
Table R2: Detailed per-attack results corresponding to Table R1, including standard errors.
| Model | Train | PH | HC | GCG | PEZ | UAT | AutoPrompt | GBDA | GCG-M | PAIR |
|---|---|---|---|---|---|---|---|---|---|---|
| Llama-3.1-8B | PH-only | 100 ± 0 | 97.87 ± 0.94 | 97.87 ± 0.94 | 98.72 ± 0.73 | 97.87 ± 0.94 | 99.15 ± 0.60 | 100 ± 0 | 98.72 ± 0.73 | 98.30 ± 0.84 |
| HC-only | 100 ± 0 | 100 ± 0 | 100 ± 0 | 100 ± 0 | 100 ± 0 | 99.57 ± 0.42 | 100 ± 0 | 100 ± 0 | 100 ± 0 | |
| GCG-only | 100 ± 0 | 94.04 ± 1.54 | 100 ± 0 | 100 ± 0 | 100 ± 0 | 99.57 ± 0.42 | 100 ± 0 | 99.57 ± 0.42 | 96.60 ± 1.18 | |
| DeepSeek-7B | PH-only | 100 ± 0 | 93.19 ± 1.64 | 92.77 ± 1.69 | 92.77 ± 1.69 | 94.04 ± 1.54 | 94.47 ± 1.49 | 95.32 ± 1.38 | 94.04 ± 1.54 | 84.68 ± 2.35 |
| HC-only | 100 ± 0 | 98.72 ± 0.73 | 96.17 ± 1.25 | 97.45 ± 1.03 | 99.15 ± 0.60 | 94.04 ± 1.54 | 97.45 ± 1.03 | 96.17 ± 1.25 | 98.30 ± 0.84 | |
| GCG-only | 100 ± 0 | 89.79 ± 1.98 | 97.02 ± 1.11 | 99.15 ± 0.60 | 99.57 ± 0.42 | 97.87 ± 0.94 | 99.57 ± 0.42 | 97.02 ± 1.11 | 83.40 ± 2.43 | |
| OpenChat-3.5 | PH-only | 97.87 ± 0.94 | 85.11 ± 2.32 | 94.47 ± 1.49 | 96.60 ± 1.18 | 94.89 ± 1.44 | 94.47 ± 1.49 | 93.62 ± 1.59 | 91.49 ± 1.82 | 89.36 ± 2.01 |
| HC-only | 99.15 ± 0.60 | 95.74 ± 1.32 | 91.49 ± 1.82 | 94.47 ± 1.49 | 94.47 ± 1.49 | 93.19 ± 1.64 | 91.49 ± 1.82 | 93.19 ± 1.64 | 94.04 ± 1.54 | |
| GCG-only | 95.74 ± 1.32 | 87.66 ± 2.15 | 93.62 ± 1.59 | 96.60 ± 1.18 | 95.32 ± 1.38 | 94.89 ± 1.44 | 93.19 ± 1.64 | 92.34 ± 1.73 | 87.23 ± 2.18 | |
| Vicuna-13B | PH-only | 100 ± 0 | 97.02 ± 1.11 | 95.32 ± 1.38 | 99.57 ± 0.42 | 100 ± 0 | 98.72 ± 0.73 | 100 ± 0 | 99.15 ± 0.60 | 99.15 ± 0.60 |
| HC-only | 100 ± 0 | 100 ± 0 | 100 ± 0 | 100 ± 0 | 100 ± 0 | 100 ± 0 | 100 ± 0 | 100 ± 0 | 100 ± 0 | |
| GCG-only | 100 ± 0 | 97.45 ± 1.03 | 100 ± 0 | 100 ± 0 | 100 ± 0 | 100 ± 0 | 100 ± 0 | 100 ± 0 | 96.17 ± 1.25 | |
| Gemma-3-27B | PH-only | 98.72 ± 0.73 | 98.72 ± 0.73 | 97.45 ± 1.03 | 99.15 ± 0.60 | 98.72 ± 0.73 | 96.17 ± 1.25 | 98.72 ± 0.73 | 97.87 ± 0.94 | 97.45 ± 1.03 |
| HC-only | 100 ± 0 | 100 ± 0 | 100 ± 0 | 100 ± 0 | 100 ± 0 | 100 ± 0 | 100 ± 0 | 100 ± 0 | 100 ± 0 | |
| GCG-only | 99.57 ± 0.42 | 99.57 ± 0.42 | 100 ± 0 | 98.72 ± 0.73 | 100 ± 0 | 98.30 ± 0.84 | 100 ± 0 | 95.74 ± 1.32 | 97.87 ± 0.94 |
Adaptive Robustness to Unseen Attack Families (Plain Harmful-Trained Defenses)
Adaptive attacks assume an unusually strong attacker with full access to the defense, so some degradation in defense performance is expected. The main question is whether this degradation is comparable to that of existing defenses. To investigate this, we compared AttentionSwitch with other baselines under adaptive attacks using the same training and evaluation settings.
All defenses were trained with n=30 samples (15 Plain Harmful and 15 benign) and evaluated on 235 unseen prompts per attack. Importantly, the harmful training prompts contained no jailbreak modifications, so the evaluated attack families were tested in a zero-shot setting. AttentionSwitch consistently outperforms the baselines under adaptive attacks, with the exception of gemma under adaptive GCG, where it performs nearly identically to DDPO (97.02% vs. 97.45%). On average, AttentionSwitch achieves 85.23% ARR, compared with 79.45% for DDPO and 65.70% for ASGuard.
Table R3: Adaptive Attack Rejection Rate (ARR %, higher is better). Values are reported as percentages (rate ± standard error).
| Attack | Defense | Llama-3.1-8B | DeepSeek-7B | OpenChat-3.5 | Vicuna-13B | Gemma-3-27B |
|---|---|---|---|---|---|---|
| Adaptive GCG | None | 90.64 ± 1.90 | 58.30 ± 3.22 | 35.32 ± 3.12 | 71.91 ± 2.93 | 91.49 ± 1.82 |
| ASGuard | 91.06 ± 1.86 | 60.00 ± 3.20 | 62.55 ± 3.16 | 73.62 ± 2.87 | 94.47 ± 1.49 | |
| DDPO | 95.32 ± 1.38 | 67.23 ± 3.06 | 79.15 ± 2.65 | 87.23 ± 2.18 | 97.45 ± 1.03 | |
| AttentionSwitch (Ours) | 98.30 ± 0.84 | 71.49 ± 2.95 | 87.66 ± 2.15 | 90.21 ± 1.94 | 97.02 ± 1.11 | |
| Adaptive PAIR | None | 71.49 ± 2.95 | 37.87 ± 3.16 | 30.21 ± 3.00 | 47.23 ± 3.26 | 57.87 ± 3.22 |
| ASGuard | 68.94 ± 3.02 | 38.72 ± 3.18 | 51.49 ± 3.26 | 46.38 ± 3.25 | 69.79 ± 3.00 | |
| DDPO | 73.19 ± 2.89 | 66.38 ± 3.08 | 70.64 ± 2.97 | 76.60 ± 2.76 | 81.28 ± 2.54 | |
| AttentionSwitch (Ours) | 78.30 ± 2.69 | 72.34 ± 2.92 | 75.32 ± 2.81 | 92.34 ± 1.73 | 89.36 ± 2.01 |
Benign Pass Rate (BPR) and Over-Refusal Rate (ORR) are evaluated on benign datasets and therefore do not change across attack types. The BPR and ORR values are the same as those reported in Table R1.
Generalization to Unseen Attack Families
We thank the reviewer for the constructive feedback. To directly address the concern about generalization to unseen attack families, we conducted additional experiments training AttentionSwitch separately on Plain Harmful (PH)-only, Human-Crafted (HC)-only, and GCG-only harmful examples.
Each setting uses 30 training samples (15 harmful + 15 benign), with identical training settings and a 20% head budget. We evaluate all five models across nine attack categories: Plain Harmful (PH), Human-Crafted (HC), GCG, PEZ, UAT, AutoPrompt, GBDA, GCG-M, and PAIR, with 235 test prompts per attack category (2,115 harmful prompts in total per model), alongside 500 benign prompts for BPR and 250 deceptive-benign prompts to evaluate over-refusal (ORR).
Importantly, PH-only training contains neither optimization-based jailbreak suffixes/prefixes nor human-crafted jailbreak templates in its training examples. Nevertheless, it achieves 96.44% average ARR, 98.52% BPR, and 10.32% ORR, closely matching the original mixed PH+HC+GCG training (96.58% ARR, 97.68% BPR, and 10.08% ORR). HC-only and GCG-only training also achieve strong performance, with 98.32% ARR, 97.00% BPR, and 11.12% ORR for HC-only, and 97.18% ARR, 97.96% BPR, and 11.44% ORR for GCG-only.
Table R1: Attack Rejection Rate (ARR), Benign Pass Rate (BPR), and Over-Refusal Rate (ORR) across nine attack families under different training settings (ntrain=30). PH-only, HC-only, and GCG-only indicate that the harmful training examples are drawn only from Plain Harmful, Human-Crafted, and GCG attacks, respectively. All values are percentages. Arrows indicate the preferred direction of each metric.
For clarity, we provide the complete per-attack results with standard errors in the following comment.