EfficientVLM: Fast and Accurate Vision-Language Models via Knowledge Distillation and Modal-adaptive Pruning

Tiannan Wang, Wangchunshu Zhou, Yan Zeng, Xinsong Zhang

Abstract

Pre-trained vision-language models (VLMs) have achieved impressive results in a range of vision-language tasks. However, popular VLMs usually consist of hundreds of millions of parameters which brings challenges for fine-tuning and deployment in real-world applications due to space, memory, and latency constraints. In this work, we introduce a distilling then pruning framework to compress large vision-language models into smaller, faster, and more accurate ones. We first shrink the size of a pre-trained large VLM and apply knowledge distillation in the vision-language pre-training stage to obtain a task-agnostic compact VLM. Then we propose a modal-adaptive pruning algorithm to automatically infer the importance of vision and language modalities for different downstream tasks and adaptively remove redundant structures and neurons in different encoders with controllable target sparsity. We apply our framework to train EfficientVLM, a fast and accurate vision-language model consisting of 6 vision layers, 3 text layers, and 3 cross-modal fusion layers, accounting for only 93 million parameters in total, which is 44.3% of the teacher model. EfficientVLM retains 98.4% performance of the teacher model and accelerates its inference speed by 2.2×. EfficientVLM achieves a large absolute improvement over previous SoTA efficient VLMs of similar sizes by a large margin on various vision-language tasks, including VQAv2 (+4.9%), NLVR2 (+5.6%), ITR (R@1 on TR +17.2%, on IR + 15.6% ) and COCO caption generation (CIDEr +6.5), demonstrating a large potential on training lightweight VLMs.

Introduction

Large-scale pre-trained Vision-Language Models (VLMs), such as CLIP or ALBEF, have set new benchmarks for tasks ranging from image captioning to visual reasoning. However, these models often carry a significant "deployment tax" due to their massive parameter counts—frequently in the hundreds of millions. This leads to high latency and substantial memory requirements, posing significant hurdles for real-time applications or deployment on edge devices.

While compression techniques like knowledge distillation and pruning are common in Natural Language Processing (NLP), they face unique challenges in the multi-modal domain. Different vision-language tasks rely on modalities to varying degrees; for example, image-text retrieval is highly sensitive to visual features, whereas visual reasoning (e.g., NLVR2) requires deep integration of both text and images. Standard pruning methods often fail by treating all components equally, leading to sub-optimal performance.

High-level architecture of the Vision-Language Model (VLM) used as the base for EfficientVLM.

Methodology

EfficientVLM addresses these challenges through a two-stage "distill then prune" framework designed to create compact yet high-performing models.

Task-Agnostic Knowledge Distillation

The first stage involves creating a compact "student" model from a large "teacher" (specifically X-VLM). The student is initialized with roughly half the layers of the teacher. During a task-agnostic pre-training phase on a large-scale dataset of 4 million image-text pairs, the student is trained to mimic the teacher's internal logic. This includes aligning attention distributions, hidden representations, and output logits. This stage establishes a robust, general-purpose foundation for the compact model.

The teacher-student distillation framework, showing the alignment of hidden states, attention maps, and logits.

The second stage occurs during task-specific fine-tuning. The researchers introduce a modal-adaptive pruning algorithm that uses a differentiable approximation of $L_0$ regularization. This allows the model to "learn" which neurons and structures within the vision, text, and cross-modal encoders are redundant for a specific downstream task. By automatically inferring the importance of each modality, the algorithm adaptively removes less critical components while maintaining a controllable target sparsity. This ensures that the model preserves the most relevant features for the task at hand, such as prioritizing the vision encoder for retrieval tasks.

Experiments and Results

EfficientVLM was evaluated on several standard benchmarks, including VQAv2, NLVR2, and MSCOCO (for retrieval and captioning). The resulting model, with 93 million parameters, demonstrated remarkable efficiency:

  • Performance Retention: It recovered 98.4% of the performance of its much larger teacher model (X-VLM).
  • Speedup: It accelerated inference speed by 2.2x on CPU and nearly 2x on GPU compared to the teacher.
  • State-of-the-Art Efficiency: It significantly outperformed previous "efficient" models of similar size. For example, on Image-Text Retrieval (R@1), it improved over DistillVLM by +17.2% on text retrieval and +15.6% on image retrieval.
  • Sparsity: The model can maintain over 95% of the teacher's performance even when pruned to 40-50% sparsity on tasks like NLVR2.

Conclusion

EfficientVLM demonstrates that a combination of task-agnostic distillation and modal-adaptive pruning can significantly reduce the size and latency of VLMs without sacrificing accuracy. By allowing the model to adapt its architecture to the specific requirements of downstream tasks, the researchers have paved the way for more efficient multi-modal AI deployment. Future work may explore combining these techniques with quantization or matrix decomposition to push the boundaries of efficiency even further.

Summary updated

BibTeX
@inproceedings{wang2023efficientvlm,
  author = {Tiannan Wang and Wangchunshu Zhou and Yan Zeng and Xinsong Zhang},
  title = {{EfficientVLM: Fast and Accurate Vision-Language Models via Knowledge Distillation and Modal-adaptive Pruning}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  url = {https://openreview.net/forum?id=kXc9qb4KQK},
}
Figure