Deep k-Means: Re-Training and Parameter Sharing with Harder Cluster Assignments for Compressing Deep Convolutions

Junru Wu, Yue Wang, Zhenyu Wu, Zhangyang Wang, Ashok Veeraraghavan, Yingyan Lin

Introduction

Deep $k$-Means is a novel compression pipeline that uses a "spectrally relaxed" $k$-means regularization during re-training to force Convolutional Neural Network (CNN) weights into highly clustered structures. By combining this "harder" cluster assignment with a hardware-friendly row-wise parameter sharing scheme, the authors achieve significant compression ratios and energy reductions on state-of-the-art models like ResNet and GoogLeNet with virtually no loss in accuracy.

The Bottleneck in Edge Deployment

While deep CNNs have revolutionized computer vision, their deployment on edge devices—such as smartphones, wearables, and IoT sensors—is stifled by storage limits and energy consumption. Modern architectures are dominated by convolutional layers. Traditional compression techniques often focus on fully-connected layers or simply reducing the number of parameters via pruning. However, this approach has two major flaws:

  1. Parameter count does not equal energy consumption: Reducing weights doesn't always lead to lower power consumption if the data movement patterns remain inefficient.
  2. Soft vs. Hard Clustering: Previous "soft" weight-sharing methods (which use probabilistic assignments during training) often struggle to maintain accuracy when weights are finally "hard" quantized for deployment.

The Deep $k$-Means Approach

To address these challenges, the authors propose a two-step pipeline:

  1. Spectrally Relaxed $k$-Means Regularization: Instead of training a network and then clustering its weights post-hoc, they add a specialized regularization term to the loss function during re-training. Derived from a trace-form reformulation of the $k$-means objective, this term encourages weights to naturally gravitate toward $K$ cluster centers while the model is still learning. This "harder" assignment makes the eventual weight-sharing step much more accurate and robust.
  2. Row-wise Parameter Sharing: Weights are reshaped into a matrix where columns represent rows of the convolutional filters. This specific structure exploits "row-stationary" hardware dataflows (like those used in the Eyeriss accelerator), minimizing energy-expensive data movement between memory and processing elements.

To evaluate the energy impact accurately, the authors introduce an improved set of Energy-Aware Metrics. These metrics go beyond simple FLOP counts to account for the bit-width of operations and the frequency of data loading (representational cost) for both weights and activations.

Key Insights and Results

The method was evaluated across standard benchmarks including MNIST (LeNet-5), CIFAR-10 (TT-conv-CNN, FreshNet-CNN, Wide ResNet), and ImageNet (GoogLeNet, AlexNet).

Superiority Over Baselines

Deep $k$-Means consistently outperforms alternative compression strategies like Ultimate Tensorization (TT-conv) and FreshNet. For instance, on the TT-conv-CNN model, Deep $k$-Means achieved better accuracy at a Compression Ratio (CR) of 4 than the baseline did at CR=2. In some cases, the compressed model actually performed better than the original (+0.05% accuracy), suggesting that the clustering acts as a powerful regularizer that removes harmful parameter redundancy.

Comparison of Deep k-Means against TT-conv baseline

Robustness at High Compression

Unlike Bayesian "soft" clustering, which can be sensitive to learning rates, the "harder" spectral regularization aligns better with the final goal of discrete weight sharing. As shown in the convolutional layer analysis, Deep $k$-Means maintains near-perfect accuracy even at extreme reductions in weight representational cost, significantly outperforming standard clustering approaches like CAR.

Accuracy vs. Reduction in Weight Representational Cost for Conv1 Layer

Scalability and Efficiency

On large-scale tasks like ImageNet using GoogLeNet, the method achieved a 3x compression ratio with almost lossless performance (only a -0.36% top-1 accuracy drop). The extra computational complexity of the Singular Value Decomposition (SVD) used in the regularization is mitigated by a "lazy update" strategy—computing it once every few epochs—making it highly scalable. Furthermore, the proposed energy metrics showed a >0.99 correlation ($R^2$) with actual hardware-based estimation tools, proving they are reliable proxies for real-world power savings.

Limitations and Future Work

While highly effective, the current implementation focuses primarily on convolutional layers, which, although the most computationally expensive part of modern CNNs, leaves room for full-network optimization. Additionally, the authors currently use a uniform parameter sharing scheme where most layers use the same cluster rate. They acknowledge that adaptive cluster rates—assigning more clusters to sensitive layers and fewer to redundant ones—could further improve results. Finally, while row-wise clustering is ideal for row-stationary dataflows, its benefits might vary on different hardware architectures (e.g., systolic arrays vs. GPUs), suggesting a pathway for future hardware-specific tailoring.

Summary updated

BibTeX
@inproceedings{wu2018deep,
  author = {Junru Wu and Yue Wang and Zhenyu Wu and Zhangyang Wang and Ashok Veeraraghavan and Yingyan Lin},
  title = {{Deep k-Means: Re-Training and Parameter Sharing with Harder Cluster Assignments for Compressing Deep Convolutions}},
  booktitle = {International Conference on Machine Learning},
  year = {2018},
  url = {https://openreview.net/forum?id=rkWQp5buWS},
}
Figure