To prune, or not to prune: exploring the efficacy of pruning for model compression

TL;DR

Gradual pruning method reduces large models by up to 10x with minimal accuracy loss, outperforming small dense models of same size.

stat.ML 🔴 Advanced 2017-10-05 46 views
Michael Zhu Suyog Gupta
model pruning deep learning compression sparsity energy-efficient inference model optimization

Key Findings

Methodology

This paper introduces a gradual pruning algorithm that integrates a binary mask into the training process, progressively increasing sparsity based on a schedule (equation 1). The approach sorts weights by magnitude, prunes the smallest, and updates masks every ∆t steps, allowing the model to recover from pruning-induced accuracy drops. Tested across architectures like InceptionV3, MobileNet, stacked LSTMs, and seq2seq models, the method maintains high accuracy at sparsity levels up to 87.5%. The algorithm's simplicity and minimal hyperparameter tuning make it broadly applicable, with experimental results showing parameter reductions of up to 10x with less than 2% accuracy decline.

Key Results

  • In InceptionV3, 87.5% sparse models retain 74.6% top-1 accuracy, only 1.5% below dense baseline, with parameter count dropping from 27.1M to 3.3M. MobileNet with 75% sparsity achieves 67.7% top-1 accuracy, outperforming denser counterparts with similar parameter counts. In language modeling, a 90% sparse LSTM reduces parameters from 66M to 6.6M, with perplexity increasing marginally by 2 points. In neural machine translation, pruning to 85% sparsity yields BLEU scores within 0.25 of the baseline, with a 10x parameter reduction. These results demonstrate the effectiveness of the approach across diverse tasks.
  • Further, the method outperforms dense models of comparable size, indicating that training a larger dense model and pruning yields better performance than directly training a small dense model of the same size. The experiments confirm that high sparsity models can be both compact and accurate, making them suitable for deployment on resource-constrained devices.

Significance

This work advances model compression by showing that high sparsity can be achieved without significant performance loss, enabling deployment on edge devices with limited memory and power. It challenges the traditional focus on dense models, highlighting the potential of sparse architectures for efficient inference. The approach offers a practical, hardware-agnostic solution that can be integrated into training pipelines, fostering broader adoption of compressed models in real-world applications. It also provides insights into the relationship between model capacity, sparsity, and hardware efficiency, guiding future research in neural network optimization.

Technical Contribution

The paper introduces a simple yet effective gradual pruning algorithm that dynamically adjusts sparsity during training, avoiding complex hyperparameter tuning. Unlike prior methods relying on second-order approximations or structured pruning, this approach employs a universal schedule (equation 1) applicable across architectures. It seamlessly integrates with standard optimizers like SGD, ensuring training stability. The method's core innovation lies in its adaptive schedule, which prunes rapidly at first and then more gradually, allowing models to recover from pruning-induced errors. The experimental validation across vision, NLP, and translation tasks demonstrates its robustness and generality, setting a new standard for model compression techniques.

Novelty

This study is the first comprehensive comparison of large sparse models versus small dense counterparts across multiple domains, showing that sparse models can outperform dense ones of similar size. The key innovation is the gradual, schedule-based pruning that does not depend on layer-specific thresholds or structural assumptions, making it broadly applicable. Unlike previous works that require manual threshold tuning or layer-specific pruning, this method automates the sparsity increase, simplifying implementation and hyperparameter tuning. The results challenge the conventional wisdom that dense models are always superior, opening new avenues for efficient neural network design.

Limitations

  • The storage overhead for sparse matrices, such as index vectors in CSR format, can offset some compression gains, especially at very high sparsity levels. Hardware support for sparse matrix operations remains a bottleneck.
  • Hyperparameters like pruning frequency and schedule parameters still require empirical tuning, which may limit ease of use in some scenarios.
  • Extreme sparsity (>95%) may lead to performance degradation, and the method's effectiveness varies across tasks and architectures. Further work is needed to optimize hardware-aware sparse representations.

Future Work

Future research should focus on hardware-aware sparse storage formats, automatic hyperparameter tuning, and extending the approach to transformer architectures. Combining pruning with quantization and low-rank approximations could further enhance compression. Investigating adaptive schedules based on model feedback and exploring pruning in multi-task learning settings are promising directions to make sparse models more practical and scalable.

AI Executive Summary

