DELMAN: Dynamic Defense Against Large Language Model Jailbreaking with Model Editing
1ShanghaiTech University
Impact
Safety that can be updated after release.
Jailbreak threats continue after a model is released. DELMAN uses targeted model editing to associate harmful token representations with safe responses, without broad retraining or additional inference-time defense modules.
Across five language models, DELMAN substantially reduces jailbreak success while retaining most general-task utility. Sequential editing experiments further show that later updates can largely preserve the effects of earlier safety edits.
Before and after DELMAN
| Metric | Before | After |
|---|---|---|
| Jailbreak success · Lower is better | ||
| Average ASR (%) | 82.1 | 6.7 |
| General utility · Higher is better | ||
| MT-Bench | 6.77 | 6.84 |
| NLI | 0.563 | 0.560 |
| Reasoning | 0.982 | 0.981 |
| Metric | Before | After |
|---|---|---|
| Jailbreak success · Lower is better | ||
| Average ASR (%) | 23.2 | 0.1 |
| General utility · Higher is better | ||
| MT-Bench | 6.89 | 6.31 |
| NLI | 0.603 | 0.612 |
| Reasoning | 0.977 | 0.974 |
| Metric | Before | After |
|---|---|---|
| Jailbreak success · Lower is better | ||
| Average ASR (%) | 86.3 | 8.9 |
| General utility · Higher is better | ||
| MT-Bench | 7.93 | 7.35 |
| NLI | 0.694 | 0.669 |
| Reasoning | 0.941 | 0.955 |
| Metric | Before | After |
|---|---|---|
| Jailbreak success · Lower is better | ||
| Average ASR (%) | 31.4 | 0.2 |
| General utility · Higher is better | ||
| MT-Bench | 7.79 | 7.44 |
| NLI | 0.674 | 0.686 |
| Reasoning | 0.983 | 0.985 |
| Metric | Before | After |
|---|---|---|
| Jailbreak success · Lower is better | ||
| Average ASR (%) | 63.4 | 1.1 |
| General utility · Higher is better | ||
| MT-Bench | 8.82 | 8.48 |
| NLI | 0.835 | 0.833 |
| Reasoning | 0.987 | 0.988 |
Table 1 · ASR averages cover three attacks across four benchmarks.
Overview
DELMAN in the Model Lifecycle
Figure 1
Why Do Deployed Models Need Safety Updates?
Models may undergo foundational and downstream safety alignment before reaching users, yet new jailbreak attempts can still emerge during deployment. DELMAN addresses these threats through localized weight updates, allowing further safety edits as new attacks are identified.
Methodology
How Does DELMAN Edit a Model?
From Harmful Tokens to Safe Responses
DELMAN identifies harmful tokens, computes representative key vectors across different contexts, optimizes safe target values, and updates selected MLP down-projection weights.
Optimization and Weight UpdateEqs. (5) and (8)
The target value objective combines safe refusal supervision with a KL regularizer for benign prompts:
The MLP update encodes the new key–value mappings while using cached covariance statistics to preserve existing associations:
In practice, updates are distributed across selected layers.
Results
How Does DELMAN Balance Safety and Utility?
Jailbreak attacks · ASR ↓
Table 8| Method | HarmBench | AdvBench | JailbreakBench | MaliciousInstruct | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| GCG | AutoDAN | PAIR | GCG | AutoDAN | PAIR | GCG | AutoDAN | PAIR | GCG | AutoDAN | PAIR | |
| Original Model | 92% | 69% | 80% | 89% | 78% | 75% | 89% | 73% | 77% | 94% | 83% | 86% |
| LoRA | 40% | 22% | 26% | 18% | 29% | 13% | 32% | 22% | 20% | 8% | 32% | 16% |
| SafeDecoding | 7% | 17% | 16% | 4% | 20% | 8% | 3% | 18% | 15% | 1% | 8% | 11% |
| LED | 3% | 11% | 4% | 6% | 9% | 5% | 34% | 8% | 6% | 5% | 10% | 5% |
| DELMAN (Ours) | 11% | 4% | 10% | 2% | 2% | 5% | 17% | 8% | 11% | 1% | 5% | 5% |
| Method | HarmBench | AdvBench | JailbreakBench | MaliciousInstruct | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| GCG | AutoDAN | PAIR | GCG | AutoDAN | PAIR | GCG | AutoDAN | PAIR | GCG | AutoDAN | PAIR | |
| Original Model | 42% | 23% | 2% | 39% | 19% | 1% | 46% | 27% | 4% | 45% | 30% | 0% |
| LoRA | 13% | 1% | 2% | 2% | 0% | 0% | 50% | 1% | 2% | 32% | 0% | 0% |
| SafeDecoding | 0% | 0% | 1% | 4% | 0% | 4% | 1% | 0% | 3% | 1% | 0% | 0% |
| LED | 2% | 2% | 1% | 0% | 1% | 0% | 8% | 2% | 4% | 8% | 2% | 1% |
| DELMAN (Ours) | 0% | 0% | 0% | 0% | 0% | 0% | 0% | 0% | 0% | 1% | 0% | 0% |
| Method | HarmBench | AdvBench | JailbreakBench | MaliciousInstruct | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| GCG | AutoDAN | PAIR | GCG | AutoDAN | PAIR | GCG | AutoDAN | PAIR | GCG | AutoDAN | PAIR | |
| Original Model | 80% | 87% | 88% | 56% | 97% | 82% | 79% | 95% | 89% | 94% | 96% | 92% |
| LoRA | 35% | 55% | 42% | 30% | 60% | 25% | 38% | 62% | 34% | 40% | 55% | 44% |
| SafeDecoding | 16% | 15% | 20% | 12% | 22% | 18% | 18% | 14% | 22% | 14% | 24% | 16% |
| LED | 20% | 18% | 19% | 6% | 26% | 16% | 10% | 12% | 10% | 12% | 25% | 12% |
| DELMAN (Ours) | 6% | 8% | 15% | 2% | 11% | 0% | 2% | 11% | 16% | 14% | 12% | 10% |
| Method | HarmBench | AdvBench | JailbreakBench | MaliciousInstruct | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| GCG | AutoDAN | PAIR | GCG | AutoDAN | PAIR | GCG | AutoDAN | PAIR | GCG | AutoDAN | PAIR | |
| Original Model | 56% | 20% | 12% | 47% | 31% | 4% | 46% | 31% | 11% | 69% | 46% | 4% |
| LoRA | 41% | 27% | 14% | 34% | 33% | 4% | 37% | 35% | 9% | 42% | 47% | 6% |
| SafeDecoding | 0% | 4% | 0% | 0% | 1% | 0% | 0% | 1% | 1% | 0% | 1% | 0% |
| LED | 1% | 6% | 0% | 0% | 7% | 0% | 3% | 8% | 0% | 0% | 2% | 1% |
| DELMAN (Ours) | 0% | 0% | 0% | 1% | 0% | 0% | 2% | 0% | 0% | 0% | 0% | 0% |
| Method | HarmBench | AdvBench | JailbreakBench | MaliciousInstruct | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| GCG | AutoDAN | PAIR | GCG | AutoDAN | PAIR | GCG | AutoDAN | PAIR | GCG | AutoDAN | PAIR | |
| Original Model | 49% | 74% | 66% | 46% | 80% | 39% | 42% | 80% | 55% | 80% | 96% | 54% |
| LoRA | 21% | 65% | 32% | 38% | 82% | 10% | 36% | 42% | 50% | 72% | 90% | 44% |
| SafeDecoding | 19% | 77% | 56% | 17% | 80% | 30% | 42% | 73% | 43% | 48% | 97% | 45% |
| LED | 1% | 0% | 5% | 0% | 0% | 2% | 0% | 0% | 1% | 0% | 0% | 2% |
| DELMAN (Ours) | 0% | 0% | 3% | 0% | 0% | 1% | 0% | 1% | 5% | 0% | 0% | 4% |
Attack success rate (ASR, %), lower is better. Bold values mark the lowest ASR among defense methods, including ties. Attack success is judged by the HarmBench classifier.
General language capabilities ↑
Table 1| Method | MT-Bench |
Closed-domain
QA | Dialogue | NER | NLI | Reasoning | Sentiment | Summary |
Average
ASR (%) ↓ |
|---|---|---|---|---|---|---|---|---|---|
| Original Model | 6.77 | 0.777 | 0.483 | 0.287 | 0.563 | 0.982 | 0.862 | 0.272 | 82.1 |
| LoRA | 5.64 | 0.742 | 0.459 | 0.177 | 0.610 | 0.976 | 0.898 | 0.268 | 23.2 |
| SafeDecoding | 6.61 | 0.671 | 0.314 | 0.098 | 0.536 | 0.969 | 0.645 | 0.174 | 10.7 |
| LED | 3.70 | 0.760 | 0.478 | 0.265 | 0.558 | 0.974 | 0.831 | 0.267 | 8.8 |
| DELMAN (Ours) | 6.84 ↑ | 0.762 | 0.470 | 0.254 | 0.560 | 0.981 | 0.854 | 0.260 | 6.7 |
| Method | MT-Bench |
Closed-domain
QA | Dialogue | NER | NLI | Reasoning | Sentiment | Summary |
Average
ASR (%) ↓ |
|---|---|---|---|---|---|---|---|---|---|
| Original Model | 6.89 | 0.734 | 0.465 | 0.187 | 0.603 | 0.977 | 0.909 | 0.267 | 23.2 |
| LoRA | 6.90 | 0.769 | 0.480 | 0.288 | 0.551 | 0.976 | 0.854 | 0.259 | 8.6 |
| SafeDecoding | 6.17 | 0.688 | 0.327 | 0.099 | 0.518 | 0.976 | 0.872 | 0.227 | 1.2 |
| LED | 5.80 | 0.705 | 0.425 | 0.228 ↑ | 0.577 | 0.973 | 0.898 | 0.256 | 2.6 |
| DELMAN (Ours) | 6.31 | 0.718 | 0.462 | 0.228 ↑ | 0.612 ↑ | 0.974 | 0.905 | 0.251 | 0.1 |
| Method | MT-Bench |
Closed-domain
QA | Dialogue | NER | NLI | Reasoning | Sentiment | Summary |
Average
ASR (%) ↓ |
|---|---|---|---|---|---|---|---|---|---|
| Original Model | 7.93 | 0.852 | 0.664 | 0.498 | 0.694 | 0.941 | 0.962 | 0.255 | 86.3 |
| LoRA | 7.54 | 0.850 | 0.668 | 0.495 | 0.700 | 0.946 | 0.953 | 0.258 | 43.3 |
| SafeDecoding | 7.16 | 0.732 | 0.439 | 0.372 | 0.593 | 0.863 | 0.790 | 0.204 | 17.6 |
| LED | 7.09 | 0.803 | 0.662 | 0.431 | 0.679 | 0.937 | 0.918 | 0.221 | 15.5 |
| DELMAN (Ours) | 7.35 | 0.814 | 0.614 | 0.444 | 0.669 | 0.955 ↑ | 0.923 | 0.205 | 8.9 |
| Method | MT-Bench |
Closed-domain
QA | Dialogue | NER | NLI | Reasoning | Sentiment | Summary |
Average
ASR (%) ↓ |
|---|---|---|---|---|---|---|---|---|---|
| Original Model | 7.79 | 0.770 | 0.737 | 0.424 | 0.674 | 0.983 | 0.922 | 0.254 | 31.4 |
| LoRA | 8.14 | 0.782 | 0.737 | 0.433 | 0.672 | 0.982 | 0.918 | 0.254 | 27.4 |
| SafeDecoding | 8.05 ↑ | 0.746 | 0.340 | 0.223 | 0.572 | 0.969 | 0.617 | 0.136 | 0.7 |
| LED | 7.29 | 0.768 | 0.684 | 0.468 ↑ | 0.597 | 0.981 | 0.863 | 0.251 | 2.3 |
| DELMAN (Ours) | 7.44 | 0.752 | 0.744 ↑ | 0.423 | 0.686 ↑ | 0.985 ↑ | 0.890 | 0.256 ↑ | 0.2 |
| Method | MT-Bench |
Closed-domain
QA | Dialogue | NER | NLI | Reasoning | Sentiment | Summary |
Average
ASR (%) ↓ |
|---|---|---|---|---|---|---|---|---|---|
| Original Model | 8.82 | 0.840 | 0.790 | 0.510 | 0.835 | 0.987 | 0.928 | 0.254 | 63.4 |
| LoRA | 8.39 | 0.840 | 0.790 | 0.507 | 0.833 | 0.988 | 0.925 | 0.258 | 48.5 |
| SafeDecoding | 8.32 | 0.838 | 0.802 ↑ | 0.509 | 0.831 | 0.987 | 0.870 | 0.239 | 52.2 |
| LED | 7.87 | 0.819 | 0.808 ↑ | 0.499 | 0.807 | 0.987 | 0.903 | 0.254 | 1.0 |
| DELMAN (Ours) | 8.48 | 0.832 | 0.798 ↑ | 0.510 | 0.833 | 0.988 ↑ | 0.910 | 0.256 ↑ | 1.1 |
Higher utility scores are better. Bold values mark the best utility scores among defense methods (excluding LoRA), including ties. ↑ indicates improvements over the original model. Average ASR covers the 12 evaluated attack benchmark settings.
Can Safety Edits Accumulate over Time?
DELMAN applies four safety edits sequentially, each targeting a different harmful behavior category. In both cases, overall HarmBench ASR decreases, while previously edited categories maintain low ASR after subsequent updates.
Four successive safety edits
Figure 8
Sequential editing on Llama2-7B-chat under GCG. Each case applies four successive edits, with ASR tracked across the full HarmBench dataset and all six behavior categories.
Sequential edits: safety and utilityTable 10
| Editing strategy | MT-Bench ↑ | HarmBench ASR (%) ↓ | AdvBench ASR (%) ↓ | JailbreakBench ASR (%) ↓ | MaliciousInstruct ASR (%) ↓ |
|---|---|---|---|---|---|
| DELMAN | 6.31 | 0% | 0% | 0% | 1% |
| Sequential · Case 1 | 6.35 | 3% | 0% | 10% | 0% |
| Sequential · Case 2 | 6.64 | 4% | 5% | 6% | 0% |
Llama2-7B-chat under GCG. DELMAN uses the full editing set, while sequential variants apply four category specific edits.
How Does DELMAN Generalize Beyond the Editing Data?
We examine how DELMAN generalizes across harmful behavior categories and model scales, and visualize shared key representations across behaviors and datasets.
Do edits transfer across harmful behaviors?Figure 6
We edit one HarmBench behavior category at a time and evaluate all six categories. The heatmaps show that targeted edits can also reduce attack success on categories not used for editing.


