FastSGD: A Fast Compressed SGD Framework for Distributed Machine Learning

Keyu Yang, Lu Chen, Zhihao Zeng, Yunjun GaoarXiv 2021

TL;DR

This paper introduces FastSGD, a novel framework for compressing gradients in distributed machine learning. By employing a unique combination of reciprocal mapping, logarithm quantization, and adaptive delta encoding for keys, FastSGD significantly reduces communication overhead, leading to up to an 8x faster convergence time compared to existing methods.

What Problem Does This Paper Address?

Training large-scale machine learning models often requires distributing the workload across multiple machines. Stochastic Gradient Descent (SGD) is a cornerstone algorithm for this, but its effectiveness in distributed settings is hampered by the massive amount of gradient information that needs to be communicated between workers. This communication bottleneck limits scalability and increases training time. Existing compression techniques, while helpful, often struggle to achieve high compression ratios without incurring significant computational costs or impacting model convergence. The paper aims to bridge this gap by proposing a fast and efficient compression framework that minimizes both communication and computational overhead.

Methods

FastSGD tackles gradient compression in two main parts: gradient values and gradient keys.

For gradient values, FastSGD employs a three-phase hybrid approach:

  1. Reciprocal Mapper: Original gradient values are transformed into their reciprocals. This step is crucial for the next phase.
  2. Logarithm Quantization: The reciprocal values are then quantized into small integers using a logarithm function. This further reduces the numerical range and thus the storage space required.
  3. Threshold Filter: A threshold is applied to discard gradient elements with small absolute values. This sparsification step significantly reduces the number of elements to be transmitted.

For gradient keys, FastSGD uses a two-phase lossless approach:

  1. Delta Encoding: Instead of transmitting the original keys, FastSGD transmits the difference (delta) between consecutive keys. This is effective because keys in high-dimensional parameter spaces are often close to each other.
  2. Adaptive Binary Encoding: The delta keys are then encoded into a binary format using an adaptive length flag. This allows for efficient representation of varying delta key lengths, minimizing the bits needed for each key.

The framework is designed for linear time complexity, ensuring that the compression and decompression processes are fast.

Datasets

The paper evaluates FastSGD on four public datasets:

  • URL: Used for malicious URL detection.
  • KDD10: Used for predicting student performance.
  • KDD12: Used for predicting user engagement with recommendations.
  • WebSpam: Used for identifying web spam.

These datasets vary in size and number of features, allowing for a comprehensive evaluation of FastSGD's performance across different scenarios.

Key Insights and Ideas

  • Reciprocal mapping as a precursor to quantization: The insight that transforming gradient values to their reciprocals before logarithm quantization allows for a more effective reduction in the numerical range of the values is key. This prepares the values for efficient integer representation.
  • Thresholding for significant compression: The threshold filter is a critical component for achieving high compression ratios. By discarding small gradients, it effectively sparsifies the gradient vector, which is often already sparse in practice.
  • Adaptive binary encoding for keys: Recognizing that delta keys can have varying lengths, the adaptive binary encoding with length flags is a clever way to avoid wasting bits and achieve a more compact representation than fixed-length encoding.
  • Underestimation of gradients is acceptable: The paper leverages the observation that SGD can tolerate underestimated gradients, which is crucial for the lossy compression techniques employed. The threshold filter, combined with other strategies, helps mitigate potential convergence issues.

Key Results

  • Compression Ratio: FastSGD achieves compression ratios of up to 4 orders of magnitude.
  • Convergence Speedup: The framework accelerates convergence time by up to 8x compared to state-of-the-art methods.
  • Efficiency: FastSGD has a linear time complexity (O(D)) for compression and decompression, making it computationally efficient.
  • Space Cost: The average size per gradient key is reduced to 6.04 bits in FastSGD, significantly lower than methods like SketchML (9.95 bits) and Adam (32 bits).
  • Scalability: FastSGD demonstrates good scalability, benefiting from reduced communication overhead as the number of workers increases.
  • Model Quality: Despite aggressive compression, FastSGD achieves comparable or better model quality (minimal loss) than baseline methods.

Limitations and Future Work

  • Hyperparameter Tuning: FastSGD involves several hyperparameters (base b for logarithm quantization, threshold τ, and length flag size l) that require careful tuning for optimal performance. The paper provides guidance on these settings.
  • Communication Bottleneck Assumption: The effectiveness of FastSGD is most pronounced in communication-intensive scenarios. In situations where computation is the primary bottleneck, the overhead of compression might outweigh the benefits.
  • Future Work: The paper suggests that FastSGD can be beneficial for distributed Neural Network models, indicating potential for further exploration in this area. The authors also mention the possibility of further optimizing the adaptive fine-grained delta encoding.

Summary updated

BibTeX
@misc{yang2021fastsgd,
  author = {Keyu Yang and Lu Chen and Zhihao Zeng and Yunjun Gao},
  title = {{FastSGD: A Fast Compressed SGD Framework for Distributed Machine Learning}},
  year = {2021},
  eprint = {2112.04291},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2112.04291},
}
Figure