Inferensys

Glossary

Adaptive Replacement Cache (ARC)

Adaptive Replacement Cache (ARC) is a self-tuning cache eviction policy that dynamically balances between recency (LRU) and frequency (LFU) by maintaining two adaptive lists for recent and frequent entries.
Stylish WeWork-like workspace with hot desks and document wall, professional searching through enterprise knowledge base on a mounted ultrawide display, warm industrial pendants overhead.
MEMORY UPDATE AND EVICTION

What is Adaptive Replacement Cache (ARC)?

A self-tuning, adaptive algorithm for managing cached data in memory-limited systems.

Adaptive Replacement Cache (ARC) is a self-tuning cache eviction policy that dynamically balances between recency-based (Least Recently Used (LRU)) and frequency-based (Least Frequently Used (LFU)) strategies by maintaining two adaptive lists. It continuously learns from the workload's access patterns, adjusting the size of its recency (T1) and frequency (T2) lists to minimize cache misses. This makes it highly effective for workloads with shifting or unpredictable access patterns, outperforming static policies like pure LRU or LFU.

The algorithm's core innovation is its use of a ghost list (a history of recently evicted entries) to guide its adaptation. By tracking what was almost useful, ARC can detect changes in workload locality and proactively adjust its balance. This policy is foundational in agentic memory and context management, where efficient cache eviction is critical for maintaining high-performance access to frequently needed operational data within an autonomous agent's limited context window.

MEMORY UPDATE AND EVICTION

Key Features of ARC

Adaptive Replacement Cache (ARC) is a self-tuning, adaptive cache eviction policy that dynamically balances between recency-based (LRU) and frequency-based (LFU) caching strategies to optimize hit rates across varying workloads.

01

Dual Adaptive Lists

ARC maintains two adaptive lists instead of a single cache directory:

  • List T1 (Recent Cache): Contains entries accessed only once recently (recency-focused, like LRU).
  • List T2 (Frequent Cache): Contains entries accessed at least twice within a recent time window (frequency-focused, like LFU). A separate ghost list (B1, B2) for each tracks recently evicted entries, providing the algorithm with a 'history' of what was just removed to inform its adaptation.
02

Self-Tuning Parameter (p)

The core of ARC's intelligence is a dynamic parameter p that represents the target size for the recent list (T1). The algorithm continuously adjusts p based on workload:

  • Recency-favoring workload: Increases p, allocating more space to T1 (LRU-like behavior).
  • Frequency-favoring workload: Decreases p, allocating more space to T2 (LFU-like behavior). This adjustment happens on every cache miss by checking the ghost lists, allowing ARC to converge on the optimal recency/frequency mix for the current access pattern without manual configuration.
03

Ghost (History) Lists

For each main list (T1, T2), ARC maintains a corresponding ghost list (B1, B2). These are metadata-only lists that store the keys of recently evicted items, not their values.

  • Ghost Hit: If a requested item is found in a ghost list, ARC interprets this as evidence that the corresponding main list (T1 or T2) is too small.
  • This ghost hit triggers an adaptive resizing: ARC increases the target size (p) for the list that should have held the item, stealing a page from the other list. Ghost lists provide a low-overhead memory of past mistakes, enabling the algorithm to learn from near-misses.
04

Adaptive Replacement on Cache Miss

ARC's eviction and adaptation logic is triggered on a cache miss. The algorithm decides which list to evict from and whether to adapt p:

  1. If cache is full and a new item is inserted: Evict from T1 if |T1| ≥ p; otherwise, evict from T2.
  2. On a miss that is a ghost hit in B1: Increase p (favor T1).
  3. On a miss that is a ghost hit in B2: Decrease p (favor T2). This ensures the policy reacts in real-time to changing access patterns, constantly rebalancing its resources between recency and frequency.
05

Resistance to Scan Attacks

ARC is highly resilient to one-time sequential scans (e.g., a full database table scan) that pollute and destroy the utility of traditional LRU caches.

  • Mechanism: A scanned item enters T1 on its first access. Before it can be promoted to the frequent cache (T2), it is likely evicted by subsequent scanned items, as T1's size is controlled.
  • The scanned items are recorded in the ghost list B1, but ARC correctly interprets this pattern and does not overreact by drastically resizing p. This makes ARC particularly effective for database buffer pools and file system caches where mixed workloads are common.
06

Low Computational Overhead

Despite its adaptive complexity, ARC maintains O(1) complexity for all operations (insert, access, evict), comparable to LRU.

  • Data Structures: Typically implemented using doubly-linked lists and hash maps for constant-time lookups and moves.
  • The adaptive logic based on ghost list checks adds minimal constant-time overhead. This efficiency makes ARC suitable for high-performance systems where cache management cannot become a bottleneck, such as operating system page caches, database buffers, and CDN edge caches.
FEATURE COMPARISON

ARC vs. Other Eviction Policies

A technical comparison of the Adaptive Replacement Cache (ARC) algorithm against other common cache eviction policies, focusing on core mechanisms, performance characteristics, and implementation complexity.

Feature / MetricAdaptive Replacement Cache (ARC)Least Recently Used (LRU)Least Frequently Used (LFU)

Core Eviction Heuristic

Dynamically balances recency (LRU) and frequency (LFU)

Recency of access only

Frequency of access only

Adaptive Self-Tuning

Resistance to One-Time Scans

High (protects frequency list)

Low (scan pollutes cache)

High (scan items have low frequency)

Resistance to Looping Sequences

High (adapts to changing patterns)

Low (loops cause constant evictions)

Medium (can lock in looping items)

Memory Overhead

~2x cache size (maintains 4 lists)

Minimal (single list/queue)

Moderate (requires frequency counters)

Computational Complexity (per access)

O(1) with hash map + lists

O(1) with hash map + list

O(1) with hash map + heap; O(log n) with strict ordering

Handles Changing Access Patterns

Requires Manual Parameter Tuning (e.g., λ)

Typical Hit Ratio vs. LRU on Real Workloads

5-25% higher

Baseline

Varies widely; can be higher or lower

ADAPTIVE REPLACEMENT CACHE (ARC)

Frequently Asked Questions

Adaptive Replacement Cache (ARC) is a foundational self-tuning eviction algorithm critical for managing memory in agentic systems. These questions address its core mechanics, trade-offs, and practical applications for engineers.

Adaptive Replacement Cache (ARC) is a self-tuning, adaptive cache eviction policy that dynamically balances between recency-based (Least Recently Used - LRU) and frequency-based (Least Frequently Used - LFU) caching strategies to optimize hit rates. It works by maintaining four lists: two LRU lists (T1 for recent entries, T2 for frequent entries) and two ghost lists (B1 for recently evicted from T1, B2 for recently evicted from T2). The algorithm's core innovation is its adaptive parameter, p, which represents the target size for the T1 (recency) list. When a cache hit occurs on an item in a ghost list (B1 or B2), p is adjusted, effectively increasing the size of the list (T1 or T2) that would have benefited from retaining that item. This continuous feedback allows ARC to learn the optimal balance between recency and frequency for a given workload without manual configuration.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.