Deep neural networks have revolutionized many AI tasks, yet their enormous parameter counts hinder deployment on resource-constrained devices. Existing compression techniques like magnitude pruning can reduce model size with minimal accuracy loss, but often require complex tuning or structural assumptions. This paper introduces a straightforward, schedule-based gradual pruning method that integrates seamlessly into training, progressively increasing sparsity from zero to target levels. Tested across diverse architectures—InceptionV3, MobileNet, LSTM, seq2seq—results show that models pruned to 87.5% sparsity retain over 94% of their original accuracy, with parameter counts reduced by up to 10 times. These sparse models outperform similarly sized dense models, demonstrating that high compression ratios are achievable without sacrificing performance. The approach's simplicity and broad applicability make it a promising solution for deploying deep learning models in edge environments, where memory and power are limited. Moreover, the experimental validation confirms that sparse models can be both efficient and accurate, challenging the traditional reliance on dense architectures. The study also discusses hardware considerations, noting that sparse matrix representations like CSR can further optimize storage, although hardware support remains a key factor. Looking ahead, integrating hardware-aware storage formats, automating hyperparameter tuning, and extending to transformer models are promising directions. Overall, this work paves the way for scalable, energy-efficient AI systems capable of operating effectively in real-world, resource-limited settings.

Deep Analysis

Background

Over the past decade, deep neural networks have achieved remarkable success across vision, NLP, and translation tasks, driven by increasing data and computational power. Early methods like LeCun’s Optimal Brain Damage and Optimal Brain Surgeon introduced second-order approximations for pruning, but their computational cost limited practical use. More recent techniques, such as magnitude-based pruning (Han et al., 2015), have become popular due to efficiency. With hardware advancements supporting sparse matrix operations, model sparsity has gained prominence. Despite progress, achieving high sparsity without performance loss remains challenging, especially across diverse architectures. This paper builds on these foundations, proposing a simple, effective pruning schedule that adapts during training, validated across multiple models and tasks, aiming to bridge the gap between theoretical compression and practical deployment.

Core Problem

The core challenge is balancing model size reduction with performance preservation. Large models contain redundant parameters, but naive pruning often leads to accuracy degradation. Existing methods depend on fixed thresholds or structural assumptions, limiting flexibility and generality. Hardware constraints, such as storage overhead for sparse matrices and lack of universal sparse computation support, further complicate deployment. The key question is how to design a universal, easy-to-implement pruning strategy that can be applied during training, achieve high sparsity, and maintain accuracy across architectures and tasks. Addressing this problem is critical for enabling deep learning in resource-limited environments like mobile devices, IoT, and embedded systems.

Innovation

The primary innovation is the development of a schedule-based gradual pruning algorithm that dynamically adjusts sparsity during training without requiring layer-specific thresholds or structural assumptions. Key features include:

1) a sparsity schedule (equation 1) that prunes rapidly initially, then more gradually,

2) integration into standard training routines with minimal hyperparameter tuning,

3) applicability across diverse architectures (CNNs, RNNs, seq2seq), and

4) empirical validation showing superior performance compared to traditional fixed-threshold pruning.

This approach simplifies the pruning process, reduces tuning complexity, and enhances generality, making high sparsity models feasible in practical scenarios.

Methodology

  • �� Select target models (InceptionV3, MobileNet, LSTM, seq2seq).• Insert binary masks into each layer’s weights, controlling participation in forward pass.• Sort weights by magnitude, prune smallest according to schedule (equation 1).• Increase sparsity from si to sf over n steps, updating masks every ∆t steps.• Use a schedule that prunes rapidly at first, then more slowly, to allow recovery.• Incorporate pruning into training with learning rate schedules, avoiding low learning rates during pruning.• Stop mask updates once target sparsity sf is reached, continue training to recover performance.• Evaluate models at various sparsity levels, compare accuracy, parameter count, and storage overhead.• Analyze hardware implications, storage formats, and performance trade-offs.

Experiments

Experiments cover image classification (ImageNet with InceptionV3, MobileNet), language modeling (Penn Treebank with stacked LSTMs), and machine translation (Google NMT). For each, models are trained with standard hyperparameters, then pruned to target sparsities (50%-87.5%). Performance metrics include accuracy, perplexity, BLEU scores, and parameter counts. Ablation studies vary pruning schedules, sparsity levels, and compare sparse versus dense models of similar size. Hardware considerations, such as storage overhead for sparse matrices, are also examined. Results demonstrate that high sparsity models retain near-original performance, outperforming similarly sized dense models, validating the approach’s robustness and broad applicability.

