Ensembles of Low-Rank Expert Adapters

Yinghao Li, Vianne R. Gao, Chao Zhang, MohamadAli Torkamani · DOI

Abstract

Fine-tuning Large Language Models (LLMs) on diverse datasets often leads to "gradient interference," where conflicting signals from different tasks hinder optimal learning. We present Ensembles of Low-Rank Expert Adapters (ELREA), a framework that mitigates this conflict by clustering training data based on gradient similarity. By training specialized LoRA experts for each cluster and employing a task-agnostic routing mechanism during inference, ELREA achieves significant performance gains in mathematical and general reasoning tasks without requiring manual data selection or task-specific labels.

Introduction

When fine-tuning LLMs, practitioners typically aggregate diverse datasets—ranging from code and mathematics to creative writing—into a single training pipeline. However, these data types often produce "conflicting gradients." For example, the optimization path required for logical reasoning may contradict the path for creative prose, leading to suboptimal model specialization.

While traditional "data selection" methods attempt to solve this by isolating specific subsets of data for specific tasks, they require prior knowledge of the target task. ELREA addresses this by allowing the model to specialize across all tasks simultaneously, intelligently selecting the appropriate "expertise" during inference, even for novel or out-of-distribution prompts.

Methodology

The ELREA framework consists of a four-stage pipeline designed to identify and exploit task-specific learning signals:

  1. Base Tuning: A standard Low-Rank Adaptation (LoRA) adapter is trained on the entire dataset. This establishes a baseline for instruction-following and provides a reference point for gradient calculation.
  2. Gradient Feature Extraction: For every training example, the system calculates the gradient—the vector indicating how weights should move to minimize loss. To handle the massive dimensionality of these vectors, Random Projection is used to compress them into an 8,192-dimensional space while preserving their geometric relationships.
  3. Clustering: The BIRCH algorithm groups training examples with similar gradient directions. This process effectively partitions the data into "areas of expertise," such as logic, mathematics, or linguistic nuances, based on how the model learns from them.
  4. Expert Training and Routing: Multiple new LoRA adapters are initialized and fine-tuned exclusively on specific clusters. At inference, the system calculates the gradient of the input prompt, compares it to the cluster centroids, and assigns weights to each expert. The final output is a weighted ensemble of the experts' predictions, including the original base adapter to ensure robustness.

Experimental Setup

The researchers evaluated ELREA using Gemma-2b-it and Gemma2-9b-it models across two primary benchmarks:

  • General Reasoning: Evaluation on MMLU and Big-Bench Hard (BBH) using data from Flan V2, CoT, Dolly-15k, and OpenAssistant.
  • Mathematical Reasoning: A unified MATH-Combined dataset was created by merging GSM8k, MathQA, SVAMP, and MATH.

Key Insights

  • Gradients vs. Embeddings: ELREA demonstrates that gradients are superior to semantic sentence embeddings for routing. Gradients capture how a model learns the data, whereas embeddings only capture what the words mean.
  • Standardization: To combat the "curse of dimensionality" in high-dimensional similarity calculations, the authors found that standardizing cosine similarities before applying a SoftMax was essential for effective routing.
  • The Safety Net: By including the base adapter in the final ensemble, ELREA maintains a "safety net." If a prompt is significantly different from the training data, the system defaults to the base adapter, ensuring the model remains robust and instruction-compliant.

Results

ELREA demonstrated superior accuracy compared to standard LoRA baselines and other popular architectures:

  • Accuracy Gains: On the MATH-Combined benchmark (rank 8), ELREA achieved 20.41% accuracy, a relative improvement of approximately 9.7% over the standard LoRA baseline (18.61%).
  • Comparison to MoE: ELREA consistently outperformed Mixture-of-Experts (MoE) and MoLE architectures, which often struggle with complex routing functions in Parameter-Efficient Fine-Tuning (PEFT) contexts.
  • Generalization: The framework showed improved zero-shot and few-shot performance on out-of-distribution tasks, proving that gradient-based clustering captures fundamental learning patterns that generalize beyond the training set.

Limitations and Conclusion

Despite its performance advantages, ELREA introduces computational overhead. Activating multiple experts during inference resulted in a 2.3x slowdown and increased VRAM usage compared to a single adapter. Additionally, performance gains were less pronounced on larger models (Gemma2-9b), suggesting that high-capacity models may inherently manage some gradient conflict.

Future research will focus on "adapter merging" techniques to mitigate inference costs and the application of ELREA to larger-scale models to determine the limits of gradient-based specialization.

Summary updated

BibTeX
@inproceedings{li2025ensembles,
  author = {Yinghao Li and Vianne R. Gao and Chao Zhang and MohamadAli Torkamani},
  title = {{Ensembles of Low-Rank Expert Adapters}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=l0gZS0sAlf},
}
Figure