Skip to content
AI.info

Research

$D^2Prune$: Sparsifying Large Language Models via Dual Taylor Expansion and Attention Distribution Awareness

$D^2Prune$: Sparsifying Large Language Models via Dual Taylor Expansion and Attention Distribution Awareness Overview Research area: Model compression for large language models — specifically post-tra

arXiv
2601.09176
Published
2026-01-14
Authors
Lang Xiong, Ning Liu, Ao Ren, Yuheng Bai, Haining Fang, BinYan Zhang, Zhe Jiang, Yujuan Tan, Duo Liu

AI summary

$D^2Prune$: Sparsifying Large Language Models via Dual Taylor Expansion and Attention Distribution Awareness

Overview

Research area: Model compression for large language models — specifically post-training (training-free) pruning.

Technical level: Advanced. The method builds on second-order Taylor expansion, Hessian-based saliency (OBS/SparseGPT lineage), and attention-distribution analysis, so some background in Transformer internals and optimization is assumed. The plain-language explanations below are written to make the core ideas accessible anyway.

Scope (one sentence): The paper proposes a post-training pruning framework that jointly models weight perturbations and activation shifts during error estimation, and adds an attention-aware dynamic weight-update rule that preserves long-tail attention patterns, evaluated on OPT, LLaMA-2/3, Qwen3, and DeiT.

What This Paper Is About

Post-training pruning compresses LLMs by removing weights without retraining, but existing methods estimate pruning damage using two flawed assumptions: that input activations stay constant between the small calibration set and the actual downstream data, and that attention weights (query, key, value) can be treated the same as ordinary feed-forward weights. $D^2Prune$ targets both: it estimates pruning error as a joint function of weight and activation changes, and it selectively decides which of the q/k/v projections to update so that attention's skewed, long-tail focus on a few key tokens is not flattened.

Key Contributions

  1. Dual Taylor Expansion pruning framework. The paper formulates the pruning error as a Taylor expansion with respect to both weights and activations (not weights alone), producing a saliency metric that explicitly includes the layer's output activation (the next layer's input activation), which prior methods such as SparseGPT, Wanda, and Pruner-Zero do not.

  2. Attention Distribution-Aware Dynamic Weight Update Strategy. For query, key, and value weights in multi-head attention, the method frames the choice of "update vs. do not update" as a combinatorial optimization problem and searches for the configuration that best balances reconstruction error minimization against preservation of the original attention distribution.

  3. A perplexity-guided lightweight adaptive search. Rather than exhaustively evaluating every q/k/v update combination, the search space is pruned using cross-layer consistency in q/k/v outlier ratios — the paper reports that 98% of layers in LLaMA-2-13B show the highest outlier ratio in the key matrix (Figure 10, Appendix D).

  4. Broad empirical validation. Results span OPT-125M, LLaMA-2-7B/13B/70B, LLaMA-3-8B, Qwen3-8B/14B, and the ViT-based vision model DeiT, across unstructured sparsity levels (50%, 60%, 70%, 80%) and semi-structured patterns (2:4, 3:4), plus LoRA fine-tuning and GSM8K in-context learning experiments.

