Adaptive Replacement Cache (ARC) is a self-tuning cache eviction algorithm that maintains two adaptive lists: one for recently accessed items (T1) and one for frequently accessed items (T2). It dynamically adjusts the size of these lists based on the observed workload, effectively learning whether the access pattern favors recency (LRU) or frequency (LFU). This continuous adaptation allows ARC to outperform static algorithms like pure LRU or LFU, especially under workloads with shifting locality, without requiring manual parameter tuning.
Glossary
Adaptive Replacement Cache (ARC)

What is Adaptive Replacement Cache (ARC)?
Adaptive Replacement Cache (ARC) is a self-tuning, adaptive cache eviction algorithm that dynamically balances between recency-based (LRU) and frequency-based (LFU) caching strategies to optimize the cache hit ratio under varying and unpredictable access patterns.
The algorithm's core mechanism involves a ghost list for each main list (B1 for T1, B2 for T2), which tracks recently evicted metadata. When a cache miss occurs for an item in a ghost list, ARC interprets this as evidence to favor that list's policy and grows its corresponding main list. This feedback loop enables online learning of the optimal policy mix. In agent-side caching, ARC is particularly valuable for managing the cache of API responses and computed results, where request patterns from an autonomous agent can be highly dynamic and non-stationary.
Key Features of ARC
Adaptive Replacement Cache (ARC) is a self-tuning, adaptive algorithm that dynamically balances between recency-based (LRU) and frequency-based (LFU) caching to optimize hit ratios under varying workloads.
Dual Cache Lists (T1 & T2)
ARC maintains two primary LRU lists:
- T1 (Recency List): Contains items accessed only once recently (new entries).
- T2 (Frequency List): Contains items accessed at least twice recently, promoting them from T1. A ghost list (B1) tracks recently evicted items from T1, and another (B2) tracks evictions from T2. The sizes of T1 and T2 are dynamically adjusted based on the contents of these ghost lists.
Self-Tuning Adaptation
The algorithm's core innovation is its ability to self-tune the balance between recency and frequency without manual parameter tuning. It does this by:
- Monitoring cache misses to items in the ghost lists (B1, B2).
- Increasing the target size (p) for the T1 list if a miss occurs for an item in B1 (indicating a need for more recency-focused caching).
- Decreasing p if a miss occurs for an item in B2 (indicating a need for more frequency-focused caching). This continuous adjustment allows ARC to adapt to changing access patterns in real-time.
Ghost (History) Buffers
ARC uses non-resident ghost buffers (B1 and B2) to track metadata about recently evicted items. These buffers store only the keys, not the data values.
- Purpose: They provide a low-memory-cost history of recent evictions.
- Mechanism: On a cache miss, ARC checks these buffers. A 'hit' in a ghost buffer signals that the eviction policy may be suboptimal for the current workload, triggering the adaptive resizing of T1 and T2. This history is critical for the algorithm's learning capability.
Optimal for Mixed Workloads
ARC is specifically designed to outperform static algorithms like pure LRU or LFU when access patterns are unpredictable or mixed. It excels in scenarios where the workload shifts between:
- Scanning/Looping: Sequential access patterns where LRU fails.
- Repeated Access to a Subset: Frequency-biased patterns. By dynamically rebalancing, ARC provides near-optimal performance across these shifts, preventing the drastic performance drops seen in fixed policies.
Complexity & Implementation
Despite its adaptive nature, ARC maintains manageable operational complexity:
- Time Complexity: O(1) for all core operations (lookup, insertion, promotion, eviction).
- Space Complexity: Requires overhead for the ghost lists (keys only) and metadata for tracking the adaptive parameter
p. - Implementation Challenge: The logic for managing four interlinked lists (T1, T2, B1, B2) and adapting
pis more complex than LRU, but libraries likelru-cachefor Node.js offer production-ready implementations.
Use Case: Agent-Side Caching
In AI agent systems, ARC is highly effective for semantic or deterministic caches storing LLM responses or API call results. Its benefits include:
- Adapting to User Session Shifts: As a user's conversation with an agent changes topics, ARC can adapt its caching strategy.
- Handling Bursty, Non-Stationary Data: Ideal for the unpredictable query patterns typical of interactive agents.
- Maximizing Utility of Limited Memory: By self-tuning, it ensures the limited cache memory in an agent's runtime is used for the data patterns most likely to recur.
ARC vs. LRU vs. LFU
A technical comparison of three fundamental cache eviction policies, highlighting their operational mechanisms, performance characteristics, and suitability for different access patterns.
| Feature / Metric | Adaptive Replacement Cache (ARC) | Least Recently Used (LRU) | Least Frequently Used (LFU) |
|---|---|---|---|
Core Eviction Principle | Dynamically balances between recency (LRU) and frequency (LFU) using two adaptive lists (T1, T2) and two ghost lists (B1, B2). | Evicts the item that has not been accessed for the longest time. | Evicts the item with the lowest historical access count. |
Self-Tuning / Adaptivity | |||
Memory Overhead | High (Maintains 4 lists and metadata for adaptation). | Low (Maintains a single recency-ordered list). | Medium to High (Requires maintaining and updating frequency counters for each item). |
Resistance to Scan/One-Time Access | High (Ghost lists protect against one-time scans polluting the cache). | Low (A sequential scan flushes the entire cache). | Medium (One-time accesses get low frequency counts but still pollute the cache until evicted). |
Handling Shifts in Access Pattern | Excellent (Automatically adjusts the balance between LRU and LFU based on observed misses). | Poor (Requires the entire cache to turn over to adapt to a new pattern). | Poor (Historical frequency counts become stale and slow to adapt to new patterns). |
Typical Implementation Complexity | High | Low | Medium |
Optimal Use Case | Workloads with mixed or unpredictable access patterns (e.g., databases, file systems, agent-side caching). | Workloads with strong temporal locality where recent items are likely to be re-accessed. | Workloads with stable, long-term popularity trends (e.g., static content with known hot items). |
Worst-Case Scenario | Higher memory overhead for small caches. | Thrashing on sequential or looping access patterns larger than the cache. | Cache pollution by old, high-frequency items that are no longer relevant. |
Frequently Asked Questions
Adaptive Replacement Cache (ARC) is a foundational algorithm for optimizing data retrieval in AI agents and high-performance systems. These questions address its core mechanisms, advantages, and practical applications.
Adaptive Replacement Cache (ARC) is a self-tuning, adaptive cache eviction algorithm that dynamically balances between recency-based (Least Recently Used - LRU) and frequency-based (Least Frequently Used - LFU) caching strategies to optimize the cache hit ratio under varying and unpredictable data access patterns.
Developed by IBM researchers Nimrod Megiddo and Dharmendra S. Modha, ARC maintains two LRU lists: one for recently accessed items (T1) and one for items accessed at least twice (T2), representing frequency. It also tracks two ghost lists (B1, B2) of recently evicted items from T1 and T2. The algorithm's core innovation is its adaptive parameter, p, which it continuously adjusts based on the observed hit rates in the ghost lists. If hits occur in B1 (suggesting recency is more important), p increases, favoring the LRU list (T1). If hits occur in B2 (suggesting frequency is more important), p decreases, favoring the LFU list (T2). This real-time feedback loop allows ARC to outperform static policies like pure LRU or LFU, especially in workloads with shifting access patterns.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Adaptive Replacement Cache (ARC) operates within a broader ecosystem of caching strategies and eviction policies. Understanding these related concepts is essential for designing high-performance agent-side caching systems.
Least Recently Used (LRU)
Least Recently Used (LRU) is the foundational recency-based eviction algorithm that ARC dynamically balances against frequency. When the cache is full, LRU discards the item that has not been accessed for the longest time.
- Core Mechanism: Maintains items in order of access; the head is most recent, the tail is least recent.
- ARC Relationship: ARC maintains an LRU list (T1) for items seen only once recently. It protects this list from being evicted by frequent items.
- Weakness: Performs poorly under scans or cyclical access patterns, as it evicts potentially useful older items.
Least Frequently Used (LFU)
Least Frequently Used (LFU) is a frequency-based eviction algorithm that removes the item with the lowest access count when space is needed.
- Core Mechanism: Tracks a reference counter for each cached item. Eviction targets the item with the smallest count.
- ARC Relationship: ARC maintains an LFU list (T2) for items seen at least twice. This list represents the "frequency" component that ARC adaptively favors.
- Weakness: Can be polluted by items with a high initial burst of accesses that are never used again, wasting cache space.
LRU-K Algorithm
The LRU-K algorithm is an advanced policy that tracks the times of the last K references to an item, providing a bridge between pure recency (LRU) and frequency (LFU).
- Core Mechanism: For K=2, it records the timestamps of the last two accesses. Eviction decision is based on the K-th most recent access time.
- Comparison to ARC: While both consider recency and frequency, LRU-K uses a fixed parameter (K). ARC is self-tuning and does not require pre-configuration of K, automatically adjusting the balance between its LRU and LFU lists based on workload.
- Use Case: Often used in database buffer pool management.
2Q Algorithm (Two Queues)
The 2Q Algorithm is a predecessor to ARC that uses two queues: an A1in queue for items seen once (similar to ARC's T1) and an Am (main) LRU queue for hot items (similar to ARC's T2).
- Core Mechanism: New items enter A1in. On a second access, they are promoted to Am. Eviction happens from A1in, then Am.
- ARC as a Successor: ARC is a generalized, adaptive enhancement of 2Q. ARC replaces the fixed-size A1in queue with two adaptive lists (T1 and B1) and introduces a ghost list (B2) to track evicted history, enabling its continuous self-tuning.
- Limitation: 2Q has a fixed partition between its queues, while ARC's partition adapts.
Cache Hit Ratio
Cache Hit Ratio is the critical performance metric that ARC is designed to optimize. It is calculated as (Number of Cache Hits / Total Requests) * 100%.
- Primary Goal: A higher hit ratio means more requests are served from fast cache memory, reducing latency and load on the primary data source (e.g., an API or database).
- ARC's Advantage: By dynamically balancing LRU and LFU, ARC maximizes the hit ratio across diverse and changing access patterns (e.g., looping scans, shifting popular items) where static algorithms fail.
- Measurement: This is the definitive metric for comparing the effectiveness of different eviction policies like LRU, LFU, and ARC.
Cache Eviction
Cache Eviction is the overarching process of selecting and removing items from a cache when it reaches capacity, which is governed by a policy like ARC.
- Fundamental Problem: All finite caches require an eviction policy. The choice of policy directly determines cache performance and efficiency.
- ARC's Role: ARC provides an adaptive, online eviction algorithm. It makes eviction decisions based on real-time access history, choosing to evict from either its recency (T1) or frequency (T2) list.
- Ghost Entries: A key innovation of ARC is its use of ghost entries in lists B1 and B2. These track recently evicted items, providing the metadata needed for its self-tuning adaptation without storing the actual data.

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us