Improving General Text Embedding Model: Tackling Task Conflict and Data Imbalance through Model Merging

Mingxin Li, Zhijie Nie, Yanzhao Zhang, Dingkun Long, Richong Zhang, Pengjun Xie

TL;DR

Training a single "jack-of-all-trades" text embedding model often leads to "task conflict," where learning one skill (like retrieval) hurts another (like similarity). This paper introduces Self Positioning, a method that bypasses messy joint training by merging specialized models and using gradient descent to find the perfect "sweet spot" in the model weight space, leading to state-of-the-art performance on the Massive Text Embedding Benchmark (MTEB).

What Problem Does This Paper Address?

In the world of Natural Language Processing, we want "general" embedding models that work for everything: finding a needle in a haystack (Retrieval), deciding if two sentences mean the same thing (Semantic Textual Similarity or STS), and categorizing text (Classification).

The standard approach is joint training: throw all the data into one pot and train. However, the authors identify two major "poison pills" in this process:

  1. Task Conflict: Gradients from different tasks often point in opposite directions. Improving retrieval might inadvertently "damage" the model's ability to judge sentence similarity—a phenomenon known as Negative Transfer.
  2. Data Imbalance: If you have 50 times more retrieval data than classification data, the model becomes biased toward retrieval. Standard fixes like resampling data are computationally expensive and often yield sub-optimal results.

Methods

The authors propose moving away from joint training toward Model Merging. They train specialized models (or "task vectors") independently and then combine their weights.

The core contribution is Self Positioning. Usually, finding the right weights to merge two models requires an exhaustive (and slow) grid search. Self Positioning treats the merging weights as learnable parameters.

  • The Process: They take a small "probe" dataset and use Stochastic Gradient Descent (SGD) to optimize the merging hyperparameters (the direction and scale of the task vectors).
  • Pipelines: They explore two strategies:
  • Separate Merging: Training models on distinct datasets from a common backbone and merging them.
  • Iterative Merging: Training on tasks sequentially and merging the stages to prevent "forgetting."

They evaluate five merging techniques, including SLERP (Spherical Linear Interpolation) and TIES Merging, finding that SLERP generally offers the highest performance ceiling.

Datasets

The researchers used a wide array of datasets to prove their point:

  • Training (English): AllNLI (for STS), FEVER, HotpotQA, MS MARCO, and NQ (for Retrieval).
  • Training (Chinese): SimCLUE, DuReader, Ecom, Medical, and Video-Retrieval.
  • Evaluation: The Massive Text Embedding Benchmark (MTEB), covering 56 datasets across tasks like classification, clustering, pair classification, reranking, retrieval, STS, and summarization.
  • Application: They also applied their method to the Instructor model, which involves 330 diverse tasks.

Key Insights and Ideas

  • Geometry of Imbalance: The authors discovered a clear linear relationship between the amount of training data and the norm (length) of the resulting task vector. Furthermore, the direction of a jointly trained model's vector is heavily pulled toward the task with more data.
  • The Interpolation Space is Enough: They found that high-performing models almost always exist within the interpolation space between specialized task vectors. You don't need to search the entire high-dimensional weight space; you just need to find the right "position" on the line (or curve) between models.
  • Loss as a Proxy: The performance of a merged model correlates strongly with its loss on a small multi-task training sample. This allows Self Positioning to find optimal weights without needing to run the full, expensive evaluation suite during the search.

Key Results

  • MTEB Superiority: Self Positioning achieved an absolute improvement of 0.7 points on the MTEB dataset compared to standard training methods.
  • Beating Joint Training: In the Chinese setting, joint training underperformed task-specific models in 13 out of 16 tasks. Merged models via Self Positioning consistently outperformed the joint training baseline.
  • Efficiency: Compared to traditional data resampling (which requires retraining the whole model), Self Positioning finds better weight configurations in a fraction of the time (hours vs. days of GPU time).
  • Robustness: When applied to the T5-large backbone (the "Instructor" model), the merging strategy consistently yielded improvements across various cluster sizes and data sources.

Limitations and Future Work

  • The Probe Dataset: Self Positioning requires a small, representative "probe" dataset. If this probe is biased or too small, the optimized merging weights might not generalize well to the full evaluation set.
  • Linear Scaling of Sub-models: While merging is efficient, you still have to train the initial specialized sub-models. As the number of tasks grows into the thousands, managing and merging these individual models could become a logistical challenge.
  • Future Directions: The authors suggest exploring how this method applies to even larger models (LLMs) and whether it can be used for "on-the-fly" model merging based on specific user instructions.

Summary updated

BibTeX
@misc{li2024improving,
  author = {Mingxin Li and Zhijie Nie and Yanzhao Zhang and Dingkun Long and Richong Zhang and Pengjun Xie},
  title = {{Improving General Text Embedding Model: Tackling Task Conflict and Data Imbalance through Model Merging}},
  year = {2024},
  eprint = {2410.15035},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.15035},
}
Figure