Introduction
As neural networks increase in size and complexity, deploying them on resource-constrained hardware like mobile devices or IoT sensors becomes increasingly difficult. Traditional techniques for model compression, such as pruning or $L_1/L_0$ regularization, typically focus on reducing the number of parameters. However, parameter count is often a poor proxy for actual hardware performance. The number of Floating-Point Operations (FLOPs) provides a much more accurate prediction of latency and energy consumption. This paper introduces a method to directly optimize for a specific "FLOPs budget" during training, allowing practitioners to explicitly control the computational cost of their models.
Methodology
The proposed approach extends $L_0$ regularization by incorporating a novel FLOPs-based loss term. The core of the method is a differentiable objective function that includes a "hinge" term: $\lambda_f \max(0, \text{Current FLOPs} - \text{Target})$. This term only penalizes the network when it exceeds a user-defined FLOPs budget ($T$).
To make the discrete "on/off" nature of neural connections trainable via gradient descent, the authors utilize "hard concrete distributions." These distributions create gates that can be exactly zero, effectively pruning parts of the network during training. Since the calculation of FLOPs is a non-differentiable function of these gates, the REINFORCE (score function) estimator is employed to calculate gradients. Furthermore, the method targets "structured sparsity" by applying gates to entire groups, such as convolutional filters or input neurons, which translates directly to hardware speedups.
Experimental Results
The researchers evaluated their method across several standard image classification benchmarks, demonstrating its ability to meet specific computational targets while maintaining or even improving accuracy.
MNIST
On the MNIST dataset using the LeNet-5 architecture, the proposed method achieved a 1.1% error rate with only 111K FLOPs. This represents a significant improvement over standard $L_0$ regularization, which required 1.3M FLOPs to reach a similar error rate of 0.9%.
CIFAR-10 and CIFAR-100
For the CIFAR datasets using WideResNet-28-10, the method showed that the FLOPs constraint can act as a powerful regularizer. On CIFAR-10, the model achieved a 3.82% error rate with 4.6B FLOPs, actually outperforming the original uncompressed model (4.00% error, 5.9B FLOPs). On CIFAR-100, the method successfully compressed the model to 2.4B FLOPs with a manageable increase in error.
Discussion and Insights
A key advantage of this approach is the "knob" it provides to practitioners. By setting a target $T$, engineers can tailor a model to the specific constraints of their target hardware. The results suggest that explicitly optimizing for efficiency does not necessarily come at the cost of accuracy; in some cases, the added constraint helps the network learn more robust and computationally efficient features.
Conclusion
While FLOPs are a better proxy for latency than parameter count, they do not account for all hardware-specific factors like memory bandwidth. Future work could involve swapping the FLOPs objective for other device-specific metrics. Additionally, exploring this direct optimization in domains like object detection or natural language processing remains an open area for research.
Summary updated