Abstract
Embedded systems often face fluctuating hardware resources due to background tasks or thermal throttling. Dynamic-OFA addresses this by allowing deep learning models to adapt their architecture at runtime. By leveraging pre-trained "Once-for-all" (OFA) networks, the system identifies optimal sub-networks for different hardware states and switches between them in milliseconds without retraining. Experimental results show that Dynamic-OFA outperforms state-of-the-art dynamic models by up to 3.5x in speed while maintaining higher accuracy.
Introduction: The Challenge of Resource Volatility
In embedded environments—such as smartphones, drones, or IoT gateways—hardware resources are rarely static. While Neural Architecture Search (NAS) can find an "optimal" model for a specific hardware configuration, this optimization often fails when system conditions change, such as when a new application starts or the device throttles its frequency to save power.
Existing dynamic DNNs attempt to address this by scaling dimensions like width on the fly. However, they typically require expensive specialized training pipelines and lack the flexibility to adapt to the fundamentally different architectural requirements of CPUs versus GPUs (e.g., deep/narrow vs. shallow/wide).
Methodology: The Dynamic-OFA Framework
Dynamic-OFA treats a pre-trained Once-for-all (OFA) network as a vast library of over $2 \times 10^{19}$ potential architectures. The framework operates in two distinct phases:
- Offline Sampling: The system uses an improved random search algorithm to identify a "family" of sub-networks on the Pareto-front, representing the best accuracy-latency trade-offs. This search is performed independently for CPU and GPU targets. Crucially, Batch-Normalization (BN) statistics are pre-calculated and stored for these sub-networks, reducing runtime overhead.
- Online Runtime Management: A runtime manager monitors execution latency and hardware state. When resource availability changes, it uses a lookup table to instantly switch to the most appropriate pre-sampled sub-network.
Experimental Setup
The approach was evaluated using the ImageNet dataset with a MobileNetV3-based OFA backbone. Accuracy was measured on the ImageNet 50K validation set, and batch-norm calibration utilized a subset of 2,000 images. Testing was conducted on an Nvidia Jetson Xavier NX platform.
Key Results and Performance
Dynamic-OFA demonstrates significant improvements over state-of-the-art dynamic models such as AutoSlim and MutualNet. On the Nvidia Jetson Xavier NX, the system achieved:
- Speedup: Up to 3.5x faster on CPU and 2.4x faster on GPU for equivalent Top-1 accuracy.
- Accuracy Gains: At similar latencies, it provides 3.8% higher accuracy on CPU and 5.1% higher on GPU.
- Switching Efficiency: The total runtime switching overhead is approximately 73ms, with parameter loading taking only 2ms.
Discussion and Key Insights
The success of Dynamic-OFA stems from several key innovations:
- Zero-Retraining Dynamicism: By sampling from a static "super-network," dynamic behavior is achieved without additional training.
- Multi-Dimensional Scaling: Unlike prior methods limited to width adjustment, Dynamic-OFA adapts across depth, width, kernel size, and input resolution. This allows the model to find the specific "shape" (e.g., deep/narrow vs. shallow/wide) that best suits the current processor's architecture.
- BN Parameter Pre-calculation: Recalculating Batch-Normalization statistics at runtime is a major bottleneck. By pre-storing these statistics for specific levels, the system reduces switching overhead to a negligible amount.
Conclusion and Future Work
Dynamic-OFA provides a robust solution for maintaining DNN performance on heterogeneous embedded platforms under varying workloads. While it requires a slightly larger memory footprint to store BN parameters, the overhead is negligible (approx. 2KB per level). Future research will explore extending this framework to other domains, including Transformers for NLP, GANs, and 3D point cloud processing.
Summary updated