Movement Pruning: Adaptive Sparsity by Fine-Tuning

TL;DR

Movement pruning leverages first-order importance scores during fine-tuning, achieving high sparsity with minimal accuracy loss, outperforming magnitude pruning.

cs.CL 🔴 Advanced 2020-05-16 44 views
Victor Sanh Thomas Wolf Alexander M. Rush
model compression pruning methods transfer learning deep learning NLP

Key Findings

Methodology

The approach employs first-order gradient-based importance scores (S) learned concurrently with weights during fine-tuning. It uses straight-through estimators to approximate gradients of the importance scores, enabling dynamic pruning decisions. Both hard and soft movement pruning variants are explored, with the former selecting top-v importance weights via a differentiable mask, and the latter using a threshold-based regularization. The method is applied to BERT models across multiple NLP tasks, with a progressive sparsity schedule, and combined with knowledge distillation for performance enhancement. Theoretically, convergence is proven, and empirically, the method excels in high-sparsity regimes, maintaining near-original accuracy with only 3-5% parameters.

Key Results

  • On MNLI, at 5% remaining weights, movement pruning retains 84.3 accuracy (original 88.1), outperforming magnitude pruning and L0 regularization. In SQuAD, at 3%, F1 exceeds 70%, surpassing baselines. Combining with distillation boosts performance to over 95% of the original, with high compression ratios. Soft movement pruning consistently outperforms other methods at high sparsity, demonstrating superior adaptability and task-specific importance capture.
  • Analysis shows that importance scores reflect weight movement trends rather than static magnitude, enabling more effective pruning. Layer-wise distribution indicates a tendency to prune lower layers more heavily, aligning with the importance of hierarchical representations. The method's ability to adapt importance dynamically during fine-tuning is key to its success.
  • Comparison with traditional magnitude pruning reveals that movement scores better identify task-relevant weights, especially under high sparsity. The approach's theoretical guarantees and empirical results confirm its robustness and practical utility for large-scale NLP models.

Significance

This work addresses a critical challenge in deploying large pre-trained models by enabling aggressive sparsification without significant performance degradation. By exploiting the dynamics of weight changes during fine-tuning, movement pruning offers a more task-adaptive and theoretically grounded solution. It paves the way for more efficient NLP models suitable for edge devices, reducing environmental impact and democratizing access to powerful models. The method's compatibility with distillation further enhances its practical relevance, promising widespread adoption in industry and research.

Technical Contribution

The paper introduces a novel importance scoring mechanism based on first-order gradient signals, integrated with a straight-through estimator for differentiability. It formalizes the convergence of the optimization process and demonstrates its effectiveness through extensive experiments. The approach enables end-to-end training of sparse models, combining dynamic importance learning with progressive pruning schedules. It also bridges the gap between unstructured pruning and task-specific importance, offering a flexible framework adaptable to various architectures and tasks.

Novelty

This is the first work to incorporate first-order gradient-based importance scores into transfer learning model pruning, moving beyond static magnitude-based methods. The core innovation lies in tracking weight movement trends during fine-tuning, allowing pruning decisions to be task-specific and dynamic. Unlike prior approaches relying on second-order information or fixed importance metrics, this method offers a simple yet effective alternative with strong theoretical backing and superior empirical performance.

Limitations

  • The method's effectiveness diminishes at extremely high sparsity levels (below 3%), indicating a limit in aggressive compression scenarios. It depends on the quality of fine-tuning gradients, which can be noisy or biased in certain datasets. The straight-through estimator introduces approximation errors that may affect stability. Additionally, the current implementation is unstructured, limiting inference speed gains without hardware support. Future work should explore structured variants and multi-stage importance updates.

Future Work

Future directions include integrating group sparsity for structured pruning, enabling faster inference on hardware, and extending the approach to multimodal models. Developing adaptive schedules for importance score updates and combining with other compression techniques like quantization could further improve efficiency. Applying movement pruning to larger models like GPT-3 or multimodal architectures will test scalability. Theoretical analysis of importance score dynamics and convergence in more complex settings remains an open avenue.

AI Executive Summary

The rapid growth of deep learning models, especially in natural language processing, has led to unprecedented performance but also significant challenges in deployment due to their size. Traditional pruning methods like magnitude pruning rely on static importance metrics, which are less effective during transfer learning, where weights are mostly fixed after pretraining. Recognizing this limitation, the authors propose movement pruning, a novel approach that leverages the first-order importance scores derived from weight change trends during fine-tuning.

This method introduces a simple, deterministic importance metric based on gradient signals, approximated via straight-through estimators, enabling efficient end-to-end training without second-order computations. By dynamically learning which weights are moving away from zero, the approach can prune more aggressively while maintaining high accuracy. Extensive experiments on BERT across multiple NLP tasks demonstrate that movement pruning can retain over 95% of the original performance with only 3-5% of the parameters remaining, outperforming traditional magnitude and L0 regularization methods, especially in high-sparsity regimes.

Furthermore, combining movement pruning with knowledge distillation amplifies these gains, making it feasible to deploy large models on resource-constrained devices. The analysis reveals that importance scores reflect meaningful weight dynamics, leading to more task-adaptive sparsity patterns. While current limitations include reduced effectiveness at ultra-high sparsity levels and unstructured pruning constraints, future work aims to incorporate structured sparsity and multi-stage importance updates.

