Skip to content

The study proposes SafeReAct: restoring the masked safety mechanisms of post-trained large modelsFinding and Reactivating Post-Trained LLMs’ Hidden Safety Mechanisms

Paper Tracker· arXiv:2604.00012· NeurIPS 2025· Mingjie Li, Wai Man Si, Michael Backes, Yang Zhang, Yisen Wang·Indexed by this site · 2026-10-06· Originally publishedAlignment

Quick read

Defenses

Based on the paper PDF (AI-generated); refer to the original

SafeReAct uses LoRA to reactivate masked safety mechanisms; in Table 2, R1-8B's JBB harmful rate drops from 33% to 0%.

Threat modelPost-trained models more often give harmful responses to harmful prompts. SafeReAct uses LoRA to align internal representations and requires modifying parameters; the paper does not call it white-box. PAT, ICD, and Self-Remind are black-box, modifying only the input. The harmful rate is determined by Llama-3-Guard.

Questions
Post-training makes LLMs better at specific tasks, but also more likely to give harmful responses to harmful prompts. The authors believe the safety mechanism is still present, just masked by overactivated domain capabilities; realigning with large-scale data is resource-intensive and may harm task capabilities.
Methods
SafeReAct first prunes neurons related to post-training capabilities to obtain a safer copy M_safe. Then it trains LoRA on a few layers to make the representations on harmful prompts close to M_safe, and uses held-out samples to pull the representations back toward the original model.
Experiments and results
Table 2: SafeReAct's JBB harmfulness rate is 0% or 1% on the four models. Medical JBB from 66% to 6%, finance from 47% to 3%. On R1-7B, Circuit-Breaker's JBB is 47%, higher than its Original's 45%.
Limitations and future work
The authors say the evaluation covers only reasoning, medical, and finance, with sizes 7B, 8B, 14B, 32B; larger than 32B was not evaluated. The harmful rate is determined by Llama-3-Guard; the checklist states that multiple reruns were not done, so there are no error bars.
Experimental setupDeepSeek-R1-distilled LLaMA-8B、DeepSeek-R1-distilled Qwen-7B et al. · JailbreakBench、AdvBench et al. · harmful rate、accuracy et al.
Evaluated models
DeepSeek-R1-distilled LLaMA-8BDeepSeek-R1-distilled Qwen-7BDeepSeek-R1-distilled Qwen-14BOpenThinker-7BLlama-3-8B-UltraMedicalFinance-Llama3.1-8B-InstructQwQ-32BR1-distilled-32BQwQ-8B
Benchmarks
JailbreakBenchAdvBenchXsTestGSM8KMATH-500MedQAHarmBenchLIMOUltraMedicalS1KWildJailbreak
Metrics
harmful rateaccuracyrejection rateJBB ASRcosine similarity
AI summaryThe paper finds that post-training masks the safety mechanisms originally present in base large language models, while excessively amplifying representations related to post-training capabilities, but the safety mechanisms themselves are not removed. Based on this, the authors propose SafeReAct, which restores suppressed safety behavior by aligning LoRA adapters on a few layers. Experiments on four advanced large reasoning models show that this method significantly improves safety performance on harmful prompts without harming reasoning performance; additional results on domain-specific models such as medical also support its generality.

The paper finds that post-training masks the safety mechanisms originally present in base large language models, while excessively amplifying representations related to post-training capabilities, but the safety mechanisms themselves are not removed. Based on this, the authors propose SafeReAct, which restores suppressed safety behavior by aligning LoRA adapters on a few layers. Experiments on four advanced large reasoning models show that this method significantly improves safety performance on harmful prompts without harming reasoning performance; additional results on domain-specific models such as medical also support its generality.

Related events and news

0 events · 1 news mentions

