TL;DR
K-Merge is a new framework designed to help small, on-device Large Language Models (LLMs) support dozens of different tasks without blowing their storage budget. By intelligently merging incoming Low-Rank Adapters (LoRAs) into a fixed number of "slots" based on weight similarity, the system achieves 80-90% of the performance of dedicated task-specific models while using a fraction of the memory.
What Problem Does This Paper Address?
Deploying LLMs on mobile devices is a balancing act. While a base model (like Llama-3.2-1B) is versatile, it often needs specialized "adapters" (LoRAs) to perform well on specific tasks like grammar correction in Italian or summarization in Korean.
The challenge is twofold:
- Storage Constraints: A single LoRA might be small (~30MB), but if a user wants 40 different task/language combinations, that’s over 1GB of storage—a heavy ask for a smartphone.
- Online Arrival: In the real world, these capabilities aren't all available at once. They arrive incrementally as the user requests new features.
Existing model merging techniques usually assume you have all the models and the original training data ready at once. This paper tackles online continual merging: how to integrate new adapters into a limited number of storage slots, on-the-fly, without any original training data.
Methods
The authors propose two variants: K-Merge and K-Merge++. Both follow a three-step pipeline:
- Similarity-Based Clustering: When a new LoRA arrives, the system flattens its weight matrices and calculates the cosine similarity against the adapters already stored on the device.
- Decision Logic:
- K-Merge: If there is an empty storage slot, it takes it. If the budget ($K$) is full, it merges the new LoRA into the most similar existing one.
- K-Merge++: This version is more "picky." It only merges if the similarity exceeds a specific threshold. If not, it tries to save a new slot for the adapter, preserving diversity for future, potentially very different tasks.
- History-Aware Merging: Instead of a simple average, the system uses a running average formula that accounts for how many previous LoRAs are already "inside" a merged adapter. This ensures that the 10th task merged into a slot doesn't drown out the influence of the first nine.
Datasets
The researchers evaluated their method using a massive benchmark of 40 distinct tasks (5 problem types across 8 languages):
- Task Types: Smart Reply, Summarization, Tone Adjustment, Question Answering, and Grammar Correction.
- Languages: English, Spanish, French, German, Italian, Korean, Japanese, and Chinese.
- Source Datasets: Persona-Chat, SAMSum, Sound Natural, SQuAD, and various grammar corpora (e.g., Write & Improve, ECSpell).
- Held-out Tasks: They also used Translation and Title Generation tasks to calibrate their similarity thresholds.
Key Insights and Ideas
- Tasks Over Languages: One of the most interesting findings is that LoRAs tend to cluster naturally by task type rather than by language. An English summarization adapter is more similar to a French summarization adapter than it is to an English grammar correction adapter.
- Order Invariance: By using a running average for merging, the final performance is less dependent on the specific order in which the user "downloads" new capabilities.
- Data-Free Efficiency: The entire process happens in fractions of a second (0.04s to 0.18s) because it only looks at the weights of the adapters, never requiring the LLM to process actual text data during the merge.
Key Results
- Performance Retention: With a budget of only 8 storage slots to cover 40 tasks, K-Merge++ recovered 80-90% of the performance of having 40 individual, dedicated adapters.
- Superiority over Baselines: K-Merge consistently outperformed standard merging techniques like Linear averaging, TIES, and DARE, especially when the storage budget was very tight (e.g., only 3 or 5 slots).
- Robustness: K-Merge++ proved highly resilient to "adversarial" task orderings (where very different tasks arrive in a sequence designed to confuse the clustering), thanks to its similarity threshold mechanism.
Limitations and Future Work
- Text-Only: The study focused exclusively on text-based LLMs. The authors note that extending this to multimodal models (vision/audio) is a logical next step.
- LoRA Specificity: The method is tailored for LoRA adapters. While LoRA is the industry standard, other adapter types (like IA3 or Bottleneck adapters) weren't tested.
- Model Size: Testing was limited to 1B-2B parameter models. While perfect for current mobile hardware, the dynamics of merging might change for larger "edge" models in the 7B-14B range.
Summary updated