RAC: Relation-Aware Cache Replacement for Large Language Models

Yuchong Wu, Zihuan Xu, Wangze Ni, Peng Cheng, Lei Chen, Xuemin Lin, Heng Tao Shen, Kui RenarXiv 2026

TL;DR

Traditional cache replacement policies fail in Large Language Model (LLM) services because real-world conversations exhibit long reuse distances and sparse local recurrence. To address this, the authors introduce Relation-Aware Cache (RAC), an online eviction strategy that leverages semantic and structural relationships between requests rather than simple recency or frequency. By combining topic-level temporal tracking with intra-topic dependency mapping, RAC improves cache hit ratios by 20% to 30% over state-of-the-art baselines.

What Problem Does This Paper Address?

Whether managing semantic caches or intermediate KV caches, LLM services rely heavily on caching to minimize latency and compute costs. However, serving these models often happens under tight memory budgets. Standard cache eviction policies (like LRU or TinyLFU) rely on short-window statistics: if an item hasn't been accessed recently or frequently, it gets evicted.

The authors demonstrate that these classic signals break down for LLM workloads. Real-world user interactions are typically organized into multi-turn dialogue sessions or distinct topics that alternate. A core "context-setting" request (e.g., uploading a large code snippet or defining strict formatting rules) might not be repeated exactly, but many subsequent queries will depend on it. If a user switches topics temporarily, traditional policies will evict that crucial context anchor, resulting in costly cache misses when the user returns to the original task.

Figure 1: Demonstration of traditional, learning-based, and offline-optimal policies on Example 1.

Methods

RAC discards isolated per-entry statistics in favor of a unified heuristic value calculated as:

$$\text{Value}(q) = \text{TP}(Z) \cdot \text{TSI}(q)$$

Where:

  1. Topical Prevalence (TP): A per-topic temporal signal. Instead of tracking individual items, RAC clusters incoming queries into broad semantic topics online. It maintains a score for each topic that exponentially decays over time but increments on a topic hit, capturing long-horizon topic recurrence.
  2. Topic Structural Importance (TSI): A per-item topological signal. Within a single topic episode, queries naturally depend on prior ones (forming a Directed Acyclic Graph, or DAG). RAC uses a lightweight, constant-time dependency detector to identify "context anchors"—prerequisite queries that support many downstream requests—and assigns them higher structural value.

When the cache reaches capacity, RAC evicts the entry with the lowest combined Value(q). The entire pipeline operates online with $O(1)$ maintenance overhead, avoiding the heavy training or inference costs seen in learning-based caching methods.

Datasets

The authors evaluated RAC using two types of workloads:

  • Real Traces (OASST1): Extracted from the OpenAssistant conversation corpus, which retains natural conversation-thread structures and chronological timestamps. They created 10 non-overlapping sub-traces of 10,000 requests each.
  • Synthetic Traces: Generated using a topic-level semi-Markov process expanded via ChatGPT to model varying degrees of reuse distances and long-tail popularity skews, specifically designed to stress-test the limits of short-window policies.

Key Insights and Ideas

  • Discourse Structure Over Raw Statistics: LLM workloads are fundamentally structured by human conversation patterns. Treating requests as independent items misses the inherent tree/DAG structure of multi-turn dialogues.
  • Preserving the Core, Trimming the Periphery: The offline optimal policy naturally keeps root context anchors while aggressively discarding peripheral follow-up queries. RAC successfully mimics this behavior online by using its structural importance metric (TSI).
  • Topic-Level Aggregation Beats Item-Level Sparsity: Because exact query repetitions are rare (sparse recurrence), aggregating access evidence at the topic level provides a much more stable and predictive signal for future reuse.

Key Results

RAC was tested against a wide array of baselines, including classic heuristics (LRU, FIFO), frequency-resistant policies (TinyLFU, ARC, S3-FIFO, SIEVE), and learning-based methods (LeCaR, LHD).

  • Synthetic Stress Tests: As the workload became more adversarial (longer reuse distances where items reappear long after the cache window has passed), the performance of standard baselines plummeted. RAC maintained stable gains, outperforming the best baselines by up to 30% in normalized hit ratio.
Figure 2: Hit ratio on simulated sequences under two stress axes: (a) varying long reuse-distance ratio; (b) varying long-tail coefficient.
  • Real-World Performance: On the OASST1 dialogue traces, RAC consistently achieved the highest overall cache hit ratio across all tested capacities (2.5%, 10%, and 20%), outperforming the strongest baselines by 5%–12% and the baseline average by over 10%.
Figure 3: Normalized hit ratio on timestamp-continuous OASST1 sub-traces under different cache capacities.

Limitations and Future Work

While RAC introduces a highly effective framework, the authors note some areas for improvement:

  • Heuristic Dependency Tracking: The online dependency link detector relies on a simple look-back window and a basic similarity threshold. While computationally cheap, it can miss complex or highly distant structural relationships.
  • Global Structural Ranking: The paper outlines an extension that applies PageRank/TextRank style global ranking to the dependency DAG to capture multi-hop importance. However, this is computationally heavier and was not integrated into the primary online evaluation. Future work could focus on making these global graph-ranking methods efficient enough for real-time, low-latency deployment.

Summary updated

BibTeX
@misc{wu2026rac,
  author = {Yuchong Wu and Zihuan Xu and Wangze Ni and Peng Cheng and Lei Chen and Xuemin Lin and Heng Tao Shen and Kui Ren},
  title = {{RAC: Relation-Aware Cache Replacement for Large Language Models}},
  year = {2026},
  eprint = {2602.21547},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.21547},
}
Figure