mzCache: On-Device LLM Memory Management under Multitasking
Hongseung Yu, Minsung Kim, Jongseok Park, Kyunghan Lee
Abstract
On-device mobile Large Language Model (LLM) inference is gaining significant attention. However, mobile devices operate in highly dynamic multitasking environments where users frequently switch between applications. This creates memory pressure, forcing LLM memory (model weights and KV cache) to be evicted by the operating system. When a new inference request arrives, the inference system must restore the evicted memory through slow storage reads or recompute the entire KV cache, severely degrading responsiveness. To address this, we present mzCache, an on-device LLM inference system with specialized memory management for multitasking environments. Under unpredictable memory pressure, mzCache elastically evicts LLM memory and leverages the unified memory of mobile SoCs to enable zero-wait inference on the GPU with concurrent CPU-side restoration. mzCache realizes this through restoration-oriented memory management: LLM memory is partitioned into fine-grained shared buffers to enable partial eviction and restoration with concurrent cross-processor access, while hybrid swap and backward-out eviction policies ensure low-latency restoration from any eviction state. Implemented on llama.cpp and deployed as an Android application, mzCache achieves 2.1-5.5× reduction in Time-to-First-Token compared to storage-backed partial offload and demonstrates its effectiveness in real multitasking scenarios.
Create a lesson
Related papers
SchedBlame: Who Ran While You Waited? Culprit-Attributed CPU Contention for Containers on Stock Kernels
Hao Li, Tonghao Zhang, Honglei Wang
Adaptive KV Retention for LLM Agents at Human-Approval Timescales
Minseo Choi, Ananya Joshi
mold: A Massively Parallel Linker
Rui Ueyama
AdaSprite: Resource-efficient Online Co-Adaptation for V2I Systems Under Large-scale Data Drifts
Lehao Wang, Zhiwen Yu, Sicong Liu et al.
Global Simulation-Guided Dynamic Operator Scheduling for Efficient Multi-Tenant Model Serving
Weinan Liu, Zeyuan Ding, Dian Ding et al.
From LLM Inference to Agentic Workloads: Characterization and Implications for Serving Systems
Chaokun Chang, Yukun Zhou, Kaihua Fu et al.