Open Source 开源项目 10h ago Updated 10h ago 更新于 10小时前 50

GEM Training: How Meta Doubled the Efficiency of Its LLM-Scale Ads Foundation Model GEM训练:Meta如何将其LLM规模广告基础模型的效率提高一倍

Meta's GEM (Generative Ads Recommendation Model) now trains at LLM scale on thousands of GPUs, doubling E2E training efficiency to 20-25% MFU while scaling training FLOPs 4x in 12 months Custom kernel library (Jagged Flash Attention, GDPA, BlockAttention) and mixed ultra-low precision training (MXFP8) were co-designed specifically for recommendation workloads Topology-aware 5D parallelism with SM-free collectives combines 2D FSDP + Expert Parallelism for dense parameters with Fully Sharded 2D Mo Meta的GEM广告推荐模型已实现LLM级别的千卡规模训练,端到端训练效率翻倍至20-25% MFU,训练算力12个月内增长4倍 针对推荐系统独特的混合架构(万亿级稀疏嵌入+十亿级稠密参数)和Jagged输入特征,设计了定制化kernel库(JFA、GDPA、BlockAttention等) 采用拓扑感知的5D并行策略(2D FSDP + Expert Parallelism + Fully Sharded 2D Model Parallelism),结合SM-free collectives优化通信开销 创新性地应用混合超低位精度训练(MXFP8 attention和MLP),在保持CTR/

68
Hot 热度
78
Quality 质量
72
Impact 影响力

Analysis 深度分析

TL;DR

  • Meta's GEM (Generative Ads Recommendation Model) now trains at LLM scale on thousands of GPUs, doubling E2E training efficiency to 20-25% MFU while scaling training FLOPs 4x in 12 months
  • Custom kernel library (Jagged Flash Attention, GDPA, BlockAttention) and mixed ultra-low precision training (MXFP8) were co-designed specifically for recommendation workloads
  • Topology-aware 5D parallelism with SM-free collectives combines 2D FSDP + Expert Parallelism for dense parameters with Fully Sharded 2D Model Parallelism for sparse parameters
  • Recommendation model training faces fundamentally different challenges than LLMs: jagged inputs, asymmetric attention patterns, memory-bound operations, and numerical sensitivity
  • Standard LLM-optimized infrastructure does not transfer directly to recommendation systems, requiring significant hardware/software co-design innovation

Why It Matters

