您的浏览器禁用了JavaScript(一种计算机语言,用以实现您与网页的交互),请解除该禁用,或者联系我们。[零一万物]:千亿参数LLM的训练效率优化 - 发现报告

千亿参数LLM的训练效率优化

信息技术2024-10-28张力寰零一万物徐***
AI智能总结
查看更多
千亿参数LLM的训练效率优化

演讲人:张力寰零一万物/AI Infra分布式训练优化架构师 CONTENTS目 录 01模型训练硬件利用率影响因素 02分布式训练效率提升 03FP8训练经验分享 04MoE训练经验分享 05Goodput提升 06总结与展望 模型训练硬件利用率影响因素 Llama 3.1 •92页的技术报告 •最大405B的模型•16K H100训练集群•54天的预训练,466次任务中断 https://arxiv.org/pdf/2407.21783 MFU •Model FLOPS Utilization,模型算力利用率•FLOPS (Floating Point Operations Per Second) 푀�=표푏푠푒푒怀�ℎ표ℎ푝��ℎ푒표푒�㘴㘱൭푚㘱푥푚푚�ℎ표ℎ푝� Goodput •A metric to measure AI system efficiency (Google) •Scheduling Goodput•Runtime Goodput•Program Goodput 分布式训练效率提升 Data Parallelism •DDP: Distributed Data Parallel •模型较小,数据量较大 Tensor Parallelism •Megatron-LM-1 •拆分均匀,但通信量大 Pipeline Parallelism •GPipe (Google), PipeDream (Microsoft)•Megatron-LM-2•通信量低,但会引入bubble Expert Parallelism •Switch Transformers (Google) •Megatron Expert Parallelism Context Parallelism RingAttention •(a) Outer loop: computing blockwise attention amongdevices•(b) Inner loop: every device computes blockwise attention and feedforwardoperations Ring Attention •基本原理:Onlinesoftmax •性能问题:负载不均衡 RingAttention •原版VS负载均衡版 SWA+CP •Sliding Window Attention + Context Parallel •不同情况序列长度的问题 •如何复用高性能Attention算子(如FlashAttention)•模基共建 •如何与FullAttention+CP混合使用 其它优化 •通信计算并行 FP8训练经验分享 FP8训练简介 •E4M3: 1 sign bit, 4 exponent bits and 3 bits of mantissa.+/-448 and nan. •E5M2: 1 sign bit, 5 exponent bits and 2 bits of mantissa. +/-57344, +/- inf FP8训练简介 •部分计算采用FP8•前向用E4M3,反向用E5M2 •缩放方式 •Just-in-time scaling•Delayed scaling FP8训练实践 MoE训练经验分享 MoE结构 •Switch Transformers (Google) 细粒度专家和共享专家 •DeepSeekMoE•通信计算并行 Top-P路由实现 •Dynamic Routing in MoE Models 其它优化 •算子融合•细粒度重计算•自定义流水线并行层数划分•... Goodput优化 Goodput定义回顾 自研集群训推任务调度系统 拓扑亲和调度 故障监控与定位 FastCkpt •基本原理•GPU内存到CPU内存,同步 •持续优化•分布式优化器的切分 •xxx任务效果•每次保存ckpt的额外耗时趋近于0•Goodput提升15% •CPU内存到磁盘,异步 •多种分布式策略的适配 总结与展望 总结与展望 MFU Goodput •分布式训练效率提升•DP/TP/PP/EP/CP及其优化 •训推任务调度系统•拓扑亲和调度•故障监控与定位 •FP8训练经验分享•FP8训练介绍/实践 •FastCkpt •MoE训练经验分享•MoE介绍•MoE系列优化 •基本原理•持续优化•提升效果 THANKS 智能未来,探索AI无限可能Intelligent Future, Exploring theBoundless Possibilities of AI