TL;DR
GRIM is a new end-to-end framework that enables real-time, high-accuracy deep learning inference on mobile devices by introducing a "just right" pruning strategy called Block-based Column-Row (BCR) sparsity. By co-designing this fine-grained pruning with a custom compiler stack, the authors achieve up to 14x speedups over industry standards like TensorFlow-Lite and TVM, making heavy models like VGG-16 run at 30+ FPS on a standard smartphone.
What Problem Does This Paper Address?
Running state-of-the-art Deep Neural Networks (DNNs) on mobile devices is a classic "unstoppable force meets immovable object" problem. Large models are computationally expensive and memory-hungry, while mobile CPUs and GPUs are strictly resource-constrained.
To bridge this gap, researchers usually turn to weight pruning—removing unnecessary connections in a network. However, there is a frustrating trade-off:
- Non-structured pruning: Removes weights anywhere. It keeps accuracy high but creates "irregular" math that mobile hardware (which loves parallel, block-based data) handles very poorly.
- Coarse-grained structured pruning: Removes entire rows or filters. This is hardware-friendly but often destroys model accuracy, especially for Recurrent Neural Networks (RNNs).
The authors of GRIM set out to find a "middle ground" that offers the accuracy of irregular pruning with the execution speed of structured pruning, applicable to both Convolutional (CNNs) and Recurrent (RNNs) architectures.
Methods
The core of GRIM is a two-pronged approach: a new sparsity scheme and a specialized compiler.
- BCR (Block-based Column-Row) Pruning: Instead of pruning the whole weight matrix at once, GRIM divides it into smaller $n \times m$ blocks. Within each block, it performs independent row and column pruning. This limits the "search space" for the pruning algorithm, making it easier to find a high-accuracy sparse configuration that still maintains enough regularity for hardware to exploit.
- The GRIM Compiler Stack: Pruning alone isn't enough; you need code that knows how to skip the zeros efficiently. The framework includes:
- Matrix Reordering: It groups rows with similar sparse patterns together to minimize "thread divergence" (where different processing cores on a GPU waste time waiting for each other).
- BCRC Storage Format: A specialized "Blocked Column-Row Compact" format that is more memory-efficient than the standard CSR (Compressed Sparse Row) format.
- Register Load Redundancy Elimination (LRE): A trick to reuse data already sitting in the processor's fastest memory (registers), significantly reducing expensive trips to main memory.
- ADMM-based Optimization: The framework uses the Alternating Direction Method of Multipliers (ADMM) to mathematically guarantee that the pruning process converges on the best possible sparse model.
Datasets
The authors evaluated GRIM across several mainstream benchmarks:
- ImageNet: Used for large-scale CNN evaluation (VGG-16).
- CIFAR-10: Used for various CNN architectures (VGG-16, ResNet-18, MobileNet-V2).
- TIMIT: A standard dataset for speech recognition used to evaluate the framework's performance on GRU-based RNNs.
Key Insights and Ideas
- "Beyond a Mere Tradeoff": The authors argue that BCR pruning isn't just a compromise. Because the search space is more constrained than totally irregular pruning, the optimization algorithm often finds better solutions faster, sometimes even surpassing the accuracy of non-structured pruning at the same sparsity level.
- Generality via GEMM: By treating both Convolutional (CONV) and Fully Connected (FC) layers as General Matrix Multiplications (GEMM), GRIM provides a unified acceleration path for both CNNs and RNNs—something many mobile frameworks struggle to do.
- Compiler-Pruning Co-design: The "aha moment" is that hardware regularity doesn't have to be global. By enforcing regularity at the block level, the compiler can generate highly optimized code that rivals the speed of dense computations while reaping the storage benefits of sparsity.
Key Results
- Massive Speedups: On a mobile GPU (Adreno 640), GRIM achieved speedups of up to 14.08x compared to TensorFlow-Lite and TVM.
- Real-Time Performance: GRIM successfully ran the VGG-16 model on a smartphone in just 33ms, meeting the industrial "real-time" standard of 30 frames per second. For context, standard TFLite takes over 300ms for the same task.
- Efficiency vs. FPGAs: When tested on RNNs, GRIM matched the performance of ESE (a specialized FPGA-based framework) but with 38x higher energy efficiency.
- High Sparsity, Low Loss: On CIFAR-10, the framework achieved a 50.5x pruning rate on VGG-16 with zero accuracy loss.
Limitations and Future Work
While GRIM is highly effective for CNNs and RNNs, the authors note that the "extremely deep nature" of newer models like Transformers (e.g., BERT, GPT) requires even more careful optimization.
The paper briefly mentions an ongoing study where they achieved a 1.8x pruning rate on BERT-base without accuracy loss, suggesting that extending the BCR scheme to attention-based mechanisms is the next frontier. Additionally, while the framework includes an auto-tuning module, this process still requires an offline profiling stage on the target device before deployment.
Summary updated