Abstract
Structural pruning enables model acceleration by removing structurally-grouped parameters from neural networks. However, the parameter-grouping patterns vary widely across different models, making architecture-specific pruners, which rely on manually-designed grouping schemes, non-generalizable to new architectures. In this work, we study a highly-challenging yet barely-explored task, any structural pruning, to tackle general structural pruning of arbitrary architecture like CNNs, RNNs, GNNs and Transformers. The most prominent obstacle towards this goal lies in the structural coupling, which not only forces different layers to be pruned simultaneously, but also expects all removed parameters to be consistently unimportant, thereby avoiding structural issues and significant performance degradation after pruning. To address this problem, we propose a general and fully automatic method, Dependency Graph (DepGraph), to explicitly model the dependency between layers and comprehensively group coupled parameters for pruning. In this work, we extensively evaluate our method on several architectures and tasks, including ResNe(X)t, DenseNet, MobileNet and Vision transformer for images, GAT for graph, DGCNN for 3D point cloud, alongside LSTM for language, and demonstrate that, even with a simple norm-based criterion, the proposed method consistently yields gratifying performances.
The Challenge of Structural Coupling
Pruning is a critical technique for compressing deep learning models. While unstructural pruning (zeroing individual weights) is straightforward, it requires specialized hardware for speedups. In contrast, structural pruning (removing entire channels or neurons) offers immediate acceleration on standard hardware but faces the hurdle of structural coupling.
In modern architectures like ResNets or Transformers, layers are interconnected via skip connections, concatenations, or shared operations. Pruning a channel in one layer can "break" the input of a subsequent layer. Traditionally, researchers manually defined grouping logic for each architecture—a tedious and error-prone process. DepGraph automates this by treating structural pruning as a recursive "trigger" effect where pruning one layer necessitates adjustments across a chain of dependencies.
The Dependency Graph Framework
The core innovation of this work is the Dependency Graph (DepGraph), which decomposes a network into finer components—inputs ($f^-$) and outputs ($f^+$)—to establish two types of dependencies:
- Inter-layer Dependency: Arising from physical connectivity (e.g., output of Layer A is input to Layer B).
- Intra-layer Dependency: Occurring when a layer requires its input and output to be pruned simultaneously (e.g., Batch Normalization).
By modeling these as edges in a graph, identifying coupled layers becomes a graph traversal problem: finding the Maximum Connected Components.
Once grouped, the framework applies Group-level Pruning. Unlike standard criteria that evaluate layers in isolation, DepGraph uses a sparse training regularization term to ensure all parameters within a coupled group become "unimportant" together, minimizing performance impact upon removal.
Experimental Evaluation
DepGraph was evaluated across a diverse set of tasks and architectures to prove its versatility:
- Image Classification: On CIFAR-10, ResNet-56 achieved a 2.57x acceleration with a 0.11% accuracy increase. On ImageNet, ResNet-50 reached over 2x speedup with only a 0.32% accuracy loss.
- Vision Transformers: ViT-B/16 was successfully pruned on ImageNet, reducing MACs from 17.6 to 10.4 with a 1.90% accuracy drop.
- Non-CNN Architectures: The method achieved 8x to 16x acceleration on GNNs (GAT) and RNNs (LSTM) without significant performance degradation, demonstrating true architectural generality.
Conclusion
DepGraph provides a fully automatic solution for "any structural pruning," removing the need for architecture-specific manual rules. While currently utilizing a norm-based importance criterion, the framework is compatible with more sophisticated metrics like Taylor expansion. Its ability to handle diverse models—from CNNs to GNNs—marks a significant step toward universal, automated model compression.
Summary updated