Dynamic DNNs and Runtime Management for Efficient Inference on Mobile/Embedded Devices

Lei Xun, Jonathon S. Hare, Geoff V. MerrettarXiv 2024 · DOI

TL;DR

This paper proposes a co-designed framework that combines Dynamic Super-networks with a Runtime Management Layer to optimize deep learning on mobile and embedded devices. By dynamically selecting model sub-networks and adjusting hardware settings (like frequency and voltage) in real-time, the system achieves significant energy savings and speedups compared to traditional static deployment methods.

The Challenge of Dynamic Environments

Deploying Deep Neural Networks (DNNs) on mobile devices is a "moving target" problem. The authors identify two primary challenges:

  1. Runtime Hardware Availability: Modern mobile chips (SoCs) are shared environments. If another app starts using the GPU, or if the phone gets too hot and throttles its clock speed, a statically optimized model will suddenly fail to meet its latency targets.
  2. Runtime Application Variability: A single model might be used for different tasks. A ChatBot needs instant responses (low latency), while a document translator might prioritize precision (high accuracy). Storing multiple separate models for every possible trade-off is impossible due to the strict memory limits of embedded hardware.

Proposed Methodology

The approach relies on two integrated pillars: Dynamic Super-networks and a Runtime Management Layer.

1. Runtime Management Layer (RTM)

The RTM is the "brain" of the system that sits between the application and the hardware. It monitors real-time metrics like accuracy, latency, temperature, and power consumption. By controlling "Application Knobs" (choosing which sub-network to use) and "Device Knobs" (adjusting DVFS—Dynamic Voltage and Frequency Scaling—and task mapping), it finds the "sweet spot" for performance trade-offs that standalone software or hardware managers would miss.

The three-layer system architecture illustrating the interaction between the application, runtime management, and device layers.

2. Dynamic Super-networks (Dynamic-OFA)

Instead of training many individual models, the researchers use a "Once-For-All" (OFA) approach. They train one large "super-network" that contains many smaller sub-networks within it.

  • Novelty: Unlike previous methods that require expensive retraining, their "Dynamic-OFA" directly samples efficient sub-networks from the backbone to create hardware-specific libraries (for CPU, GPU, and NPU).
  • Mechanism: To switch between "modes," the system applies a "mask" to the super-network weights. This allows it to change its architecture instantly without the massive memory overhead of loading a new model.

Key Results and Evaluation

The system was primarily evaluated using the ImageNet dataset on heterogeneous SoCs, specifically the NVIDIA Jetson Xavier NX platform.

Comparison of Top-1 Accuracy vs. Latency for Dynamic-OFA against other state-of-the-art dynamic and static models.

As shown in the performance analysis, the Dynamic-OFA model is 2.4x faster than state-of-the-art dynamic networks at similar accuracy levels. It achieved a 5.1% higher Top-1 accuracy on ImageNet compared to AutoSlim-MnasNet at similar latencies. Furthermore, compared to the standard Linux "schedutil" governor, this runtime approach achieved:

  • Up to 19% energy reduction and 9% latency reduction for single-model scenarios.
  • A staggering 89% energy reduction and 23% latency reduction when running two models concurrently.

Insights and Future Directions

  • Hardware-Awareness is Non-Negotiable: The most efficient model architecture for a CPU is often completely different from the best architecture for an NPU. The super-network approach allows one set of weights to be "re-interpreted" optimally for each specific core.
  • Masking > Switching: Using bit-masks to "turn off" parts of a super-network allows for nearly instantaneous adaptation to changing system conditions, avoiding the slow and memory-intensive process of switching model files.
  • Future Work: While the current focus is on image classification, the authors are expanding this to Dynamic Transformers for machine translation and other complex tasks. Although Dynamic-OFA pays a small "generality tax" in accuracy compared to fine-tuned static models, its system-level gains make it a superior choice for real-world mobile deployment.

Summary updated

BibTeX
@misc{xun2024dynamic,
  author = {Lei Xun and Jonathon S. Hare and Geoff V. Merrett},
  title = {{Dynamic DNNs and Runtime Management for Efficient Inference on Mobile/Embedded Devices}},
  year = {2024},
  eprint = {2401.08965},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2401.08965},
}
Figure