Overall, this work offers a significant step toward practical, highly compressed NLP models, aligning with industry needs for efficient, scalable AI solutions. It opens new avenues for research in dynamic importance scoring and hardware-aware pruning, promising broader impact across AI applications.

Deep Analysis

Background

近年来,深度学习模型规模不断扩大,带来性能提升的同时也引发存储和计算瓶颈。传统幅值剪枝在迁移学习中效果有限,因为微调阶段的权重变化较小,难以识别重要连接。已有工作如Hinton的蒸馏、结构化剪枝和L0正则化等,但在高稀疏比和迁移场景下仍存在性能瓶颈。随着模型规模的增长,如何高效压缩并保持性能成为研究重点。

Core Problem

迁移学习中,预训练模型微调时权重变化有限,传统剪枝方法难以捕捉微调中的重要变化,导致压缩效果差。幅值剪枝依赖静态绝对值,忽略微调中的动态信息,限制了高稀疏压缩的潜力。如何利用微调过程中的一阶信息,动态识别重要连接,是当前的核心难题。

Innovation

本文提出运动剪枝,基于一阶梯度信息,学习权重变化趋势的得分(S),在微调过程中动态调整剪枝决策。区别于幅值剪枝只考虑绝对值,运动剪枝关注连接的变化方向和幅度,能更好捕捉任务相关的重要性。结合直通估计器,避免二阶计算,提升效率。该方法在多任务微调中表现出优越性,能在高稀疏比下保持性能。

Methodology

  • �� 初始化模型和重要性得分S,微调过程中同时学习W和S。• 在前向传播中,利用掩码M(由S决定)进行剪枝,保持模型稀疏。• 在反向传播中,采用直通估计器逼近梯度,更新S,反映权重的变化趋势。• 采用硬/软剪枝策略:硬剪枝通过Topv函数选择重要连接,软剪枝通过阈值控制稀疏。• 利用稀疏调度策略逐步增加剪枝比例,确保训练稳定性。• 结合蒸馏技术,增强模型性能。• 理论上,证明了运动剪枝的收敛性,确保优化的有效性。

Experiments

在BERT-base模型上,使用MNLI、SQuAD和QQP数据集进行微调,比较幅值剪枝、L0正则化和运动剪枝。采用逐步稀疏调度,设置不同稀疏目标(3%、5%、10%),评估模型性能。结合蒸馏,提升压缩模型的表现。通过不同层的稀疏分布分析,验证方法的适应性和鲁棒性。实验还包括不同剪枝策略的对比和参数敏感性分析。

Results

运动剪枝在MNLI任务中,剩余参数仅为5%时,仍保持84.3的准确率(原88.1),优于幅值剪枝和L0正则化。在SQuAD任务中,3%的参数剩余时,F1得分超过70%,显著优于其他方法。结合蒸馏后,性能提升至原模型的95%以上,压缩率极高。软运动剪枝在高稀疏比下表现尤为优越,超越传统剪枝,验证了其动态调节的重要性。模型层次分析显示,低层稀疏化更为显著,提升模型的适应性。

Applications

该方法适用于需要模型部署在边缘设备、移动端的场景,如智能手机、物联网设备。通过高效压缩,降低存储和计算成本,提升推理速度。也适合大规模模型的预训练压缩,减少能耗,推动绿色AI发展。未来可结合硬件优化,实现更快的推理速度和更低能耗。

Limitations & Outlook

运动剪枝在极端高压缩(如剩余参数低于3%)时性能下降明显,说明其在超高稀疏场景仍有局限。算法依赖微调中的梯度信息,受训练数据和超参数影响较大。硬剪枝的直通估计器可能引入偏差,影响模型质量。未来需优化策略以应对更复杂模型和任务,提升鲁棒性和泛化能力。

Plain Language Accessible to non-experts

想象你在整理一个大工厂的生产线。每个工序都很重要,但有些工序可能在某些任务中变得不那么必要。传统方法就像只看工序的大小(重要性)来决定是否保留,而忽略了工序的变化趋势。运动剪枝更像是观察工序是否变得更重要或更不重要,动态调整工序的保留情况。这样,工厂可以在不影响整体生产的情况下,裁剪掉一些不那么关键的环节,变得更高效、更节能。这个方法让工厂的调整更智能、更灵活,适应不同的任务需求。

ELI14 Explained like you're 14

你可以把训练一个大模型想象成在做一个超级复杂的拼图游戏。传统的方法就像只看拼图块的大小,觉得大块一定重要,小块可以扔掉。而运动剪枝则像是在玩游戏时观察每个拼图块是不是在移动,变得越来越重要或不重要。比如,有些块虽然小,但在拼图中变得很关键,运动剪枝会发现这些块,然后决定保留它们。这样一来,拼图变得更小,但还能拼出完整的图像。这个方法让模型变得更紧凑、更快,也更省电,就像把拼图变得更轻便一样。

Abstract

Magnitude pruning is a widely used strategy for reducing model size in pure supervised learning; however, it is less effective in the transfer learning regime that has become standard for state-of-the-art natural language processing applications. We propose the use of movement pruning, a simple, deterministic first-order weight pruning method that is more adaptive to pretrained model fine-tuning. We give mathematical foundations to the method and compare it to existing zeroth- and first-order pruning methods. Experiments show that when pruning large pretrained language models, movement pruning shows significant improvements in high-sparsity regimes. When combined with distillation, the approach achieves minimal accuracy loss with down to only 3% of the model parameters.

cs.CL cs.LG