Large Language Model Performance Benchmarking on Mobile Platforms: A Thorough Evaluation

Jie Xiao, Qianyi Huang, Xu Chen, Chen Tian · OpenReview

TL;DR

This paper dives deep into the performance of Large Language Models (LLMs) running directly on commercial mobile devices. It provides a comprehensive benchmark of various LLMs across different mobile chipsets, revealing key insights into hardware limitations, software optimizations, and user experience factors like speed and battery life, crucial for the future of on-device AI.

What Problem Does This Paper Address?

The increasing integration of LLMs into our daily lives, coupled with growing privacy concerns, is driving a strong trend towards deploying these models locally on user devices, especially smartphones. While lightweight LLMs are becoming available, their performance on the diverse landscape of commercial off-the-shelf (COTS) mobile devices remains largely uncharacterized. This paper aims to bridge this gap by conducting a thorough measurement study to understand how LLMs perform on these devices, considering both user-centric metrics (speed, quality) and developer-centric factors (resource usage, system dynamics).

Methods

The authors conducted a comprehensive measurement study using six representative LLMs (Llama3.2, Qwen3, Gemma3) across seven mobile devices featuring SoCs from Qualcomm, MediaTek, Hisilicon, and Apple. They employed two popular mobile LLM inference engines: llama.cpp for CPU-based inference and MLC LLM for GPU-based inference. To capture detailed performance data, they utilized specialized profiling tools like Snapdragon Profiler, Arm Streamline, and Xcode. Their methodology involved evaluating various aspects, including:

  • Hardware Requirements: Assessing the necessary computation capability and RAM.
  • Model and Quantization: Analyzing the trade-offs between accuracy and throughput across different quantization schemes.
  • Resource Configuration: Investigating optimal runtime settings like DVFS and thread allocation.
  • Software-Hardware Alignment: Examining how inference frameworks utilize hardware accelerators.
  • Concurrent Workloads: Evaluating LLM performance when running alongside background tasks (non-AI and AI).
  • Power Consumption: Measuring battery usage for different inference scenarios.
  • Thermal Throttling and DVFS: Analyzing the impact of heat and dynamic voltage and frequency scaling on performance.
  • Model Preparation Latency: Measuring the time taken for cold starts and warm-ups.

Datasets

The paper does not introduce new datasets for training. Instead, it focuses on evaluating the performance of pre-trained LLMs on existing benchmarks. The LLMs themselves are used as the "dataset" for performance evaluation.

Key Insights and Ideas

  • Apple's M1 is a Performance Powerhouse: The Apple M1 SoC, being a laptop-grade processor, significantly outperforms even the top-tier Android SoCs in LLM inference, especially in the prefill stage.
  • CPU vs. GPU Trade-offs: While GPUs offer substantial speedups in the compute-bound prefill stage, their advantage diminishes in the memory-bound decode stage, where CPU performance can be comparable.
  • Quantization is Key, but Nuanced: 4-bit quantization generally strikes a good balance between speed and accuracy. However, the optimal quantization scheme can be task- and model-dependent, with higher bit-widths not always guaranteeing better accuracy.
  • Hardware-Software Co-design is Crucial: Generic LLM implementations often fail to fully leverage the capabilities of specific mobile GPUs (especially Mali), leading to significant underutilization. Tailored optimizations are essential.
  • Concurrency Challenges: Running LLMs alongside other demanding tasks (especially AI tasks) significantly degrades performance, particularly in the decode stage, highlighting memory bandwidth as a critical bottleneck.
  • DVFS and Thermal Throttling Impact: Mobile SoCs employ aggressive DVFS strategies that can lead to performance degradation over sustained inference. Thermal throttling is a significant factor, especially for long-context tasks.
  • Instruction Acceleration Matters: Specialized CPU instructions (like INT8 matrix multiplication) can provide substantial speedups, particularly in the prefill stage, by optimizing computations.

