SliceGPT:通过删除行和列压缩大型语言模型
SliceGPT: Compress Large Language Models by Deleting Rows and Columns
AI总结:
本文提出SliceGPT,一种通过删除权重矩阵的行和列来压缩大型语言模型的训练后稀疏化方法,可移除高达25%的参数并保持大部分性能,同时减少推理计算量。
摘要:
大型语言模型已成为自然语言处理的基石,但其使用在计算和内存资源方面带来了巨大成本。稀疏化提供了一种缓解这些资源限制的解决方案,且近期研究表明,已训练模型可以在事后进行稀疏化。现有的稀疏化技术面临挑战,因为它们需要额外的数据结构,并且在当前硬件上提供的加速效果有限。在本文中,我们提出了SliceGPT,一种新的训练后稀疏化方案,它将每个权重矩阵替换为更小的(稠密)矩阵,从而降低网络的嵌入维度。通过大量实验,我们证明SliceGPT能够为LLAMA2-70B、OPT 66B和Phi-2模型移除高达25%的模型参数(包括嵌入),同时分别保持稠密模型99%、99%和90%的零样本任务性能。我们的切片模型在更少的GPU上运行,且无需任何额外代码优化即可更快运行:在24GB消费级GPU上,我们将LLAMA2-70B推理的总计算量降低至稠密模型的64%;在40GB A100 GPU上,我们将其降低至66%。我们提供了一个新见解——Transformer网络中的计算不变性,它使得SliceGPT成为可能,我们希望这能激发并促成未来减少预训练模型内存和计算需求的途径。代码可在以下网址获取:https://github.com/microsoft/TransformerCompression
英文摘要:
Large language models have become the cornerstone of natural language processing, but their use comes with substantial costs in terms of compute and memory resources. Sparsification provides a solution to alleviate these resource constraints, and recent works have shown that trained models can be sparsified post-hoc. Existing sparsification techniques face challenges as they need additional data structures and offer constrained speedup with current hardware. In this paper we present SliceGPT, a new post-training sparsification scheme which replaces each weight matrix with a smaller (dense) matrix, reducing the embedding dimension of the network. Through extensive experimentation, we show that SliceGPT can remove up to 25% of the model parameters (including embeddings) for LLAMA2-70B, OPT 66B and Phi-2 models while maintaining 99%, 99% and 90% zero-shot task performance of the dense model respectively. Our sliced models run on fewer GPUs and run faster without any additional code optimization: on 24GB consumer GPUs we reduce the total compute for inference on LLAMA2-70B to 64% of that of the dense model; on 40GB A100 GPUs we reduce it to 66%. We offer a new insight, computational invariance in transformer networks, which enables SliceGPT and we hope it will inspire and enable future avenues to reduce memory and computation demands for pre-trained models. Code is available at: https://github.com/microsoft/TransformerCompression
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。