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

针对大语言模型微调优化的研究

A Study of Optimizations for Fine-tuning Large Language Models

Microsoft(微软公司)

Arjun Singh, Nikhil Pandey, Anup Shirgaonkar, Pavan Manoj, Vijay Aski

AI总结:

本文系统评估了多种大语言模型微调优化方法,重点分析其对 GPU 内存和运行时间的影响,并为不同模型规模及资源受限场景提出了最佳优化组合与策略。

摘要:

微调大语言模型是用户尝试将其适配到特定应用时的热门选择。然而,微调这些模型是一项要求很高的任务,因为用户必须考察多个因素,例如资源预算、运行时间、模型规模和上下文长度等。一个具体的挑战是微调非常占用内存,对所需硬件内存以及可处理的训练数据上下文长度施加了限制。在这项工作中,我们分享了一项关于不同微调场景下多种微调优化的详细研究。特别地,我们评估了 Gradient Checkpointing、Low-Rank Adaptation、DeepSpeed 的 Zero Redundancy Optimizer 以及 FlashAttention。我们以内存和运行时间为重点,考察了不同优化组合在微调阶段对 GPU 内存使用和执行运行时间的影响。我们针对在不同模型规模之间平衡内存和运行时间的最佳默认优化提出了建议。我们分享了用于微调具有数百亿或数千亿参数的极大型模型以及在微调期间支持长上下文长度的有效策略。此外,我们提出了在 GPU 资源受限条件下进行微调的合适优化组合。

英文摘要:

Fine-tuning large language models is a popular choice among users trying to adapt them for specific applications. However, fine-tuning these models is a demanding task because the user has to examine several factors, such as resource budget, runtime, model size and context length among others. A specific challenge is that fine-tuning is memory intensive, imposing constraints on the required hardware memory and context length of training data that can be handled. In this work, we share a detailed study on a variety of fine-tuning optimizations across different fine-tuning scenarios. In particular, we assess Gradient Checkpointing, Low-Rank Adaptation, DeepSpeed's Zero Redundancy Optimizer and FlashAttention. With a focus on memory and runtime, we examine the impact of different optimization combinations on GPU memory usage and execution runtime during fine-tuning phase. We provide our recommendation on the best default optimization for balancing memory and runtime across diverse model sizes. We share effective strategies for fine-tuning very large models with tens or hundreds of billions of parameters and enabling large context lengths during fine-tuning. Furthermore, we propose the appropriate optimization mixtures for fine-tuning under GPU resource limitations.

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

↑