Retrieval Instead of Fine-tuning: A Retrieval-based Parameter Ensemble for Zero-shot Learning

Pengfei Jin, Peng Shu, Sekeun Kim, Qing Xiao, Sifan Song, Cheng Chen, Tianming Liu, Xiang Li, Quanzheng Li · OpenReview

Abstract

Foundation models have become a cornerstone in deep learning, with techniques like Low-Rank Adaptation (LoRA) offering efficient fine-tuning of large models. Similarly, methods such as Retrieval-Augmented Generation (RAG), which leverage vectorized databases, have further improved model performance by grounding outputs in external information. While these approaches have demonstrated notable success, they often require extensive training or labeled data, which can limit their adaptability in resource-constrained environments. To address these challenges, we introduce Retrieval-based Parameter Ensemble (RPE), a new method that creates a vectorized database of LoRAs, enabling efficient retrieval and application of model adaptations to new tasks. RPE minimizes the need for extensive training and eliminates the requirement for labeled data, making it particularly effective for zero-shot learning. Additionally, RPE is well-suited for privacy-sensitive domains like healthcare, as it modifies model parameters without accessing raw data. When applied to tasks such as medical report generation and image segmentation, RPE not only proved effective but also surpassed supervised fine-tuning methods in certain cases, highlighting its potential to enhance both computational efficiency and privacy in deep learning applications.

Introduction

Foundation models like LLaMA and Stable Diffusion have revolutionized deep learning, yet adapting them to specialized niche tasks remains computationally expensive. While Low-Rank Adaptation (LoRA) has democratized model fine-tuning—resulting in over 100,000 specialized adapters on platforms like CivitAI—users face a significant challenge when encountering a brand-new task: selecting the optimal adapter. Current heuristics typically rely on simple retrieval (picking the single most similar adapter) or uniform averaging. These methods often fail to capture the complex "latent geometry" of task relationships, where a new task might be a specific blend of multiple existing prototypes or require the subtraction of irrelevant features.

Methodology: Latent Geometry-Preserving Composition

To overcome the limitations of simple retrieval, we propose the Retrieval-based Parameter Ensemble (RPE) framework, which utilizes a three-stage pipeline for Latent Geometry-Preserving Composition.

Overview of the RPE framework, showing the construction of the Adapter-VecDB and the retrieval/reconstruction process for new tasks.
  1. Task Prototype Construction: A library of adapters (the "Adapter-VecDB") is established. Each task is represented by a "prototype" vector—the average of feature embeddings derived from the base model's encoder.
  2. Sparse Task Projection: For a new target task, the system retrieves the $k$ nearest reference prototypes. Rather than simple similarity weighting, RPE solves an optimization problem to reconstruct the target prototype as a sparse linear combination of references. By using $\ell_1$-regularization (Lasso), the system ensures the combination is sparse, selecting only the most essential adapters.
  3. Parameter-Space Composition: The calculated weights are applied to linearly combine the actual LoRA weights ($\delta\theta$) in the parameter space. This composite adapter is then integrated into the frozen foundation model.
Comparison of similarity-based weighting versus linear reconstruction in the representation and parameter spaces.

This approach is entirely training-free and "plug-and-play," requiring no gradient-based tuning or labeled data for the new task. Crucially, linear reconstruction allows for negative weights, enabling the system to "de-bias" or subtract interfering features from the final composite adapter.

Experimental Evaluation

We evaluated RPE across three distinct domains:

  • Medical Image Segmentation: Utilizing the Segment Anything Model (SAM) across 10 datasets, including Prostate MRI and various abdominal CT scans (e.g., AbdAtlas, Abdomen1k).
  • Medical Report Generation: Employing LLaMA 3.1 8B on radiology report datasets from Massachusetts General Hospital (CT-Head, CT-Abdomen, X-ray, and MR).
  • Image Synthesis: Using Stable Diffusion v1.5 with a library of 10,000 community-contributed LoRA adapters from CivitAI.

Key Results

  • Superior Segmentation: On the "Prostate-E" dataset, RPE achieved a 79.1% DICE score, significantly outperforming similarity-based weighting (56.9%) and uniform averaging (64.6%).
  • Zero-Shot Performance: In medical report generation, RPE often matched or surpassed supervised fine-tuning (SFT) performance, particularly in ROUGE-L scores for X-ray and CT-Head modalities.
  • Efficiency: RPE offers a 10x speedup for deployment; while fine-tuning a LoRA may take 30 minutes, RPE's retrieval and projection process takes less than 3 minutes.
  • Robustness and Interpretability: The use of sparse weights prevents noise from irrelevant adapters and provides clear interpretability regarding which source tasks contribute to the new task's performance.

Conclusion

Retrieval-based Parameter Ensemble (RPE) provides a robust, efficient, and privacy-preserving alternative to traditional fine-tuning. By leveraging the latent geometry of task prototypes, RPE enables high-quality zero-shot adaptation across diverse modalities. Future work will focus on scaling these libraries to millions of adapters and exploring multi-modal prototype expansion to further enhance cross-domain generalization.

Summary updated

Abstract

Foundation models have become a cornerstone in deep learning, with techniques like Low-Rank Adaptation (LoRA) offering efficient fine-tuning of large models. Similarly, methods such as Retrieval-Augmented Generation (RAG), which leverage vectorized databases, have further improved model performance by grounding outputs in external information. While these approaches have demonstrated notable success, they often require extensive training or labeled data, which can limit their adaptability in resource-constrained environments. To address these challenges, we introduce Retrieval-based Parameter Ensemble (RPE), a new method that creates a vectorized database of LoRAs, enabling efficient retrieval and application of model adaptations to new tasks. RPE minimizes the need for extensive training and eliminates the requirement for labeled data, making it particularly effective for zero-shot learning. Additionally, RPE is well-suited for privacy-sensitive domains like healthcare, as it modifies model parameters without accessing raw data. When applied to tasks such as medical report generation and image segmentation, RPE not only proved effective but also surpassed supervised fine-tuning methods in certain cases, highlighting its potential to enhance both computational efficiency and privacy in deep learning applications.
BibTeX
@misc{jin2024retrieval,
  author = {Pengfei Jin and Peng Shu and Sekeun Kim and Qing Xiao and Sifan Song and Cheng Chen and Tianming Liu and Xiang Li and Quanzheng Li},
  title = {{Retrieval Instead of Fine-tuning: A Retrieval-based Parameter Ensemble for Zero-shot Learning}},
  year = {2024},
  eprint = {2410.09908},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.09908},
}

Loading related content...

Figure