arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.17227cs.LG
收藏

基于方差控制自适应采样的高效反向传播

Efficient Backpropagation with Variance-Controlled Adaptive Sampling

Tsinghua University(清华大学);Tsinghua-Bosch Joint ML Center(清华-博世联合机器学习中心)

Ziteng Wang, Jianfei Chen, Jun Zhu

AI总结:

本文提出方差控制的自适应采样方法 VCAS,通过逐层重要性采样和杠杆分数采样加速反向传播,并在训练中联合学习采样比例以控制方差,在保持训练精度和损失轨迹的同时显著降低 FLOPs。

摘要:

基于采样的算法在前向和/或反向传播(BP)过程中消除“不重要”的计算,为加速神经网络训练提供了潜在方案。然而,由于采样会给训练引入近似,这类算法在不同任务上可能无法持续保持精度。本文提出了一种方差控制的自适应采样(VCAS)方法,用于加速反向传播。VCAS 计算无偏随机梯度,在数据维度上对激活梯度计算进行细粒度逐层重要性采样,并在 token 维度上对权重梯度计算进行杠杆分数采样。为保持精度,我们在训练过程中与模型参数联合学习采样比例,以控制额外方差。我们在视觉和自然语言领域的多个微调和预训练任务上评估了 VCAS。在所有任务上,VCAS 都能保持原始训练损失轨迹和验证精度,同时反向传播的 FLOPs 最多减少 73.87%,整个训练过程的 FLOPs 最多减少 49.58%。实现代码见 https://github.com/thu-ml/VCAS。

英文摘要:

Sampling-based algorithms, which eliminate ''unimportant'' computations during forward and/or back propagation (BP), offer potential solutions to accelerate neural network training. However, since sampling introduces approximations to training, such algorithms may not consistently maintain accuracy across various tasks. In this work, we introduce a variance-controlled adaptive sampling (VCAS) method designed to accelerate BP. VCAS computes an unbiased stochastic gradient with fine-grained layerwise importance sampling in data dimension for activation gradient calculation and leverage score sampling in token dimension for weight gradient calculation. To preserve accuracy, we control the additional variance by learning the sample ratio jointly with model parameters during training. We assessed VCAS on multiple fine-tuning and pre-training tasks in both vision and natural language domains. On all the tasks, VCAS can preserve the original training loss trajectory and validation accuracy with an up to 73.87% FLOPs reduction of BP and 49.58% FLOPs reduction of the whole training process. The implementation is available at https://github.com/thu-ml/VCAS .

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

↑