GRAM: Group-wise Rank-Aware Model Merging via Subspace Alignment
Organizations: JPMorgan Chase & Co.
Abstract
Merging different models into a single model is highly desirable for multi-task deployment, particularly in regulated domains like healthcare. In such settings, models are often locally fine-tuned due to strict data privacy policies, necessitating that aggregation operates exclusively on the fine-tuned weights. Existing methods apply a uniform merge across all tasks, ignoring the geometric relationships among their learned subspaces. When task updates occupy misaligned subspaces, projecting them onto a shared low-rank basis discards task-relevant directions, a failure mode named subspace interference. Through this study, we show that the per-task projection error of a merged model is governed by the principal-angle alignment between each task and the shared subspace, so that grouping geometrically compatible tasks provably reduces this error within each group. Motivated by this observation, we propose Group-wise Rank-Aware Model Merging (GRAM), which uses the principal-angle geometry of task vectors to decide which tasks should be merged together and then performs a standard SVD-based merge within each coalition; the pipeline requires only the fine-tuned weights at merge time. With only one additional model (), GRAM significantly mitigates subspace interference and consistently outperforms prior merging methods across language understanding (GLUE with Flan-T5), 8-task CLIP vision, and medical instruction tuning (Qwen2-7B-Instruct with four English/Chinese medical LoRAs).
Figures & tables
| Method | CoLA | MNLI | MRPC | QNLI | QQP | RTE | SST-2 | STS-B | Avg. |
|---|---|---|---|---|---|---|---|---|---|
| Individual (oracle) | 69.1 / 80.1 | 82.7 / 88.5 | 85.5 / 89.2 | 90.9 / 94.4 | 84.0 / 87.1 | 84.4 / 91.3 | 92.9 / 95.2 | 87.4 / 90.9 | 84.6 / 89.6 |
| Weight Averaging | 69.7 / 74.6 | 59.7 / 84.3 | 78.9 / 84.1 | 90.1 / 92.8 | 83.8 / 86.2 | 80.5 / 85.9 | 91.2 / 94.8 | 72.0 / 88.0 | 78.2 / 86.3 |
| Task Arithmetic | 69.5 / 76.9 | 59.0 / 85.4 | 78.7 / 85.3 | 90.1 / 93.9 | 83.9 / 85.8 | 79.4 / 88.1 | 91.5 / 95.2 | 72.9 / 87.8 | 78.1 / 87.3 |
| Concrete TA | 69.1 / 76.6 | 58.1 / 86.3 | 78.4 / 86.3 | 89.9 / 93.9 | 83.5 / 85.9 | 79.4 / 88.4 | 91.6 / 95.2 | 73.4 / 87.9 | 78.0 / 87.5 |
| DOGE TA | 69.1 / 78.4 | 71.9 / 88.1 | 80.9 / 86.5 | 90.3 / 93.8 | 83.5 / 86.3 | 79.8 / 87.7 | 92.5 / 95.1 | 71.1 / 87.7 | 79.9 / 88.0 |
| TIES-Merging | 68.3 / 77.1 | 56.3 / 85.1 | 79.4 / 86.3 | 89.8 / 93.9 | 83.7 / 86.0 | 79.4 / 87.7 | 91.6 / 95.1 | 71.2 / 88.0 | 77.5 / 87.4 |
| Method | MNIST | SVHN | GTSRB | DTD | Cars | RESISC45 | EuroSAT | SUN397 | Avg. |
|---|---|---|---|---|---|---|---|---|---|
| Individual (oracle) | 99.7 / 99.8 | 97.6 / 98.1 | 99.1 / 99.2 | 97.7 / 98.5 | 78.2 / 92.2 | 95.9 / 97.3 | 99.8 / 99.8 | 75.3 / 82.0 | 92.9 / 95.9 |
| Weight Averaging | 86.5 / 96.8 | 62.7 / 77.7 | 53.3 / 68.9 | 54.7 / 66.8 | 62.6 / 81.7 | 71.9 / 82.3 | 71.0 / 88.7 | 65.1 / 71.5 | 66.0 / 79.3 |
| Task Arithmetic | 96.9 / 99.0 | 78.1 / 86.0 | 68.2 / 84.9 | 59.6 / 72.2 | 56.2 / 81.9 | 68.1 / 86.3 | 76.0 / 91.9 | 57.3 / 72.9 | 70.1 / 84.4 |
| TIES-Merging | 97.0 / 99.0 | 80.5 / 87.6 | 69.3 / 83.7 | 66.2 / 77.5 | 61.1 / 83.3 | 73.2 / 87.7 | 79.4 / 93.8 | 62.7 / 74.0 | 73.7 / 85.8 |
| AdaMerging++ | 98.2 / 99.0 | 90.1 / 90.2 | 73.2 / 95.7 | 81.3 / 93.7 | 69.2 / 88.6 | 78.2 / 91.5 | 93.9 / 97.2 | 65.7 / 74.7 | 81.2 / 91.3 |
| TSV-Merge | 99.3 / 99.6 | 91.5 / 95.1 | 91.8 / 96.3 | 83.8 / 93.4 | 69.5 / 89.3 | 84.8 / 93.2 | 94.1 / 98.5 | 65.6 / 76.8 | 85.0 / 92.8 |
| MedQA | CMExam | HealthcareMagic | cMedQA2 | |||||||||
| Method | Acc. | Acc. | BLEU-4 | ROUGE-1 | ROUGE-2 | ROUGE-L | BLEU-4 | ROUGE-1 | ROUGE-2 | ROUGE-L | Avg Impr. | Avg Rank. |
| Pretrained | 51.92 | 74.77 | 1.05 | 25.90 | 3.27 | 12.65 | 9.77 | 40.30 | 19.05 | 20.94 | – | – |
| Individual (oracle) | 60.25 | 88.63 | 5.43 | 30.60 | 8.07 | 18.48 | 11.17 | 41.71 | 19.23 | 24.02 | +69.62% | 4.55 |
| Weight Averaging | 56.64 | 85.63 | 4.49 | 30.71 | 7.13 | 17.70 | 10.78 | 41.26 | 20.08 | 22.28 | +55.23% | 7.65 |
| Task Arithmetic | 57.97 | 87.69 | 5.00 | 30.33 | 7.72 | 18.11 | 5.55 | 32.70 | 12.02 | 19.15 | +49.40% | 7.05 |
| TIES-Merging | 58.05 | 87.69 | 4.23 | 30.72 | 7.03 | 17.58 | 11.30 | 42.06 | 20.60 | 22.85 | +54.18% | 6.10 |
| Model | GLUE | ViT-B/32 |
|---|---|---|
| GRAM | 83.8 | 88.8 |
| PA-Sim | 80.8_{\,{\color[rgb]{0.7,0,0}-3.0}} | 88.3_{\,{\color[rgb]{0.7,0,0}-0.5}} |
| Coalition | 81.7_{\,{\color[rgb]{0.7,0,0}-2.1}} | 85.4_{\,{\color[rgb]{0.7,0,0}-3.4}} |
| Adapt-Rank | 82.2_{\,{\color[rgb]{0.7,0,0}-1.6}} | 88.7_{\,{\color[rgb]{0.7,0,0}-0.1}} |
| Partitioning of the same subspace geometry | partition | Avg. |
|---|---|---|
| GRAM | {CoLA, MRPC, QNLI, QQP, RTE, SST-2} {MNLI, STS-B} | 83.8 |
| Agglomerative (average linkage) | identical partition | 83.8 |
| Max-modularity communities (exact, all 127 bipartitions) | {CoLA, MNLI, SST-2, STS-B} {MRPC, QNLI, QQP, RTE} | 82.9 |
| Random equipartition | random | 82.4 |
| No grouping ( , re-merged) | all tasks | 81.9 |
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
| CoLA | MNLI | MRPC | QNLI | QQP | RTE | SST-2 | STS-B | Avg. | Extra params | |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 (weight averaging) | 69.7 / 74.6 | 59.7 / 84.3 | 78.9 / 84.1 | 90.1 / 92.8 | 83.8 / 86.2 | 80.5 / 85.9 | 91.2 / 94.8 | 72.0 / 88.0 | 78.2 / 86.3 | — |
| 1 (global merge) | 69.1 / 79.2 | 74.2 / 86.0 | 80.4 / 87.3 | 89.7 / 93.6 | 83.5 / 85.6 | 80.9 / 87.0 | 92.7 / 95.3 | 84.6 / 88.7 | 81.9 / 87.8 | — |
| 2 (GRAM) | 69.5 / 79.3 | 82.8 / 89.0 | 84.3 / 88.7 | 90.2 / 93.8 | 84.0 / 85.7 | 79.8 / 88.1 | 93.2 / 95.4 | 86.7 / 89.9 | 83.8 / 88.7 | M / M |
| 3 | 69.5 / 79.3 | 82.7 / 88.5 | 84.3 / 88.7 | 90.2 / 93.8 | 84.0 / 85.7 | 79.8 / 88.1 | 93.2 / 95.4 | 87.4 / 90.9 | 83.9 / 88.8 | M / M |
| 4 | 69.1 / 79.9 | 82.7 / 88.5 | 84.8 / 89.5 | 90.2 / 93.8 | 83.7 / 85.8 | 78.0 / 88.4 | 93.2 / 95.2 | 87.4 / 90.9 | 83.6 / 89.0 | M / M |
| 5 | 69.1 / 80.1 | 82.7 / 88.5 | 84.8 / 89.5 | 90.2 / 93.8 | 83.7 / 85.8 | 78.0 / 88.4 | 92.9 / 95.2 | 87.4 / 90.9 | 83.6 / 89.0 | M / M |
| Setting | Intra-sim | Inter-sim | Ratio | Avg Acc |
|---|---|---|---|---|
| No grouping ( , global merge) | 0.097 | — | — | 81.7 |
| GRAM | 0.143 | 0.035 | 4.06 | 83.8 |
| Random | 0.089 | 0.102 | 0.87 | 82.4 |
| GRAM | 0.150 | 0.036 | 4.21 | 83.9 |
| Random | 0.119 | 0.089 | 1.34 | 83.1 |
| 2 | 3 | 4 | 5 | 6 | 7 | 8 (full task ID) | |
|---|---|---|---|---|---|---|---|
| Group-routing acc. | 100.00 | 100.00 | 100.00 | 100.00 | 99.99 | 99.98 | 99.98 |
| Method | MNIST | SVHN | GTSRB | DTD | Cars | RESISC45 | EuroSAT | SUN397 | Avg. |
|---|---|---|---|---|---|---|---|---|---|
| Individual (oracle) | 99.8 | 97.8 | 99.0 | 98.3 | 87.5 | 97.0 | 99.8 | 78.8 | 94.8 |
| Weight Averaging | 94.4 | 72.6 | 60.6 | 54.0 | 69.9 | 75.2 | 81.3 | 68.6 | 72.1 |
| Task Arithmetic | 98.3 | 84.5 | 76.1 | 60.4 | 68.1 | 73.7 | 86.4 | 64.4 | 76.5 |
| TIES-Merging | 98.3 | 84.8 | 73.9 | 64.8 | 71.7 | 77.8 | 89.4 | 68.0 | 78.6 |
| AdaMerging++ | 98.4 | 93.1 | 92.3 | 64.0 | 79.2 | 81.1 | 95.6 | 69.2 | 84.1 |
| TSV-Merge | 99.3 | 92.9 | 94.5 | 85.2 | 81.0 | 88.5 | 97.4 | 70.6 | 88.7 |
Language Model Merging
Language model merging combines capabilities from multiple models or adapters by composing their weights, updates, or outputs.
See all 109 papers