Learning a Code: Machine Learning for Approximate Non-Linear Coded Computation

Jack Kosaian, K. V. Rashmi, Shivaram VenkataramanarXiv 2018

Introduction

Distributed machine learning inference is increasingly common in cloud services, where workloads are spread across numerous compute nodes to meet high demand. However, this scale introduces the "straggler" problem: individual nodes that fail or experience transient slowdowns can delay the entire system, causing violations of strict latency Service Level Agreements (SLAs).

Traditionally, systems researchers have used coded computation to mitigate this. By applying erasure codes to input data, they create redundant "parity" tasks. If a node fails, its output can be mathematically reconstructed from the remaining nodes. While effective, traditional coding theory is mathematically restricted to linear operations, such as matrix multiplication. Modern deep learning models are inherently non-linear, utilizing functions like ReLU and max-pooling that break traditional codes. This paper introduces a novel framework that learns neural network-based encoders and decoders to bring the resilience of coded computation to non-linear neural network inference.

The Learned Coded Computation Framework

Instead of relying on handcrafted mathematical constructs, the authors propose leveraging the universal approximation capabilities of neural networks to learn an encoding function ($\mathcal{E}$) and a decoding function ($\mathcal{D}$).

Overview of the learned coded computation pipeline.

As illustrated in the figure above, the pipeline operates in three stages:

  1. Encoding: The encoder $\mathcal{E}$ takes $k$ input data samples (e.g., images) and generates $r$ redundant parity samples ($P_1, \dots, P_r$).
  2. Computation: The base model $\mathcal{F}$ (the non-linear neural network being protected) processes all $k+r$ inputs on separate distributed nodes.
  3. Decoding: If up to $r$ nodes fail, the decoder $\mathcal{D}$ takes the available outputs from $\mathcal{F}$ and produces an approximate reconstruction of the missing predictions.

Training Methodology: The encoder and decoder are trained together via backpropagation directly through the frozen base model $\mathcal{F}$. The loss function is designed to minimize the difference between the decoder's reconstruction and the base model's actual output (using Mean Squared Error or KL-divergence) or the ground truth label (using Cross-Entropy).

Encoder Architectures

The authors evaluated two distinct encoder designs to handle different data complexities and spatial requirements.

Comparison between MLPEncoder and ConvEncoder architectures.
  • MLPEncoder: A simple fully-connected network that treats inputs as flattened vectors. While effective for simple datasets like MNIST, it tends to overfit on more complex data.
  • ConvEncoder: A convolutional neural network that utilizes dilated convolutions. This design is crucial for image data as it exponentially increases the receptive field without requiring downsampling or upsampling bottlenecks, which can destroy the spatial information necessary for accurate encoding.

Key Insights and Results

The research demonstrates that approximate reconstruction is a powerful paradigm for ML inference. Unlike traditional codes that require bit-for-bit accuracy, neural networks can recover "good enough" predictions that maintain high classification accuracy.

Experimental Performance

The approach was tested on standard benchmarks using a ResNet-18 base model:

  • MNIST: Achieved 95.71% recovery accuracy with 20% redundancy ($k=5, r=1$).
  • Fashion-MNIST: Achieved 82.77% recovery accuracy with 20% redundancy.
  • CIFAR-10: Achieved 80.74% recovery accuracy, though this required 50% redundancy ($k=2, r=1$) due to the increased complexity of the images.

Smart Degradation

A significant finding is that the learned codes exhibit "smart degradation." The system is approximately 2.2x more accurate at recovering predictions for samples that the base model classifies correctly compared to those it misclassifies. This suggests the code naturally prioritizes the preservation of high-confidence, useful features. Furthermore, when the decoder fails to match the top prediction exactly, it matches the base model's 2nd or 3rd highest-ranked prediction roughly 79% of the time.

Conclusion and Future Work

This work proves the feasibility of using machine learning to protect non-linear computations from node failures. While the current implementation focuses on image classification, the framework is generalizable to other domains like Natural Language Processing. Future research will focus on optimizing the computational overhead of the encoder and decoder to ensure the time spent on coding is significantly less than the latency saved by avoiding stragglers.

Summary updated

BibTeX
@misc{kosaian2018learning,
  author = {Jack Kosaian and K. V. Rashmi and Shivaram Venkataraman},
  title = {{Learning a Code: Machine Learning for Approximate Non-Linear Coded Computation}},
  year = {2018},
  eprint = {1806.01259},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1806.01259},
}
Figure