TL;DR
Large Language Models (LLMs) are top-tier at document retrieval but are often too bulky for real-world deployment. This paper reveals that while attention layers are vital for retrieval, MLP layers are highly redundant; by targeting these MLPs with a "coarse-to-fine" pruning strategy called EffiR, the authors slash model size and nearly double inference speed while maintaining over 98% of the original performance.
What Problem Does This Paper Address?
Dense retrievers use LLMs to transform queries and documents into mathematical vectors (embeddings) to find the best matches in a search index. While LLMs like Mistral-7B excel at this, their billions of parameters make them slow and computationally expensive.
Previous research on making LLMs smaller has focused on generative tasks (like chatting or writing code), finding that attention layers are often redundant. However, retrieval is a different beast: it requires condensing an entire sequence into a single, semantically rich vector. The authors set out to discover if the "rules of redundancy" change when an LLM is used as a retriever rather than a generator.
Methods
The authors introduce EffiR (Efficient Retriever Training), a framework that compresses models in two stages:
- Coarse-grained Depth Reduction: They identify and remove entire MLP (Multi-Layer Perceptron) layers that contribute the least to the final embedding. Crucially, they leave the attention layers untouched.
- Fine-grained Width Reduction (Self-Slimming): For the MLP layers that remain, they use a "trainable importance indicator" to identify which internal dimensions are least useful. They then "slim" these layers by pruning those dimensions.
- Retrieval-Specific Fine-Tuning: After pruning, the model undergoes contrastive fine-tuning on the MS MARCO dataset, often using knowledge distillation from a larger "teacher" model to help the smaller "student" recover its accuracy.
This approach differs from standard "block pruning," which removes both attention and MLP components together.
Datasets
- Training: The models were fine-tuned on the MS MARCO dataset, a standard benchmark for information retrieval.
- Pruning Analysis: Importance scores for layers were calculated using samples from the C4 corpus.
- Evaluation: The primary evaluation used the BEIR benchmark, which consists of 13 diverse retrieval datasets including Natural Questions (NQ), Quora Question Pairs, and HotpotQA.
Key Insights and Ideas
- The Retrieval Paradox: In generative models, attention layers are often the most prunable. In retrieval, the opposite is true. Dropping attention layers leads to a "drastic collapse" in performance because they are essential for aggregating global semantic information across the text.
- MLPs are the Real Bloat: MLP layers account for roughly 80% of the parameters in models like Mistral-7B. The authors found these layers are significantly more redundant in retrieval tasks than previously thought.
- Deeper is Redundant: As shown in the "dropping-order heat maps" (Figure 2a/5), layers closer to the end of the model are generally more redundant and safer to prune than earlier layers.
- Coarse-to-Fine Superiority: Combining layer dropping with width reduction (slimming) creates a much better efficiency-effectiveness tradeoff than simply dropping more layers.
Key Results
- High Fidelity: The EffiR-16M-4.3B model (which drops 16 MLP layers from Mistral-7B) retained 98.5% of the full model's performance on BEIR (55.3 vs. 56.1 nDCG@10).
- Significant Speedup: EffiR achieved a 1.97x query-side speedup and reduced the parameter count by over 50% compared to the Mistral-7B baseline.
- Better than "Native" Small Models: EffiR-compressed models consistently outperformed smaller models of similar size (like Llama-1B or Gemma-2B) that were trained from scratch for retrieval. This suggests that starting big and pruning intelligently is more effective than starting small.
Limitations and Future Work
- English-Centric: The evaluation was primarily performed on English-language benchmarks. The authors acknowledge that the effectiveness of EffiR in multilingual or low-resource settings remains to be explored.
- Still Larger than BERT: While much faster than full LLMs, these models are still significantly slower than "classic" small retrievers like BERT-base.
- Future Directions: The authors suggest exploring how these insights apply to even larger models (70B+) and investigating the interaction between pruning and other efficiency techniques like quantization.
Summary updated