DOI: 10.1145/3845607 ISSN: 1556-4665

Hermes \({}^{+}\) : Adaptive Memory-Efficient Pipeline Inference for Large Models on Edge Devices

Zinuo Cai, Xueyuan Han, Nan Jiang, Baoheng Zhang, Yiming Qiang, Tianqi Wu, Yuan Liu, Ruhui Ma

The application of Transformer-based large models has achieved significant success in recent years. However, the exponential growth in the parameters of large models introduces formidable memory challenges for edge deployment. Prior works to address this challenge mainly focus on optimizing the model structure and adopting memory swapping methods. However, the former reduces the inference accuracy, and the latter raises the inference latency. This paper  1

introduces
PipeLoad
, a novel adaptive memory-efficient pipeline execution mechanism. It reduces memory usage by incorporating dynamic memory management and minimizes inference latency by employing parallel model loading. Based on the
PipeLoad
mechanism, we present Hermes \({}^{+}\) , a framework optimized for large model inference on edge devices. In Hermes \({}^{+}\) , we adopt a searching algorithm to balance inference latency and memory usage. We evaluate Hermes \({}^{+}\) with Transformer-based models of different sizes on a CPU server and edge devices. Our experiments illustrate that Hermes \({}^{+}\) achieves up to \(4.49\times\) speedup in latency and \(81.1\%\) lower memory footprint than the state-of-the-art pipeline mechanism for BERT and ViT models, \(24.3\times\) speedup in latency and \(67.2\%\) lower memory footprint for GPT-2 and GPT-J models with 128 tokens.