TL;DR
NNV12 is the first inference engine specifically designed to optimize "cold inference"—the slow process of loading and initializing a deep learning model from disk before its first execution. By intelligently selecting kernels, caching transformed weights, and pipelining operations across asymmetric mobile processors, NNV12 achieves up to 15.2× speedup on mobile CPUs and a staggering 401.5× on edge GPUs compared to state-of-the-art engines like TFLite.
What Problem Does This Paper Address?
Most deep learning research focuses on "warm inference," where a model is already loaded into memory and ready to run. However, in the real world of mobile and IoT devices, hardware resources are tightly constrained. Operating systems frequently kill background apps to save memory, and many apps (like OCR scanners or beauty filters) only use models sporadically.
When a model isn't already in RAM, the device must perform a "cold start": reading weights from disk, allocating memory, transforming those weights into an execution-ready format, and finally executing the model. The authors found that for popular engines like ncnn and TFLite, cold inference can be 1.5× to 443× slower than warm inference. This creates a significant "lag" that hurts user experience, yet existing engines ignore the loading and transformation overhead entirely.
Methods
The authors introduce NNV12, a system that treats the entire loading-to-execution pipeline as an optimization problem. They leverage three primary "knobs":
- Cold-Aware Kernel Selection: Standard engines choose the fastest kernel for execution (e.g., Winograd-based convolution). However, Winograd requires a heavy weight transformation step. NNV12 might choose a slightly slower execution kernel (like SGEMM) if its transformation cost is significantly lower, resulting in a faster total "cold" time.
- Post-Transformed Weight Caching: To bypass the transformation bottleneck, NNV12 can store the already-transformed weights on disk. This trades off disk space for a massive reduction in initialization time.
- Pipelined Execution: Mobile devices typically use asymmetric "big.LITTLE" architectures. NNV12 pipelines the process: while the "big" cores are executing the current layer, the "little" cores are busy reading and transforming weights for the next layer.
To manage the massive search space of these combinations, the authors developed a heuristic-based kernel scheduler that balances workloads across cores and accounts for disk I/O interference.
Datasets (Models & Hardware)
The paper evaluates NNV12 using 12 popular CNN models spanning classification, object detection, and OCR, including:
- AlexNet, GoogLeNet, ResNet-18/50, MobileNet v1/v2, ShuffleNet v1/v2, SqueezeNet, and EfficientNet-B0.
- MobileNetv2-YOLOv3 and MobileNet-YOLO.
- CRNN-lite.
Hardware Platforms: * Smartphones: Meizu 16T (Snapdragon 855), Google Pixel 5 (Snapdragon 765G), Redmi 9, and Meizu 18 Pro. * Edge GPU Boards: NVIDIA Jetson TX2 and Jetson Nano.
Key Insights and Ideas
- The "Fastest" isn't always the Best: The most surprising insight is that the industry-standard kernels optimized for warm inference are often the worst choices for cold starts because they front-load too much computational work into the transformation phase.
- I/O is the Real Bottleneck: On mobile devices, weight transformation is often bottlenecked by memory and disk I/O rather than raw compute. This makes multithreading transformation less effective than pipelining it with execution.
- GPU Prep is Brutal: On GPUs, "cold start" includes shader compilation and driver setup, which can take seconds. NNV12 addresses this by caching compiled shaders on disk.
- Asymmetry is an Asset: Instead of seeing big.LITTLE cores as a load-balancing headache, NNV12 uses the "little" cores as dedicated I/O and transformation pre-fetchers, keeping the "big" cores fed with ready-to-execute data.
Key Results
- CPU Speedups: On a Meizu 16T, NNV12 reduced cold inference latency by an average of 3.7× over
ncnnand 7.5× overTFLite. - GPU Speedups: The improvements on edge GPUs were even more dramatic due to shader caching and pipeline optimization, reaching up to 401.5× faster than TensorFlow on the Jetson Nano.
- Energy Efficiency: Because NNV12 finishes the task much faster, it reduces total energy consumption by 0.2× to 0.6× compared to standard engines.
- Near-Warm Performance: In some optimized cases (like ShuffleNetV2), NNV12 makes the cold start latency almost indistinguishable from a warm start.
Limitations and Future Work
- Storage Overhead: Caching post-transformed weights increases the app's disk footprint (e.g., ResNet-50 requires ~90MB of extra storage). While tolerable on modern phones, it might be an issue for ultra-constrained IoT devices.
- CNN Focus: The current prototype and evaluation focus heavily on Convolutional Neural Networks (CNNs). While the principles apply to Transformers (LLMs), the paper does not explicitly test them.
- Hardware Dynamics: While NNV12 includes a "workload stealing" technique to handle background noise from other apps, highly volatile system loads can still disrupt the optimal pipeline schedule. Future work could involve tighter integration with the OS scheduler.
Summary updated