Main Findings

  • Consistent gains across models and sparsity levels. On LLaMA-3-8B at 80% unstructured sparsity, $D^2Prune$ reaches 151.47 perplexity on WikiText2 versus 178.01 for SparseGPT, 2245.91 for Wanda, and 10420.01 for Pruner-Zero (dense model: 5.54).

  • Large margins at the hardest sparsity. On LLaMA-2-7B at 80% sparsity, Wanda collapses to 5107.20 perplexity while $D^2Prune$ reports 92.68, compared with 102.43 for SparseGPT.

  • Reported aggregate improvements. Compared with weight-update methods such as SparseGPT, the paper reports an average 3.1% accuracy gain and 16% lower perplexity; against non-weight-update methods such as Wanda and Pruner-Zero, perplexity reduction reaches up to 86%.

  • Beating the dense model in one setting. $D^2Prune$ surpasses the dense model on LLaMA-2-70B at 50% sparsity in zero-shot accuracy (71.60 versus 71.50 for dense, at 3.93 versus 3.12 perplexity).

  • Semi-structured pruning behavior. At the 3:4 pattern on LLaMA-2-7B, Wanda reports 3111.14 perplexity, Pruner-Zero 7913.18, SparseGPT 154.23, and $D^2Prune$ 136.89. Accuracy was not evaluated for 2:4 and 3:4 and is marked as "–" in the paper.

  • Both components are independently validated. Ablations that add the first- and second-order activation partial derivative terms back into the baselines ($D^2$-SparseGPT and $D^2$-Wanda) consistently improve on the originals — for example, $D^2$-Wanda on LLaMA-3-8B at 80% reduces perplexity from 2245.91 to 1414.32.

  • The attention update ablation supports selectivity. On LLaMA-2-7B, leaving the value projection unupdated (w/o v) yields the same perplexities as the dynamic update search (6.36 / 9.05 / 21.10 / 92.68 at 50%/60%/70%/80%), while updating all layers or none is worse at high sparsity.

  • The optimal q/k/v configuration is sparsity-independent. The paper reports that the configuration producing the lowest perplexity stays the same across all sparsity levels for a given model.

  • Distribution preservation is measured directly. The attention strategy is reported to reduce the KL divergence of attention distributions and the root-mean-square error of attention outputs by 61% and 43% on average, compared with the non-weight-update (Wanda) and weight-update (SparseGPT) baselines.

  • The dual expansion is claimed to help most under distribution shift. The introduction states a roughly 10% perplexity reduction over single-variable approaches and up to 40% accuracy improvement at high sparsity on downstream tasks with significant distribution shift.

  • LoRA fine-tuning preserves the ranking. After LoRA fine-tuning (r=8, α=16, one epoch on C4, 30k training samples, one 40G GPU, 15 hours) on LLaMA-2-7B, $D^2Prune$ at 70% sparsity reaches 9.70 perplexity and 51.37 accuracy, versus 10.18/49.73 for SparseGPT and 11.81/46.43 for Wanda.

Methodology in Plain English

The starting point is the standard layer-wise pruning objective: keep the layer's output as close as possible to the original after zeroing out weights. Classical methods such as OBS and SparseGPT approximate that output change with a Taylor expansion taken only over the weights, treating input activations as fixed.

The paper's first move is to expand the error over two variables at once — the weights and the activations — and then simplify. Because Transformers apply Layer Normalization to each layer's input, the cross terms between weight and activation in the Hessian are argued (and tested in Appendix C) to be negligible, leaving a diagonal structure: one first-order activation term, one second-order weight term, and one second-order activation term. The activation shift itself is not directly observable, so the authors assume it is proportional to the calibration activation via a coefficient λ, and the paper reports empirical support — average cosine similarity across layers reaching 0.96 (range 0.94–0.98). The resulting saliency score ranks weights for pruning, and the Lagrange-multiplier solution gives the compensating weight update.

The second move concerns the attention block. Because softmax attention has a long-tail pattern where a few key tokens dominate, applying the same global weight update to q, k, and v weights homogenizes attention scores; skipping the update entirely avoids that distortion but lets error accumulate across layers. The authors turn this all-or-nothing choice into a search: each of q, k, and v can be in "update" or "non-update" state, and the combination minimizing perplexity is selected. The cost of that search is kept low by exploiting the observation that outlier ratios in q/k/v weights are consistent across layers, which shrinks the candidate space. Attention layers outside q/k/v (including the output projection) and the MLP/FFN layers follow the dual-Taylor mask selection and weight update path.

Why This Matters

