CLIP-FMoE: Scalable CLIP via Fused Mixture-of-Experts with Enforced Specialization
Organizations: FPT Software AI Center · Center for AI Research, VinUniversity
Abstract
Mixture-of-Experts (MoE) architectures have emerged as a promising approach for scaling deep learning models while maintaining computational efficiency. However, existing MoE adaptations for Contrastive Language-Image Pre-training (CLIP) models suffer from significant computational overhead during sequential training and degradation of zero-shot capabilities. To address these limitations, we propose CLIP-FMoE, a novel approach that integrates MoE architecture into CLIP fine-tuning. Our method uses Isolated Constrained Contrastive Learning, a pipeline that trains specialized experts on cluster-based data partitions to accelerate expert specialization. Additionally, we introduce a Fusion Gate mechanism to mitigate catastrophic forgetting of pre-trained knowledge. Extensive experiments across multiple benchmarks demonstrate that our approach achieves consistent improvements on downstream tasks while preserving zero-shot capabilities. Furthermore, our method demonstrates robust performance across varying context lengths, making it particularly suitable for diverse real-world applications.
Figures & tables
| Model | Cars | Coun | FGVC | Food | Sun | Cal | Euro | Flow | Pets | IN-1K | IN-v2 | Avg. |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| OpenAI CLIP | 77.93 | 31.88 | 31.77 | 93.07 | 67.56 | 83.27 | 62.59 | 79.20 | 93.21 | 75.54 | 69.84 | 69.62 |
| Fine-tuning | 69.12 | 25.43 | 25.83 | 91.34 | 71.17 | 79.67 | 65.20 | 69.56 | 90.24 | 72.89 | 66.39 | 66.08 |
| Up-cycling | 68.98 | 25.36 | 27.66 | 90.78 | 70.82 | 81.22 | 69.98 | 68.52 | 91.11 | 72.92 | 66.27 | 66.69 |
| CLIP-MoE | 71.20 | 25.31 | 27.81 | 91.27 | 71.01 | 79.19 | 65.13 | 69.90 | 90.35 | 73.19 | 66.86 | 66.47 |
| CLIP-FMoE | 74.62 | 28.02 | 29.58 | 92.32 | 71.86 | 81.79 | 68.31 | 73.54 | 91.58 | 74.87 | 68.66 | 68.65 |
| MS COCO | Flickr 8K | Flickr 30K | |||||||||||
| Model | IR | TR | IR | TR | IR | TR | Avg. | ||||||
| R@1 | R@5 | R@1 | R@5 | R@1 | R@5 | R@1 | R@5 | R@1 | R@5 | R@1 | R@5 | ||
| OpenAI CLIP | 36.51 | 61.01 | 56.38 | 79.36 | 61.60 | 86.36 | 77.40 | 94.00 | 65.22 | 87.26 | 85.10 | 97.30 | 73.96 |
| Fine-tuning | 49.04 | 73.36 | 63.76 | 83.94 | 73.24 | 93.14 | 83.20 | 96.80 | 78.16 | 94.85 | 90.90 | 99.00 | 81.62 |
| Up-cycling | 48.83 | 73.19 | 63.12 | 84.36 | 73.10 | 93.48 | 83.50 | 97.00 | 77.98 | 94.66 | 91.20 | 98.90 | 81.61 |
| CLIP-MoE | 49.46 | 73.80 | 65.30 | 85.44 | 73.28 | 93.48 | 85.70 | 96.90 | 78.22 | 94.94 | 92.00 | 99.00 | 82.29 |
| Model | MS COCO | Flickr 8K | Flickr 30K | DOCCI-Long | IIW-Long | Urban | DCI | Avg. | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| IR | TR | IR | TR | IR | TR | IR | TR | IR | TR | IR | TR | IR | TR | |||||||||
| OpenAI CLIP | 36.5 | 56.4 | 61.6 | 77.4 | 65.2 | 85.1 | 63.3 | 66.0 | 90.5 | 90.2 | 55.8 | 68.3 | 33.9 | 36.0 | 63.3 | |||||||
| Fine-tuning | 46.6 | 64.3 | 72.1 | 84.6 | 74.8 | 90.8 | 77.7 | 77.6 | 97.5 | 96.8 | 88.9 | 89.8 | 54.4 | 57.6 | 76.7 | |||||||
| LongCLIP | 47.0 | 63.3 | 72.5 | 83.4 | 76.1 | 89.3 | 78.8 | 66.7 | 97.2 | 94.5 | 86.1 | 82.4 | 52.7 | 45.3 | 73.9 | |||||||
| TULIP | 45.7 | 61.2 | 70.6 | 81.5 | 74.6 | 88.0 | 79.6 | 78.0 | 97.2 | 96.2 | 91.2 | 90.2 | 54.7 | 54.3 | 75.9 | |||||||
| CLIP-FMoE | 47.7 | 65.6 | 72.4 | 84.9 | 75.9 | 91.6 | 79.2 | 78.4 | 97.3 | 98.0 | 88.2 | 90.7 | 54.7 | 55.9 | 77.2 | |||||||
| Model | # Parameters (M) | Cluster (min) | Total Training (min) | Inference (GFLOPs) |
|---|---|---|---|---|
| CLIP (Base) | 427.62 / 64.53 | - | 24.59 | 84.38 |
| Up-Cycling | 685.78 / 322.69 | - | 40.41 | 112.44 |
| CLIP-MoE | 685.78 / 64.53 / 0.04 | 60.32 | 193.51 | 112.44 |
| CLIP-FMoE | 693.83 / 72.59 / 8.09 | 14.54 | 53.24 | 128.22 |
Appendix figures & tables14 assets
Supplementary material from the paper’s appendix.
Appendix
| Model | Cars | Coun | FGVC | Food | Sun | Cal | C10 | C100 | Euro | Flow | Pets | IN-a | IN-o | IN-r | IN-1K | IN-Ske | IN-v2 | Avg. |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| CLIP OpenAI | 77.93 | 31.88 | 31.77 | 93.07 | 67.56 | 83.27 | 95.59 | 75.85 | 62.59 | 79.20 | 93.21 | 70.75 | 32.25 | 87.82 | 75.54 | 59.58 | 69.84 | 69.86 |
| Fine-tuning | 69.12 | 25.43 | 25.83 | 91.34 | 71.17 | 79.67 | 96.63 | 77.93 | 65.20 | 69.56 | 90.24 | 61.92 | 35.30 | 85.62 | 72.89 | 56.37 | 66.39 | 67.09 |
| Up-cycling | 68.98 | 25.36 | 27.66 | 90.78 | 70.82 | 81.22 | 95.72 | 77.92 | 69.98 | 68.52 | 91.11 | 61.43 | 35.55 | 85.73 | 72.92 | 56.62 | 66.27 | 67.45 |
| CLIP-MoE | 71.20 | 25.31 | 27.81 | 91.27 | 71.01 | 79.19 | 95.82 | 77.70 | 65.13 | 69.90 | 90.35 | 62.33 | 34.75 | 86.23 | 73.19 | 56.89 | 66.86 | 67.35 |
| CLIP-FMoE | 74.62 | 28.02 | 29.58 | 92.32 | 71.86 | 81.79 | 95.74 | 78.75 | 68.31 | 73.54 | 91.58 | 66.13 | 35.80 | 87.46 | 74.87 | 58.71 | 68.66 | 69.28 |
| Model | Cars | Coun | FGVC | Food | Sun | Cal | C10 | C100 | Euro | Flow | Pets | IN-a | IN-o | IN-r | IN-1K | IN-Ske | IN-v2 | Avg. |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| OpenAI CLIP | 77.93 | 31.88 | 31.77 | 93.07 | 67.56 | 83.27 | 95.59 | 75.85 | 62.59 | 79.20 | 93.21 | 70.75 | 32.25 | 87.82 | 75.54 | 59.58 | 69.84 | 69.86 |
| Fine-tune | 74.36 | 28.68 | 28.18 | 91.00 | 70.27 | 85.00 | 94.74 | 76.18 | 61.28 | 72.82 | 91.17 | 59.41 | 35.60 | 85.56 | 71.69 | 57.74 | 65.53 | 67.60 |
| LongCLIP | 72.37 | 28.14 | 30.78 | 91.47 | 72.54 | 82.58 | 96.10 | 79.82 | 69.09 | 72.39 | 91.03 | 64.13 | 37.00 | 86.44 | 72.82 | 57.95 | 66.88 | 68.91 |
| TULIP | 63.25 | 21.75 | 19.95 | 83.46 | 67.24 | 83.06 | 92.96 | 71.91 | 55.43 | 61.64 | 87.03 | 55.28 | 33.90 | 81.42 | 63.48 | 52.51 | 57.56 | 61.87 |
| CLIP-FMoE | 75.58 | 30.17 | 29.07 | 92.32 | 71.54 | 84.63 | 95.26 | 78.02 | 67.11 | 76.06 | 93.08 | 65.24 | 35.90 | 87.27 | 73.90 | 58.84 | 67.72 | 69.51 |
| Model | DOCCI | IIW | Urban | DCI | Avg. | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| IR | TR | IR | TR | IR | TR | IR | TR | ||||||
| OpenAI CLIP | 17.1 | 48.5 | 35.0 | 84.3 | 55.8 | 68.3 | 33.9 | 36.0 | 47.4 | ||||
| Vanilla Fine-tuning | 23.9 | 53.6 | 46.8 | 88.5 | 87.3 | 85.9 | 51.1 | 49.2 | 60.8 | ||||
| CLIP Up-cycling | 23.9 | 52.9 | 46.6 | 89.0 | 87.6 | 85.4 | 53.1 | 51.3 | 61.2 | ||||
| CLIP-MoE | 24.1 | 56.1 | 47.2 | 89.8 | 86.1 | 86.0 | 53.5 | 52.0 | 61.8 | ||||
| CLIP-FMoE | 23.7 | 58.2 | 45.4 | 92.5 | 85.5 | 85.7 | 53.9 | 53.0 | 62.2 | ||||
| MS COCO | Flickr 8K | Flickr 30K | ||||||||||||||||
| Cluster Type | Image Retrieval | Text Retrieval | Image Retrieval | Text Retrieval | Image Retrieval | Text Retrieval | Avg. | |||||||||||
| R@1 | R@5 | R@1 | R@5 | R@1 | R@5 | R@1 | R@5 | R@1 | R@5 | R@1 | R@5 | |||||||
| Random | 40.8 | 66.0 | 58.8 | 81.8 | 64.9 | 88.4 | 80.1 | 95.0 | 69.8 | 89.3 | 86.6 | 97.9 | 76.6 | |||||
| Text | 41.8 | 66.9 | 59.8 | 82.4 | 65.6 | 88.6 | 80.5 | 95.3 | 70.8 | 90.3 | 87.5 | 98.2 | 77.3 | |||||
| Image + Text | 41.1 | 66.5 | 59.6 | 82.3 | 65.4 | 88.3 | 80.6 | 95.3 | 70.7 | 89.9 | 89.2 | 98.6 | 77.3 | |||||
| Image (level 1) | 41.3 | 66.6 | 59.8 | 82.8 | 65.9 | 88.4 | 80.7 | 95.3 | 70.6 | 90.3 | 87.5 | 98.5 | 77.3 | |||||
| Fine-grained Text-Image Retrieval | Long Text-Image Retrieval | |||||||||||||||||||||||
| DOCCI-FG | IIW-FG | Urban 1K | DCI | |||||||||||||||||||||
| Cluster Type | IR | TR | IR | TR | IR | TR | IR | TR | Avg. | |||||||||||||||
| R@1 | R@5 | R@1 | R@5 | R@1 | R@5 | R@1 | R@5 | R@1 | R@5 | R@1 | R@5 | R@1 | R@5 | R@1 | R@5 | |||||||||
| Random | 15.7 | 29.8 | 47.1 | 72.9 | 32.2 | 52.9 | 88.0 | 98.0 | 84.5 | 96.7 | 87.0 | 97.0 | 50.4 | 69.2 | 52.2 | 71.0 | 65.3 | |||||||
| Text | 16.0 | 30.4 | 47.8 | 74.8 | 32.6 | 52.9 | 87.5 | 98.5 | 86.1 | 97.7 | 89.9 | 98.6 | 51.5 | 70.5 | 53.3 | 71.8 | 66.2 | |||||||
| Image + Text | 15.9 | 30.0 | 48.0 | 73.8 | 32.3 | 52.0 | 89.8 | 98.3 | 85.5 | 96.9 | 88.1 | 98.3 | 50.9 | 69.6 | 53.4 | 71.9 | 65.9 | |||||||
| Data type | MS COCO | Flickr 8K | Flickr 30K | DOCCI-Long | IIW-Long | Urban | DCI | Avg. | |||||||||||||
| IR | TR | IR | TR | IR | TR | IR | TR | IR | TR | IR | TR | IR | TR | ||||||||
| 400M OpenAI | 36.51 | 56.38 | 61.60 | 77.40 | 65.22 | 85.10 | 63.25 | 66.04 | 90.50 | 90.25 | 55.80 | 68.30 | 33.94 | 36.04 | 63.31 | ||||||
| + 1.2M ShareGPT4V | 47.57 | 65.48 | 72.08 | 84.90 | 75.98 | 91.10 | 78.83 | 77.61 | 97.50 | 98.25 | 88.00 | 90.50 | 54.50 | 55.43 | 76.98 | ||||||
| + 2.8M LLaVA-Recap | 49.50 | 67.00 | 74.02 | 85.20 | 78.54 | 93.10 | 84.92 | 81.90 | 97.75 | 96.75 | 93.40 | 94.00 | 59.88 | 58.07 | 79.57 | ||||||
| Data type | Cars | Coun | FGVC | Food | Sun | Cal | C10 | C100 | Euro | Flow | Pets | IN-a | IN-o | IN-r | IN-1K | IN-Ske | IN-v2 | Avg. |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 400M OpenAI | 77.9 | 31.9 | 31.8 | 93.1 | 67.6 | 83.3 | 95.6 | 75.9 | 62.6 | 79.2 | 93.2 | 70.8 | 32.3 | 87.8 | 75.5 | 59.6 | 69.8 | 69.9 |
| + 1.2M ShareGPT4V | 75.8 | 30.1 | 29.8 | 92.4 | 65.1 | 84.4 | 95.4 | 78.3 | 67.2 | 76.0 | 93.0 | 65.1 | 35.6 | 87.2 | 73.9 | 58.9 | 67.8 | 69.2 |
| + 2.8M LLaVA-Recap | 74.6 | 28.0 | 29.7 | 92.8 | 71.9 | 82.3 | 95.7 | 79.0 | 68.0 | 74.2 | 92.2 | 66.1 | 35.8 | 87.4 | 74.7 | 59.0 | 68.7 | 69.4 |
| MS COCO | Flickr 8K | Flickr 30K | Urban | DCI | Avg. | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| IR | TR | IR | TR | IR | TR | IR | TR | IR | TR | |||||||
| 8 | 4 | 41.6 | 60.2 | 65.4 | 80.5 | 70.9 | 88.4 | 87 | 88 | 52.2 | 54.3 | 68.9 | ||||
| 8 | 40.6 | 59.4 | 64.8 | 79.7 | 70.1 | 86.9 | 83.5 | 86.3 | 50.8 | 53.2 | 67.5 | |||||
| 16 | 4 | 42.2 | 60.3 | 66 | 80.9 | 70.7 | 88.6 | 87.2 | 88.2 | 52 | 54.6 | 69.1 | ||||
| 8 | 40.6 | 58.8 | 64.8 | 79.7 | 69.8 | 87.1 | 82.7 | 86.5 | 50.5 | 52.8 | 67.3 | |||||
| 32 | 4 | 41.9 | 60.4 | 66 | 80.8 | 70.8 | 87.8 | 87.2 | 89.6 | 52.1 | 54.4 | 69.1 | ||||
| Cars | Coun | FGVC | Food | Sun | Cal | C10 | C100 | Euro | Flow | Pets | IN-a | IN-o | IN-r | IN-1K | IN-Ske | IN-v2 | Avg. | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 8 | 4 | 61.5 | 22 | 21.9 | 87.4 | 67.8 | 82.7 | 90.8 | 67.2 | 55.6 | 69.5 | 89.9 | 40.4 | 42.7 | 76.2 | 66.1 | 47.6 | 59.1 | 61.7 |
| 8 | 61.5 | 22.2 | 22.5 | 88 | 67.6 | 82.7 | 90.8 | 68.4 | 57.9 | 68.8 | 89.3 | 41.8 | 44.3 | 76.4 | 66.5 | 47.6 | 59.7 | 62.1 | |
| 16 | 4 | 61.2 | 22 | 22.2 | 87.2 | 67.9 | 82.8 | 90.6 | 66.6 | 55.7 | 69.5 | 89.6 | 40.2 | 42.6 | 76 | 66 | 47.5 | 58.9 | 61.6 |
| 8 | 62.2 | 22 | 22.4 | 88.2 | 67.6 | 83 | 90.4 | 68.3 | 58.4 | 68.3 | 89.3 | 41.6 | 43.9 | 76.2 | 66.4 | 47.5 | 59.5 | 62.1 | |
| 32 | 4 | 61.3 | 22 | 22.6 | 87.2 | 67.8 | 83.2 | 91.1 | 67.4 | 54.4 | 69.2 | 89.5 | 40.8 | 43.2 | 76.3 | 66.1 | 47.5 | 58.9 | 61.7 |
| 8 | 61.9 | 21.9 | 22.3 | 88 | 67.4 | 82.8 | 90.8 | 67.7 | 59.4 | 67.8 | 88.9 | 41.32 | 44.2 | 76.4 | 66.2 | 47.4 | 59.3 | 62.0 |
| Attribute | Expert 0 | Expert 1 | Expert 2 | Expert 3 |
|---|---|---|---|---|
| Orientation and Direction | 13.33 | 20 | 0 | 6.67 |
| Presence of Specific Features | 6.67 | 20 | 13.33 | 6.67 |
| State and Condition | 40 | 40 | 40 | 46.67 |
| Quantity and Count | 20 | 13.33 | 13.33 | 13.33 |
| Positional and Relational Context | 0 | 0 | 20 | 6.67 |
| Color and Appearance | 53.33 | 66.67 | 73.33 | 66.67 |
| Dataset | Cars | Food | Sun | Eurosat | Cal | IN-a | IN-o | IN-r | IN-s | IN-1K | IN-v2 | FLow | Avg. |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Worst among experts | 65.69 | 88.49 | 64.71 | 48.83 | 75.22 | 54.88 | 32.2 | 84.72 | 55.3 | 67.34 | 60.77 | 65.95 | 63.68 |
| Best among experts | 71.33 | 91.71 | 69.44 | 64.57 | 82.5 | 61.55 | 33.2 | 86.6 | 56.91 | 70.38 | 64.47 | 72.03 | 68.72 |
| MoE-Top-2 | 73.22 | 91.66 | 71.19 | 66.61 | 81.45 | 64.11 | 34.7 | 87.22 | 58.61 | 72.98 | 66.52 | 72.63 | 70.08 |
| MoE-Top-4 | 73.48 | 91.85 | 71.36 | 67.33 | 81.74 | 64.52 | 35.05 | 87.33 | 58.78 | 73.31 | 66.95 | 73.07 | 70.40 |
| Dataset | COCO IR | COCO TR | Urban IR | Urban TR | DCI IR | DCI TR | Flickr 8K IR | Flickr 8K TR | Flickr 30K IR | Flickr 30K TR | Avg. |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Worst among experts | 42.83 | 54.58 | 85.8 | 86.6 | 54.38 | 41.82 | 66.98 | 78.0 | 70.94 | 85.3 | 66.72 |
| Best among experts | 46.87 | 59.72 | 92.3 | 92.8 | 59.49 | 53.62 | 71.76 | 82.1 | 76.48 | 89.8 | 72.49 |
| MoE-Top-2 | 48.17 | 62.84 | 93.4 | 93.4 | 59.54 | 53.98 | 72.72 | 83.8 | 76.86 | 91.3 | 73.6 |
| MoE-Top-4 | 48.28 | 63.02 | 93.6 | 93.4 | 59.67 | 54.17 | 72.70 | 84.6 | 76.96 | 91.6 | 73.8 |