揭秘小模型微调秘诀,让资源有限者也能高效训练大模型。
Unveiling the Secret Recipe: A Guide For Supervised Fine-Tuning Small LLMs
- 用大批次小学习率提升3B-7B小模型性能
- 早期训练时梯度小、损失高预示最终效果好
- 简化训练策略仍能保持性能,适合个人开发者
大语言模型(LLM)的兴起加剧了科研资源差距:工业实验室凭借算力、人才和基础设施可有效微调大模型,而个人开发者和小团队因资源受限难以参与。本文聚焦3B至7B参数的小型LLM,通过四个开源预训练模型,在涵盖多元知识领域的指令微调数据集上系统研究监督微调方法。我们探索多种训练配置与策略,揭示了挑战常见实践的关键发现:(i) 大批量配合低学习率显著提升模型在MMLU、MTBench和Open LLM Leaderboard上的表现;(ii) 早期训练中梯度范数低、损失值高是良好最终性能的强预测信号,可用于提前终止低效训练,大幅节省计算成本;(iii) 经过对预热步数和学习率调度等超参的深入分析,我们为从业者提供实用建议,发现部分简化方案不影响性能;(iv) 分阶段与堆叠式训练效果无显著差异,但堆叠训练更简单且样本效率更高。这些结论在不同数据集和模型间均具鲁棒性,旨在为小规模模型微调提供实用指南,推动大模型研究的包容性发展。
原文摘要 · Abstract (English)
The rise of large language models (LLMs) has created a significant disparity: industrial research labs with their computational resources, expert teams, and advanced infrastructures, can effectively fine-tune LLMs, while individual developers and small organizations face barriers due to limited resources. In this paper, we aim to bridge this gap by presenting a comprehensive study on supervised fine-tuning of LLMs using instruction-tuning datasets spanning diverse knowledge domains and skills. We focus on small-sized LLMs (3B to 7B parameters) for their cost-efficiency and accessibility. We explore various training configurations and strategies across four open-source pre-trained models. We provide detailed documentation of these configurations, revealing findings that challenge several common training practices, including hyperparameter recommendations from TULU and phased training recommended by Orca. Key insights from our work include: (i) larger batch sizes paired with lower learning rates lead to improved model performance on benchmarks such as MMLU, MTBench, and Open LLM Leaderboard; (ii) early-stage training dynamics, such as lower gradient norms and higher loss values, are strong indicators of better final model performance, enabling early termination of sub-optimal runs and significant computational savings; (iii) through a thorough exploration of hyperparameters like warmup steps and learning rate schedules, we provide guidance for practitioners and find that certain simplifications do not compromise performance; and (iv) we observed no significant difference in performance between phased and stacked training strategies, but stacked training is simpler and more sample efficient. With these findings holding robustly across datasets and models, we hope this study serves as a guide for practitioners fine-tuning small LLMs and promotes a more inclusive environment for LLM research.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。