LLM-Oriented Retrieval Tuner

Si Sun, Hanqing Zhang, Zhiyuan Liu, Jie Bao, Dawei Song · DOI

Abstract

Large Language Models (LLMs) are increasingly used as the core of AI agents, yet their generative training objectives often conflict with the requirements of dense retrieval. This paper presents LMORT (LLM-Oriented Retrieval Tuner), a lightweight architectural plugin designed to unlock the retrieval capabilities of frozen LLMs. By identifying and fusing layers optimized for alignment and uniformity, LMORT achieves competitive retrieval performance on the BEIR benchmark using only 2% of the training parameters and 4% of the training time of full fine-tuning, all while preserving the original generative power of the LLM.

Introduction

The integration of Large Language Models (LLMs) into retrieval-augmented generation (RAG) systems typically requires specialized dense retrieval (DR) models. However, fine-tuning LLMs for retrieval often leads to a "paradigm discrepancy," where the model's generative ability is compromised to improve its vector-space mapping. This research addresses the challenge of extracting high-quality retrieval embeddings from frozen LLMs without altering their weights or sacrificing their general-purpose utility.

Methodology

The researchers propose LMORT, a small Transformer-based "tuner" that interfaces with a frozen LLM. The design is motivated by the observation that retrieval performance depends on two distinct properties: alignment (closeness of related items) and uniformity (maximal information spread).

Architecture of the LMORT plugin and its integration with a frozen LLM.

LMORT identifies the "Optimal Alignment Layer" ($H^a$) and the "Optimal Uniformity Layer" ($H^u$) within the frozen LLM. It then employs a specialized architecture consisting of:

  • Self Bi-Attention: To process features from a single optimal layer.
  • Cross Bi-Attention: To integrate and fuse features from both the alignment and uniformity layers. This allows the model to project internal LLM knowledge into a unified retrieval space efficiently.

Experimental Setup

The model was trained on the MS MARCO dataset, comprising 500,000 web queries. Evaluation was conducted using the BEIR benchmark, focusing on six diverse datasets: TREC-COVID, NFCorpus, FiQA, ArguAna, SciFact, and SCIDOCS. These datasets evaluate the model's zero-shot retrieval capabilities across specialized domains like medicine and finance.

Key Insights and Ideas

A central discovery of this work is the mutual exclusivity of layers regarding retrieval metrics. Layer-wise analysis reveals that lower layers tend to exhibit high alignment due to their focus on literal word overlaps, whereas higher layers demonstrate superior uniformity as they capture abstract semantic features.

Heatmaps showing the distribution of alignment and uniformity across LLM layers for various datasets.

Additional findings include:

  • Efficiency: By utilizing dimensionality reduction via a two-layer MLP, the tuner requires only 2% of the base model's parameters.
  • Inverse Scaling: Larger base models (e.g., GPT-j-6B) require fewer LMORT layers to achieve optimal performance compared to smaller models.

Key Results

LMORT demonstrates significant efficiency and performance gains:

  • Performance: On the BEIR benchmark, LMORT (with GPT-j-6B) outperformed traditional models like BM25 and DPR, coming within 2% of the much larger GTR-XXL.
  • Resource Efficiency: Training requires only 4% of the time needed for full-parameter fine-tuning.
  • Capability Preservation: Since the base LLM remains frozen, its original text generation capabilities are fully preserved, enabling a dual-purpose model.

Limitations and Future Work

While highly efficient, LMORT still exhibits a slight performance gap compared to full-parameter fine-tuning. Additionally, the method requires access to the model's internal hidden states, limiting its current application to open-source LLMs. Future research will explore integration with long-context models to enhance memory management in AI agents.

Summary updated

BibTeX
@misc{sun2024llm,
  author = {Si Sun and Hanqing Zhang and Zhiyuan Liu and Jie Bao and Dawei Song},
  title = {{LLM-Oriented Retrieval Tuner}},
  year = {2024},
  eprint = {2403.01999},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.01999},
}
Figure