TL;DR
SparseProp is a new, highly efficient backpropagation algorithm that finally delivers practical training speedups for neural networks with unstructured sparsity on standard CPUs. By scaling runtime linearly with the number of non-zero weights, it enables end-to-end training speedups of up to 1.85x for both vision and language models.
The Challenge of Unstructured Sparsity
Deep learning is notoriously power-hungry and computationally expensive, making it difficult to train models on "edge" devices like standard desktop or mobile CPUs. One popular solution is sparsity: zeroing out a large percentage of a model's weights to reduce the overall computational workload.
However, there is a significant catch. Most sparsity is "unstructured," meaning the zero-values are scattered randomly throughout the network. While this is great for saving memory and maintaining model accuracy, it is incredibly difficult for standard hardware to translate into actual time savings during training. Most existing "fast" sparse methods either require specialized hardware or force the sparsity into rigid "blocks" that can degrade model performance. SparseProp aims to break this deadlock by providing a way to leverage arbitrary, unstructured sparsity for real-world speedups on commodity CPUs.
Methods: Vectorized Sparse Backpropagation
The authors introduce SparseProp, a vectorized backpropagation algorithm designed specifically for sparse weights. The core innovation lies in how it handles the two main gradient calculations in a neural network layer:
- Gradient with respect to inputs ($\partial L / \partial X$): Treated as a General Sparse Matrix-Matrix Multiplication (SpGEMM).
- Gradient with respect to weights ($\partial L / \partial W$): Treated as a Sampled Dense-Dense Matrix Multiplication (SDDMM).
SparseProp is implemented using standard AVX2 vector instructions available on most modern Intel and AMD CPUs. It uses efficient data structures like Compressed Sparse Row (CSR) and employs clever tricks like transposing input matrices to ensure the CPU's cache is used effectively. For convolutional layers, the researchers developed a specialized variant that permutes the input tensors to vectorize over the output dimensions, which significantly boosts performance for the smaller layers often found at the end of networks.
Datasets and Validation
The researchers validated SparseProp across a diverse set of benchmarks:
- Computer Vision: They used ImageNet-1K for pre-training and a suite of 12 transfer learning datasets (including CIFAR-10/100, Caltech-256, SUN397, and Food-101). They also evaluated multi-attribute prediction on the CelebA dataset and training from scratch on CIFAR-10.
- Natural Language Processing: They tested BERT-base models pre-trained on BookCorpus and English Wikipedia, with fine-tuning performed on the GLUE benchmark (specifically the MNLI and QQP tasks).
Key Insights and Results
SparseProp challenges conventional wisdom by proving that you don't need specialized hardware or structured "block" sparsity to achieve faster training. Well-optimized software can make unstructured sparsity practical on the CPUs we already own.
- Linear Scaling: SparseProp’s runtime is mathematically tied to the "density" of the layer. If you remove 90% of the weights, the core operations become roughly 10x faster. This linear scaling is the "holy grail" for sparse computing.
- The "Crossover" Point: The researchers found that their sparse implementation starts to beat standard dense libraries (like those in PyTorch) once a model is about 90% sparse. At 99% sparsity, the speedups for individual layers can reach as high as 19x.
- End-to-End Speedups: In transfer learning, the algorithm provided up to 1.85x end-to-end speedup for ResNet and BERT models with minimal loss in accuracy.
- Backward Pass Efficiency: When isolating the backward pass (the most expensive part of training), SparseProp is up to 3.6x faster than standard dense implementations at 95% sparsity.
- Training from Scratch: For models trained from scratch using dynamic sparsity (like the RigL method), they observed speedups of up to 1.4x.
As shown in the performance graphs below, SparseProp significantly reduces computation time as sparsity increases, eventually crossing below the standard dense baseline.
Limitations and Future Work
While SparseProp is a major step forward for CPU-based training, it currently lacks support for GPUs, which remain the primary hardware for large-scale AI training. The authors suggest that integrating their approach with libraries like Sputnik could bring similar unstructured sparsity gains to NVIDIA hardware.
Additionally, the "end-to-end" speedups are currently bottlenecked by framework overhead. While the sparse math itself is incredibly fast, other parts of the training process (like Batch Normalization and ReLU layers) are still handled by standard, non-optimized code in PyTorch. Future system-level optimizations could mitigate these overheads to unlock even higher total speedups.
Summary updated