Large language models can often be made smaller and faster by deleting whole layers. A layer in a Transformer, the architecture behind these models, mostly adds a small correction to a running internal state, so many middle layers can be removed with little loss on benchmarks. Separately, safety researchers have found that the circuitry deciding whether to refuse a harmful request sits in those same middle layers. Compression methods choose which layers to delete by checking how well the model still predicts ordinary text, so they cannot see this circuitry. The result is a hidden alignment tax: the pruned model scores well on utility benchmarks and quietly stops refusing.
The obvious fix is to tell the pruner about safety: add harmful prompts to its calibration data, or fence off the safety layers. This note argues for a different fix. The refusal behaviour that a pruned middle sub-layer contributed is mostly a switch, "this request is harmful, push toward refusal." A switch can be rebuilt far more cheaply than the layer that computed it. We propose to delete safety-band sub-layers anyway and replace each one with a gated emulated update. This is a tiny linear probe that reads the internal state at the cut. It adds one of two fixed vectors, measured from what the deleted sub-layer used to add on benign inputs and on harmful inputs. If it works, compression and safety stop competing for the same layers.
Core Claim
We make two claims. The first is diagnostic. Pruners that rank layers by perplexity on benign text preferentially remove sub-layers inside the empirically located safety band. Their safety damage is therefore much larger than their utility damage. The second is constructive. Most of the refusal contribution of a deleted safety-band sub-layer can be restored by a two-vector, probe-gated replacement. This gives a safety-preserving pruned model at a higher pruning ratio than any method that must keep the safety layers intact.
Concretely, when sub-layer $l$ is removed, we replace it with
$$x_l = x_{l-1} + \big(1-g(x_{l-1})\big)\,\mu_l^{\text{benign}} + g(x_{l-1})\,\mu_l^{\text{harm}}, \qquad g(x)=\sigma(w_l^\top x + b_l).$$
Here $x_{l-1}$ is the internal state entering the deleted sub-layer. $\mu_l^{\text{benign}}$ and $\mu_l^{\text{harm}}$ are the deleted sub-layer's average additive update over benign and harmful calibration prompts respectively. $g$ is a logistic probe with weights $w_l$ and offset $b_l$, trained to separate the two prompt types at that position, and $\sigma$ is the sigmoid. Setting $g\equiv 0$ recovers the static emulated update of prior work. The cost is two vectors and one linear probe per removed sub-layer.
Where This Sits
Two kinds of prior work motivate the diagnostic claim. On the compression side, BlockPruner iteratively removes attention or MLP sub-blocks by global perplexity on 256 Alpaca samples. Early on it removes mostly attention blocks. A deeper look at depth pruning of LLMs shows that attention sub-layers are more redundant than MLPs, with 33% removable in Mistral-7B. Investigating Layer Importance in Large Language Models finds "cornerstone" layers by Shapley value on utility tasks, and places them at the very bottom of the network. None of these papers measures refusal. On the safety side, Safety Layers in Aligned LLMs locates a contiguous band of middle layers that appears only after alignment, for example layers 7–12 in Llama-3-8B. Fine-Grained Safety Neurons with Training-Free Continual Projection reports a "one-third depth" rule. Both use this localization only to freeze or project weights during fine-tuning, never to decide what may be deleted. Taken together, this is circumstantial evidence that utility-blind pruners cut into the safety band. Nobody has measured whether they do.
One paper constrains the design. Safe Pruning LoRA prunes LoRA adapter layers, not base layers. It finds that safety-degrading updates are spread across the whole depth, which cuts against a single tidy safety band. Our diagnostic stage therefore localizes safety sensitivity per model and per sub-layer by direct ablation, rather than assuming a band. NeuronGuard warns that concentrating safety in a few units creates a single point of failure. Our gate is exactly such a concentration, so the experiments must include attacks aimed at it.
Two papers supply the method. The static emulated update comes from A deeper look at depth pruning of LLMs, which found it matched or beat low-rank adapters for recovering utility. We make it input-conditional. The premise that refusal is a near-binary decision readable early is taken from the Superficial Safety Alignment Hypothesis, which frames alignment as a fulfil-or-refuse classification at the first generated token. It is also taken from Any-Depth Alignment, which shows that linear probes on hidden states detect harmfulness cheaply. Neither paper involves structural compression. The closest relative of the gated update is refusal steering under a null-space constraint, as in AlphaSteer. AlphaSteer adds a refusal direction to an intact model. We instead derive both vectors from the deleted sub-layer's own outputs, so the replacement reproduces what was removed rather than imposing a new direction. We test that distinction directly as an ablation.
Research Program
The work has three stages. In stage one we build per-sub-layer sensitivity maps for Llama-2-7B-Chat, Llama-3-8B-Instruct and Mistral-7B-Instruct. Each attention block and each MLP block is ablated one at a time. For every ablation we record two things: the change in benign perplexity, and the change in harmful-prompt refusal. Refusal is measured as the first-token refusal log-probability, plus attack success rate on AdvBench behaviours. This yields a two-dimensional map of utility sensitivity against safety sensitivity. It answers the attention-versus-MLP question within the safety band, which no prior work has resolved. We then run BlockPruner, ShortGPT-style block removal and static-emulated-update pruning at ratios from 10% to 35%. For each, we measure how much of what they remove falls in the high-safety-sensitivity region.
Stage two fits the gated replacement. For each sub-layer a pruner removes, we compute $\mu^{\text{benign}}$ on Alpaca prompts and $\mu^{\text{harm}}$ on BeaverTails harmful prompts. We fit the probe on a held-out split, with harm categories disjoint from evaluation where BeaverTails' 14-category labels permit. We fit replacements sequentially, so each probe sees the internal states of the already-pruned model. We also study a variant that shares one probe across all removed sub-layers in a contiguous run, since the harmfulness signal is likely the same direction throughout the band.
Stage three asks how far this goes. We trace the full utility–safety–speed frontier as the pruning ratio grows. We then attack the gate itself: GCG suffixes optimized against the pruned model including its probes, and affirmative-prefill attacks that try to suppress the probe's input feature.
Baselines
The naive reference is the unpruned aligned model and each pruner run as published. For BlockPruner on Llama-2-7B at about 22% pruning, the paper reports an average commonsense score of 60.17 versus 58.18 for ShortGPT, and a 1.47x speedup at 24%. We found no reported result on Lacuna for safety metrics of any depth-pruned model. Establishing that number is stage one's job.
The static emulated update from A deeper look at depth pruning of LLMs is the ablation that isolates our key ingredient, the gate. The paper reports MMLU gains of up to 5% over plain pruning. We run it on exactly the same removed sub-layers, with the same calibration prompts pooled. Any safety gap between it and our method is attributable to conditionality alone.
The strongest competitor is safety-aware BlockPruner. It uses the same iterative search, but the score adds benign perplexity to the negative log-likelihood of refusal responses on harmful calibration prompts. This is the obvious dual-objective pruner, and it preserves safety by refusing to cut safety-critical sub-layers. We run it with the same harmful calibration prompts our probes use and an equal search budget. We sweep its mixing weight and report its best frontier. Beating it means matching its attack success rate and utility at a pruning ratio at least five points higher, or equivalently showing lower attack success at equal ratio and equal measured latency.
A second strong competitor is the exclusion-zone pruner. It forbids removal within the safety band found by the Safety Layers cosine analysis and prunes elsewhere.
The last competitor is steering after pruning. A single refusal direction, the harmful-minus-benign mean difference at one layer, is added when a probe fires, in the style of AlphaSteer and Any-Depth Alignment. This tests whether per-sub-layer reconstruction matters at all. For reference, Any-Depth Alignment's probe reports reducing attack success from over 50% to below 3% on average across GCG, AutoDAN, PAIR and TAP, on unpruned models.
Why not just…?
Why not just add harmful prompts to the pruner's calibration set? This is the most serious alternative, and it may well preserve safety. Its mechanism, however, is to keep the safety-critical sub-layers. If those overlap the redundant middle as heavily as the localization papers suggest, it gives up exactly the compression that made depth pruning attractive. Our claim stands only if the frontier comparison shows extra pruning ratio at matched safety. If safety-aware BlockPruner reaches the same ratio, the gate is unnecessary and we will report that.
Why not just fence off the safety layers? Safety layer boundaries differ across model families. Safe Pruning LoRA found safety-relevant change spread across depth, so a fixed fence may protect the wrong layers. Fencing whole blocks also wastes the attention redundancy documented by BlockPruner. The stage-one map shows directly whether the fence covers where refusal actually breaks.
Why not just prune for utility and put an external guardrail in front? Any-Depth Alignment reports external guardrails costing about 500ms and nearly 1GB at 10,000 tokens, against about 25ms for internal probes. That overhead eats into the speedup pruning bought. A guardrail also does not restore the model's own refusal under prefill attacks.
Why not just re-align the pruned model with a short safety fine-tune? This is plausible, but the Superficial Safety Alignment Hypothesis reports that LoRA-style updates degrade safety more than full tuning, because they do not target safety units. Re-tuning also needs a training run per pruned model. We include a LoRA refusal fine-tune with a matched number of trainable parameters as a further comparison. If it dominates, the training-free argument fails.
Proposed Experiments and Decisive Checks
Safety is measured as attack success rate on AdvBench behaviours and StrongREJECT under GCG, PAIR and AutoDAN, plus SafetyBench scores. Over-refusal is measured as the refusal rate on the benign half of the BeaverTails probe set used by NeuronGuard. Utility is measured on MMLU, GSM8K (which A deeper look at depth pruning flags as pruning-sensitive), the BlockPruner commonsense suite and AlpacaEval. We also report wall-clock latency and KV-cache size.
The first decisive check tests whether utility-blind pruners cause safety regression disproportionate to their utility loss. If attack success under BlockPruner at 22% rises far more than its commonsense average falls, the diagnostic claim holds. If attack success barely moves, the safety-band story does not survive compression, and the constructive part is moot.
The second check compares our gated update with the static emulated update on identical removed sub-layers. If the gate does not restore substantially more refusal at equal benign utility, conditionality is not the missing ingredient.
The third check compares our method with safety-aware BlockPruner on the frontier, as specified above.
The fourth check uses adaptive attacks on the gate. If GCG optimized through the probes drives attack success well above that of the unpruned model, the method has relocated the single point of failure that NeuronGuard warns about. In that case we will test a redundancy variant that spreads probes across several removed sub-layers before claiming robustness.
References
- BlockPruner: Fine-grained Pruning for Large Language Models
- A deeper look at depth pruning of LLMs
- Investigating Layer Importance in Large Language Models
- Safety Layers in Aligned Large Language Models: The Key to LLM Security
- Fine-Grained Safety Neurons with Training-Free Continual Projection to Reduce LLM Fine Tuning Risks
- Safe Pruning LoRA: Robust Distance-Guided Pruning for Safety Alignment in Adaptation of LLMs
- NeuronGuard: Robust LLM Safety Alignment via Ablation-Aware Safety Signal Redistribution
- Superficial Safety Alignment Hypothesis
- Any-Depth Alignment: Unlocking Innate Safety Alignment of LLMs to Any-Depth
- AlphaSteer: Learning Refusal Steering with Principled Null-Space Constraint