加速稀疏神经训练:一种可证明且有效的N:M转座掩码方法
Accelerated Sparse Neural Training: A Provable and Efficient Method to Find N:M Transposable Masks
摘要:
非结构化修剪减少了深度神经网络(DNN)中的内存占用。最近,研究人员提出了不同类型的结构修剪,旨在降低计算复杂度。在这项工作中,我们首先提出了一个新的措施,称为掩模多样性与预期的准确性不同类型的结构修剪。我们专注于最近提出的N:M细粒度块稀疏掩码,其中对于每个M个权重的块,我们至少有N个零。虽然N:M细粒度块稀疏允许在实际的现代硬件中加速,但它只能用于加速推理阶段。为了在训练阶段允许类似的加速,我们提出了一种新的可转置的细粒度稀疏掩码,其中相同的掩码可以用于向前和向后传递。我们的转置掩码保证了权重矩阵及其转置都遵循相同的稀疏模式;因此,向后传递错误所需的矩阵乘法也可以加速。我们制定的问题,找到最佳的可转掩模作为一个最小成本流问题。此外,为了加快最小成本流计算,我们还引入了一种快速线性时间近似,当掩码在训练过程中动态变化时可以使用。我们的实验表明,在视觉和语言模型上,矩阵乘法的速度提高了2倍,而精度没有下降。最后,为了解决不同结构约束之间的切换问题,我们提出了一种方法,可以将具有非结构化稀疏性的预训练模型转换为N:M细粒度块稀疏模型,几乎没有训练。可以在https://github.com/papers-submission/structured_transposable_masks上找到参考实现。
英文摘要:
Unstructured pruning reduces the memory footprint in deep neural networks (DNNs). Recently, researchers proposed different types of structural pruning intending to reduce also the computation complexity. In this work, we first suggest a new measure called mask-diversity which correlates with the expected accuracy of the different types of structural pruning. We focus on the recently suggested N:M fine-grained block sparsity mask, in which for each block of M weights, we have at least N zeros. While N:M fine-grained block sparsity allows acceleration in actual modern hardware, it can be used only to accelerate the inference phase. In order to allow for similar accelerations in the training phase, we suggest a novel transposable fine-grained sparsity mask, where the same mask can be used for both forward and backward passes. Our transposable mask guarantees that both the weight matrix and its transpose follow the same sparsity pattern; thus, the matrix multiplication required for passing the error backward can also be accelerated. We formulate the problem of finding the optimal transposable-mask as a minimum-cost flow problem. Additionally, to speed up the minimum-cost flow computation, we also introduce a fast linear-time approximation that can be used when the masks dynamically change during training. Our experiments suggest a 2x speed-up in the matrix multiplications with no accuracy degradation over vision and language models. Finally, to solve the problem of switching between different structure constraints, we suggest a method to convert a pre-trained model with unstructured sparsity to an N:M fine-grained block sparsity model with little to no training. A reference implementation can be found at https://github.com/papers-submission/structured_transposable_masks.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。