Hemingway: Modeling Distributed Optimization Algorithms

Xinghao Pan, Shivaram Venkataraman, Zizheng Tai, Joseph GonzalezarXiv 2017

Introduction

Distributed machine learning is often treated as a simple scaling problem: if a training job is slow, add more machines. However, in practice, increasing cluster size often leads to diminishing returns or even performance degradation. Hemingway is a modeling framework designed to navigate this complexity. By separately modeling system-level performance (hardware throughput) and algorithmic convergence (mathematical efficiency), Hemingway predicts the optimal cluster configuration to reach a target error in the minimum wall-clock time.

The Challenge: The Scaling Paradox

In distributed optimization, scaling a job across a larger cluster triggers two opposing effects. First, system dynamics change. While individual iterations typically get faster as work is distributed, communication overhead—the time spent synchronizing data between machines—eventually dominates.

Iteration time as a function of core count, illustrating the 'U-shaped' curve where communication overhead eventually outweighs computation gains.

Second, the mathematical efficiency of the algorithm often degrades. For many popular distributed algorithms, such as mini-batch SGD or CoCoA, increasing parallelism reduces the "progress" made per iteration. While you might process data faster in terms of raw throughput, you require significantly more iterations to reach the same level of accuracy. This "statistical inefficiency" is a major bottleneck that hardware-focused metrics often ignore.

The Hemingway Framework

Hemingway replaces the traditional trial-and-error approach with a data-driven "black-box" model. It decomposes the problem into two independent components:

  1. The System Model ($f(m)$): This model predicts the time taken per iteration based on the number of machines ($m$). It accounts for computation (scaling at $1/m$), communication patterns like broadcasts or shuffles (scaling at $\log(m)$ or $m$), and constant system overheads.
  2. The Convergence Model ($g(i, m)$): This predicts the loss or error after $i$ iterations on $m$ machines. Hemingway fits a linear model (using LassoCV) to data from early runs, using a mix of fractional, polynomial, and logarithmic features to capture the non-linear slowdown in convergence as parallelism increases.

By combining these models—$h(t, m) = g(t/f(m), m)$—the framework can predict the objective value attained after a specific amount of wall-clock time $t$ for any given cluster size.

Key Insights and Predictive Power

A major advantage of Hemingway is its ability to "predict the unseen." By observing an algorithm's performance on a small subset of configurations (e.g., 1, 2, 4, and 8 cores), it can accurately forecast behavior on much larger setups (e.g., 32 or 64 cores) without requiring expensive full-scale runs.

Actual vs. estimated sub-optimality when predicting one iteration ahead, demonstrating the model's high fidelity across various cluster sizes.

Furthermore, the decoupling of system and convergence models allows for modular updates. If the underlying network hardware is upgraded, only the system model needs retraining. Conversely, if the algorithm's hyperparameters are tuned, only the convergence model requires an update.

Experimental Results

The researchers evaluated Hemingway using the MNIST dataset for a binary classification task with a linear Support Vector Machine (SVM) loss function. The experiments, conducted on a YARN cluster, yielded several key findings:

  • High Accuracy: The system-level model predicted iteration times with an error rate of approximately 12%, even when trained on less than 10% of the total data.
  • Optimal Configuration: For the specific MNIST task, Hemingway correctly identified that performance began to degrade after 32 cores. Beyond this point, the increase in communication costs and the decrease in mathematical efficiency outweighed any gains from additional computation.
  • Algorithm Comparison: The framework successfully captured the performance trends of various algorithms, including CoCoA, CoCoA+, and SGD with local updates, allowing for direct comparison of their wall-clock efficiency.

Limitations and Future Directions

While Hemingway provides a robust foundation for modeling distributed ML, several challenges remain. Building the initial model still requires a set of "pilot" experiments, necessitating better experimental design to minimize data collection costs. Currently, the framework is limited to convex optimization; extending these techniques to non-convex domains like Deep Learning is a primary goal for future research. Additionally, the model assumes Bulk Synchronous Parallel (BSP) execution; adapting it for asynchronous systems where machines operate at different speeds presents a significant technical hurdle.

Finally, the authors envision "adaptive scaling," where Hemingway could dynamically adjust cluster sizes during a training run—leveraging high parallelism for initial speed and then narrowing down to fewer cores for higher mathematical precision as the model approaches convergence.

Summary updated

Abstract

Distributed optimization algorithms are widely used in many industrial machine learning applications. However choosing the appropriate algorithm and cluster size is often difficult for users as the performance and convergence rate of optimization algorithms vary with the size of the cluster. In this paper we make the case for an ML-optimizer that can select the appropriate algorithm and cluster size to use for a given problem. To do this we propose building two models: one that captures the system level characteristics of how computation, communication change as we increase cluster sizes and another that captures how convergence rates change with cluster sizes. We present preliminary results from our prototype implementation called Hemingway and discuss some of the challenges involved in developing such a system.
BibTeX
@misc{pan2017hemingway,
  author = {Xinghao Pan and Shivaram Venkataraman and Zizheng Tai and Joseph Gonzalez},
  title = {{Hemingway: Modeling Distributed Optimization Algorithms}},
  year = {2017},
  eprint = {1702.05865},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1702.05865},
}
Figure