Unifying Depth and Width Pruning for LLMs via Binary Knapsack Optimization

Palaash Goel, Ayan Sengupta, Akshay Nambi, Tanmoy ChakrabortyarXiv 2026

TL;DR

The paper introduces SNIPER, a novel dual-axis structured pruning framework for Large Language Models (LLMs) that unifies depth and width pruning. By formulating coarse-grained component removal as a 0/1 knapsack optimization problem solved via dynamic programming, SNIPER eliminates the "capacity slack" common in greedy pruners, hitting target compression budgets near-perfectly while maintaining superior task stability.

What Problem Does This Paper Address?

As Large Language Models continue to scale, deploying them on resource-constrained hardware requires effective compression techniques. Structured pruning—which removes entire architectural units like layers or attention blocks—is highly attractive because it directly translates into hardware-friendly inference speedups.

However, existing structured pruning methods suffer from two major flaws:

  1. Myopic Greedy Heuristics: They make local, layer-by-layer decisions, ignoring global inter-component dependencies. This leads to high performance instability across different tasks.
  2. Capacity Slack: They struggle to hit exact target compression ratios. Because they operate on coarse atomic units (like an entire layer), they often under-prune, missing memory budgets by up to 33%.

SNIPER addresses these gaps by moving away from greedy selection, framing structured pruning as a global optimization problem that balances both depth and width compression axes.

Methods

SNIPER (Structured Knapsack-optimization-based Pruner) operates in two distinct stages:

Stage 1: Coarse-Grained Depth Pruning via Knapsack Optimization

Instead of greedily dropping layers, SNIPER treats the LLM as a collection of prunable components (Multi-Head Attention blocks, Feed-Forward Network blocks, or entire layers). It formulates the selection of which components to keep as a 0/1 Knapsack Problem, where the "weight" is the parameter count and the "value" is the component's contribution to model performance.

To solve this globally and optimally (conditioned on importance estimates), the authors use Dynamic Programming (DP). To make the DP solver tractable over billions of parameters, they introduce a discretization factor ($\alpha$) that scales down the parameter counts, reducing the time complexity to $\Theta(N\lfloor C/\alpha \rfloor)$.

Component importance is calculated iteratively by measuring the marginal degradation in prediction logits when a component is dropped from a partially pruned model, capturing global inter-component dependencies.

Stage 2: Fine-Grained Residual Width Pruning

Because coarse blocks are discrete, Stage 1 often leaves a small residual capacity budget. Stage 2 fills this gap by performing fine-grained width pruning within the remaining MLPs (slicing rows and columns). The remaining budget is distributed across layers inversely proportional to their importance using a softmax function, ensuring that critical layers are compressed more conservatively.

To quantify how well a pruner adheres to its target budget, the authors introduce a new metric: the Compression Ratio Adherence Factor (CRAFT), defined as the ratio of observed compression to target compression.

Figure 2. A schematic overview of SNIPER which performs structured pruning in two stages under a strict target com- pression ratio (CR). Stage 1: Coarse pruning removes entire redundant components such as full transformer layers or attention blocks, enabling notable efficiency gains while preserving architectural coherence. Stage 2: Fine pruning then operateswithin the remaining layers, selectively pruning the internal dimensions of the model’s MLPs to precisely meetthetargetCR.Thisdual-axisstrategyallowsSNIPERtocombinetheefficiencyofdepthpruningwiththeprecision of width pruning, eliminating capacity slack and avoiding greedy, layer-wise decisions.

Datasets

The framework was evaluated across an extensive testbed of 18 tasks spanning 5 domains:

  • Generative Performance: WikiText-2, LAMBADA
  • World Understanding: PIQA, PROST, CommonsenseQA
  • Domain-Specific Knowledge: ARC-Easy, ARC-Challenge, MathQA, OpenBookQA, MedQA
  • Natural Language Understanding & Inference: BLiMP, BoolQ, Winogrande, CoQA
  • Safety, Bias & Ethics: TruthfulQA, Winogender, Moral Stories

For pre-compression calibration and post-compression Recovery Fine-Tuning (RFT), the authors primarily used SlimOrca. They also tested robustness against calibration distribution shifts using Alpaca and C4.

Key Insights and Ideas

  • Complementarity of Axes: Coarse depth pruning delivers hardware-friendly speedups but lacks budget precision. Fine-grained width pruning restores task consistency and fills the residual budget but yields less raw speedup due to irregular tensor shapes. Combining them gives the best of both worlds.
  • Global vs. Local Decisions: Moving from local greedy selection to a global knapsack formulation prevents the premature discarding of components that might look weak individually but are globally vital to the network.
  • Interpretable Structural Salience: SNIPER’s learned importance scores reveal a clear, stable architectural pattern: intermediate layers consistently exhibit higher redundancy than early and late boundary layers across multiple compression budgets.

Key Results

  • Perfect Budget Fidelity: SNIPER achieved a near-ideal CRAFT score of 0.98, whereas baseline pruners exhibited severe capacity slack, averaging a CRAFT score of 0.78.
  • Task-Level Stability: SNIPER reduced task-wise standard deviation by up to 60% compared to prior methods, mitigating the performance drops on outlier tasks that plague greedy strategies.
Figure 1. (a) Existing structured pruners exhibit severe “capacity slack”, with the actual compression ratio deviating fromthetargetbyupto33%. SNIPERachievesnear-exactbudgetadherencewithaCRAFTof0.98,comparedtothebase- line average of0.78. Quantitative results are provided in Table 8 of Appendix C.1. (b) SNIPER reduces task-wise standard deviation by up to 60% relative to prior methods, mitigating the instability induced by existing pruning strategies.
  • Cross-Architectural Generalization: Evaluated across dense (LLaMA-3.1-8B, Qwen3-8B), fused-MLP (Phi-4-14B), and Mixture-of-Experts (GPT-OSS-20B) models, SNIPER achieved a stellar mean rank of 1.25 across all pruning configurations, consistently outperforming state-of-the-art baselines like ShortGPT, SliceGPT, and 2SSP.

Limitations and Future Work

Currently, SNIPER utilizes homogeneous pruning signals across all model components. While it was successfully evaluated on a Mixture-of-Experts (MoE) architecture, incorporating non-homogeneous, expert-specific routing signals could further optimize compression for sparse models. Additionally, while the component selection phase provides conditional optimality guarantees, extending these theoretical guarantees to the importance estimation phase remains an open direction for future research.

Summary updated

BibTeX
@misc{goel2026unifying,
  author = {Palaash Goel and Ayan Sengupta and Akshay Nambi and Tanmoy Chakraborty},
  title = {{Unifying Depth and Width Pruning for LLMs via Binary Knapsack Optimization}},
  year = {2026},
  eprint = {2608.12953},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2608.12953},
}
Figure