TL;DR
Standard dynamic pruning dramatically reduces the inference cost of Large Language Models (LLMs), but often strips away safety-critical circuits—causing models to fulfill harmful prompts they would otherwise refuse. Alignment-Aware Probe Pruning (AAPP) introduces a risk-aware gating mechanism that detects adversarial inputs during early probe passes and enforces hard preservation constraints on safety-critical channels, boosting refusal rates by up to 50% over standard dynamic pruning at matched compute budgets.
What Problem Does This Paper Address?
While model compression is essential for cost-effective LLM deployment, safety alignment is notoriously fragile. Recent studies show that removing as little as 3% of model weights can completely compromise an LLM's guardrails.
Dynamic structured pruning—such as Probe Pruning (PP)—selects which channels to execute on the fly based on intermediate activation norms. However, because standard importance metrics prioritize general linguistic modeling and next-token prediction energy, they frequently prune away sparse, specialized refusal circuitry. As a consequence, pruned models suffer severe alignment degradation, readily generating toxic content or answering jailbreak prompts. The authors set out to build a dynamic pruning framework that satisfies safety constraints without sacrificing inference efficiency.
Methods
AAPP builds on top of Probe Pruning by integrating historical activation profiles with a real-time adversarial detection gate across five execution stages:
- Pre-profiling Historical States: Offline, the authors compute average channel activation energies across three calibration sets:
- General linguistic functionality (from the C4 dataset),
- Benign queries, and
- Harmful/adversarial queries (both from WildJailbreak).
- Probe Generation and Execution: For an incoming prompt, residual-important tokens form a small probe that is executed a few layers ahead of full inference.
-
KL Divergence Risk Gate: The live probed hidden-state distribution ($p$) is compared against the precomputed safe ($q_{\text{safe}}$) and harmful ($q_{\text{jail}}$) activation profiles: $$\text{KL}_{\text{harm}} - \text{KL}_{\text{safe}} \ge \tau_{\text{margin}}$$ If this condition is met, the prompt is classified as adversarial, triggering safety preservation.
-
Constrained Channel Selection:
- If the gate fires: The model allocates a dedicated safety quota, strictly preserving the top $k_{\text{align}} = \lfloor \text{align\_frac} \cdot C \rfloor$ channels most active under harmful prompts (which house refusal circuitry). The remaining channel budget is selected using standard probe-pruning importance metrics.
- If the gate does not fire: The probed states fuse with general historical states, and the top $k$ channels are selected purely by standard importance scores.
- Full Inference: Pruning masks are materialized over the target layers (specifically the input channels of attention
o_projand MLPdown_proj, skipping the first 6 and last 3 layers) to run accelerated inference.
Incoming Tokens ──> Early Layers ──> Probe Pass (Probing State p)
│
┌─────────┴─────────┐
▼ ▼
KL(p || q_safe) KL(p || q_jail)
└─────────┬─────────┘
▼
[ KL_harm - KL_safe ≥ τ ? ]
/ \
(Yes) (No)
/ \
Preserve top k_align Standard PP
safety-critical channels importance selection
\ /
▼ ▼
Materialize Mask & Full Inference
Datasets
- C4 (Colossal Clean Crawled Corpus): Used to compute baseline historical activation scores that maintain core language modeling capability.
- WildJailbreak Dataset: Contains paired benign and adversarial/harmful jailbreak prompts. Subsets are used both for establishing baseline safe/jailbreak activation distributions and as held-out evaluation sets (prompts averaging ~300 input tokens and generating 120 output tokens).
Key Insights and Ideas
- Adversarial intent leaves distinct early footprints: By measuring the relative Kullback-Leibler (KL) divergence of intermediate probed states against safe versus harmful baselines, models can accurately flag adversarial jailbreaks before running full-depth inference.
- Explicit reservation beats uniform importance metrics: Refusal circuits are often low-energy compared to dominant semantic circuits. Standard pruning heuristics discard them as "unimportant"; explicitly reserving a fraction of the pruning budget ($\text{align\_frac} = 0.3$) for refusal-associated channels prevents catastrophic safety collapse.
- Toxicity drops at high sparsity can be misleading: The authors observe that toxicity scores sometimes decrease under extreme pruning. Rather than improved safety, this reflects severe linguistic degradation—the model produces incoherent or flat text that automated toxicity classifiers fail to register as harmful.
Key Results
The framework was evaluated on LLaMA-2-7B-chat, Qwen2.5-14B-Instruct, and Gemma-3-12B-IT:
- Refusal Rate Gains: At a 30% pruning ratio ($r = 0.3$):
- LLaMA-2-7B-chat: AAPP achieves a refusal rate of 0.57, outperforming baseline Probe Pruning (0.38, a 50% relative increase) and random pruning (0.32).
- Qwen2.5-14B-Instruct: Refusal increases from 0.27 (PP) to 0.37 (AAPP).
- Gemma-3-12B-IT: Refusal increases from 0.38 (PP) to 0.43 (AAPP).
- Compute vs. Safety Frontier: To achieve a 0.50 refusal rate on LLaMA-2-7B, AAPP requires only 10.3 GFLOPs/token, substantially shifting the efficiency-alignment frontier upward compared to PP.
- Classification Quality and FAR: On LLaMA-2-7B ($r = 0.3$), AAPP maintains a False Acceptance Rate (FAR) of 0.254 compared to PP's 0.313, alongside higher accuracy (0.741 vs. 0.624) and F1 score (0.760 vs. 0.645).
- Toxicity Suppression: On LLaMA-2-7B at $r = 0.2$, PP's toxicity peaks at 0.044, while AAPP remains near 0.0075 (matching the unpruned base model). On Qwen2.5-14B, PP toxicity peaks near 0.08, whereas AAPP stays below 0.02.
Limitations and Future Work
- Restricted Pruning Targets: Pruning is restricted exclusively to
o_projanddown_projchannels while completely bypassing the first 6 and final 3 layers of the transformer, leaving a portion of parameter compute unoptimized. - Dependency on Calibration Data: The KL-based risk gate relies on representative precomputed distributions ($q_{\text{safe}}$ and $q_{\text{jail}}$). Unseen out-of-distribution attack strategies that fail to trigger the gate threshold $\tau_{\text{margin}}$ could bypass the alignment safeguards.
- Hardware Acceleration Nuances: While the paper models FLOP savings and materializes binary masks, real-world deployment requires runtime kernels optimized for dynamic structured channel exclusion without introduced latency overheads.
Summary updated