Results

In InceptionV3, 87.5% sparsity reduces parameters from 27.1M to 3.3M with only 1.5% accuracy loss. MobileNet with 75% sparsity achieves 67.7% top-1 accuracy, surpassing denser models of similar parameter count. In language modeling, 90% sparse LSTM reduces parameters from 66M to 6.6M, with perplexity increasing marginally. In NMT, pruning to 85% sparsity yields BLEU scores within 0.25 of the baseline, with 10x fewer parameters. These results confirm that sparse models can be both compact and high-performing, across vision, NLP, and translation tasks, demonstrating the method’s versatility.

Applications

The approach enables deploying high-accuracy, low-memory models on mobile devices, embedded systems, and IoT applications. It reduces storage, computational load, and energy consumption, facilitating real-time inference in resource-limited environments. The method is suitable for tasks requiring efficient models, such as on-device image recognition, speech processing, and translation. Combining pruning with hardware-aware sparse storage formats can further optimize inference speed and energy efficiency. Long-term, this technique could transform AI deployment, making sophisticated models accessible in everyday devices, reducing hardware costs, and enabling scalable AI solutions across industries.

Limitations & Outlook

While effective, the method’s performance at extremely high sparsity (>95%) can degrade, especially on complex tasks. Sparse matrix storage overhead, such as index vectors, may offset compression gains, particularly on hardware lacking optimized sparse support. Hyperparameter tuning, including pruning schedule and frequency, remains necessary, which can be time-consuming. The approach's effectiveness varies across architectures; further work is needed to adapt it to transformer models and multi-modal tasks. Hardware implementation challenges, such as supporting efficient sparse matrix operations, must be addressed for practical deployment.

Plain Language Accessible to non-experts

想象你在整理一个超级大的工具箱,里面装满了各种工具。有些工具你经常用,有些工具很少用甚至不用。为了让工具箱更轻便、更容易找到你需要的工具,你决定把那些用得很少的工具先放到一边,慢慢地,你发现剩下的工具都非常实用,工具箱变得更整洁,也更方便使用。这就像深度学习中的剪枝,把模型中不重要的连接“拆掉”,让模型变得更小、更快,但还能完成任务。这个过程逐步进行,就像整理工具箱一样,既节省空间,又保证功能不受影响。通过不断地“拆掉”不重要的连接,模型变得更轻便,更适合在手机或智能摄像头等设备上运行。

ELI14 Explained like you're 14

想象你有一个超级大的乐高城堡,里面堆满了各种积木。有些积木其实用得很少,或者根本用不到。你可以把那些不用的积木拆掉,这样城堡变得更轻、更快,也更容易搬动。但是,如果拆掉太多重要的积木,城堡可能会倒塌或变得不完整。这个过程就像训练神经网络一样,先让它变得很大很复杂,然后慢慢拆掉那些不重要的连接,只留下最关键的部分。这样,城堡(模型)还能完成任务,又变得更轻便,能在手机或小电脑上跑得更快。这个拆掉不重要连接的过程叫做“剪枝”,它帮助我们让复杂的模型变得更简单、更实用。

Abstract

Model pruning seeks to induce sparsity in a deep neural network's various connection matrices, thereby reducing the number of nonzero-valued parameters in the model. Recent reports (Han et al., 2015; Narang et al., 2017) prune deep networks at the cost of only a marginal loss in accuracy and achieve a sizable reduction in model size. This hints at the possibility that the baseline models in these experiments are perhaps severely over-parameterized at the outset and a viable alternative for model compression might be to simply reduce the number of hidden units while maintaining the model's dense connection structure, exposing a similar trade-off in model size and accuracy. We investigate these two distinct paths for model compression within the context of energy-efficient inference in resource-constrained environments and propose a new gradual pruning technique that is simple and straightforward to apply across a variety of models/datasets with minimal tuning and can be seamlessly incorporated within the training process. We compare the accuracy of large, but pruned models (large-sparse) and their smaller, but dense (small-dense) counterparts with identical memory footprint. Across a broad range of neural network architectures (deep CNNs, stacked LSTM, and seq2seq LSTM models), we find large-sparse models to consistently outperform small-dense models and achieve up to 10x reduction in number of non-zero parameters with minimal loss in accuracy.

stat.ML cs.LG