This work represents a critical milestone in extending LLM-scale training techniques to recommendation systems, which power some of the most commercially impactful AI products (Meta's ad platform). The co-design approach demonstrates that one-size-fits-all infrastructure solutions are insufficient — different AI workloads require purpose-built optimization strategies. For practitioners, this highlights the growing importance of understanding the unique computational characteristics of non-LLM workloads as models continue to scale.

Technical Details

  • Hybrid Architecture: GEM combines trillions of sparse embedding parameters with billions of dense parameters, processing both sequence features (user activity history) and non-sequence features (location, ad creative) with customized attention mechanisms and cross-feature learning
  • Compute Efficiency Innovations: Custom kernel library including Jagged Flash Attention (JFA) for variable-length sequences, Generalized Dot-Product Attention (GDPA), BlockAttention, and mixed ultra-low precision training (MXFP8 attention and MLP) optimized for recommendation-specific patterns
  • Scaling Efficiency: Topology-aware 5D parallelism with SM-free collectives — 2D FSDP + Expert Parallelism for dense parameters, Fully Sharded 2D Model Parallelism for sparse parameters — co-designed with Meta's multi-tiered network hierarchy
  • Key Challenges Addressed: Jagged inputs (variable sequence lengths wasting up to 50% compute if padded), asymmetric attention patterns (self-attention: long sequences/short window; cross-attention: long queries/short KV; PMA: short queries/long KV), memory-bound operations with small embedding dimensions, and numerical sensitivity of CTR/CVR prediction tasks
  • Efficiency Framework: E2E MFU = Local MFU (compute efficiency) × Scaling Ratio (scaling efficiency), decomposing the optimization into two distinct but related problems

Industry Insight

  • The boundary between recommendation systems and LLMs is blurring — as rec models scale to foundation model sizes, they require fundamentally different infrastructure than text-based LLMs, creating a new specialization opportunity in AI systems engineering
  • Hardware/software co-design is becoming essential at scale; Meta's approach of building purpose-built kernels and precision schemes for specific workload characteristics suggests that generic frameworks will increasingly hit diminishing returns for non-standard AI applications
  • The 4x FLOPs scaling with doubled efficiency in 12 months demonstrates that significant gains are still achievable through systems-level optimization, not just model architecture improvements — a reminder that infrastructure investment remains a high-leverage strategy for organizations training large models

TL;DR

  • Meta的GEM广告推荐模型已实现LLM级别的千卡规模训练,端到端训练效率翻倍至20-25% MFU,训练算力12个月内增长4倍
  • 针对推荐系统独特的混合架构(万亿级稀疏嵌入+十亿级稠密参数)和Jagged输入特征,设计了定制化kernel库(JFA、GDPA、BlockAttention等)
  • 采用拓扑感知的5D并行策略(2D FSDP + Expert Parallelism + Fully Sharded 2D Model Parallelism),结合SM-free collectives优化通信开销
  • 创新性地应用混合超低位精度训练(MXFP8 attention和MLP),在保持CTR/CVR预测精度的同时大幅提升计算效率
  • 推荐系统训练无法直接复用LLM基础设施,需要硬件/软件协同设计解决GPU利用率低、通信瓶颈、负载不均衡等独特挑战

为什么值得看

本文首次系统性地展示了如何将LLM级别的训练效率技术迁移到推荐系统领域,为万亿参数推荐模型的分布式训练提供了可复用的工程范式。对AI基础设施工程师和推荐系统研究者而言,文中提出的Jagged输入优化、混合精度训练和5D并行策略具有重要的实践指导价值。

技术解析

  • 定制化Kernel库:针对推荐数据Jagged特性(序列长度变化大),设计了Jagged Flash Attention (JFA)、Generalized Dot-Product Attention (GDPA)和BlockAttention等专用kernel,避免padding导致的50%计算浪费,解决长短序列不对称的attention模式(self-attention长序列短窗口、cross-attention长query短KV、PMA短query长KV)的GPU利用率问题。

  • 混合超低位精度训练:采用MXFP8精度的attention和MLP层,在CTR/CVR预测等数值敏感任务上实现精度与效率的平衡,充分利用最新GPU架构的计算能力,显著提升Local MFU。

  • 拓扑感知5D并行策略:稠密参数采用2D FSDP + Expert Parallelism,稀疏参数采用Fully Sharded 2D Model Parallelism,结合Meta多层级网络层次结构进行协同设计,使用SM-free collectives减少通信开销,解决O(Trillion)稀疏参数和O(Billion)稠密参数带来的通信瓶颈。

  • E2E MFU效率框架:提出E2E MFU = Local MFU × Scaling Ratio的分解框架,Local MFU衡量单GPU计算利用率,Scaling Ratio衡量分布式扩展效率,为训练优化提供清晰的量化指标。

行业启示

  • 推荐系统与LLM基础设施融合趋势:万亿参数推荐模型训练正逼近LLM规模,传统推荐系统训练框架需要向LLM级别的分布式训练架构演进,硬件/软件协同设计成为必然选择。

  • Jagged数据处理成为新挑战:推荐数据的非结构化、变长序列特性对GPU计算效率提出独特挑战,专用kernel设计和内存优化策略将成为推荐系统基础设施的核心竞争力。

  • 超低位精度训练的精度边界探索:广告优化任务对数值精度高度敏感,如何在保持预测质量的前提下突破FP16/BF16精度限制,探索FP8甚至更低精度的训练方案,是推荐系统规模化训练的关键突破口。

Disclaimer: The above content is generated by AI and is for reference only. 免责声明:以上内容由 AI 生成,仅供参考。

Training 训练 GPU GPU LLM 大模型 Research 科学研究 Deployment 部署