Large Language Models (LLMs), composed of billions of parameters, demand substantial computational and memory resources and are typically deployed on high-performance servers within data centers. As LLM-based services continue to expand, the fundament...
Large Language Models (LLMs), composed of billions of parameters, demand substantial computational and memory resources and are typically deployed on high-performance servers within data centers. As LLM-based services continue to expand, the fundamental limitations of cloud-based inference have become critical such as privacy concerns, network dependency, and significant latency. To address these issues, on-device LLMs that enable local inference without network dependency have emerged as a promising alternative. However, existing LLM systems, originally designed for server environments, fail to adequately accommodate the strict memory constraints of mobile systems. Therefore, efficient memory management techniques are essential to enable LLM inference in mobile systems.
This paper presents an in-depth analysis of memory bottlenecks during LLM inference on mobile systems and proposes two page-level memory management techniques. Initial KV cache swap(IS) proactively offloads unused KV cache pages to zRAM to secure free memory in advance. Because these unused KV cache pages are highly compressible, this approach effectively reduces memory usage, and the DRAM-resident nature of zRAM allows fast page restoration upon access. Deferred Weight Reclamation(DW) marks weight-associated file pages with a dedicated flag to deprioritize their eviction during LRU traversal. By retaining weight pages in memory longer, this mechanism minimizes storage I/O overhead from weight reloading and improves inference throughput.
Experimental results show that the proposed techniques reduce memory usage by up to 31% compared to the baseline Linux kernel, demonstrating substantial efficiency improvements in memory-constrained mobile environments. Moreover, the proposed methods yield proportional efficiency gains in speculative decoding scenarios with multiple candidate paths, validating their applicability across diverse advanced LLM inference workloads on mobile systems.