Abstract
Recent work shows the effectiveness of Machine Learning (ML) to reduce cache miss ratios by making better eviction decisions than heuristics. However, state-of-the-art ML caches require many predictions to make an eviction decision, making them impractical for high-throughput caching systems. This paper introduces Machine learning At the Tail (MAT), a framework to build efficient ML-based caching systems by integrating an ML module with a traditional cache system based on a heuristic algorithm. MAT treats the heuristic algorithm as a filter to receive high-quality samples to train an ML model and likely candidate objects for evictions. We evaluate MAT on 8 production workloads, spanning storage, in-memory caching, and CDNs. The simulation experiments show MAT reduces the number of costly ML predictions-per-eviction from 63 to 2, while achieving comparable miss ratios to the state-of-the-art ML cache system. We compare a MAT prototype system with an LRU-based caching system in the same setting and show that they achieve similar request rates.
Introduction: The Throughput Wall in ML Caching
Caching is a fundamental pillar of modern internet infrastructure, utilized in everything from Content Delivery Networks (CDNs) to in-memory databases. The primary objective is to maintain "hot" data in the fast cache while evicting "cold" data to accommodate new requests.
Traditional heuristics, such as Least Recently Used (LRU), are computationally efficient but often make sub-optimal decisions because they fail to capture complex, non-linear access patterns. Conversely, recent Machine Learning (ML) approaches can predict future access patterns with high accuracy, significantly reducing cache miss ratios. However, these systems face a "throughput wall." State-of-the-art models like Learning Relaxed Belady (LRB) require dozens of predictions (e.g., 64) to decide which single object to evict. In high-throughput environments handling hundreds of thousands of evictions per second, this computational overhead is prohibitive. MAT aims to provide ML-level accuracy with heuristic-level speed.
The MAT Framework
The core innovation of MAT is treating a traditional heuristic algorithm as a high-quality "candidate generator" rather than the final decision-maker. This approach allows the system to focus its computational resources only on the most critical decisions.
System Architecture
As shown in the architecture above, MAT consists of two primary components:
- The Heuristic Filter: Instead of sampling the entire cache for eviction candidates, MAT monitors the "tail" of the heuristic (e.g., objects LRU is currently prepared to evict).
- ML Prediction and Dynamic Thresholding: An ML module predicts the Time-To-next-Access (TTA) for these tail objects. MAT uses a dynamic threshold ($T$). If an object’s predicted TTA is greater than $T$, it is evicted. If the model predicts the object will be accessed sooner than $T$, the object is "rescued" and re-inserted into the cache.
This design allows the system to "fall back" to the underlying heuristic if the ML module becomes a bottleneck, ensuring the cache never stalls. The threshold $T$ automatically adjusts to maintain a target number of predictions per eviction ($k$), providing self-adjusting overhead.
Key Insights: Why Filtering the Tail Works
The researchers discovered that common heuristics like LRU are already surprisingly effective, evicting 87–97% of the same objects that an "optimal" offline algorithm (Belady’s MIN) would. The ML model's job is not to reinvent the wheel, but to catch the small percentage of "mistakes" where the heuristic tries to evict an object that is actually about to be reused.
By focusing only on the tail, MAT reduces training data volume by 50–90%, making online model retraining significantly faster. Furthermore, by decoupling the eviction thread from the ML prediction thread, MAT can run elastically. When CPU resources are scarce, the system relies more on the heuristic; when available, the ML model "sharpens" the eviction decisions.
Evaluation and Results
MAT was evaluated using 8 production workloads across CDNs (including Wikipedia), in-memory caching (Memcachier), and storage (IBM and Microsoft traces). These datasets represent a diverse range of object sizes and access patterns.
- Efficiency: MAT reduced the number of costly ML predictions per eviction from 63 down to 2 compared to state-of-the-art systems.
- Latency: The total software overhead per eviction dropped from 300μs to 9.3μs—a 32x improvement.
- Accuracy: Despite the massive reduction in computation, MAT achieved miss ratios comparable to LRB. For the CDN1 workload, MAT reduced the miss ratio from LRU's 21% to 18%, saving 14% of wide-area network traffic.
- Throughput: In a prototype implementation using Facebook’s Cachelib, MAT achieved request processing rates nearly identical to a pure LRU system, proving its viability for production traffic.
Conclusion
MAT demonstrates that ML-based caching does not have to be computationally expensive. By leveraging heuristics as a filter, MAT achieves the best of both worlds: the high throughput of traditional algorithms and the low miss ratios of modern machine learning. Future work may explore more complex models, such as Recurrent Neural Networks (RNNs), to further close the gap to the theoretical optimal performance.
Summary updated