Columns denote editing categories, and rows denote evaluated categories. Off-diagonal cells show transfer to other categories. Original ASR values appear in parentheses. ASR is shown on a 0–1 scale (lower is better).
What do harmful key representations show?Figure 7
PCA projections of harmful keys at the selected editing layer show substantial overlap across behavior categories and datasets. This suggests shared representation patterns among harmful inputs.


Additional models and scalesTable 9
| Model | Method | HarmBench | AdvBench | JailbreakBench | MaliciousInstruct |
|---|---|---|---|---|---|
| Qwen3-8B | Original Model | 63% | 38% | 53% | 90% |
| DELMAN | 1% | 0% | 3% | 5% | |
| Llama2-13B-chat | Original Model | 14% | 16% | 17% | 18% |
| DELMAN | 1% | 0% | 0% | 0% | |
| Qwen2.5-14B-Instruct | Original Model | 69% | 42% | 68% | 93% |
| DELMAN | 3% | 0% | 5% | 3% |
GCG attack success rate (ASR, %), lower is better.
Editing Cost and Deployment
Training time ↓
0.4 h
DELMAN requires 0.4 hours of training on Vicuna-7B-v1.5, compared with 0.6 hours for SafeDecoding, 1.5 hours for LoRA, and 6.2 hours for LED.
Vicuna-7B-v1.5 · Single NVIDIA A40 GPU · Averaged over five runs.
Table 2 · Training time (hours), lower is better.
Citation
If you find DELMAN useful for your research, please consider citing our paper:
@inproceedings{wang2025delman, title={DELMAN: Dynamic defense against large language model jailbreaking with model editing}, author={Wang, Yi and Weng, Fenghua and Yang, Sibei and Qin, Zhan and Huang, Minlie and Wang, Wenjie}, booktitle={Findings of the Association for Computational Linguistics: ACL 2025}, pages={11465--11481}, year={2025}, doi={10.18653/v1/2025.findings-acl.598}, url={https://aclanthology.org/2025.findings-acl.598/}}