Maxwell's Demon at Work: Efficient Pruning by Leveraging Saturation of Neurons

Simon Dufort-Labbé, Pierluca D'Oro, Evgenii Nikishin, Razvan Pascanu, Pierre-Luc Bacon, Aristide Baratin

TL;DR

Traditionally viewed as a harmful side effect of training, "dying neurons"—units that become permanently inactive or saturated—are reframed as a valuable resource for network compression. The authors introduce Demon Pruning (DemP), a method that actively drives unnecessary neurons into saturation using asymmetric noise injection and a one-cycle regularization schedule. By dynamically removing these dead units from the computation graph during training, DemP achieves superior accuracy-sparsity tradeoffs and accelerates training by up to 3.56$\times$.

What Problem Does This Paper Address?

As deep learning models grow, compressing them via pruning is essential for deployment on resource-constrained hardware. Structured pruning (deleting entire channels or layers) is highly desirable because it directly translates to hardware speedups without requiring specialized sparse computation libraries.

However, existing dense-to-sparse structured pruning methods often require complex heuristic schedules, meticulous timing, or extended training budgets that negate the computational savings during the training phase itself. Meanwhile, deep learning practitioners have long struggled with "dying neurons" (particularly with ReLU activations), treating them as an undesirable phenomenon that degrades network plasticity. This paper asks a clever counter-question: Instead of fighting neuron death, can we harness it to naturally and efficiently prune networks during training?

Methods

The authors introduce Demon Pruning (DemP), a dynamic dense-to-sparse structured pruning framework. It operates via three core mechanisms:

  1. One-Cycle Regularization Schedule: Instead of regularizing all weights, DemP applies $\ell_1$-regularization (Lasso) exclusively to the scale parameters ($\gamma$) of normalization layers (e.g., Batch Normalization). It uses a one-cycle schedule: a linear warmup phase to a peak value $\lambda$, followed by a cosine decay. This pushes targeted channel activations toward zero.
  2. Asymmetric Noise Injection: Inspired by the thermodynamics concept of Maxwell's Demon, DemP injects Gaussian noise only into the weights of active (live) neurons early in training. Because dead neurons receive no noise, they become trapped in a low-energy, inactive subspace, preventing them from reviving and accelerating the overall "dying" process.
  3. Dynamic Pruning: Rather than waiting until the end of training, DemP periodically checks neuron activations across minibatches. Units that are consistently inactive are completely excised from the GPU's computation graph, reducing the model's embedding dimensions and accelerating subsequent training iterations.

Datasets

The method was evaluated across standard computer vision benchmarks:

  • MNIST: Used for initial, small-scale Multi-Layer Perceptron (MLP) exploratory analysis on noise regimes.
  • CIFAR-10: Evaluated using ResNet-18 and VGG-16 architectures.
  • ImageNet: Evaluated using a large-scale ResNet-50 architecture to test scalability.
  • ImageNet (Exploratory): Also tested on a Vision Transformer (ViT-B/16) to explore compatibility with transformer architectures.

Key Insights and Ideas

  • The Asymmetry of SGD Noise: The paper demonstrates that standard stochastic gradient descent (SGD) noise is inherently asymmetric. Since gradients are zero for dead neurons, only live neurons experience noisy updates. DemP exploits this by adding artificial noise exclusively to live units, creating an "attractor" state in the saturated zone.
  • Adam is a Neuron Killer: The authors reveal that the Adam optimizer naturally induces significantly higher rates of neuron death than SGD with momentum. This is primarily driven by Adam’s second-moment term ($\text{v}_t$); when gradients become very small, the numerical stability parameter $\epsilon$ dominates, inadvertently spiking the effective learning rate and kicking borderline neurons into permanent inactivity.
Figure 1: Dead neuron accumulation for a ResNet-18 trained on CIFAR-10 with different activation functions and values of the learning rate. We use a negative slope of α = 0.05 for Leaky ReLU and β = 1 for Swish.
  • Relaxed Death Criterion: Checking if a neuron is dead across an entire dataset is computationally expensive. The authors found that evaluating inactivity over a small proxy minibatch (e.g., 512 or 2048 samples) yields virtually identical pruning distributions at a fraction of the cost.

Key Results

DemP consistently outperforms strong structured pruning baselines like EarlyCrop and SNAP, particularly at high sparsity levels:

  • ImageNet (ResNet-50): At ~80% weight sparsity, DemP achieved 71.52% test accuracy, outperforming baselines by up to 2.85%. Crucially, at ~90% sparsity, while baselines collapsed below 30% accuracy, DemP maintained a highly functional 66.34% accuracy.
  • Training Acceleration: By dynamically shrinking the network during the forward/backward passes, DemP achieved a 1.23$\times$ training speedup on ImageNet (ResNet-50), a 2.45$\times$ speedup on ResNet-18 (CIFAR-10), and up to a 3.56$\times$ speedup on VGG-16 (CIFAR-10).
Figure 2: Left: Increased regularization during training increases the ratio of dead units, as showcased here for a ResNet-18 trained on CIFAR-10. We use ·(γ) to denote when regularization is applied solely to the scale parameters of the normalization layers. Right: Augmenting training updates with asymmetric Gaussian noise, sampled from N(x|0, σ2) and applied to weights of live neurons only, also leads to higher levels of dead unit accumulation, also showcased for a ResNet-18 trained on CIFAR-10 with various values of the Lasso(γ) regularization parameter.

Limitations and Future Work

  • Lack of Direct Sparsity Control: Unlike some pruning algorithms where you can explicitly request "80% sparsity," DemP relies on a hyperparameter search over the regularization strength ($\lambda$) to implicitly reach a target sparsity level.
  • Coarse Granularity: In its current implementation, DemP removes entire channels. The authors note that adapting it to remove individual filters could yield even better accuracy-sparsity tradeoffs.
  • Activation Function Dependency: The method inherently relies on activation functions with clear saturation regions (like ReLU or GELU). Consequently, it cannot easily prune layers that lack adjacent activations, such as the internal attention layers of Transformer blocks.

Summary updated

BibTeX
@article{dufortlabbe2025maxwell,
  author = {Simon Dufort-Labbé and Pierluca D'Oro and Evgenii Nikishin and Razvan Pascanu and Pierre-Luc Bacon and Aristide Baratin},
  title = {{Maxwell's Demon at Work: Efficient Pruning by Leveraging Saturation of Neurons}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2025},
}
Figure