News that mentions this paper

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    Post-training masks rather than removes safety mechanisms; SafeReAct reactivates them with a small amount of LoRA.

    Post-training masks the original safety mechanism, making the model more likely to answer harmful prompts, rather than deleting the safety mechanism.

    • Scenario: The authors state that LLMs can be post-trained to enhance specific capabilities, e.g., DeepSeek-R1 series become better at reasoning after training on long CoT, but harmful behavior occurs more often than before post-training; after capability enhancement, the ethical risk of unsafe responses is also greater.
    • Existing methods: The authors state that realignment with SafeChain (over 50,000 harmful samples paired with reasoning-style safe responses) requires significant resources and can harm original capabilities.
    • Observation and hypothesis: After adding a safety suffix or changing the input template, LRMs become safer on harmful prompts, leading the authors to believe the safety mechanism is not completely removed. After pruning reasoning-related neurons, safe behavior recovers. The authors hypothesize that post-training overactivates domain mechanisms, thereby masking the original safety mechanism.
    • This paper proposes: SafeReAct. Use LoRA on a few layers to align representations on harmful prompts to the pruned hidden safety representation, and constrain domain representations. Main experiments on four LRMs, extended to medical and finance models.
    • Threat model:
      • Goal: Re-trigger refusal on harmful prompts, rather than expanding post-training capabilities and producing harmful content.
      • Victim system: Post-trained LLMs. The paper focuses on LRMs, and includes biomedical and finance models.
      • Intervention: PAT, ICD, Self-Remind modify only inputs under black-box. SafeReAct trains LoRA, aligning internal representations, requiring parameter modification; the paper does not call this defense white-box.
      • Evaluation: Harmfulness rate is given by Llama-3-Guard; utility uses GSM8K, MATH-500, or MedQA. The paper does not formalize the attacker-controlled input scope.
  2. What related research exists?

    Related work covers safety alignment, post-training recovery, and representation engineering; this paper aligns the model's own hidden safety representations.

    Section 2 of the paper is divided into safety alignment and representation engineering; the introduction also specifically mentions the safety degradation brought by post-training.

    Safety Alignment and Jailbreak Defense

    • Alignment: RLHF, direct preference optimization (Rafailov et al. [17]), and safe decoding (Xu et al. [18]) are used to make responses conform to human values and reduce harmful generation.
    • Jailbreaks and defenses: The paper lists optimization-based jailbreaks, multilingual or encrypted inputs, as well as prompt templates, feature editing, context correction, and adversarial training. These are only listed here, not compared one by one with this paper in terms of effectiveness.
    • Fine-tuning breaks alignment: Qi et al. [35] and others point out that fine-tuning or post-training weakens existing safety alignment; Zhou et al. [12] evaluate the safety risks of R1.

    Adding Safety After Post-Training

    • SafeChain (Jiang et al. [11]): Retrains an LRM using more than 50,000 harmful samples and reasoning-style safe responses. The introduction states that this training is resource-intensive and usually damages original capabilities.
    • SaLoRA [37]: Adds a safety module during post-training to preserve safety. The paper does not directly compare it with SafeReAct here.
    • Safe LoRA [38] and Safety Lock [39]: If fine-tuning an already aligned LLM, the original aligned base can be used to restore safety. The paper notes that if not trained on an aligned LLM (such as R1-distilled), these methods do not work well.

    Representation Engineering

    • Several works use internal representations to explain style or domain capabilities, or modify representations at inference time to strengthen alignment and suppress unwanted behavior, including RepE [29].
    • Circuit-breaker [28]: On pre-built safe-response and harmful-response data, it pushes the aligned model's internal representations away from the original representations, thereby disrupting generation on harmful prompts. The paper says its effectiveness depends on the pre-built dataset.
    • Relation to this paper: The authors aim to restore weakly aligned or unaligned models. They first prune highly activated domain capabilities to find hidden safety features, then pull representations closer to these features rather than toward pre-written target responses. The authors claim this is more effective across models.

    Baselines and Benchmarks

    • Baselines: Circuit-Breaker and SafeChain. Mechanism analysis additionally uses PAT [34], ICD [31], and Self-Remind [27]. The authors state in Section 3 that the latter three cannot fully restore safety and have a safety–reasoning trade-off.
    • Data: Evaluation uses JailbreakBench, AdvBench, XsTest, GSM8K, MATH-500, and MedQA; alignment uses HarmBench, and preservation uses LIMO or UltraMedical.

    The authors place this paper in the setting where post-training has already occurred and the original aligned base cannot be relied on: first find the masked safety representations inside the model, then align with a small amount of LoRA.

  3. How does the paper address this problem?

    SafeReAct aligns layer representations on harmful prompts to the safety representations obtained by pruning, and uses a preservation loss to retain task capability.

    The authors propose SafeReAct: first prune to obtain internal representations that produce safe behavior, then train LoRA on only a few layers to pull the original model's representations on harmful prompts toward that representation, and use a retention loss to maintain post-training capabilities.

    Is the safety mechanism still there

    • Black-box probing: Under black-box settings, use PAT, ICD, Self-Remind, modifying only inputs without accessing parameters (Section 3.1, Table 1).
    • Authors' hypothesis: The decrease in harmfulness rate indicates the safety mechanism has not been removed; meanwhile reasoning performance declines, which the authors call a safety–reasoning trade-off, and they further hypothesize that the safety mechanism is masked by the reasoning mechanism.
    • The paper does not provide the specific prompt templates for these three methods.

    Pruning to locate the masked safety representation

    • Importance: The Wanda score is the product of the absolute value of the weight and the ℓ2 norm of the input token row (Eq. 1).
    • Set difference: Take top-q neurons in the target domain and top-p in the retention domain; the difference set is treated as target-domain-specific neurons (Eq. 2). In the analysis, the target domain is S1K, and the retention set is built from AdvBench safety-aligned data, with p=0.3 and q=0.4; random pruning of 20% serves as a control.
    • Authors' explanation: After pruning reasoning-related neurons, safe behavior recovers, so the decline comes from over-activation of the reasoning mechanism rather than removal of the safety mechanism. This pruned model is denoted M_safe. During training, p and q are selected according to M_safe's safety results on JailbreakBench; the paper does not give the final values.

    Representation realignment

    • Alignment target: On harmful prompts, make the representations of several layers of the model being optimized close to M_safe. The input can be concatenated with a fixed safety suffix; the paper sets it as an English sentence reminding not to generate harmful or misleading content, and does not require collecting safe target responses.
    • Alignment loss: Lalign=∑i∈ I|Mopt(i)(xharm)−Msafe(i)(xharm|ssafe)|F. The meaning is the sum of Frobenius distances between the representations of the optimized layers and those of the pruned safe model on the same harmful prompt.
    • Retention loss: On retention samples, make these layers close to the unpruned original model, so as not to lose post-training capabilities.
    • Total loss: L=α(1−t/(2T))Lalign+α(t/(2T))Lretain. The meaning is that alignment is weighted more heavily early on and retention more heavily later; α is a coefficient, t is the current step, and T is the total number of steps. The authors say this schedule is inspired by representation engineering work.
    • Difference: The authors say Circuit-breaker relies on pre-built response data, whereas this paper aligns the model's own hidden features. M_safe is obtained by pruning the original model and introduces no new weights.

    Optimization settings and evaluation

    • Default training: LoRA rank 16; the authors say optimizing only a few layers suffices, so by default every fifth layer is used. For R1-8B the layer indices are 5, 10, 15, 20, 25, 30. α defaults to 10. Adam, learning rate 2e-5, batch size 16, 300 steps total. A single NVIDIA A100 80GB.
    • Data: Harmful prompts come from HarmBench. The reasoning model's retention set is LIMO (about 1,000 long CoT examples). The medical model uses the first 20, 00 entries of UltraMedical (as written in the original). The retention set for the finance experiment is not written in the paper.
    • Evaluation: The harmfulness rate is computed by Llama-3-Guard; the paper does not state the threshold. Reasoning utility is accuracy on GSM8K and MATH-500, and medical is MedQA. Evaluation uses sampling decoding with temperature 0.6, which the paper says follows R1's official recommendation.
  4. What experiments did the paper conduct?

    In Table 2, the JBB harmful rate for SafeReAct across the four models is 0% or 1%.

    Experimental Setup

    • Models under test: DeepSeek-R1-distilled LLaMA-8B (R1-8B), DeepSeek-R1-distilled Qwen-7B (R1-7B), OpenThinker-7B (OT-7B, the paper states post-trained from Qwen2.5-7B-Instruct), DeepSeek-R1-distilled Qwen-14B (R1-14B). Also Llama-3-8B-UltraMedical, Finance-Llama3.1-8B-Instruct, QwQ-32B, R1-distilled-32B; Table 6 also has QwQ-8B.
    • Data: Safety evaluation uses AdvBench, JailbreakBench, XsTest; reasoning uses GSM8K, MATH-500; medical uses MedQA. Alignment uses HarmBench; reasoning holdout set LIMO (about 1,000 entries). The SafeChain baseline uses 50K long CoT safety responses generated by R1 on WildJailbreak, and adds s1k. The number of entries for each benchmark is not stated in the paper.
    • Baselines: Circuit-Breaker, with LoRA settings and layer sets the same as SafeReAct; SafeChain, with each linear module LoRA rank 16. Mechanism analysis also uses PAT, ICD, Self-Remind.
    • Metrics: Harmful rate is determined by Llama-3-Guard, the paper does not state the threshold. Utility is accuracy. The refusal rate for XsTest benign prompts is matched using the same string list as the GCG paper. Figure 3 reports cosine similarity and JBB ASR.
    • Training and decoding: rank 16, α default 10, Adam, learning rate 2e-5, batch size 16, 300 steps; vLLM, temperature 0.6 sampling; single A100 80GB (Section 5.1).
    • Repeats: The paper does not report the number of repeats. The NeurIPS checklist states that due to computational resources, multiple reruns were not performed, so there are no error bars.

    Main Results

    According to Table 2. Abbreviations correspond to the four reasoning models above. SR is SafeReAct, CB is Circuit-Breaker, SC is SafeChain.

    | Model | Original JBB | SR's JBB | CB's JBB | SC's JBB | SR's GSM8K | | R1-8B | 33% | 0% | 2% | 27% | 87% | | R1-7B | 45% | 1% | 47% | 8% | 91% | | OT-7B | 43% | 0% | 41% | 9% | 91% | | R1-14B | 23% | 0% | 17% | 7% | 94% |

    • SafeReAct: The authors state it is the most stable across the four models, because it only aligns the model's own hidden safety representations, rather than predefined responses. In Table 2, its AdvBench harmful rates are 1%, 0%, 0%, 1%, and XsTest are 2%, 5%, 4%, 2% (order same as table). R1-7B's XsTest is 5%, not all safety columns are close to 0.
    • Circuit-Breaker: The authors state it only improves safety on R1-8B, and hypothesize that Qwen-series responses differ more from its training set. Not fully consistent with "other models fail", R1-14B's XsTest goes from 8% to 4%. Clear degradations include R1-7B's AdvBench from 29% to 40%, and R1-8B's XsTest from 8% to 16%. In the table, on the JBB column for R1-7B, CB is higher than Original.
    • SafeChain and utility: The authors state that in most cases the harmful rate remains near 10%, but R1-8B's JBB is 27%. The authors state reasoning accuracy drops by about 20%. On GSM8K, SafeChain is 63%, 71%, 79%, 81% (Original 88%, 92%, 93%, 94%). On MATH-500, SafeChain is 66%, 70%, 69%, 75%, SafeReAct is 80%, 81%, 76%, 84% (Original 81%, 83%, 78%, 85%). The authors state SafeReAct drops less than 3% on these two reasoning sets.

    Prompt Reactivation and Reasoning Neuron Pruning

    • Setup: R1-8B and R1-7B; black-box ICD, PAT, Self-Remind. Pruning uses Wanda set difference, p=0.3, q=0.4, target domain S1K, holdout set from AdvBench; control is random pruning of 20% (Section 3, Table 1, Figure 2).
    • Table 1: R1-8B's JBB/AdvBench/GSM8K, Original is 33%/29%/88%, ICD is 17%/1%/77%, PAT is 19%/21%/81%, SelfRemind is 27%/13%/75%. R1-7B Original is 45%/29%/92%, ICD is 23%/1%/81%, PAT is 29%/11%/87%, SelfRemind is 34%/17%/83%.
    • Authors' interpretation: All three prompting methods reduce harmful rates, so the safety mechanism is not removed; GSM8K also drops, which the authors call a safety–reasoning trade-off, and state it is insufficient to fully restore safety. The authors state random pruning does not change safety, and after pruning reasoning neurons safety improves; the Takeaways state safety behavior is fully restored. Figure 2's main text does not give bar percentages. The authors also state harmful rates exceed 30%, higher than LLaMA-3 and Qwen2.5; in the table, JBB is 33% and 45%, AdvBench is 29% for both, and the numbers for these two regular models are not given in the paper.

    Medical, Finance, and 32B

    • Medical (Table 4): Llama-3-8B-UltraMedical, Original's JBB 66%, MEDQA 77%; SafeReAct is 6% and 74%. The authors state domain utility is maintained, and state the masking claim in Section 3 is not limited to reasoning.
    • Finance (Table 5): Finance-Llama3.1-8B-Instruct, AdvBench from 16% to 2%, JBB from 47% to 3%. The paper states this result was added during the rebuttal phase.
    • 32B (Table 7, JailbreakBench): QwQ-32B Original 23%, SafeReAct 2%; R1-distilled-32B (table header R1-32B) 27% and 3%. The authors state this is the largest model that can run on a single 80GB A100, and the method still works.

    Other Ablations and Analyses

    • Table 3, R1-8B, α=2/5/10/20: JBB is 0% for all, GSM8K is 84%, 86%, 87%, 86%.
    • Table 3, R1-7B: JBB is 0%, 1%, 1%, 0%, GSM8K is 88%, 86%, 91%, 87%. The authors state safety is stable with respect to α, reasoning varies more, and recommend selecting α based on the utility set.
    • Figure 3: The main text states comparison with R1-7B, the caption states R1-8B. The authors state cosine similarity with safety representations increases during training, and JBB ASR decreases. The figure has Similarity, JBB ASR(%), and iteration ticks 0, 50, 150, 300; the main text does not give values for each point.
    • Table 6, string-matching refusal rates for XsTest benign prompts. Header is R1-8B, R1-8B, R1-32B, QwQ-8B; Before is 2%, 2%, 3%, 2%, After is 3%, 4%, 3%, 3%. The authors state there is no over-refusal, and speculate the original safety policy is stricter than XsTest.
    • The authors state SafeChain training cost exceeds that of Circuit-Breaker and SafeReAct by more than 10 times; except for SafeReAct's 300 steps, the paper does not report specific times.
  5. What are some points that can be further explored?

    The authors state that only reasoning, medicine, and finance are covered, and models larger than 32B are not evaluated.

    Limitations and future directions noted by the authors

    • Domains: Evaluation only includes reasoning, medicine, and finance (Conclusion's Limitations).
    • Scale: Due to resource constraints, only 7B, 8B, 14B, and 32B are evaluated; effects for larger than 32B are not evaluated (Conclusion's Limitations).
    • Limitations does not list other pending experiments. Broader Impacts only states that the method can be used to make post-trained models safe again, not written as future work.

    Experimental coverage

    • The main reasoning table includes R1-8B, R1-7B, OT-7B, R1-14B, comparing Original, Circuit-Breaker, SafeChain, SafeReAct (Table 2, Section 5.2).
    • Also reports Llama-3-8B-UltraMedical (Table 4), Finance-Llama3.1-8B-Instruct (Table 5), and JailbreakBench for QwQ-32B and R1-distilled-32B (Table 7); Table 6 includes benign refusal rate for QwQ-8B. Tables 4 and 5 only give Original and SafeReAct.
    • Harmfulness rate is determined by Llama-3-Guard; decoding is sampling at temperature 0.6; training is 300 steps of LoRA on a single A100 80GB (Section 5.1).
    • Prompts, pruning, and α ablations are on R1-7B and R1-8B (Section 3, Table 3, α=2, 5, 10, 20). The p and q used for training are only described as selected based on M_safe's safety results on JailbreakBench, without final values. The paper does not specify the held-out set for the finance experiments.
    • The paper does not report the number of repetitions; the checklist states that due to computational resources, multiple reruns were not done, so no error bars. The paper does not report agreement between Llama-3-Guard and human judgment.
  6. Summarize the main content of the paper

    SafeReAct uses pruned safety representations for LoRA alignment to restore the masked refusal behavior of post-trained models.

    This work addresses the safety decline of post-trained LLMs and proposes a representation alignment method, SafeReAct.

    • Problem: After post-training enhances domain capabilities such as long CoT, models more frequently answer harmful prompts. The authors argue that safety mechanisms are not removed but masked by over-activated domain mechanisms; realigning with large-scale safety data is resource-intensive and harms task performance.
    • Method: Use Wanda set difference to prune domain-related neurons, obtaining M_safe. Then train LoRA on a few layers so that representations on harmful prompts approach M_safe, and use held-out samples to pull back the original model's representations. The loss weight shifts from alignment to preservation over steps. Default 300 steps, rank 16, α=10.
    • Main reasoning results (Table 2): After SafeReAct, R1-8B, R1-7B, OT-7B, R1-14B have JailbreakBench harmful rates of 0%, 1%, 0%, 0%, and GSM8K of 87%, 91%, 91%, 94% (Original: 88%, 92%, 93%, 94%). In the same table, Circuit-Breaker on R1-7B has JBB of 47%, higher than Original's 45%. SafeChain's GSM8K is 63%, 71%, 79%, 81%.
    • Other settings: Llama-3-8B-UltraMedical's JBB goes from 66% to 6%, MEDQA from 77% to 74% (Table 4). Finance-Llama3.1-8B-Instruct's JBB goes from 47% to 3% (Table 5). QwQ-32B and R1-distilled-32B have JBB of 2% and 3% after SafeReAct (Table 7, Original: 23% and 27%).
    • Authors' conclusion: The authors believe that the masked safety representations of aligned models themselves can restore refusal while maintaining reasoning or domain performance, and argue that this phenomenon is not limited to reasoning models. The authors also state that the evaluation only covers reasoning, medicine, and finance, and does not assess models larger than 32B.
Read originalNeurIPS 2025