Learning Efficient Parameter Server Synchronization Policies for Distributed SGD

Rong Zhu, Sheng Yang, Andreas Pfadler, Zhengping Qian, Jingren ZhouICLR 2020

TL;DR

This paper introduces a Reinforcement Learning (RL) approach to automatically discover optimal synchronization policies for distributed Stochastic Gradient Descent (SGD). By training an agent to decide when worker nodes should "run" or "wait," the authors achieve a 44% average reduction in training time compared to standard policies like BSP or ASP, while demonstrating impressive generalization across different models and datasets.

The Problem: Parameter Server Synchronization

In distributed machine learning using a Parameter Server (PS) architecture, multiple "worker" nodes compute gradients while a central server manages the model parameters. The core challenge is the synchronization policy: how should the server coordinate these workers?

Existing hand-crafted policies face a difficult trade-off:

  • Bulk Synchronous Parallel (BSP): The server waits for every worker to finish. This prevents "stale" gradients but is severely bottlenecked by stragglers (slow workers).
  • Asynchronous Parallel (ASP): Workers never wait. This maximizes hardware utility but introduces high staleness (gradients calculated on old versions of the model), which can slow down or even prevent convergence.
  • Stale Synchronous Parallel (SSP): A middle ground that allows a fixed amount of staleness, but the "optimal" staleness threshold is notoriously difficult to tune manually.

The authors aim to replace these rigid, manual rules with a policy that is adaptive, automatic, and data-driven.

Methods: An RL Approach to Synchronization

The authors formulate synchronization as an RL problem where the Parameter Server acts as the agent.

The Reinforcement Learning framework for parameter server synchronization, showing the agent (two-layer DNN) and the environment (workers and parameter server).
  • The Unified Framework: They first define a mathematical framework that can describe BSP, ASP, and SSP as specific instances of a broader "action" set.
  • State Representation: To ensure the policy generalizes, the state doesn't look at specific gradient values. Instead, it tracks a history of the $H$ most recent iterations, including loss values, the change in loss, and the "staleness" level (how many updates occurred while a worker was busy).
  • Action Space: To keep the search space manageable, they limit the agent to three actions per iteration:
  • Keep all idle workers idle.
  • Allow only the worker that just submitted a gradient to run again.
  • Allow all currently idle workers to run.
  • Reward Function: The reward is simply the negative of the time elapsed ($-\Delta t$). Maximizing this reward is equivalent to minimizing the total training time.
  • Algorithm: They use a standard Deep Q-Learning (DQN) approach with a two-layer neural network. To speed up training, they "warm-start" the model by pre-training it on data generated by existing policies (BSP, ASP, SSP).

Datasets & Experimental Setup

The experiments were conducted in a simulated cluster environment to allow for controlled "straggler" behavior (using Gaussian-distributed sleep times).

  • MNIST: Used for the primary training and evaluation of the RL policy.
  • CIFAR-10: Used to test the policy's ability to generalize to a completely unseen dataset.
  • Model Variations: They tested on various Deep Neural Networks (DNNs) with 0 to 6 hidden layers to evaluate architectural generalization.

Key Insights and Ideas

  • Generalization via Abstraction: By focusing on the dynamics of the training process (loss curves and staleness counts) rather than the specific weights or gradients, the learned policy (RLP) becomes "model-agnostic." A policy trained on a 10-worker cluster can be successfully applied to a 2-worker or 8-worker cluster.
  • Dynamic Staleness: The RL agent learns that staleness is more damaging at the beginning of training when the loss is dropping rapidly. Consequently, it tends to be more "synchronous" early on and more "asynchronous" as the model nears convergence.
  • Low Overhead: The authors found that the time spent on RL inference is negligible—only about 1.4% of the total training time—making it a practical addition to the training pipeline.

Key Results

  • Significant Speedups: RLP reduced training time by 44% on average compared to the best-performing existing policy. Specifically, it was 1.56x faster than BSP and 1.86x faster than ASP.
Relative training time of the learned RL policy (RLP) compared to standard baselines (BSP, ASP, SSP).
  • Superior Resource Utility: In a cluster with multiple stragglers, RLP kept worker idle time down to 8.1%, compared to 54.2% for BSP.
  • Robust Generalization: A policy trained on a simple 1-layer model on MNIST provided a 33% speedup when applied to a 6-layer model on the CIFAR-10 dataset, proving the policy isn't just memorizing one specific task.

Limitations and Future Work

  • Simulated Environment: While simulation allows for rigorous testing of stragglers, the authors acknowledge that real-world network latency and hardware quirks might introduce complexities not captured here.
  • Optimization Scope: The study focused on "plain" SGD. Future work is needed to see how these learned policies interact with more complex optimizers like Adam or those using momentum.
  • Scale: Due to resource constraints, the authors did not test on massive, state-of-the-art models like BERT or large-scale ResNets. Testing the scalability of RLP to hundreds of workers and massive models remains an open area for research.

Summary updated

BibTeX
@inproceedings{zhu2020learning,
  author = {Rong Zhu and Sheng Yang and Andreas Pfadler and Zhengping Qian and Jingren Zhou},
  title = {{Learning Efficient Parameter Server Synchronization Policies for Distributed SGD}},
  booktitle = {International Conference on Learning Representations},
  year = {2020},
  url = {https://openreview.net/forum?id=A1z3VhSAll},
}
Figure