Making Large Language Models Efficient Dense Retrievers

Yibin Lei, Shwai He, Ang Li, Andrew Yates

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:

  1. 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.
  2. 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.
  3. 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

Abstract

Recent work has shown that directly fine-tuning large language models (LLMs) for dense retrieval yields strong performance, but their substantial parameter counts make them computationally inefficient. While prior studies have revealed significant layer redundancy in LLMs for generative tasks, it remains unclear whether similar redundancy exists when these models are adapted for retrieval tasks, which require encoding entire sequences into fixed representations rather than generating tokens iteratively. To this end, we conduct a comprehensive analysis of layer redundancy in LLM-based dense retrievers. We find that, in contrast to generative settings, MLP layers are substantially more prunable, while attention layers remain critical for semantic aggregation. Building on this insight, we propose EffiR, a framework for developing efficient retrievers that performs large-scale MLP compression through a coarse-to-fine strategy (coarse-grained depth reduction followed by fine-grained width reduction), combined with retrieval-specific fine-tuning. Across diverse BEIR datasets and LLM backbones, EffiR achieves substantial reductions in model size and inference cost while preserving the performance of full-size models.
BibTeX
@inproceedings{lei2026making,
  author = {Yibin Lei and Shwai He and Ang Li and Andrew Yates},
  title = {{Making Large Language Models Efficient Dense Retrievers}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2026},
  doi = {10.18653/v1/2026.acl-long.587},
}

Loading related content...

Figure