arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2305.15265cs.LGcs.CL
收藏

赢者全取列行采样用于语言模型的内存高效适配

Winner-Take-All Column Row Sampling for Memory Efficient Adaptation of Language Model

Rice University(莱斯大学);Texas A&M University(德克萨斯农工大学);Case Western Reserve University(凯斯西储大学)

Zirui Liu, Guanchu Wang, Shaochen Zhong, Zhaozhuo Xu, Daochen Zha, Ruixiang Tang, Zhimeng Jiang, Kaixiong Zhou, Vipin Chaudhary, Shuai Xu, Xia Hu

AI总结:

针对大模型微调内存瓶颈,提出WTA-CRS无偏估计器,仅存子采样激活值,降低方差,实现2.7倍内存减少和6.4倍批量增大,性能几乎无损。

摘要:

随着模型规模的快速增长,由于大量的内存使用,微调大型预训练语言模型变得越来越困难。以往的工作通常侧重于减少网络中可训练参数的数量。虽然模型参数确实对内存使用有贡献,但训练过程中的主要内存瓶颈来自于存储特征图(也称为激活值),因为它们对于梯度计算至关重要。值得注意的是,神经网络通常使用随机梯度下降进行训练。我们认为,在随机优化中,只要梯度估计器是无偏的且具有合理的方差,模型就能处理有噪声的梯度。基于这一动机,我们提出了一类新的无偏估计器,称为WTA-CRS,用于降低方差的矩阵乘法,它仅需存储子采样的激活值来计算梯度。我们的工作提供了理论和实验证据,表明在调整变换器的背景下,我们提出的估计器相比现有估计器具有更低的方差。通过在变换器中将线性运算替换为我们的近似运算,我们能够实现高达2.7倍的峰值内存减少,且几乎没有精度下降,并支持高达6.4倍的批量大小。在相同硬件下,WTA-CRS通过应用更大的模型和/或使用更大的批量大小实现更快的训练速度,从而获得更好的下游任务性能。

英文摘要:

With the rapid growth in model size, fine-tuning the large pre-trained language model has become increasingly difficult due to its extensive memory usage. Previous works usually focus on reducing the number of trainable parameters in the network. While the model parameters do contribute to memory usage, the primary memory bottleneck during training arises from storing feature maps, also known as activations, as they are crucial for gradient calculation. Notably, neural networks are usually trained using stochastic gradient descent. We argue that in stochastic optimization, models can handle noisy gradients as long as the gradient estimator is unbiased with reasonable variance. Following this motivation, we propose a new family of unbiased estimators called WTA-CRS, for matrix production with reduced variance, which only requires storing the sub-sampled activations for calculating the gradient. Our work provides both theoretical and experimental evidence that, in the context of tuning transformers, our proposed estimators exhibit lower variance compared to existing ones. By replacing the linear operation with our approximated one in transformers, we can achieve up to 2.7$\times$ peak memory reduction with almost no accuracy drop and enables up to $6.4\times$ larger batch size. Under the same hardware, WTA-CRS enables better down-streaming task performance by applying larger models and/or faster training speed with larger batch sizes.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