Saved in:
Bibliographic Details
Main Authors: Zhang, Huawei, Xia, Chunwei, Wang, Zheng
Format: Preprint
Published: 2025
Subjects:
Online Access:https://arxiv.org/abs/2511.11907
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866912759301537792
author Zhang, Huawei
Xia, Chunwei
Wang, Zheng
author_facet Zhang, Huawei
Xia, Chunwei
Wang, Zheng
contents Language models (LMs) underpin emerging mobile and embedded AI applications like meeting and video summarization and document analysis, which often require processing multiple long-context inputs. Running an LM locally on-device improves privacy, enables offline use, and reduces cost, but long-context inference quickly hits a \emph{memory capacity wall} as the key-value (KV) cache grows linearly with context length and batch size. Existing KV-cache offloading schemes are designed to transfer cache data from GPU memory to CPU memory; however, they are not suitable for embedded and mobile systems, where the CPU and GPU (or NPU) typically share a unified memory and the non-volatile secondary storage (disk) offers limited I/O bandwidth. We present KVSwap, a software framework tailored for local devices that achieves high memory efficiency while effectively leveraging disk storage. KVSwap stores the full cache on disk, uses highly compact in-memory metadata to predict which entries to preload, overlaps computation with hardware-aware disk access, and orchestrates read patterns to match storage device characteristics. Our evaluation shows that across representative LMs and storage types, KVSwap delivers higher throughput under tight memory budgets while maintaining generation quality over existing KV cache offloading schemes.
format Preprint
id arxiv_https___arxiv_org_abs_2511_11907
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle KVSwap: Disk-aware KV Cache Offloading for Long-Context On-device Inference
Zhang, Huawei
Xia, Chunwei
Wang, Zheng
Distributed, Parallel, and Cluster Computing
Artificial Intelligence
Language models (LMs) underpin emerging mobile and embedded AI applications like meeting and video summarization and document analysis, which often require processing multiple long-context inputs. Running an LM locally on-device improves privacy, enables offline use, and reduces cost, but long-context inference quickly hits a \emph{memory capacity wall} as the key-value (KV) cache grows linearly with context length and batch size. Existing KV-cache offloading schemes are designed to transfer cache data from GPU memory to CPU memory; however, they are not suitable for embedded and mobile systems, where the CPU and GPU (or NPU) typically share a unified memory and the non-volatile secondary storage (disk) offers limited I/O bandwidth. We present KVSwap, a software framework tailored for local devices that achieves high memory efficiency while effectively leveraging disk storage. KVSwap stores the full cache on disk, uses highly compact in-memory metadata to predict which entries to preload, overlaps computation with hardware-aware disk access, and orchestrates read patterns to match storage device characteristics. Our evaluation shows that across representative LMs and storage types, KVSwap delivers higher throughput under tight memory budgets while maintaining generation quality over existing KV cache offloading schemes.
title KVSwap: Disk-aware KV Cache Offloading for Long-Context On-device Inference
topic Distributed, Parallel, and Cluster Computing
Artificial Intelligence
url https://arxiv.org/abs/2511.11907