Swan: A Neural Engine for Efficient DNN Training on Smartphone SoCs

Sanjay Sri Vallabh Singapuram, Fan Lai, Chuheng Hu, Mosharaf ChowdhuryarXiv 2022

Abstract

The need to train DNN models on end-user devices (e.g., smartphones) is increasing with the need to improve data privacy and reduce communication overheads. Unlike datacenter servers with powerful CPUs and GPUs, modern smartphones consist of a diverse collection of specialized cores following a system-on-a-chip (SoC) architecture that together perform a variety of tasks. We observe that training DNNs on a smartphone SoC without carefully considering its resource constraints can not only lead to suboptimal training performance but significantly affect user experience as well. In this paper, we present Swan, a neural engine to optimize DNN training on smartphone SoCs without hurting user experience. Extensive large-scale evaluations show that Swan can improve performance by 1.2 - 23.3x over the state-of-the-art.

Introduction

While training AI models in the cloud is standard, there is a growing push for on-device training to improve data privacy (Federated Learning) and reduce communication overhead. However, smartphones are not just "small computers." They utilize heterogeneous System-on-a-Chip (SoC) architectures where different CPU cores have vastly different power and performance profiles.

Current mobile ML frameworks, such as the mobile versions of PyTorch or TensorFlow, are often "hardware-blind." They frequently resort to greedy strategies—using as many high-performance cores as possible—which leads to thermal throttling, energy inefficiency, and poor user experience (UX) due to resource competition with foreground apps. Swan is designed to navigate these complexities to enable efficient, background training.

The Challenge of Heterogeneous SoCs

Modern smartphone SoCs, like the Snapdragon series, feature a mix of "Prime," "Low-Latency," and "Low-Power" cores. As shown in the performance analysis across different chip generations, the training time for a given model can vary drastically depending on which core type is utilized.

Heterogeneous SoC architecture and performance variance across different core types.

Without intelligent resource management, training tasks can cause the device to overheat, leading to thermal throttling that degrades performance for both the training task and the user's foreground activities. Furthermore, using the wrong cores can drain the battery faster without necessarily finishing the task sooner.

The Swan Neural Engine

To address these challenges, we introduce Swan, a specialized neural engine designed to make DNN training on smartphones both faster and more energy-efficient. Swan is built on top of a Linux terminal emulator (Termux) for Android and introduces a dynamic resource assignment algorithm that treats training as a multi-objective optimization problem.

Swan system architecture and interference-aware migration logic.

Key components of Swan include:

  • Execution Choice Exploration: Swan benchmarks different combinations of CPU cores to find the optimal balance of speed and energy for a specific model.
  • Interference-Aware Migration: Swan monitors training latency in real-time. If it detects a spike—indicating the user is actively using the phone—it dynamically "downgrades" the training task to lower-power cores to relinquish resources to the foreground app.
  • Cost-Based Pruning: It uses heuristic rules to discard inefficient execution choices, such as configurations where adding more threads leads to performance degradation due to memory bottlenecks.
  • Standardized Interface: Swan implements standard Federated Learning hooks (e.g., isActive, run_local_step), making it a drop-in replacement for existing distributed training setups.

Key Insights: The Energy Paradox and Cache Thrashing

Our research revealed several counter-intuitive findings. First, the Energy Paradox: low power usage does not always translate to low energy usage. If a low-power core takes significantly longer to complete a task, the total energy consumed (Power × Time) can exceed that of a high-power core that finishes quickly.

Second, we identified Cache Thrashing as a major performance killer. For memory-intensive models like ShuffleNet, using more threads can actually slow down training because multiple threads compete for the same L2/L3 cache. Swan identifies these scenarios and restricts such models to fewer threads to maintain peak performance.

Evaluation and Results

Swan was evaluated across five popular devices, including the Google Pixel 3 and Samsung S10e, using speech recognition (Google Speech) and image classification (OpenImage) tasks. To simulate realistic behavior, we utilized the GreenHub dataset, which contains resource usage traces from 300,000 real smartphones.

  • Performance Gains: Swan achieved local speedups of 1.2× to 23.3× compared to the PyTorch mobile baseline.
  • Energy Efficiency: It delivered up to a 39× improvement in energy efficiency for specific model-device combinations (notably MobileNet and ShuffleNet).
  • User Experience: Swan significantly reduced the impact on foreground apps. On a Google Pixel 3, the performance hit to foreground apps (measured by PCMark) was reduced from a 27% drop in the baseline to just 3.1%.
  • Federated Learning: In large-scale simulations, Swan-enabled devices reached target accuracy faster because fewer devices dropped out due to battery exhaustion.

Conclusion

Swan demonstrates that by intelligently navigating the complexities of mobile SoC architectures, it is possible to achieve high-performance DNN training on-device without compromising user experience. While currently focused on CPU optimization, the Swan architecture provides a foundation for future work involving mobile GPUs and specialized NPUs.

Summary updated

BibTeX
@misc{singapuram2022swan,
  author = {Sanjay Sri Vallabh Singapuram and Fan Lai and Chuheng Hu and Mosharaf Chowdhury},
  title = {{Swan: A Neural Engine for Efficient DNN Training on Smartphone SoCs}},
  year = {2022},
  eprint = {2206.04687},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2206.04687},
}
Figure