[Paper Review] Latency-aware Spatial-wise Dynamic Networks
This paper proposes LASNet, a latency-aware spatial-wise dynamic network that improves practical inference efficiency by co-designing coarse-grained spatially adaptive inference with a hardware-aware latency predictor. By optimizing both algorithm design and scheduling strategies for multi-core GPUs, LASNet reduces ResNet-101 inference latency by 36% on Tesla V100 and 46% on Jetson TX2 without accuracy loss.
Spatial-wise dynamic convolution has become a promising approach to improving the inference efficiency of deep networks. By allocating more computation to the most informative pixels, such an adaptive inference paradigm reduces the spatial redundancy in image features and saves a considerable amount of unnecessary computation. However, the theoretical efficiency achieved by previous methods can hardly translate into a realistic speedup, especially on the multi-core processors (e.g. GPUs). The key challenge is that the existing literature has only focused on designing algorithms with minimal computation, ignoring the fact that the practical latency can also be influenced by scheduling strategies and hardware properties. To bridge the gap between theoretical computation and practical efficiency, we propose a latency-aware spatial-wise dynamic network (LASNet), which performs coarse-grained spatially adaptive inference under the guidance of a novel latency prediction model. The latency prediction model can efficiently estimate the inference latency of dynamic networks by simultaneously considering algorithms, scheduling strategies, and hardware properties. We use the latency predictor to guide both the algorithm design and the scheduling optimization on various hardware platforms. Experiments on image classification, object detection and instance segmentation demonstrate that the proposed framework significantly improves the practical inference efficiency of deep networks. For example, the average latency of a ResNet-101 on the ImageNet validation set could be reduced by 36% and 46% on a server GPU (Nvidia Tesla-V100) and an edge device (Nvidia Jetson TX2 GPU) respectively without sacrificing the accuracy. Code is available at https://github.com/LeapLabTHU/LASNet.
Motivation & Objective
- Address the gap between theoretical FLOPs and practical inference latency in spatial-wise dynamic networks.
- Overcome the inefficiency of fine-grained pixel-level adaptive inference on multi-core processors like GPUs due to non-contiguous memory access and suboptimal scheduling.
- Develop a generalizable framework that enables real-world speedup across diverse hardware platforms and deep learning tasks.
- Integrate latency prediction into algorithm and scheduling design to guide efficient deployment of dynamic networks.
- Achieve significant practical speedup while preserving model accuracy on image classification, object detection, and instance segmentation benchmarks.
Proposed method
- Propose a latency prediction model that jointly estimates inference latency by considering algorithm design, scheduling strategy, and hardware properties.
- Introduce coarse-grained spatially adaptive inference, where computation is allocated per feature patch instead of per pixel, improving memory access contiguity.
- Design a trainable masker module to predict which feature patches require computation based on input content.
- Optimize scheduling and kernel implementation for dynamic operators to better exploit GPU parallelism and memory hierarchy.
- Use the latency predictor during training to guide the network to learn efficient computation patterns tailored to target hardware.
- Integrate the framework into various CNN backbones (e.g., ResNet, DenseNet, RegNet) for broad applicability.
Experimental results
Research questions
- RQ1Why do theoretical FLOPs fail to predict real inference latency in spatial-wise dynamic networks on GPUs?
- RQ2How does the granularity of spatially adaptive inference (pixel-level vs. patch-level) affect practical latency on multi-core processors?
- RQ3Can a hardware-aware latency predictor effectively guide the design of efficient dynamic networks across different devices?
- RQ4To what extent can coarse-grained spatial adaptation improve practical inference speed without sacrificing model accuracy?
- RQ5Can the proposed framework be generalized across different deep learning tasks and backbone architectures?
Key findings
- LASNet reduces ResNet-101 inference latency by 36% on NVIDIA Tesla V100 and 46% on NVIDIA Jetson TX2 GPU without accuracy degradation on ImageNet.
- On COCO object detection, LAS-ResNet-101 with a training target of 0.4 achieves 40.0% mAP in Faster R-CNN and 39.3% in RetinaNet, with latency 25–30% lower than the static baseline.
- For instance segmentation, LAS-ResNet-101 with a training target of 0.5 improves AP^mask by 0.9% and AP^box by 1.0% over the baseline while maintaining faster inference.
- The latency predictor enables accurate latency estimation across diverse hardware, including server and edge GPUs, facilitating hardware-aware model design.
- Coarse-grained spatial adaptation significantly improves memory access patterns, enabling better utilization of GPU parallelism compared to fine-grained pixel-level decisions.
- The framework is generalizable: it can be applied to various backbones and tasks, including image classification, object detection, and instance segmentation, with consistent efficiency gains.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.