Dynamic Network Adaptation at Inference

Daniel Mendoza, Caroline TrippelarXiv 2022

TL;DR

This paper introduces SLO-Aware Neural Networks (SLO-NNs), a novel framework that dynamically adapts neural network computation on a per-input basis to meet strict latency and accuracy Service Level Objectives (SLOs). By exploiting inherent per-input activation sparsity, SLO-NNs achieve significant speedups (up to 56.7x) with minimal accuracy loss, enabling a single model to serve diverse SLOs and adapt to dynamic inference environments.

What Problem Does This Paper Address?

Modern machine learning inference systems are critical for a wide range of applications, but they face significant challenges in meeting stringent Service Level Objectives (SLOs), particularly latency and accuracy targets. These challenges stem from several factors:

  • Accuracy-Latency Trade-off: More accurate models often require more computation, leading to higher latency.
  • SLO Diversity: Different applications and even different queries within an application have varying SLO requirements.
  • Evolving SLOs: SLOs can change over time, requiring system adaptation.
  • Unpredictable Query Patterns: Fluctuating query loads can impact performance.
  • Co-location Interference: To improve resource utilization, multiple models are often run on the same hardware, leading to interference that can degrade inference latency and cause SLO violations.

Existing solutions often involve training and managing numerous model variants, which is inefficient and time-consuming, especially when switching models dynamically. This paper aims to address the need for a single, adaptable model that can efficiently meet diverse and dynamic SLOs in real-time inference scenarios.

Methods

The core innovation is the SLO-Aware Neural Network (SLO-NN) architecture. SLO-NNs leverage the observation that individual inputs to neural networks (especially those with ReLU activations) exhibit significant per-input activation sparsity. This means that for a given input, only a subset of neurons are actively contributing to the output.

SLO-NNs introduce a Node Activator at each layer. This component dynamically decides which nodes (neurons) to compute for a given inference query. The decision is based on:

  1. SLO Optimization Target: The system can be configured to prioritize either accuracy (Latency-Constrained Accuracy-Optimized - LCAO) or latency (Accuracy-Constrained Latency-Optimized - ACLO).
  2. Machine Utilization: Information about the current load on the worker machine, which can indicate potential co-location interference.

The Node Activator uses Locality Sensitive Hashing (LSH) to group similar inputs. This allows it to learn and store:

  • Node Importance: For groups of similar inputs, it learns which nodes are most important for accurate predictions. This is achieved by ranking nodes based on their activation magnitudes during an unsupervised training phase.
  • Confidence: It estimates the network's confidence for a given input and dropout configuration.
  • Latency Profiles: It uses pre-computed latency profiles that map the percentage of activated nodes and machine utilization to inference latency.

Based on these learned associations and the current SLO target, the Node Activator determines the optimal percentage of nodes (k) to activate for each query, effectively tuning computation on-the-fly.

Datasets

The paper evaluates SLO-NNs on five datasets:

  • FMNIST: A multi-classification dataset of fashion products.
  • Kitsune: An anomaly detection dataset for network attacks.
  • FMA (Free Music Archive): A music analysis dataset.
  • Wiki10: A collection of Wikipedia articles with tags.
  • AmazonCat-13K: A product-to-product recommendation dataset.
  • Delicious-200K: A dataset generated from social bookmarking systems.

The paper notes that for some datasets (Wiki10, Delicious200k, AmazonCat13k), Node Activators were only applied at the output layer, and the underlying models were not pruned, as pruning the output layer would impact the final prediction.

Key Insights and Ideas

  • Per-Input Sparsity is Key: The most crucial insight is that neural networks are not uniformly computationally intensive for every input. Exploiting this per-input sparsity is the foundation for dynamic adaptation.
  • One Model, Many SLOs: SLO-NNs demonstrate that a single trained model can dynamically adapt to satisfy a wide range of accuracy and latency SLOs, eliminating the need for multiple specialized models.
  • Proactive Interference Mitigation: The LCAO target, by considering machine utilization and latency profiles, allows SLO-NNs to proactively adjust computation to counteract co-location interference, preventing latency SLO violations.
  • LSH as an Efficient Mechanism: Using LSH for grouping similar inputs and associating them with node importance and confidence information provides a low-overhead mechanism for dynamic adaptation.
  • FREEHASH for Efficiency: The paper proposes FREEHASH, an LSH hash function derived from neural network weights, which leverages existing computations and adds minimal overhead.

Key Results

  • Significant Speedups: SLO-NNs achieved average speedups ranging from 1.3x to 56.7x across various datasets and configurations, with minimal accuracy loss (less than 0.3%).
  • Accuracy-Constrained Latency Optimization (ACLO): For high accuracy targets (within 0.3% of the full network), SLO-NNs achieved speedups of 1.1–2.8x for FMNIST, 8.4–15.6x for Wiki10, 1.8–6.9x for AmazonCat13k, 56.7–57.9x for Delicious200k, and 1.2–1.7x for FMA.
  • Latency-Constrained Accuracy Optimization (LCAO): In interfered scenarios, LCAO SLO-NNs could achieve zero latency degradation compared to isolated inference, while maintaining high accuracy. For example, Wiki10, Delicious200k, FMNIST, AmazonCat13k, and FMA showed 0%, 0%, 2.1%, 0.3%, and 4.1% accuracy drop, respectively, while matching un-interfered latency.
  • Low Overhead: The SLO-NN implementation using FREEHASH showed performance comparable to standard PyTorch implementations, demonstrating the practicality of the approach. The Node Activator storage was less than 10% of the neural network size.
  • Outperforming Prior Work: Compared to MONGOOSE (another LSH-based dropout method), SLO-NNs were up to 50% more accurate for the same number of active nodes, attributed to SLO-NNs' use of full node activations during LSH training for more precise node importance ranking.

Limitations and Future Work

  • Focus on MLPs: The current work primarily focuses on Multi-Layer Perceptrons (MLPs). Future work will investigate applying SLO-NNs to other architectures, such as Convolutional Neural Networks (CNNs).
  • Batch Inference: The paper currently focuses on latency-critical online inference with a batch size of 1. Future work will explore batch inference for SLO-NNs, which presents challenges in adaptive batch sizing and scheduling.
  • Scalability and Complexity: Current experiments involve up to two co-located models. Future work aims to scale up evaluations with more complex query patterns, co-location configurations, and hardware platforms.
  • Online Updates: Investigating lightweight online updates to the Node Activator to adapt to shifting query data distributions is planned.
  • Node Ranking Mechanisms: While LSH is used, exploring other node ranking mechanisms is also a future direction.

Summary updated

BibTeX
@misc{mendoza2022dynamic,
  author = {Daniel Mendoza and Caroline Trippel},
  title = {{Dynamic Network Adaptation at Inference}},
  year = {2022},
  eprint = {2204.08400},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2204.08400},
}
Figure