DYNAMITE: Dynamic Interplay of Mini-Batch Size and Aggregation Frequency for Federated Learning with Static and Streaming Dataset

Weijie Liu, Xiaoxi Zhang, Jingpu Duan, Carlee Joe-Wong, Zhi Zhou, Xu Chen · DOI

TL;DR

DYNAMITE is a novel framework that jointly optimizes mini-batch sizes and aggregation frequency to balance the three-way trade-off between model accuracy, training time, and resource cost in Federated Learning (FL). By deriving new convergence bounds that account for heterogeneous edge resources and dynamic data streams, the authors provide an adaptive algorithm that significantly outperforms standard FL methods in both cost-sensitive and time-sensitive scenarios.

What Problem Does This Paper Address?

Federated Learning (FL) typically involves training models across a vast array of edge devices (like smartphones or IoT sensors) without moving their raw data to a central server. This presents two major hurdles:

  1. Statistical Heterogeneity: Data is often non-i.i.d. (not independent and identically distributed); one device might have thousands of photos of cats, while another has ten photos of cars.
  2. System Heterogeneity: Devices have vastly different computing power, battery lives, and network speeds.

Most existing research treats hyperparameters like mini-batch size ($s$) and aggregation frequency ($\tau$) as static or optimizes them in isolation. However, these parameters are deeply intertwined. A larger batch size might improve local accuracy but increase energy consumption and training time. Fewer aggregations save communication costs but can lead to "local bias," where individual models drift too far apart. DYNAMITE tackles the challenge of navigating these trade-offs dynamically, especially when dealing with live data streams and fluctuating network conditions.

Methods

The authors propose a two-pronged approach:

  • New Convergence Analysis: They established a new theoretical upper bound for training error that explicitly incorporates heterogeneous batch sizes across clients and the number of local updates. This bound quantifies two key sources of error: "gradient variance loss" (noise from small batches) and "local bias" (drift between global and local models).
  • CoOptFL (Offline Optimization): For scenarios with known system stats, they derived closed-form solutions for optimal uniform parameters. Crucially, they developed an $O(N^2\tau_{max})$ algorithm to assign heterogeneous batch sizes. A key finding here is that the optimal batch size for a client $i$ is proportional to $\sqrt{M_i D_i}$, where $M_i$ represents gradient variance and $D_i$ is the local dataset size.
  • DYNAMITE (Online Adaptive Control): This is the "live" version of the algorithm. It estimates model parameters (like smoothness and gradient divergence) and system states (like current latency) on the fly. It uses a marginal error bound to decide the best $s$ and $\tau$ for the next round to maximize the accuracy gain per unit of cost or time.
  • Reservoir Sampling: To handle streaming data with limited on-device buffers, they integrated reservoir sampling to ensure that the data used for training remains an unbiased representation of the entire stream, preventing "catastrophic forgetting."

![Fig.

  1. Left: Interplay of batch size and aggregation frequency; Right: Different batch sizes among clients with various computation and communication capabilities.](/figures/art_50d02520692f464aa39d72f077e7a1a8)

Datasets

The researchers evaluated their framework using three standard machine learning benchmarks:

  • MNIST: Handwritten digits (used with Squared-SVM and CNN).
  • EMNIST: An extended version of MNIST including letters.
  • CIFAR-10: A collection of images for object recognition (used with a 9-layer CNN).

To simulate real-world edge dynamics, they transformed these static datasets into dynamic data streams with three arrival patterns: Smooth (constant rate), Burst (sudden influx of data), and Random (uncertain timing and quantity).

Key Insights and Ideas

  • The $\sqrt{M_i D_i}$ Heuristic: The paper moves beyond the common "no-straggler" principle, which simply equalizes training time across devices. DYNAMITE shows that if a device has very diverse, high-variance data ($M_i$), it needs a larger batch size to contribute effectively to the global model, even if that makes it a bit slower.
  • Joint Optimization is Non-Linear: The relationship between batch size and aggregation frequency isn't a simple trade-off. As the number of communication rounds ($K$) increases, the optimal strategy shifts: early on, you might prefer more local updates ($\tau$) to make progress; later, you should decrease $\tau$ and increase batch size to fine-tune the model and reduce bias.
  • Buffer Management Matters: In streaming scenarios, the choice of sampling (Reservoir vs. FIFO vs. Random) is critical. Biased sampling in continuous streams leads to catastrophic forgetting, where the model "forgets" old classes as new ones arrive. Reservoir sampling proved essential for stability.

Key Results

The experimental results across various testbeds (including a 20-node geo-distributed VM cluster) were impressive:

  • Cost Efficiency: In cost-dominant scenarios, DYNAMITE achieved 2.7%–7.9% higher accuracy than vanilla FedAvg while reducing costs by 37.6%–58%.
  • Time Savings: In time-constrained settings, it reached target accuracy with 39.4%–63.8% less completion time.
  • Robustness to Bursts: DYNAMITE successfully adapted to "bursty" data arrivals, showing a much smoother convergence curve and faster "reboot" in accuracy compared to baselines that use fixed hyperparameters.

Limitations and Future Work

  • Theoretical Assumptions: The convergence proofs rely on standard assumptions like $\beta$-smoothness and the Polyak-Łojasiewicz (PL) condition. While these are common in literature, they may not perfectly capture the behavior of extremely deep or complex neural networks.
  • Client Selection: The current work focuses on optimizing parameters for a given set of clients. The authors mention that future work could more deeply integrate dynamic client selection (deciding which devices participate) with hyperparameter tuning.
  • Metadata Overhead: The online estimation requires clients to send small amounts of additional metadata (like estimated gradient variance) to the server. While small compared to model weights, this could be optimized further for extremely bandwidth-limited environments.

For a summary of the mathematical notation used throughout the paper, see the table below:

TABLE 1: Main notations

Summary updated

BibTeX
@article{liu2024dynamite,
  author = {Weijie Liu and Xiaoxi Zhang and Jingpu Duan and Carlee Joe-Wong and Zhi Zhou and Xu Chen},
  title = {{DYNAMITE: Dynamic Interplay of Mini-Batch Size and Aggregation Frequency for Federated Learning with Static and Streaming Dataset}},
  journal = {IEEE Trans. Mobile Computing},
  year = {2024},
  doi = {10.1109/tmc.2023.3337016},
}
Figure