PerCache: Predictive Hierarchical Cache for RAG Applications on Mobile Devices

Kaiwei Liu, Lin Chen and, Lilin Xu, Bufang Yang, Zhenyu Yan

TL;DR

Mobile devices are increasingly using Retrieval-Augmented Generation (RAG) for personalized applications, but this leads to high latency due to LLM inference. PerCache introduces a novel hierarchical caching system that predicts future queries and reuses intermediate computation results across different stages of the RAG pipeline, significantly reducing latency on resource-constrained mobile devices.

What Problem Does This Paper Address?

Retrieval-Augmented Generation (RAG) is becoming a popular paradigm for mobile applications like personal assistants and email helpers. These applications leverage Large Language Models (LLMs) to generate responses based on user-specific data (e.g., emails, meeting records) retrieved from the device. However, the prompts in RAG can become very long, leading to substantial computational overhead and high response latency on mobile devices, which have limited processing power. Existing caching solutions often focus on single stages of the RAG pipeline or are designed for cloud environments, performing poorly on mobile due to factors like query sparsity and dynamic resource constraints. This paper aims to tackle the primary latency bottleneck in mobile RAG: LLM inference, by proposing an efficient caching mechanism tailored for mobile environments.

Methods

PerCache employs a predictive hierarchical caching architecture designed to maximize the reuse of intermediate results across different stages of the RAG pipeline.

  • Hierarchical Cache: PerCache utilizes two layers:
  • QA Bank: Stores query-answer pairs. If a new query is semantically similar enough to a cached query, the answer can be returned directly, skipping LLM inference entirely.
  • Knowledge Bank: Stores QKV (Query, Key, Value) tensors for retrieved knowledge chunks. This allows skipping the QKV projection computation during the prefilling stage of LLM inference for subsequent queries that retrieve the same chunks.
  • Predictive Cache Population: To combat query sparsity on mobile devices, PerCache predicts future user queries during idle periods. This prediction is based on two complementary approaches:
  • Knowledge-based Prediction: Analyzes abstracts of knowledge chunks to infer likely future questions.
  • History-based Prediction: Mimics the user's language style and topical interests based on their recent query history. These predicted queries are used to proactively populate the QA bank and knowledge bank, improving cache hit rates.

  • Cache Scheduler: A dynamic scheduler manages cache population strategies and cross-layer cache conversions. It adapts to varying system loads and resource availability, balancing latency, computation, and storage. This includes strategies for deciding when to populate only the QKV cache versus both QA bank and QKV cache, and mechanisms for converting between the two cache layers.

Datasets

The evaluation uses a combination of public and self-collected datasets:

  • MISED: Meeting transcripts from three domains with corresponding question-answer pairs.
  • EnronQA: Emails with question-answer pairs.
  • Email (Self-collected): Emails from 6 volunteers, with their real-world query-answer pairs.
  • Daily Dialog Transcript (Self-collected): Conversational speech transcriptions from 4 volunteers, with recalled query-answer pairs.

These datasets were collected from 20 users, totaling 275 queries.

Key Insights and Ideas

  • Mobile RAG is Latency-Bound by LLM Inference: The paper convincingly demonstrates that for single-user mobile RAG, LLM inference, particularly due to long prompts, is the dominant latency bottleneck, not retrieval.
  • Query Sparsity is a Major Hurdle: Unlike multi-user systems, single-user mobile RAG experiences infrequent and varied queries, making traditional reactive caching strategies ineffective due to low cache hit rates.
  • Predictive Caching is Crucial for Mobile: Proactively populating the cache by predicting future queries is essential to overcome sparsity and achieve significant latency reductions.
  • Hierarchical Caching Maximizes Reuse: By caching both query-answer pairs (QA Bank) and intermediate LLM states (QKV Cache), PerCache can skip different levels of computation, leading to greater efficiency.
  • Dynamic Scheduling Adapts to Mobile Constraints: The ability to dynamically adjust caching strategies based on available resources and predicted query patterns is key to maintaining performance on resource-constrained and fluctuating mobile environments.

Key Results

  • Significant Latency Reduction: PerCache achieves up to 34.4% end-to-end latency reduction across various applications compared to the best-performing baselines.
  • Improved Cache Hit Rates: PerCache outperforms baselines by improving hit rates for QKV cache and QA bank by up to 37.56% and 13.8%, respectively.
  • Robustness Across Devices: The method maintains consistently superior performance across mobile devices with varying hardware specifications.
  • Efficiency Gains: The cache scheduler effectively reduces computational overhead by up to 14.12% by elastically bypassing portions of cache population.
  • Minimal Impact on Generation Quality: PerCache maintains relatively stable response generation quality, as measured by ROUGE-L scores.

Limitations and Future Work

  • Prediction Stride: The number of predicted queries is currently a fixed system parameter. Future work could explore more adaptive approaches where the LLM dynamically determines the prediction stride based on contextual demands.
  • Fine-grained Cache Organization: PerCache stores complete QKV cache tensors. Future work could investigate more granular strategies, such as selectively storing tensor components (e.g., only Q tensors) or caching intermediate states from different positions within the attention module.
  • Tokenization Inconsistency: The paper identifies and addresses tokenization inconsistencies that can arise when merging QKV cache tensor chains, but this remains an area for further refinement.
  • Generalizability: While PerCache is shown to work with different LLMs (Llama, Qwen), further exploration into its compatibility with other Transformer-based LLMs and multimodal models is suggested.

Summary updated

BibTeX
@misc{liu2025percache,
  author = {Kaiwei Liu and Lin Chen and and Lilin Xu and Bufang Yang and Zhenyu Yan},
  title = {{PerCache: Predictive Hierarchical Cache for RAG Applications on Mobile Devices}},
  year = {2025},
  eprint = {2601.11553},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.11553},
}
Figure