Manuscript Offprint

arXiv:2610.30552

Repair Changes Which Layers to Remove: Exact Optima for Depth Pruning of Language Models

Jianchang Su, Dawei Xiang, Yifan Zhang, Wei Zhang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Depth pruning removes entire transformer layers to make large language models faster, and recent methods recover quality by replacing the removed layers with a training-free linear map. Which layers to remove, however, is chosen with heuristic scores whose distance from the best choice is unknown. We evaluate every subset of layer groups exactly (about 53,000 pruned models across four families, with and without repair) and find that the best layers to remove depend on the repair: linear repair absorbs the interaction among nearby layers and turns the optimum from a split layout into a contiguous block, so methods that choose layers without the repair miss the repaired optimum by up to 189%. We therefore select layers under the repair that will be applied. A greedy search at the cost of SLEB lowers perplexity by 20% to 66% relative to ReplaceMe on five models up to 27B parameters, and with a task objective it is up to 25 points more accurate given the same data. A second-order expansion of the loss yields a score that selects the repaired block from one forward and one backward pass of the intact model.

1 Introduction

Depth pruning removes whole transformer layers. Unlike width pruning or sparsity, it reduces latency and memory on standard hardware without special kernels, because the pruned model is a shorter model of the same architecture (Men et al., 2025; Song et al., 2024; Kim et al., 2024). Recent methods add a training-free repair: they replace the removed layers by a linear map fitted on calibration activations and fold the map into the weights of a kept layer, so the repaired model has the same parameter count as the pruned one (Shopkhoev et al., 2025; Chen et al., 2025b, 2026).

Every depth-pruning method must choose which layers to remove. For L layers and n removed layers there are (Ln)\binom{L}{n} choices, and each choice must

Figure

Figure 1: Repair changes which set of removed layers is best. Perplexity of the best contiguous block relative to the exact optimum over all subsets, at every enumerated budget of four models. Without repair (grey) a block is up to 6.9 times worse than the optimum. With ReplaceMe's linear repair (red) the best block is the optimum at 9 of the 18 budgets and within 5% of it at 13.

be scored on a pruned model. Published methods therefore use proxies: the similarity of a layer's input and output (Men et al., 2025; Gromov et al., 2025; Shopkhoev et al., 2025), greedy removal (Song et al., 2024), evolutionary search (Sieberling et al., 2025), or game-theoretic estimates of each layer's contribution (Siddiqui et al., 2024; Ding et al., 2026). How far these choices are from the best one is unknown, and recent work concludes that more elaborate search adds little (Kim et al., 2026).

These proxies score each layer in the unrepaired model. With a linear repair, the interactions among the removed layers change: a map absorbs the joint effect of contiguous layers, so the layers that are best to remove together differ from those individually least important. The gap between the proxy and the true optimum therefore depends on the repair, and it is unknown because the true optimum

(a) Exact optima of layer removal

Figure

(b) Repair shifts the optimum

optimum: one block, or a block and a short run

local super-additivity

critical layers

Figure

(c) Select layers under repair

RGS: evaluate every candidate on its repaired model

optimum: one block, or a block and a short run

S←S∪{arg⁡min⁡iJi};n steps, cost of SLEBS \leftarrow S \cup \{\arg\min_i J_i\}; n \text{ steps, cost of SLEB}

RFS: second-order score from the intact model residual δt\delta_{t}

Figure

least squares on

intact activations

fold: W←T⊤WW \leftarrow T^{\top} W

same parameter

count

Figure

S=∑t(gt⋅δt)2S = \sum_t (g_t \cdot \delta_t)^2

Fisher form of the KL

to the intact model

one forward and one backward pass of the intact model

Figure 2: Overview. (a) Evaluating every subset of layer groups shows critical layers and local super-additivity, so the optimum without repair splits the removal into separate runs. (b) ReplaceMe’s least-squares map replaces a run by a linear map folded into the down-projection of the kept layer before it; it absorbs the interaction inside the run, and the repaired optimum becomes one block. (c) RGS evaluates every candidate on its repaired model at the cost of SLEB; RFS ranks blocks by the Fisher-weighted residual of their repair, computed on the intact model only.

has not been computed.

We close this gap. At a granularity of two-layer groups the number of subsets is small enough to evaluate every one: about 53,000 pruned models over Qwen3-1.7B, Gemma-3-4B, Llama-3.1-8B and Qwen3-14B, each scored after plain removal and after the least-squares repair of ReplaceMe (Shopkhoev et al., 2025). The exact optima show that the answer depends on the repair (Figure 1): without repair, removing two nearby layers costs more than the sum of their individual costs, so the best subset spreads the removal over separate runs and a contiguous block is close to the worst choice. With repair, one map absorbs the interaction inside a run, and the best subset becomes a block, or a block and one short run. Published methods choose layers without the repair, and so miss the repaired optimum by up to 189%.

The fix follows directly: evaluate every candidate subset on the repaired model that will be deployed (Figure 2). A greedy search that does so costs as much as SLEB and finds the exact repaired optimum, or comes within 0.2% of it, at every enumerated budget on three of four models. A second-order expansion of the repaired loss turns the same principle into a score computed from one forward and one backward pass of the intact model. Our contributions are:

• The structure of the exact optimum. A Möbius decomposition of the loss increase from removal shows two interactions in all four families: a few critical layers whose joint loss increase is far below the sum of their individual loss increases, and local superadditivity among all other layers, which decays with distance in depth with a length of 3 to 6 layers (Section 4). As a result, at 4 to 6 removed groups the best contiguous block is 18% to 588% worse than the optimum.

• Linear repair makes the optimum contiguous. One least-squares map per run absorbs the interaction among the run’s layers, and the repaired optimum becomes one block, or one block and one short run (Section 5). Selection must therefore account for the repair: choosing layers without the repair and then repairing them is 5% to 33% worse than the repaired optimum, and ReplaceMe’s cosine criterion is 11% to 189% worse.

• Selection methods. Greedy selection under repair (RGS), at the cost of SLEB, has 20% to 66% lower perplexity than ReplaceMe on four models and 54% to 56% lower on a 27B hybrid-attention model, and with a task objective is more accurate at every budget, by up to 25 points on the 27B model. A second-order expansion of the Kullback–Leibler divergence gives a score (RFS) that selects the repaired block from the gradients of the intact model (Section 6).

• Evaluation beyond the selection data. We test the methods with ReplaceMe’s default calibration, on tasks that the objective does not see, on C4, after LoRA recovery, and on a 27B model that was not used for any design choice, and we report the cases where a baseline is better (Section 7).

References (27)