Online Dynamic Batching with Formal Guarantees for LLM Training

📄 arXiv: 2606.19989v1 📥 PDF

作者: Dian Li, Zekun Wang, Yaoru Wang, Jiahong Yan

分类: cs.DC, cs.LG

发布日期: 2026-06-18

备注: 29 pages, 3 figures, 21 tables


💡 一句话要点

提出在线动态批处理以解决LLM训练中的效率问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 在线动态批处理 大规模语言模型 训练效率 分布式训练 数据加载 多模态学习 性能优化

📋 核心要点

  1. 核心问题:现有的离线批处理方法无法有效处理LLM训练中的预处理和增强依赖,导致批次构建盲目且效率低下。
  2. 方法要点:本文提出的在线动态批处理(ODB)系统在数据加载阶段动态形成批次,确保了训练过程中的准确性和效率。
  3. 实验或效果:ODB在多个实验中显示出1.58-4.43倍的吞吐量提升,同时保持与标准方法相当的训练质量。

📝 摘要(中文)

现代大规模语言模型(LLM)训练打破了离线批处理采样器的核心假设:样本的真实训练成本仅在预处理、增强、模板化、标记化和多模态视觉-标记扩展后可观察。为此,本文提出了在线动态批处理(ODB),一个在DataLoader侧的即插即用系统,将批次形成移动到准确可观察的点,同时保持DDP步骤对齐。我们将这一同步要求形式化为分布式组对齐问题,并证明了在默认加入模式下的无死锁有界终止。ODB无需模型、优化器或注意力内核的更改,并以轻量级训练器适配器的形式发布。在多个公共数据集上,ODB在单节点和双节点的全精度训练中显著提高了样本吞吐量,且质量与标准方法相当。

🔬 方法详解

问题定义:本文旨在解决现有LLM训练中批处理构建的低效问题,现有方法在预处理和增强依赖下无法准确评估样本的真实训练成本,导致资源浪费和性能瓶颈。

核心思路:提出在线动态批处理(ODB),通过在数据加载阶段动态形成批次,确保在准确可观察的时刻进行批处理,从而提高训练效率,同时保持DDP步骤的对齐。

技术框架:ODB系统在DataLoader侧实现,主要包括批次形成模块、同步机制和轻量级训练器适配器。通过分布式组对齐问题(DGAP)形式化同步要求,确保无死锁的有界终止。

关键创新:ODB的核心创新在于将批处理形成的时机前移至数据加载阶段,避免了传统方法的盲目性,并且无需对模型或优化器进行修改。

关键设计:ODB采用默认加入模式的身份覆盖和选择性非加入样本配额闭合,确保在不增加额外计算负担的情况下实现高效的批处理形成。

📊 实验亮点

实验结果表明,ODB在单节点全精度训练中提高了1.58-2.51倍的样本吞吐量,在双节点训练中提升至1.71-3.78倍,且在生产环境下的MM-Mix达到了4.43倍的提升,显示出显著的性能优势。

🎯 应用场景

该研究在大规模语言模型的训练中具有广泛的应用潜力,尤其是在需要高效资源利用和快速迭代的场景中,如自然语言处理、对话系统和多模态学习等领域。未来,ODB可能会成为LLM训练的标准工具,推动更高效的模型开发和应用。

📄 摘要(原文)

Modern LLM training breaks a core assumption behind offline batch samplers: the true training cost of a sample is only observable after preprocessing, augmentation, templating, tokenization, and multimodal visual-token expansion. Unless one pays for a preprocessing- and augmentation-dependent length cache, batch construction is therefore blind to the quantity that determines padding, memory use, and GPU saturation. We introduce Online Dynamic Batching (ODB), a DataLoader-side drop-in system that moves batch formation to this point of accurate observability while preserving DDP step alignment. We formalize this synchronization requirement as the Distributed Group Alignment Problem and prove deadlock-free bounded termination with default join-mode identity coverage and opt-in non-join sample-quota closure. ODB requires no model, optimizer, or attention-kernel changes and is released as online-dynamic-batching with lightweight trainer adapters. Across public 2B/8B Qwen3-VL runs on UltraChat/LLaVA/ShareGPT4o, ODB improves literal emitted-sample throughput vs. fixed-batch Standard by 1.58-2.51x on single-node Full FT/LoRA and 1.71-3.78x on two-node Full FT, with Standard-comparable quality; production MM-Mix reaches 4.43x. Against GMT/BMT offline token-budget oracles, ODB is within 15% on UltraChat/LLaVA and faster on high-CV ShareGPT4o: 2.24-2.39x single-node Full FT/LoRA and 3.06-3.69x two-node Full FT. Together, ODB occupies the online/drop-in regime for high-heterogeneity LLM fine-tuning: large throughput gains at Standard-comparable quality, formal DGAP guarantees, and no length-cache precompute or kernel rewrites.