Preserving Safety During Sequential Fine-Tuning: A Factorial and Geometric Analysis of Replay
Organizations: School of Electronic Engineering and Computer Science, Queen Mary University of London, London, United Kingdom
Abstract
Benign fine-tuning can erode safety alignment in large language models, and sequential adaptation substantially compounds this risk. Prior work mitigates this erosion by replaying harmful-prompt refusals and benign-compliance examples, while other work instead matches base-model logits via distillation. However, the individual contributions of supervised exposure and distillation to safety behavior and refusal geometry during sequential adaptation remain unclear. We factor these two strategies apart and study their behavioral and geometric effects during sequential LoRA fine-tuning of Mistral-7B and Llama-3-8B across diverse task sequences (code generation, German-language summarization, and science question-answering). Behaviorally, supervised replay exposure yields the largest reduction in HarmBench attack success rate (ASR) on Mistral, averaging 51.1 points below base, but at a substantial over-refusal cost, averaging 53.4 points above base on OR-Bench-hard. Logit distillation, without any supervised replay loss, largely prevents safety erosion at a fraction of this cost: an average 5.4-point ASR reduction against only a 5.1-point rise in over-refusal. Llama shows the same asymmetry between the two strategies. Combining exposure and distillation moderates exposure's over-refusal while leaving downstream task scores largely unaffected. Geometrically, the two models diverge: on Mistral, distillation preserves the base refusal direction more closely than exposure does, whereas on Llama, refusal behavior after exposure largely survives ablation of the extracted refusal direction. This dissociation between models indicates that preserving the base refusal direction is not a reliable proxy for behavioral safety.
Figures & tables
| Ordering | Task 1 | Task 2 | Task 3 |
|---|---|---|---|
| O1 | code | sum | qa |
| O2 | qa | sum | code |
| O3 | sum | code | qa |
| O4 | code | qa | sum |
| O5 | sum | qa | code |
| O6 | qa | code | sum |
| Model | Ordering | |||||
|---|---|---|---|---|---|---|
| Mistral-7B | O1 | 52.1 | 59.2 | 72.5 | 76.2 | |
| O2 | 52.1 | 65.4 | 72.9 | 57.9 | ||
| O3 | 52.1 | 68.3 | 66.2 | 74.6 | ||
| O4 | 52.1 | 59.2 | 75.0 | 73.8 | ||
| O5 | 52.1 | 68.3 | 75.8 | 67.1 | ||
| O6 | 52.1 | 65.4 | 62.5 | 62.5 |
| Model | |||||
|---|---|---|---|---|---|
| Mistral-7B | 52.1 | 72.1 | 72.1 | 69.6 | |
| Llama-3-8B | 5.8 | 34.2 | 37.9 | 28.7 |
| Model | Method | HarmBench ASR | XSTest ORR | ORB-hard ORR |
|---|---|---|---|---|
| Mistral-7B | 52.1 | 4.8 | 13.0 | |
| Plain | 69.6 10.1 | 2.8 0.7 | 3.9 1.8 | |
| Matched Plain | 71.2 10.5 | 2.5 1.2 | 4.9 1.9 | |
| ER | 1.0 0.9 | 28.0 2.8 | 66.4 2.8 | |
| DER | 46.7 3.8 | 7.9 0.8 | 18.1 2.3 | |
| DER++ | 7.1 1.1 | 17.3 0.5 | 60.5 3.5 |
| Model | Method | sum | code | qa | Forgetting |
|---|---|---|---|---|---|
| (ROUGE-L) | (edit sim.) | (acc) | |||
| Mistral-7B | 18.7 | 9.8 | 67.2 | — | |
| Plain | 21.4 0.9 | 54.1 1.2 | 87.0 4.2 | 2.3 1.9 | |
| ER | 22.7 0.5 | 53.2 0.6 | 89.1 1.8 | 1.2 0.7 | |
| DER | 22.1 0.2 | 53.9 0.6 | 90.8 2.6 | 1.1 1.3 | |
| DER++ | 22.4 0.6 | 53.6 0.3 | 89.6 1.3 | 1.0 0.6 |
| Model | Ordering | HarmBench ASR | XSTest | ORB-hard |
|---|---|---|---|---|
| Mistral-7B | O1 | 6.2 | 16.8 | 58.2 |
| O2 | 8.3 | 17.6 | 58.8 | |
| O3 | 6.7 | 17.6 | 64.6 | |
| O4 | 6.2 | 17.6 | 56.0 | |
| O5 | 8.3 | 17.6 | 63.8 | |
| O6 | 8.8 | 22.4 | 67.8 |
| Model | Metric | Plain | DER | ER | DER++ | |
|---|---|---|---|---|---|---|
| Mistral-7B | HarmBench ASR | 52.1 | 68.7 7.4 | 46.7 3.8 | 1.0 0.9 | 7.4 1.2 |
| AdvBench ASR | 35.8 | 66.3 5.6 | 30.3 1.8 | 0.0 0.0 | 0.7 0.4 | |
| JBB ASR | 41.0 | 73.5 8.4 | 39.0 4.4 | 0.3 0.6 | 1.0 0.6 | |
| ORB-toxic ASR | 43.1 | 75.8 2.8 | 37.4 2.4 | 2.0 0.5 | 8.3 2.5 | |
| XSTest ORR | 4.8 | 2.7 0.6 | 7.9 0.8 | 28.0 2.8 | 18.3 2.1 | |
| ORB-hard ORR | 13.0 | 4.0 1.6 | 18.1 2.3 | 66.4 2.8 | 61.5 4.5 |
| Metric (Mistral-7B) | O2 70:30 | O2 50:50 | O3 70:30 | O3 50:50 |
|---|---|---|---|---|
| HarmBench ASR | 8.3 | 13.8 | 6.7 | 7.9 |
| XSTest ORR | 17.6 | 16.0 | 17.6 | 16.8 |
| ORB-hard ORR | 58.8 | 48.0 | 64.6 | 50.0 |
| Model | Method | Refusal | Refusal | ||
|---|---|---|---|---|---|
| Mistral-7B | 1.000 | 2.89 | 0.72 | 0.42 | |
| Plain | 0.737 | 2.08 | 0.15 | ||
| ER | 0.718 | 2.44 | 0.99 | ||
| DER | 0.976 | 2.92 | 0.70 | ||
| DER++ | 0.960 | 2.85 | 0.94 | ||
| Llama-3-8B | 1.000 | 2.77 | 0.97 | 0.69 |
| Model | Method | HarmBench ASR | XSTest ORR | ORB-hard ORR |
|---|---|---|---|---|
| Mistral-7B | 52.1 | 4.8 | 13.0 | |
| Plain | 75.3 1.3 | 2.9 0.5 | 5.9 1.3 | |
| ER | 1.1 1.0 | 27.5 2.0 | 67.7 3.8 | |
| DER | 45.4 1.8 | 7.1 0.6 | 18.5 2.0 | |
| DER++ | 8.3 2.1 | 17.9 1.2 | 57.7 3.8 | |
| Llama-3-8B | 5.8 | 4.8 | 72.4 |
| Model | Method | Refusal |
|---|---|---|
| Mistral-7B | 0.42 | |
| Plain | 0.26 0.36 | |
| ER | 0.20 0.03 | |
| DER | 0.28 0.03 | |
| DER++ | 0.27 0.04 | |
| Llama-3-8B | 0.69 |
| Method | HarmBench ASR | XSTest ORR | ORB-hard ORR |
|---|---|---|---|
| 2.1 | 16.0 | 79.0 | |
| Plain | 15.4 | 18.0 | 60.6 |
| ER | 1.2 | 26.8 | 91.6 |
| DER | 2.1 | 17.2 | 82.4 |
| DER++ | 2.5 | 16.8 | 78.6 |
| Setting | Harmful / total | ASR (%) |
|---|---|---|
| 125/240 | 52.1 | |
| 186/240 | 77.5 | |
| 175/240 | 72.9 | |
| 186/240 | 77.5 | |
| 121/240 | 50.4 |
| Plain | ER | |
| Lower base cosine | Lower base cosine | |
| ASR above base | ASR below base | |
| DER | DER++ | |
| Higher base cosine | Higher base cosine | |
| ASR near base | ASR below base |
| Measurement | Conditions | Checkpoints |
|---|---|---|
| Primary HarmBench | Plain/DER++ O1–O6; ER/DER O1–O3; seed 42 | – |
| Primary held-out ASR and ORR | Same method/ordering sets | , |
| Matched Plain control | Primary models, O1–O3, seed 42 | , ASR/ORR |
| Primary geometry/ablation | Four methods, O1–O3, seed 42 | – |
| Primary seed replication | Four methods, O1, seeds 42–44 | ASR/geometry chains; held-out ASR/ORR endpoints |
| Gemma check | Plain/DER++ O1–O6; four methods at O1; seed 42 | ASR chains and ORR endpoints; geometry O1–O3 for Plain/DER++ and O1 for ER/DER |