Key Results

  • CPU Performance: Apple M1 leads, followed by Dimensity 9300 and Snapdragon 8 Gen 3. Armv9-A CPUs with specialized instructions show significant gains over older Armv8-A CPUs.
  • GPU Performance: Adreno GPUs generally outperform Mali GPUs. Apple's GPU shows high ALU utilization (up to 92%), while Mali GPUs struggle with low utilization (<3%) in the prefill stage.
  • Memory Requirements: A 4-bit quantized 7B-parameter model typically requires at least 4GB of RAM.
  • Power Consumption: CPU inference with a 64-token prompt and 128-token generation consumes ~20 mAh per round. GPU inference is significantly more energy-efficient.
  • Concurrency Impact: Running LLMs with a background music app causes minor performance drops (<10%). However, concurrent AI tasks (like YOLOv1ln) can reduce decode throughput by over 90% at 8 threads.
  • Accuracy vs. Latency: Larger models generally perform better. Qwen3 series shows strong accuracy across benchmarks, often outperforming larger models from other families.
  • Model Preparation: Warm-up significantly reduces preparation time for llama.cpp due to mmap. Huawei devices show unusually long cold-start preparation times.

Limitations and Future Work

Limitations:

  • Device Availability: The study is limited by the availability of specific devices and SoCs. For instance, Apple's strict per-app memory limits prevented the inclusion of lower-tier Apple devices.
  • Framework Limitations: Some tests were constrained by framework capabilities (e.g., MLC LLM crashes on certain Huawei devices).
  • Closed-Source SDKs: The closed-source nature of vendor-specific SDKs for NPUs and APUs limits the ability to fully evaluate these accelerators.
  • Thermal State Reporting: While Apple provides thermal state information, detailed CPU frequency data is not always accessible.

Future Work:

  • Optimizing for Specific GPUs: The paper emphasizes the need for device-specific tuning of kernel parameters and operator implementations for GPUs.
  • Hybrid Inference Strategies: Exploring hybrid approaches, such as using GPUs/NPUs for prefill and CPUs for decoding, to balance performance and energy efficiency.
  • Dynamic Resource Allocation: Developing more adaptive resource allocation strategies that can dynamically adjust thread counts and offload computations based on real-time workloads and thermal conditions.
  • Hardware-Aware Deployment: Encouraging developers to consider the specific instruction sets and architectural nuances of target hardware when optimizing LLM inference.
  • Future Mobile System Architecture: Providing insights for designing future mobile system architectures that are better equipped to handle the demands of on-device LLMs.

Summary updated

Abstract

As large language models (LLMs) increasingly integrate into every aspect of our work and daily lives, there are growing concerns about user privacy, which push the trend toward local deployment of these models. There are a number of lightweight LLMs (e.g., Gemini Nano, LLAMA2 7B) that can run locally on smartphones, providing users with greater control over their personal data. As a rapidly emerging application, we are concerned about their performance on commercial-off-the-shelf mobile devices. To fully understand the current landscape of LLM deployment on mobile platforms, we conduct a comprehensive measurement study on mobile devices. We evaluate both metrics that affect user experience, including token throughput, latency, and battery consumption, as well as factors critical to developers, such as resource utilization, DVFS strategies, and inference engines. In addition, we provide a detailed analysis of how these hardware capabilities and system dynamics affect on-device LLM performance, which may help developers identify and address bottlenecks for mobile LLM applications. We also provide comprehensive comparisons across the mobile system-on-chips (SoCs) from major vendors, highlighting their performance differences in handling LLM workloads. We hope that this study can provide insights for both the development of on-device LLMs and the design for future mobile system architecture.
BibTeX
@misc{xiao2024large,
  author = {Jie Xiao and Qianyi Huang and Xu Chen and Chen Tian},
  title = {{Large Language Model Performance Benchmarking on Mobile Platforms: A Thorough Evaluation}},
  year = {2024},
  eprint = {2410.03613},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.03613},
}
Figure