Computation and Memory-Efficient Model Compression with Gradient Reweighting

Yin Li (University of Wisconsin-Madison) · Zhiwei Li (Tongji University) · Weizhong Zhang (The Hong Kong University of Science and Technology) · Yuesen Liao (Fudan University) · Binrui Wu (Fudan University) · Yuquan Zhou (Fudan University) · Xupeng Shi (Northeastern University) · Dongsheng Jiang (Huawei Technologies Ltd.)
clipping techniquescomputational efficiencydeep neural networksdistributed sparse traininggradient estimationmemory efficiencyoptimization stabilizationoptimization-based methodspreconditioning matrixpruningreweighting mechanismsub-modelsvariance reductionweight sparsityzero-shot performance

Pruning is a commonly employed technique for deep neural networks (DNNs) aiming at compressing the model size to reduce computational and memory costs during inference. In contrast to conventional neural networks, large language models (LLMs) pose a unique challenge regarding pruning efficiency due to their substantial computational and memory demands. Existing methods, particularly optimization-based ones, often require considerable computational resources in gradient estimation because they cannot effectively leverage weight sparsity of the intermediate pruned network to lower compuation and memory costs in each iteration. The fundamental challenge lies in the need to frequently instantiate intermediate pruned sub-models to achieve these savings, a task that becomes infeasible even for moderately sized neural networks. To this end, this paper proposes a novel pruning method for DNNs that is both computationally and memory-efficient. Our key idea is to develop an effective reweighting mechanism that enables us to estimate the gradient of the pruned network in current iteration via reweigting the gradient estimated on an outdated intermediate sub-model instantiated at an earlier stage, thereby significantly reducing model instantiation frequency. We further develop a series of techniques, e.g., clipping and preconditioning matrix, to reduce the variance of gradient estimation and stabilize the optimization process. We conducted extensive experimental validation across various domains. Our approach achieves 50\% sparsity and a 1.58$\times$ speedup in forward pass on Llama2-7B model with only 6 GB of memory usage, outperforming state-of-the-art methods with respect to both perplexity and zero-shot performance. As a by-product, our method is highly suited for distributed sparse training and can achieve a 2 $\times$ speedup over the dense distributed baselines.