Comparison and Benchmarking of AI Models and Frameworks on Mobile Devices

Chunjie Luo, Xiwen He, Jianfeng Zhan, Lei Wang, Wanling Gao, Jiahui DaiarXiv 2020

TL;DR

This paper introduces AIoTBench, a comprehensive benchmark suite designed to evaluate the inference capabilities of AI models on mobile and embedded devices. By considering a diverse range of popular neural network architectures and popular mobile AI frameworks, AIoTBench provides a unified scoring system (VIPS and VOPS) to rank devices and frameworks, addressing a critical need for standardized performance evaluation in the rapidly growing edge AI market.

What Problem Does This Paper Address?

The proliferation of AI models and the increasing demand for on-device AI inference have created a significant challenge: how to reliably compare and rank the performance of different AI models and frameworks on diverse mobile and embedded hardware. Existing benchmarks like MLPerf Inference and ETH Zurich AI Benchmark have limitations. MLPerf Inference, while robust, requires extensive optimization effort from users, making it less accessible. ETH Zurich AI Benchmark, while evaluating Android smartphones, has a narrower focus on model diversity. This paper addresses the need for an accessible, comprehensive, and standardized benchmark that accounts for both model and framework diversity on mobile devices, enabling fair comparisons and informed decision-making for developers and hardware manufacturers.

Methods

The core of this paper is the introduction of AIoTBench, a benchmark suite with several key components:

  • Diverse Model Architectures: AIoTBench includes six representative neural network architectures: three "heavy-weight" models (ResNet50, InceptionV3, DenseNet121) and three "light-weight" models (SqueezeNet, MobileNetV2, MnasNet). This selection covers a range of complexities and design philosophies.
  • Multiple AI Frameworks: Each model is implemented using three popular frameworks designed for mobile and embedded devices: TensorFlow Lite, Caffe2, and PyTorch Mobile. This allows for evaluation of framework performance on the same hardware.
  • Unified Metrics: To provide a direct comparison and ranking, the authors propose two unified AI scores:
  • Valid Images Per Second (VIPS): Measures the number of images processed per second, weighted by accuracy.
  • Valid FLOPs Per Second (VOPS): Measures the number of floating-point operations processed per second, weighted by accuracy. These metrics aim to capture the trade-off between model accuracy and inference speed.
  • Standardized Dataset: The benchmark uses the ImageNet 2012 classification dataset for evaluation, with a subset of 5000 images (5 per class) to manage testing time on mobile devices.
  • Data Preprocessing: A consistent data preprocessing pipeline is established, including resizing, channel arrangement, and normalization, with specific settings detailed for each model-framework combination.

Datasets

  • Training: Models were trained on the ImageNet 2012 classification dataset. For InceptionV3 in Caffe2, the ImageNet 2015 dataset was used, with labels mapped to ImageNet 2012 for evaluation.
  • Evaluation: The benchmark uses a subset of 5000 images (5 images per class) from the original ImageNet 2012 validation set.

Key Insights and Ideas

  • No One-Size-Fits-All: The benchmark clearly demonstrates that there is no single "best" framework or model for all devices. Performance varies significantly based on the specific model architecture, the device's hardware capabilities (CPU, GPU, NPU), and the chosen framework implementation.
  • Frameworks Matter: Different frameworks can lead to substantial performance differences for the same model on the same hardware. This highlights the importance of framework selection in optimizing on-device AI.
  • NNAPI's Mixed Results: While Android's Neural Networks API (NNAPI) is intended to accelerate AI inference, its effectiveness is not universal. In some cases, it significantly slows down inference or doesn't work at all, particularly for certain operators or model architectures. This suggests that the underlying operator support within NNAPI is a critical factor.
  • Model Complexity vs. Implementation: While lighter models generally perform better, the implementation details and framework optimizations can sometimes lead to surprising results, where a more complex model with a highly optimized framework might outperform a simpler model with a less optimized one.
  • Model Loading Time is Significant: Tensorflow Lite, due to its use of FlatBuffers for serialization, exhibits the fastest model loading times, which is crucial for applications requiring quick startup. Caffe2, with its two-part model structure, is the slowest.

Key Results

The paper presents a comparison of five mobile devices (Samsung Galaxy s10e, Honor v20, Vivo x27, Vivo nex, and Oppo R17) across various model-framework combinations.

  • Top Performers: The Samsung Galaxy s10e and Honor v20 generally achieved the highest AI scores (both VIPS and VOPS), indicating superior overall AI inference capabilities.
  • Framework Performance:
    • For heavy-weight networks (ResNet50, InceptionV3, DenseNet121), PyTorch Mobile often performed well on Galaxy s10e and Honor v20. On Vivo x27 and Vivo nex, TensorFlow Lite CPU was frequently the best.
  • For light-weight networks (SqueezeNet, MobileNetV2, MnasNet), TensorFlow Lite generally performed best, with PyTorch Mobile often being the slowest.
  • NNAPI Impact: For light-weight networks on Galaxy s10e, NNAPI accelerated inference. However, for heavy-weight networks, NNAPI often slowed down inference or failed to work, particularly on Oppo R17.
  • Device Performance: Devices with advanced SoCs like Snapdragon 855 (Galaxy s10e) and Kirin 980 (Honor v20) generally outperformed those with older SoCs like Snapdragon 710 and 670 (Vivo x27, Vivo nex, Oppo R17).

Limitations and Future Work

  • Limited Scope: The current benchmark focuses solely on the vision domain (image classification).
  • Device Coverage: While five devices were tested, the authors plan to extend the list of measured devices.
  • Future Directions: The authors propose to:
  • Extend the benchmark to other AI domains, such as natural language processing.
  • Apply the benchmark to a wider range of mobile and embedded devices, including IoT devices.
  • Investigate the impact of model quantization on performance.

Summary updated

BibTeX
@misc{luo2020comparison,
  author = {Chunjie Luo and Xiwen He and Jianfeng Zhan and Lei Wang and Wanling Gao and Jiahui Dai},
  title = {{Comparison and Benchmarking of AI Models and Frameworks on Mobile Devices}},
  year = {2020},
  eprint = {2005.05085},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2005.05085},
}

Loading related content...

Figure