Large language model fine-tuning is bottlenecked by memory: a 7B parameter model requires 84GB--14GB for weights, 14GB for gradients, and 56GB for FP32 optimizer states--exceeding even A100-40GB capacity. We present Chronicals, an open-source training framework achieving 3.51x speedup over Unsloth through four synergistic optimizations: (1) fused Triton kernels eliminating 75% of memory traffic via RMSNorm (7x), SwiGLU (5x), and QK-RoPE (2.3x) fusion; (2) Cut Cross-Entropy reducing logit memory from 5GB to 135MB through online softmax computation; (3) LoRA+ with theoretically-derived 16x differential learning rates between adapter matrices; and (4) Best-Fit Decreasing sequence packing recovering 60-75% of compute wasted on padding. On Qwen2.5-0.5B with A100-40GB, Chronicals achieves 41,184 tokens/second for full fine-tuning versus Unsloth's 11,736 tokens/second (3.51x). For LoRA at rank 32, we reach 11,699 tokens/second versus Unsloth MAX's 2,857 tokens/second (4.10x). Critically, we discovered that Unsloth's reported 46,000 tokens/second benchmark exhibited zero gradient norms--the model was not training. We provide complete mathematical foundations: online softmax correctness proofs, FlashAttention IO complexity bounds O(N^2 d^2 M^{-1}), LoRA+ learning rate derivations from gradient magnitude analysis, and bin-packing approximation guarantees. All implementations, benchmarks, and proofs are available at https://github.com/Ajwebdevs/Chronicals with pip installation via https://pypi.org/project/chronicals/.


翻译:大语言模型微调的主要瓶颈在于内存:一个70亿参数的模型需要84GB内存——其中权重占14GB,梯度占14GB,优化器FP32状态占56GB——这甚至超过了A100-40GB的显存容量。本文提出Chronicals,一个通过四项协同优化实现比Unsloth加速3.51倍的开源训练框架:(1)融合Triton内核通过RMSNorm(7倍)、SwiGLU(5倍)和QK-RoPE(2.3倍)融合消除75%的内存流量;(2)截断交叉熵通过在线softmax计算将逻辑值内存从5GB压缩至135MB;(3)LoRA+采用理论推导的适配器矩阵间16倍差分学习率;(4)最佳适应递减序列打包回收因填充浪费的60-75%计算量。在A100-40GB上对Qwen2.5-0.5B进行测试,Chronicals在全参数微调中达到41,184词元/秒,而Unsloth为11,736词元/秒(3.51倍加速)。对于秩为32的LoRA微调,我们达到11,699词元/秒,而Unsloth MAX为2,857词元/秒(4.10倍加速)。关键发现是,Unsloth报告的46,000词元/秒基准测试显示梯度范数为零——模型并未实际训练。我们提供了完整的数学基础:在线softmax正确性证明、FlashAttention IO复杂度边界O(N^2 d^2 M^{-1})、基于梯度幅度分析的LoRA+学习率推导,以及装箱问题近似保证。所有实现、基准测试和证明均公开于https://github.com/Ajwebdevs/Chronicals,可通过https://pypi.org/project/chronicals/进行pip安装。

0
下载
关闭预览

相关内容

MonoGRNet:单目3D目标检测的通用框架(TPAMI2021)
专知会员服务
18+阅读 · 2021年5月3日
图机器学习 2.2-2.4 Properties of Networks, Random Graph
图与推荐
10+阅读 · 2020年3月28日
【NeurIPS2019】图变换网络:Graph Transformer Network
语义分割中的深度学习方法全解:从FCN、SegNet到DeepLab
炼数成金订阅号
26+阅读 · 2017年7月10日
自然语言处理(二)机器翻译 篇 (NLP: machine translation)
DeepLearning中文论坛
12+阅读 · 2015年7月1日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
8+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
相关资讯
图机器学习 2.2-2.4 Properties of Networks, Random Graph
图与推荐
10+阅读 · 2020年3月28日
【NeurIPS2019】图变换网络:Graph Transformer Network
语义分割中的深度学习方法全解:从FCN、SegNet到DeepLab
炼数成金订阅号
26+阅读 · 2017年7月10日
自然语言处理(二)机器翻译 篇 (NLP: machine translation)
DeepLearning中文论坛
12+阅读 · 2015年7月1日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
8+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员