Source-linked AI summary
The Unreasonable Ineffectiveness of the Deeper Layers
Andrey Gromov, Kushal Tirumala, Hassan Shapourian, Paolo Glorioso, Daniel A. Roberts
TL;DR
The paper asks how knowledge is distributed across an LLM’s layers and tests this by pruning blocks selected through layer-representation similarity. After optional QLoRA healing, QA performance remains nearly unchanged until substantial pruning, although other tasks and metrics can degrade earlier.
Problem
The central question is whether layers that can be removed without affecting QA performance are necessary for storing knowledge used by those questions.
Method
The method selects similar contiguous layer blocks for removal and optionally heals the pruning mismatch with a small amount of QLoRA finetuning.
Results
QA accuracy shows a flat robust region followed by a sharp transition near 45%-55% pruning for Llama-2 models, with model-family-specific critical fractions.
Takeaways & Limitations
The findings suggest shallow layers support knowledge storage and retrieval, whereas deeper layers may be more useful for higher-level reasoning computations.
Takeaways & Limitations
QA robustness does not extend to all evaluations: C4 next-token loss degrades smoothly, and reasoning tasks can be harmed by any pruning.
Abstract
from arXiv · showhide
How is knowledge stored in an LLM's weights? We study this via layer pruning: if removing a certain layer does not affect model performance in common question-answering benchmarks, then the weights in that layer are not necessary for storing the knowledge needed to answer those questions. To find these unnecessary parameters, we identify the optimal block of layers to prune by considering similarity across layers; then, to "heal" the damage, we perform a small amount of finetuning. Surprisingly, with this method we find minimal degradation of performance until after a large fraction (up to half) of the layers are removed for some common open-weight models. From a scientific perspective, the robustness of these LLMs to the deletion of layers implies either that current pretraining methods are not properly leveraging the parameters in the deeper layers of the network or that the shallow layers play a critical role in storing knowledge. For our study, we use parameter-efficient finetuning (PEFT) methods, specifically quantization and Low Rank Adapters (QLoRA), such that each of our experiments can be performed on a single 40GB A100 GPU.
1 INTRODUCTION
The paper studies whether LLM layers are necessary for storing knowledge by pruning similar layer blocks and optionally healing the resulting mismatch. QA performance remains robust to substantial pruning, while other evaluations reveal limits and suggest different roles for shallow and deep layers.
- 1 INTRODUCTION: The method identifies similar layer representations, prunes an optimal contiguous block, and optionally heals the mismatch with small parameter-efficient finetuning.For Llama-2-70B, the strategy can eliminate roughly half the layers before QA performance collapses.
- 1 INTRODUCTION: The strategy searches for the layer ℓ∗ minimizing angular distance between layers ℓ and ℓ+n, removes n layers beginning there, and can then apply healing.Figure 1 also compares healed and unhealed Llama-2-70B accuracy and C4 autoregressive loss as pruning increases.
- 1 INTRODUCTION: Deeper layers are broadly more similar to neighboring layers than shallow layers, except for the final layer.A simple deep-to-shallow pruning heuristic nearly matches similarity-informed pruning after QLoRA healing.
- 1 INTRODUCTION: QA benchmarks such as MMLU and BoolQ remain robust to large amounts of layer pruning, whereas next-token loss is smoothly damaged in proportion to the pruning fraction.This contrast motivates examining tasks that are less robust than QA benchmarks.
- 1 INTRODUCTION: The results suggest shallow layers may critically store and retrieve knowledge, while deeper layers support higher-level computations such as mathematical reasoning.The paper frames this as an accounting of the different roles of model depth.
2 LITERATURE REVIEW
The literature review places the work within the history of neural-network pruning, especially structured pruning methods developed for efficient sparse networks and later applied to transformers.
- 2 LITERATURE REVIEW: Neural-network pruning progressed from early unstructured methods to structured techniques designed to make sparse networks more efficient.Recent work has extended structured pruning to transformer architectures.
3 METHOD
The method prunes contiguous layer blocks selected by representation similarity, then optionally heals the induced mismatch with small-scale finetuning. Its residual-network intuition favors blocks whose inputs and outputs are similar, especially in deeper layers.
- 3.1 INTUITION: Residual representations evolve through layer updates, so the final representation is a sum of the embedded input and transformations contributed by all layers.The layer transformation is represented by f(x, θ) with layer input x and parameters θ.
- 3.1 INTUITION: Pruning can work when a block’s output is close to its input, because the induced representation mismatch is then small.The method assumes representations converge to a slowly changing function of layer index after some initial layers.
- 3.1 INTUITION: Deleting a layer has cascading effects through subsequent layers, making shallow-layer removal potentially more damaging than deep-layer removal.The deleted layer changes the input to later computations, which propagates through the remaining network.
- 3.2 LAYER-PRUNING ALGORITHM(S): The algorithm chooses a pruning count n, measures angular distance between x(ℓ) and x(ℓ+n), and selects the minimizing start layer ℓ∗.Distances can be computed on neutral pretraining data or data representative of a downstream task.
- 3.2 LAYER-PRUNING ALGORITHM(S): It removes layers ℓ∗ through ℓ∗+n−1, reconnects the surrounding blocks, and optionally heals the mismatch with a small amount of finetuning.Healing may use neutral pretraining data or a dataset of interest.
- 3.2 LAYER-PRUNING ALGORITHM(S): Angular distance compares final-token representations using the hidden-dimension inner product, L2 norms, and a 1/π convention.The final token is used because causal attention makes its embedding depend on the entire sequence.
- 3.2 LAYER-PRUNING ALGORITHM(S): Healing is optional for QA performance but substantially affects perplexity, so its necessity depends on resource constraints and the intended application.The paper suggests combining distance measurement and healing with downstream-task supervised finetuning when that is the ultimate goal.
- 3.2 LAYER-PRUNING ALGORITHM(S): A simpler heuristic removes the deepest layers while excluding the final layer before the language-model head, then heals the model.This avoids loading or running the unpruned model for similarity measurement and provides an ablation of block optimization.
4 RESULTS
The experiments evaluate similarity-informed and heuristic layer pruning across open-weight LLMs, measuring QA accuracy, next-token loss, representation similarity, and post-pruning healing. QA performance remains robust through substantial pruning, while healing restores next-token prediction and deeper layers generally provide the most removable blocks.
- Experimental setup: Models from 2.7B to 70B parameters were pruned across Llama-2, Qwen, Mistral-7B, and Phi-2 families, with QLoRA used for healing.The models span 32 to 80 unpruned layers; quantization and QLoRA enable the experiments on resource-constrained hardware.
- QA accuracy: Healing modestly improves QA performance by better preserving unpruned accuracy and shifting the transition to random guessing toward larger pruning fractions.The effect is also observed for average 0-shot BoolQ accuracy.
- Next-token prediction: After healing, normalized C4 loss increases slowly and linearly with layer dropping while recovering to near-unpruned levels and remaining continuous across QA transition regions.Before healing, C4 loss transitions to random guessing at approximately the same pruning fractions as QA accuracy, revealing a mismatch between these evaluation measures.
- Pruning strategy: Deeper blocks typically have the smallest inter-layer angular distances, whereas blocks containing the final layer are maximally or nearly maximally dissimilar and should not be dropped.The heuristic therefore removes layers from the penultimate layer toward shallower layers; its healed results are broadly comparable to similarity-informed pruning.
5 DISCUSSION AND FUTURE DIRECTIONS
The discussion asks why deeper-layer pruning leaves QA performance intact yet harms next-token prediction, and tests whether pruning sensitivity depends on reasoning demands. Results suggest deeper layers may support higher-level reasoning, while shallow layers support knowledge-intensive QA, but several questions remain open.
- 5 DISCUSSION AND FUTURE DIRECTIONS: QA benchmarks can remain robust to substantial pruning even though pruning disrupts the model’s next-token predictions.This motivates examining which tasks are less robust than QA benchmarks.
- 5 DISCUSSION AND FUTURE DIRECTIONS: GSM8K and HellaSwag degrade immediately with any pruning, whereas CoT-MMLU retains a relatively flat robust region.The two reasoning benchmarks show greater pruning sensitivity than CoT-MMLU in these evaluations.
- 5 DISCUSSION AND FUTURE DIRECTIONS: The results provide initial evidence that deeper layers may support higher-level reasoning, while shallow layers may be more important for knowledge-intensive QA.This favors hypothesis (i), which separates knowledge storage from more complicated computations.
- 5 DISCUSSION AND FUTURE DIRECTIONS: CoT-MMLU’s robustness suggests that perplexity errors from pruning do not necessarily compound when the model generates many tokens before answering.This contrasts with the hypothesis that deeper layers are necessary simply because chain-of-thought requires longer generation.
- 5 DISCUSSION AND FUTURE DIRECTIONS: Future work includes better pruning and healing methods, broader evaluations, checkpoint comparisons, alternative pretraining designs, and more systematic interpretability studies.The authors specifically propose testing how training, architecture, objectives, and task-dependent degradation affect layer use.
A.1 PRUNING
The paper situates layer pruning within structured model compression and distinguishes its similarity-based approach from prior layer dropping, distillation, and efficient finetuning methods. Its contribution is evidence that deep layers can be removed from large decoder-only LLMs with limited QA degradation, followed by a sharp transition.
- A.1 PRUNING: Structured pruning removes groups of parameters together to make reduced networks more efficient than irregular parameter sparsification.Transformer pruning has examined components including attention heads and layers.
- A.1 PRUNING: Prior layer-dropping work mostly studied smaller BERT-style models, whereas this paper studies decoder-only GPT-style models at 2.7B–70B parameters.The comparison highlights differences in architecture, scale, and training setup.
- A.1 PRUNING: The paper’s similarity-based strategy computes representation similarity on a small pretraining-corpus subset to select layers for pruning.Its simpler alternative removes layers from the reduced model after pruning.
- A.1 PRUNING: Unlike distillation, the pruning strategy does not rely on a large teacher processing a substantial corpus, reducing computational requirements.Distillation transfers teacher behavior to a student, whereas this method prunes the trained model directly.
- A.1 PRUNING: The study provides evidence that removing deepest layers often preserves performance and produces a sharp transition after approximately half the deepest layers are removed.This result complements prior depth-dependent studies while differing in model scale and methodology.
B EXPERIMENTAL DETAILS
The experiments cover open-weight LLM families from 2.7B to 70B parameters and use QLoRA-based healing on C4. Models are quantized and finetuned with parameter-efficient LoRA configurations under shared training settings.
- B EXPERIMENTAL DETAILS: Training uses cosine-annealed learning rates with 100 warmup steps, alongside standard PEFT implementation libraries.The experiments use the Hugging Face Trainer API, bitsandbytes, and Hugging Face peft.
- B EXPERIMENTAL DETAILS: LoRA is applied only to feed-forward modules, with model-specific target module names and rank 64 used aside from stated exceptions.The configuration also uses 0.05 dropout and sets LoRA α equal to the LoRA rank.
B.2 EVALUATION DETAILS
Evaluation measures MMLU and BoolQ accuracy plus normalized C4 validation loss, using fixed dataset and prompting choices. After healing, BoolQ retains a characteristic flat region of robust performance until a model-dependent threshold.
- B.2 EVALUATION DETAILS: The principal evaluations are MMLU accuracy, BoolQ accuracy, and C4 validation loss.These cover question answering and autoregressive next-token prediction.
- B.2 EVALUATION DETAILS: MMLU uses the cais/mmlu dataset, original formatting, zero few-shot examples, and average accuracy across subjects.The dev set is reserved for constructing few-shot examples, although experiments use none.
- B.2 EVALUATION DETAILS: BoolQ uses the hassansh/boolq_n_shot dataset version with zero few-shot examples.The complete results compare model families and distinguish healed from unhealed experiments.
- B.2 EVALUATION DETAILS: After healing, BoolQ retains a flat robust-performance region, with top-score capabilities preserved until a critical model-dependent pruning threshold.Healing is more important for BoolQ than for MMLU in the reported comparison.
- B.2 EVALUATION DETAILS: C4 validation loss is evaluated on 60k fixed validation sequences, separate from the C4 training split used for healing.The loss is normalized by log V, where V is the model-specific vocabulary size.
C ABLATIONS
The ablations test whether pruning robustness depends on model family, prompt configuration, or other experimental choices. Across these checks, the results remain qualitatively robust, while BoolQ performance benefits from healing and remains robust across substantial pruning fractions.
- The ablations find that the paper’s qualitative results are robust to prompting, finetuning seed, LoRA rank, and pruning-strategy variations.
- After healing, BoolQ performance remains robust until 20%-55% of layers are pruned, depending on model family and size.
- C.1 PROMPTING: Changing the ordering or number of few-shot examples does not undermine the layer-pruning strategy’s robustness on Llama-2-13B MMLU.
C.2 FINETUNING SEED
The finetuning-seed ablation evaluates whether stochastic training variation changes pruning outcomes. It finds no meaningful effect from the seed choice.
- The layer-pruning method is robust to the choice of finetuning seed on Llama-2-13B.
C.3 LORA RANK
The LoRA-rank ablation examines how healing rank affects pruning performance. Across tested configurations, rank has little effect on qualitative behavior, while lower ranks often improve MMLU accuracy but can worsen C4 loss.
- LoRA rank does not significantly change the qualitative behavior of healed models, and decreasing rank generally improves performance.The main experiments used rank 64 for most models, with ranks 4, 2, and 8 for Mistral-7B, Llama-2-7B, and Llama-2-70B, respectively.
- Rank 2 is the top-performing rank for Llama-2-7B under similarity-informed pruning, while both Mistral-7B and Llama-2-7B remain comparatively robust.
- The rank sweeps show similar behavior across ranks, with a small effect favoring lower ranks overall.
- For Mistral-7B, decreasing LoRA rank improves MMLU accuracy while harming C4 validation loss, supporting an overfitting hypothesis.
C.4 OTHER PRUNING STRATEGIES
The study compares similarity-informed layer pruning with random-layer and shallow-layer baselines. Similarity-informed pruning performs better on the reported Llama-2 7B MMLU evaluation.
- Similarity-informed pruning outperforms random-layer and shallow-layer pruning on Llama-2 7B MMLU accuracy.Figure 11 uses LoRA rank 64 for the comparison.