T-REX: Mixture-of-Rank-One-Experts with Semantic-aware Intuition for Multi-task Large Language Model Finetuning

Rongyu Zhang, Yijiang Liu, Huanrui Yang, Shenli Zheng, Dan Wang, Yuan Du, Li Du, Shanghang Zhang

TL;DR

T-REX (mixTure-of-Rank-onE-eXperts) is a novel parameter-efficient fine-tuning framework that enables Large Language Models (LLMs) to master multiple tasks simultaneously with unprecedented efficiency. By combining ultra-lightweight rank-1 experts through a "mix-and-match" mechanism and guiding them with semantic "intuition," T-REX achieves higher accuracy than state-of-the-art methods while using 30-40% fewer trainable parameters.

What Problem Does This Paper Address?

Adapting a single pretrained LLM to perform well across diverse downstream tasks—like reasoning, coding, and creative writing—is a major challenge in machine learning. While Mixture-of-Experts (MoE) architectures are a popular solution, they face two significant hurdles:

  1. Scaling Overheads: Traditional MoE models scale their parameter count linearly with the number of experts. For complex multi-task environments requiring many specialized experts, this becomes computationally prohibitive.
  2. Suboptimal Routing: Most MoE routers are "blind" to the underlying semantic structure of the data. They often rely on coarse human-defined task labels, which the authors show are frequently ambiguous and don't align well with how models actually process information.

Methods

T-REX introduces two primary innovations to solve these problems:

1. Mix-and-Match Rank-1 Experts

Instead of using standard Low-Rank Adaptation (LoRA) matrices for each expert, T-REX decomposes experts into the simplest possible form: rank-1 vectors.

  • The Math: It defines a set of row vectors $\{a_i\}$ and column vectors $\{b_j\}$.
  • The Innovation: Any $a_i$ can pair with any $b_j$ to form a unique rank-1 expert. If you have $I$ row vectors and $J$ column vectors, you can create $I \times J$ experts. This allows for quadratic scaling of the expert pool while only increasing parameters linearly.
Figure 1: Illustration of the trainable parameters in (a) Vanilla LoRA, (b) LoRA-MoE, and (c) our proposed T-REX. r1, r2 ≪min{m, n}. 6 experts are demonstrated for both LoRA-MoE and T-REX.

2. Semantic-aware Router (Implicit Intuition)

The authors argue that human-defined categories (e.g., "Reasoning" vs. "Knowledge") are often misleading. They propose a router guided by "implicit intuition":

  • Clustering: They use k-means to group training data embeddings into semantic clusters.
  • Intuition Score: During inference, the model calculates the cosine similarity between the input's embedding and these cluster centroids. This similarity acts as a "prior" or "intuition" that helps the router decide which experts to activate, leading to smoother and faster convergence.

Datasets

The researchers curated a massive multi-task suite of 20 datasets spanning five dimensions:

  • Reasoning: ANLI, ReCoRD, HellaSwag.
  • Examination: MMLU, ARC.
  • Language: WiC, WinoGrande.
  • Understanding: OpenBookQA, MultiRC.
  • Knowledge: CommonSenseQA, BoolQ.
  • Mixed: Alpaca.

For evaluation, they tested on 14 public datasets and used the Big-Bench Hard (BBH) benchmark to assess zero-shot generalization to out-of-distribution (OOD) tasks.

Key Insights and Ideas

  • Human Labels are Flawed: The authors visualized token embeddings (Figure 4) and found that datasets from the same human-defined category often distribute widely, while diverse tasks sometimes cluster closely. Relying on human labels for routing actually decreased performance.
  • Quadratic Expressivity: By decoupling row and column subspaces, T-REX can cover a much higher-dimensional weight space than standard LoRA-MoE for the same parameter "budget."
  • Smoother Convergence: The "intuition" signal acts as a powerful initialization for the router. As shown in Figure 2, T-REX's routing weights follow a much more stable and direct trajectory during training compared to traditional methods.
Figure 2: 3D trajectory of router weights for (a) Traditional LoRA, (b) Rank-1 experts with Mix-and-Match, and (c) T-REX with intuition in the MoE training process. Intuition helps to enable a smoother convergence.

Key Results

T-REX was tested across seven LLM backbones (including LLaMA-2, LLaMA-3, Mistral, and Gemma).

  • Accuracy: It achieved up to a 1.78% mean accuracy improvement over standard LoRA-based MoE methods.
  • Efficiency: On a Mistral 7B backbone, T-REX used only 39.9M parameters compared to 93.8M for MoLoRA, while actually running faster (6.92 it/s vs 6.43 it/s).
  • Generalization: In zero-shot OOD tests on Big-Bench Hard, T-REX consistently outperformed baselines, surpassing standard LoRA by over 1% on Gemma 2B and Yi 6B backbones.

Limitations and Future Work

  • Modality Constraints: The current study is limited to text-based LLMs. The authors suggest that extending T-REX to Vision-Language Models (VLMs) is a promising next step given the structural similarities.
  • Router Scaling: While the experts scale efficiently, the router's linear layer grows as the number of experts increases. The authors propose that future versions could use low-rank matrices within the router itself to mitigate this.
  • Intuition Source: The "intuition" currently relies on a separate embedding model (nomic-embed-text-v1). Exploring how to derive this intuition endogenously from the LLM itself could further streamline the architecture.

Summary updated

BibTeX
@misc{zhang2024t,
  author = {Rongyu Zhang and Yijiang Liu and Huanrui Yang and Shenli Zheng and Dan Wang and Yuan Du and Li Du and Shanghang Zhang},
  title = {{T-REX: Mixture-of-Rank-One-Experts with Semantic-aware Intuition for Multi-task Large Language Model Finetuning}},
  year = {2024},
  eprint = {2404.08985},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2404.08985},
}
Figure