Skip to main content
QUICK REVIEW

[论文解读] LMFlow: An Extensible Toolkit for Finetuning and Inference of Large Foundation Models

Shizhe Diao, Rui Pan|arXiv (Cornell University)|Jun 21, 2023
Advanced Neural Network Applications被引用 6
一句话总结

LMFlow 是一个可扩展的轻量级工具包,可简化大型基础模型的微调与推理,支持持续预训练、指令微调、参数高效微调(LoRA)以及一种新颖的强化学习人类反馈方法(RAFT)。它可在单张 3090 GPU 上于五小时内训练一个 70 亿参数的 LLaMA 模型,其性能在特定任务上可与或优于 ChatGPT。

ABSTRACT

Foundation models have demonstrated a great ability to achieve general human-level intelligence far beyond traditional approaches. As the technique keeps attracting attention from the AI community, an increasing number of foundation models are becoming publicly accessible. However, a significant shortcoming of most of these models lies in their performance in specialized-domain and task-specific applications, necessitating domain- and task-aware fine-tuning to develop effective scientific language models. As the number of available foundation models and specialized tasks keeps growing, the job of training scientific language models becomes highly nontrivial. In this paper, we initiate steps to tackle this issue. We introduce an extensible and lightweight toolkit, LMFlow, which aims to simplify the domain- and task-aware finetuning of general foundation models. LMFlow offers a complete finetuning workflow for a foundation model to support specialized training with limited computing resources. Furthermore, it supports continuous pretraining, instruction tuning, parameter-efficient finetuning, alignment tuning, inference acceleration, long context generalization, model customization, and even multimodal finetuning, along with carefully designed and extensible APIs. This toolkit has been thoroughly tested and is available at https://github.com/OptimalScale/LMFlow.

研究动机与目标

  • 为应对在多样化专业任务中微调大型基础模型日益增长的复杂性。
  • 为计算资源有限的研究人员和开发者提供一个统一、可扩展且资源高效的工具包。
  • 简化完整的微调流程,包括持续预训练、指令微调以及基于人类反馈的强化学习(RLHF)。
  • 在有限硬件条件下,实现问答、翻译和专家咨询等任务的个性化模型训练。
  • 提供简单、可扩展的 API 与自动化评估框架,以提升可复现性与可访问性。

提出的方法

  • LMFlow 实现了一个四阶段微调工作流:领域适应、任务适应、指令微调以及基于人类反馈的强化学习(RLHF)。
  • 通过低秩适应(LoRA)支持参数高效的微调,降低计算与内存开销。
  • 提出一种新颖的 RLHF 算法 RAFT(奖励排序微调),通过使用奖励排序而非奖励建模,简化了 RLHF 流程。
  • 该工具包采用标准化的基于 JSON 的数据格式,支持如 'text_only' 和 'text2text' 等类型,以适应多样化的训练数据。
  • 包含简化的推理框架,并与 Hugging Face 模型集成,实现无缝部署。
  • 评估采用负对数似然(NLL),其与下游任务准确率具有强相关性,且避免了困惑度(PPL)固有的偏差。

实验结果

研究问题

  • RQ1一个轻量级、可扩展的工具包能否简化在多样化专业任务中对大型基础模型的微调?
  • RQ2RAFT 算法在简化并提升生成模型的 RLHF 过程方面效果如何?
  • RQ3在硬件资源有限的情况下,参数高效微调(LoRA)在多大程度上可实现与全量微调相当的性能?
  • RQ4NLL 能否作为无需人工标注的可靠自动化评估指标,有效衡量模型能力?
  • RQ5在单张 GPU 且资源有限的条件下,微调后的 LLaMA 模型的实际性能上限是什么?

主要发现

  • 在单张 NVIDIA 3090 GPU 上,仅用五小时即可完成对 70 亿参数 LLaMA 模型的个性化微调,证明了其在有限硬件环境下的高效率。
  • 该工具包成功支持持续预训练、指令微调、参数高效微调(LoRA)以及 RLHF,实现了对基础模型的全面定制。
  • 使用 LMFlow 微调的 330 亿参数 LLaMA 模型在特定基准测试中,性能可与或优于 ChatGPT。
  • NLL 指标与常识问答准确率表现出强相关性,验证了其作为可靠自动化评估指标的有效性。
  • 基于 RAFT 的 RLHF 显著简化了强化学习流程,同时在指令遵循与对话任务中保持了优异性能。
  • 7B、13B、33B 和 65B 参数的 LLaMA 模型权重已公开发布,供学术用途,可立即用于问答服务的部署。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。