Pruning promises to make large models deployable without retraining, but the quality of the pruning metric determines whether the compressed model remains usable. This paper argues that two commonly inherited assumptions — fixed activations and uniform treatment of attention weights — are the main sources of quality loss at high sparsity, and it offers concrete, measurable fixes. For the research community, it reframes pruning error estimation as a two-variable problem and treats attention fidelity as an explicit constraint rather than a side effect. Its mechanism also transfers beyond language: the paper reports the dynamic attention update generalizing to DeiT, achieving superior accuracy on ImageNet-1K.

Real-world applications implied by the work:

  • On-device and edge deployment. The paper motivates pruning by the difficulty of running LLMs on resource-constrained devices; a compressed model with acceptable perplexity at 50–60% sparsity is directly relevant to phones, laptops, and embedded accelerators.

  • Cost reduction in inference serving. Lower memory and compute per request translate into fewer or cheaper GPUs for the same workload, particularly where semi-structured 2:4 patterns map onto supported hardware.

  • Domain-specific model adaptation. LoRA fine-tuning on top of pruned checkpoints is shown to restore much of the lost quality, which suits teams that prune a general model and then specialize it on private data.

  • Compression tooling for model hubs and pipelines. A training-free pruning method that works across OPT, LLaMA-2/3, Qwen3, and DeiT can be integrated into existing release and quantization pipelines without a retraining budget.

Industry relevance centers on the fact that this is a post-training method: it needs only a calibration set (C4, 128 samples) and no retraining resources, which is the practical constraint most deployment teams face.

Future Directions

  • More fine-grained activation-shift modeling. The linear proportionality assumption (δx = λx) is explicitly described as an approximation valid at the layerwise level; the paper leaves more detailed modeling of δx to future work.

  • Extending the dual-expansion treatment to other modules. The dynamic update search is applied to q/k/v, while output projection and MLP layers follow the standard dual-Taylor path — whether a similar selective-update formulation helps elsewhere is open.

  • Generalization to newer architectures and scale. The paper demonstrates Qwen3-8B/14B and DeiT, but extending validation to Mixture-of-Experts and other architectures, and to models beyond the sizes tested, is not covered.

  • Interaction between pruning and quantization. The paper studies pruning with and without LoRA fine-tuning but does not report combining sparsity with low-bit quantization, a natural next step for deployment pipelines.

Target Audience

This paper is most useful to researchers and engineers working on LLM compression, efficient inference, and model deployment. Readers with a background in Transformer architecture, post-training pruning (SparseGPT, Wanda, OBS), and second-order optimization will get the most from the methodology section. Practitioners who need a training-free pruning recipe for models in the LLaMA, OPT, or Qwen families, or for ViT-based vision models, will find the empirical tables and the published code (https://github.com/cquxl/D2Prune/) directly actionable. Readers without a Hessian-based pruning background may prefer to read the Overview, Main Findings, and Methodology in Plain English sections first.

Authors’ abstract

Large language models (LLMs) face significant deployment challenges due to their massive computational demands. % While pruning offers a promising compression solution, existing methods suffer from two critical limitations: (1) They neglect activation distribution shifts between calibration data and test data, resulting in inaccurate error estimations; (2) They overlook the long-tail distribution characteristics of activations in the attention module. To address these limitations, this paper proposes a novel pruning method, $D^2Prune$. First, we propose a dual Taylor expansion-based method that jointly models weight and activation perturbations for precise error estimation, leading to precise pruning mask selection and weight updating and facilitating error minimization during pruning. % Second, we propose an attention-aware dynamic update strategy that preserves the long-tail attention pattern by jointly minimizing the KL divergence of attention distributions and the reconstruction error. Extensive experiments show that $D^2Prune$ consistently outperforms SOTA methods across various LLMs (e.g., OPT-125M, LLaMA2/3, and Qwen3). Moreover, the dynamic attention update mechanism also generalizes well to ViT-based vision models like DeiT, achieving superior accuracy on ImageNet-1K.

Read the original paper