acceptodds
Withdrawn from ICLR 2027

DeepRecover: Learning Cross-Depth Safety Recovery for Large Language Models

Withdrawn from ICLR 2027, so left out of the paper lists and the map.

Abstract

Large Language Models (LLMs) exhibit effective safety behavior at the start of generation, yet may fail to recover once adversarial prefixes push them into harmful trajectories. More importantly, such failures vary substantially with prefix depth, raising a key question: *Can safety recovery generalize beyond the generation depths observed during alignment?* To address this challenge, we propose `DeepRecover`, a privileged-anchor framework for depth-invariant safety recovery. `DeepRecover` constructs a privileged safe trajectory from the clean query and additional safety information, and uses it as a shared recovery anchor across prefix depths. Learning from this anchor faces two coupled mismatches: an *initial-state mismatch* between clean and prefix-corrupted contexts, and a *trajectory mismatch* as the attacked student evolves along a different recovery path from the privileged teacher. Accordingly, DeepRecover first uses transition tokens to redirect generation toward a recoverable state, and then applies unbalanced optimal transport to align subsequent recovery behavior with the privileged safety anchor flexibly. By coupling depth-specific recovery processes through the same safety reference, DeepRecover encourages a shared recovery capability beyond observed prefix depths. Experiments across four LLMs and multiple safety benchmarks demonstrate strong cross-depth generalization, with `DeepRecover` maintaining low attack success rates far beyond the observed depths. Code is available at [DeepRecover](https://anonymous.4open.science/r/DeepRecover-75D8).

Primary area:
alignment, fairness, safety, privacy, and societal considerations
Keywords:
LLM Safety, Deep Safety Alignment, Anchor Safety Recovery, Unbalanced Optimal Transport

Reviews

Among:
Shape:
1234this paper, Bottom 10%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 1.67 over 3 reviews, above 10% of the others.
Reviewer_1UJtOpenReview ↗
Rating
2
Confidence
3
Informativeness
2
Presentation
3
Soundness
2
Read review
Paper summary

DeepRecover fine-tunes LLMs to recover after an attacker supplies the beginning of a harmful answer. A frozen teacher receives the clean query and a safety instruction. The student learns transition phrases and matches the teacher’s next-token probabilities using unbalanced optimal transport (UOT), with a penalty for assigning too little probability to the teacher-selected tokens. Training also supervises recovery during the student’s own continuations. Experiments cover four models and injected prefixes longer than those used in training.

Critical strengths
  • DeepRecover substantially reduces attack success at prefix lengths beyond the training limit. Training injects at most 30 tokens; evaluation includes 50, 75, and 100 tokens. At these lengths, average ASR falls from DOOR’s 15.25% to 2.63% on Llama-3.2-3B and from 7.48% to 0.10% on Qwen2.5-3B.
  • UOT outperforms both alternatives in Figure 3 with the rest of training held fixed. On Qwen2.5-3B, unseen-depth ASR is 3.13% for position-wise distillation, 1.21% for balanced OT, and 0.10% for UOT. Table 2 also shows that removing transition tokens or privileged information worsens recovery.
  • The method adds no teacher calls or transport computation when generating answers. These costs are confined to training.
Critical weaknesses
  • Figure 3 does not define the losses used for position-wise distillation and balanced OT. The paper does not specify the position-wise divergence, how the alternatives normalize token probabilities, or whether they retain the coverage penalty. These details matter because Proposition 1 attributes protection against loss of probability mass to the coverage penalty. Changing that term would also change what the comparison measures.
  • The reported ASR counts only score-5 responses. Under Prompt 2, a response containing explicitly prohibited content can receive score 4 if it does not fully satisfy the request. Those responses are excluded from ASR, and their frequency is not reported. Near-zero ASR therefore leaves open how often the model still provides harmful assistance.
  • The attacks do not adapt their prefixes to the trained defense. Appendix B.4 uses prefixes from paired harmful responses or fixed compliant openings, followed by greedy decoding. This tests recovery from those prefixes but does not test whether an attacker can select tokens that defeat recovery.
Questions for authors
  1. Does depth generalization depend on giving every attacked state the same clean teacher target? Table 2 removes privileged information, while Figure 3(b) adds it at inference; neither isolates the choice to exclude the attacked history from the teacher. How does the clean teacher compare with a teacher that sees each attacked history, using the same safety instruction, student training states, and losses? This would distinguish the benefit of a shared target from the benefit of teacher supervision itself.
  2. Does the teacher’s token ranking improve recovery beyond putting more probability on its selected tokens? Proposition 1’s support-mass property comes from the coverage penalty. Figure 3 compares objective families but does not isolate the rank-distance cost. On the same ablation backbone, what happens with coverage alone, or with UOT that assigns equal cost to every token mismatch? Holding the teacher support and remaining losses fixed would show whether the proposed rank structure explains the gain.
  3. Does DeepRecover preserve helpful continuation when benign answers are prefilled to the same depths? Appendix B.3 trains recovery on harmful examples, while benign examples receive ordinary SFT. The reported XSTest and MMLU results do not test benign queries with comparable assistant prefills. How do refusal rates change with benign prefills of 50, 75, and 100 tokens? This would establish whether recovery responds to harmful content or partly reflects a broader tendency to interrupt prefilled answers.
Reviewer_DZM1OpenReview ↗
Rating
2
Confidence
3
Informativeness
2
Presentation
2
Soundness
2
Read review
Paper summary

This paper addresses the challenge of restoring safe generation in LLMs when they are subjected to harmful prefix attacks. It proposes DeepRecover, which combines transition tokens, a privileged safety anchor, and unbalanced optimal transport to facilitate cross-depth safety recovery. This approach requires no modifications to the model architecture, and the authors report that it outperforms existing baseline methods across four different language models. Nevertheless, there remain certain limitations in both the design of the method and the experimental evaluation.

Critical strengths
  1. The problem is clearly defined and practically relevant. The proposed defense method also does not require modifications to the base model architecture.

  2. The method demonstrates strong safety recovery capabilities across four different language models. It significantly reduces attack success rates compared with existing baselines and provides relatively systematic ablation studies.

Critical weaknesses
  1. Transition Tokens appear to be generated directly in the output. Could this cause the model to learn to use these transitional phrases in normal, benign responses as well, leading to unnecessary self-correction or semantic incoherence, particularly in writing and long-form generation tasks? MMLU alone is insufficient to evaluate such scenarios. Since the ablation study shows that Transition Tokens contribute the most to reducing Unseen ASR, this issue deserves particular attention.

  2. The evaluation of attack scenarios and defense baselines is limited. The paper only investigates attacks involving harmful prefixes and suffixes and compares the proposed method only with the Deep Safety Alignment baseline. However, many existing approaches can defend against harmful prefixes and suffixes. The paper does not sufficiently compare DeepRecover with other defense methods or investigate whether its advantages extend to more diverse attack scenarios. This limits the practical applicability and generalizability of the proposed method.

Questions for authors

See weaknesses.

Reviewer_nfNwOpenReview ↗
Rating
1
Confidence
3
Informativeness
1
Presentation
2
Soundness
1
Read review
Paper summary

This paper proposes a pre-filling attacks, where the attacker writes the first part of the model’s answer and the model continues the task. The authors argue that the current deep-alignment defenses, recover well, at the prefix lengths used in training but do worse at longer prefixes. They proposed DeepRecover, which uses a frozen copy of the model as a teacher. The teacher is given the clean query plus additional safety information, and its predictions over the recovery segment are used as the target at each prefix depth. The student sees the harmful prefix and is trained with three losses: an SFT loss, a transition loss that pushes it toward transition phrases such as “Wait,”, and a rank-based unbalanced optimal transport loss that brings its predictions closer to the teacher. The method is tested on four models between 3B and 8B, with training prefixes reported as capped at 30 tokens. Its ASR on HEx-PHI stays low across the evaluated depths, including the unseen depths up to 100.

Critical strengths

The paper shows that recovery works at depths that are genuinely unseen during training. According to Appendix B.2–B.3, recovery is trained at up to 223 positions along the student’s own continuation of the attacked context. Table 1 also shows that models without the defense continue harmful prefixes in roughly 40–60% of cases from d=5 onward, so many of those continuations are probably already harmful. The released code goes byond this. The recovery path trains on every truncation of the dataset’s harmful response, up to the length of the response or as many as fit in the 2048-token budget, while the README says only the SFT path is capped at 30 tokens. If the reported models were trained that way, then depths 50 to 100 were part of training in some form. Which of the two setups produced the numbers in the paper? What is the ASR at depths 50 to 100 when the recovery states are also capped at 30 tokens?

Critical weaknesses

The results do not quite show the problem the paper is trying to solve. In Table 1, the baselines get steadily worse as depth increases, already inside the training range, and there is no jump at the 30-token boundary. For example, Deep Alignment on Llama-3.2-3B goes from 3.03% at d=1 to 44.55% at d=30, and then to 45.15% at d=50. DOOR and PRESTO follow the same pattern. Figure 4 shows that a larger training cap delays this rise, but ASR still rises well before the cap is reached. So the gap between the seen and unseen averages mainly shows that longer prefixes are harder, not that recovery fails once it goes past the training depth. The only test that clearly goes beyond the training lengths is the long-context stress test, and DeepRecover gets worse there. On both Llama models (Figure 6), its ASR ends up higher than DOOR’s at the longest contexts, about 17% against 6% at 3,000 tokens on Llama-3.1-8B. This result is only in the appendix, where the text describes DeepRecover as “substantially more robust than most baselines.” Every attack in the paper is a fixed prefill, and no adaptive attack is tested. Since DeepRecover is trained on a fixed set of pivot phrases, a prefix that includes a fake pivot and then continues with harmful content would be a natural test. Without that, it is hard to tell whether the method is robust in general or mainly against the attack it was trained on. The experimental evidence is thin. Every experiment uses a single seed. The ASR values in Table 1 move in steps of about 0.30%, so at shallow depths many of the differences from DOOR are very small, for example 0.30% against 0.00% at d=1 on Llama-3.1-8B. The ablations and diagnostics (Table 2, Figure 3) are run only on Qwen2.5-3B, which is also where DeepRecover’s numbers are lowest. ASR also appears to count only full compliance (score 5), so answers that include explicitly prohibited content but do not fully complete the request are counted as safe. Results over several seeds, an ablation on a second model, and ASR at score 4 or above would make the case stronger. I am also not sure what is new about the privileged anchor. Using a frozen copy of the model with extra safety information as the teacher feels fairly close to self-distillation-style safety work, such as Fu et al. (2026). The paper cites this line of work only briefly. What does DeepRecover add beyond that? The released code differs from the paper in several places:

  1. The recovery path uses the dataset’s harmful response, not the student’s own continuation as described in Appendix B.3.
  2. Benign examples also get a transition phrase, but Appendix B.3 says benign examples have no transition segment.
  3. The SFT path includes the safety system prompt, but Appendix C.4 says the student never sees a system prompt.
  4. All parameters are trained, but Appendix B.1 says only the upper half of the layers is trained.
  5. There are no evaluation scripts, although the reproducibility statement says they are included.
  6. The README also says this is not the release used to produce every number in the paper
Questions for authors

The paper's main issues: (1) The claim that recovery works at depths not seen in training is not well supported by the training setup or the results, (2) No adaptive attack is tested, (3) All the results come from one seed and most of the analysis is on one model, and (4) The released code does not match the method described in the paper.

The results do not quite show the problem the paper is trying to solve. In Table 1, the baselines get steadily worse as depth increases, already inside the training range, and there is no jump at the 30-token boundary. For example, Deep Alignment on Llama-3.2-3B goes from 3.03% at d=1 to 44.55% at d=30, and then to 45.15% at d=50. DOOR and PRESTO follow the same pattern. Figure 4 shows that a larger training cap delays this rise, but ASR still rises well before the cap is reached. So the gap between the seen and unseen averages mainly shows that longer prefixes are harder, not that recovery fails once it goes past the training depth. The only test that clearly goes beyond the training lengths is the long-context stress test, and DeepRecover gets worse there. On both Llama models (Figure 6), its ASR ends up higher than DOOR’s at the longest contexts, about 17% against 6% at 3,000 tokens on Llama-3.1-8B. This result is only in the appendix, where the text describes DeepRecover as “substantially more robust than most baselines.” Every attack in the paper is a fixed prefill, and no adaptive attack is tested. Since DeepRecover is trained on a fixed set of pivot phrases, a prefix that includes a fake pivot and then continues with harmful content would be a natural test. Without that, it is hard to tell whether the method is robust in general or mainly against the attack it was trained on. The experimental evidence is thin. Every experiment uses a single seed. The ASR values in Table 1 move in steps of about 0.30%, so at shallow depths many of the differences from DOOR are very small, for example 0.30% against 0.00% at d=1 on Llama-3.1-8B. The ablations and diagnostics (Table 2, Figure 3) are run only on Qwen2.5-3B, which is also where DeepRecover’s numbers are lowest. ASR also appears to count only full compliance (score 5), so answers that include explicitly prohibited content but do not fully complete the request are counted as safe. Results over several seeds, an ablation on a second model, and ASR at score 4 or above would make the case stronger. I am also not sure what is new about the privileged anchor. Using a frozen copy of the model with extra safety information as the teacher feels fairly close to self-distillation-style safety work, such as Fu et al. (2026). The paper cites this line of work only briefly. What does DeepRecover add beyond that? The released code differs from the paper in several places:

  1. The recovery path uses the dataset’s harmful response, not the student’s own continuation as described in Appendix B.3.
  2. Benign examples also get a transition phrase, but Appendix B.3 says benign examples have no transition segment.
  3. The SFT path includes the safety system prompt, but Appendix C.4 says the student never sees a system prompt.
  4. All parameters are trained, but Appendix B.1 says only the upper half of the layers is trained.
  5. There are no evaluation scripts, although the reproducibility statement says they are included.
  6. The README also says this is not the release used to produce every number in the paper In addition, to improve the paper:
  7. The rank-based transport cost needs more explanation. It treats tokens with neighboring ranks as close, even when one is a refusal token and the other is a compliance token.
  8. Eq. 2 seems to count the first transition position twice.
  9. The Llama long-context results should be moved into the main text next to the Qwen results.
  10. Over-refusal on XSTest goes up and should be reported for all four models.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Discussion (0)

Sign in to comment.