通过部分连接微调提升大模型训练速度与内存效率
PaCA: Partial Connection Adaptation for Efficient Fine-Tuning
- 不加适配器层,随机微调预训练权重中的部分连接
- 训练时间减少22%,总内存降低16%,精度相当
- 适合大模型高效微调,兼容量化且提升吞吐
现有参数高效微调(PEFT)方法通过仅训练少量适配器参数来降低大模型微调的内存和计算开销。然而,由于适配器层与预训练层在GPU上串行处理,计算成本下降并不等于训练时间缩短。LoRA等方法虽能在推理时合并低秩矩阵,但训练时仍需独立更新适配器,无法合并。为此,本文提出部分连接适配(PaCA),直接微调预训练权重中的随机部分连接,避免适配器层带来的串行延迟。该方法不仅将训练时间减少22%,总内存使用降低16%,还因只需存储部分激活值而减少激活内存。在MMLU和Oasst1数据集上的实验表明其精度与LoRA相当。此外,PaCA可与量化结合,支持LLaMA3.1-70B等大模型微调,并使序列长度延长23%,在NVIDIA A100和INTEL Gaudi2 HPU上提升16%吞吐量。
原文摘要 · Abstract (English)
Prior parameter-efficient fine-tuning (PEFT) algorithms reduce memory usage and computational costs of fine-tuning large neural network models by training only a few additional adapter parameters, rather than the entire model. However, the reduction in computational costs due to PEFT does not necessarily translate to a reduction in training time; although the computational costs of the adapter layers are much smaller than the pretrained layers, it is well known that those two types of layers are processed sequentially on GPUs, resulting in significant latency overhead. LoRA and its variants merge low-rank adapter matrices with pretrained weights during inference to avoid latency overhead, but during training, the pretrained weights remain frozen while the adapter matrices are continuously updated, preventing such merging. To mitigate this issue, we propose Partial Connection Adaptation (PaCA), which fine-tunes randomly selected partial connections within the pretrained weights instead of introducing adapter layers in the model. PaCA not only enhances training speed by eliminating the time overhead due to the sequential processing of the adapter and pretrained layers but also reduces activation memory since only partial activations, rather than full activations, need to be stored for gradient computation. Compared to LoRA, PaCA reduces training time by 22% and total memory usage by 16%, while maintaining comparable accuracy across various fine-tuning scenarios, such as fine-tuning on the MMLU dataset and instruction tuning on the Oasst1 dataset. PaCA can also be combined with quantization, enabling the fine-tuning of large models such as LLaMA3.1-70B. In addition, PaCA enables training with 23% longer sequence and improves throughput by 16% on both NVIDIA A100 GPU and INTEL Gaudi2 HPU compared to LoRA. The code is available at https://github.com/WooSunghyeon/paca.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。