A forward-pass-only recipe for structured pruning: sample feasible sub-models, measure their utility, fit module scores, and keep the best components under a sparsity budget.
We want to do structured pruning when the only affordable operation is inference. In particular, assume we can run a reasonable number of forward passes, but we cannot rely on gradients, Hessians, or expensive retraining loops.
SparseGPT, Wanda, and magnitude pruning already give useful saliency scores, so one option is one-shot pruning. Bonsai asks whether those saliency scores can instead guide a small set of forward-pass experiments, so we learn a better structured pruning decision.
The core idea is to sample several feasible pruned models $\hat{M}_i$, run each on a task or calibration set, and record its score $s_i$. This produces a small dataset:
Uniformly sampling structured sub-models is too wasteful. Some samples are obviously broken; for example, dropping every component in a layer can destroy the model. We therefore keep the sampling layer-aware and bias it using saliency from existing methods.
After sampling, the most direct strategy is to pick the best evaluated sub-model. That wastes most of the information in $\mathcal{D}$: every score says something about many modules at once.
The number of possible structured components (neurons, heads, channels, blocks, etc.) is much larger than the number of forward passes we can afford. Most configurations will never be evaluated. Instead of treating each sample as an isolated candidate, we fit a surrogate that explains each score in terms of the modules that were kept.
For example, $U$ might be validation accuracy, downstream task score, or negative perplexity. The important distinction is that $s_i$ is measured, while $\hat{s}_i$ is predicted:
The simplest surrogate assumes that each module contributes additively. If module $m_j$ is kept, it contributes a score $\beta_j$; if it is pruned, it contributes nothing.
where $\alpha_{\hat{M}_i}\in\{0,1\}^N$ has a $1$ in positions of kept modules.
Stack the binary masks into a sparse design matrix. Rows correspond to sampled sub-models, columns correspond to structural components under consideration.
Typically $N \gg n$ — the system is underspecified.
The goal is to estimate $\beta$, one score per module. If the linear model is a good approximation, pruning becomes simple: keep the frozen $(1-2p)$ modules, then from the candidate pool keep the highest-$\beta$ modules until the total keep budget $1-p$ is reached.
Usually $N \gg n$, so the regression is underspecified. We therefore fit $\beta$ with squared loss plus $\ell_2$ regularization:
Equivalently $\|\hat{M}\beta - s\|_2^2 + \gamma\|\beta\|_2^2$, where each row of $\hat{M}$ is the binary mask $\alpha_{\hat{M}_i}$.
When constructing each row of $\hat{M}$, draw a mask at sparsity $p$ per layer. This keeps the samples feasible and avoids rows that accidentally remove too much of one layer while leaving another layer untouched.
A remaining issue is coverage. Even with a saliency prior, some module may rarely or never appear in the sampled masks. Then its coefficient $\beta_j$ will be poorly estimated.
Kolawole et al., Everybody Prune Now: Structured Pruning of LLMs with Only Forward Passes (arXiv:2402.05406). Complements reduce regression variance on binary inputs (cf. Covert & Lee, 2020).