Competitive Caching with Machine Learned Advice: The Competitive Ratio of Predictive MarkerResearch Paper
Motivation
Caching (online paging) is one of the oldest problems in online algorithms: a fast memory of slots serves a sequence of requests, and every request for an element not in the fast memory is a cache miss that forces the element to be loaded, possibly evicting another one. With the whole request sequence known in advance, evicting the element whose next request is furthest in the future is optimal (Bélády, 1966). Without that knowledge, no deterministic algorithm is better than -competitive, and the best randomized algorithms are -competitive (Fiat, Karp, Luby, McGeoch, Sleator and Young, 1991).
Lykouris and Vassilvitskii asked what happens in between: an online algorithm receives, with every request, a machine-learned prediction of the element's next arrival time. A good predictor should make the algorithm nearly as good as Bélády's rule (consistency), and a bad predictor should never make it worse than a classical algorithm (robustness). Their paper (arXiv:1802.05399v4; J. ACM 2021) is one of the founding papers of learning-augmented algorithms, and its algorithm, Predictive Marker, is the reference point for the later literature on caching with predictions.
Timeline.
- 1966: Bélády's furthest-in-future rule is optimal offline.
- 1985: Sleator and Tarjan show that deterministic online paging is at best -competitive.
- 1991: Fiat et al. introduce the Marker algorithm, -competitive, and the clean-element lower bound on the optimum.
- 2018: Lykouris and Vassilvitskii (arXiv:1802.05399) introduce Predictive Marker, with ratio for an -accurate predictor.
- 2020: Rohatgi (arXiv:1910.12172, SODA 2020) and Wei (arXiv:2005.13716, APPROX/RANDOM 2020) improve the dependence on the error.
Setting
A request sequence lists elements of a set . A cache of size starts empty. A request for a cached element is a hit; otherwise it is a miss, the element is loaded, and if the cache is full some element is evicted first. The offline optimum is the least number of misses over all eviction schedules chosen with knowledge of .
With each request the algorithm receives a real prediction . The true label is the position of the next request of , or if there is none. For a loss function , the error of the predictions is , and the predictions are -accurate when .
The spread of measures how cheaply a predictor can get the order of arrivals completely wrong: is the least length such that every strictly increasing integer sequence and every non-increasing real sequence have total loss .
Predictive Marker (Algorithm 1) works in the phases of the Marker algorithm. Requested elements are marked. A phase ends when the cache is full, every cached element is marked, and a miss occurs; then all marks are removed. An element requested in a phase but not in the previous one is clean, and is the total number of clean elements. Each clean miss starts a chain. An element evicted in the current phase that is requested again (a stale miss) extends the chain in which it was evicted. Evictions are among unmarked elements. As long as the chain's length is at most , the evicted element is one with the largest prediction. After that it is chosen uniformly at random. The expected number of misses of Predictive Marker is .
Formalization targets
Goal: Theorem 3.3
If is concave on and majorizes the spread, then for every , every tie-breaking rule, and every sequence with -accurate predictions,
Milestones
- Claim 1 (Fiat et al.): .
- Proof of Theorem 3.3, last sentence: .
- Lemma 3.3: a chain that evicts by the predictions only has length , where is the error of the predictions on the elements evicted into it.
- Lemma 3.4: .
Significance
The result. Theorem 3.3 gives both guarantees at once. For an exact predictor () the ratio is a constant, , independent of ; for an arbitrary predictor it is , within a constant factor of the optimal randomized ratio. In between, the ratio degrades with the error at the rate of the spread: for the absolute loss the spread grows like , so the ratio grows like . The spread and the chain decomposition are the tools later papers build on to trade consistency against robustness.
Formalizing it. The theorem is proved on paper; no machine-checked proof of it, of the Marker analysis, or of the clean-element bound of Fiat et al. is known. A formalization supplies a precise model of a randomized online algorithm with predictions. It also settles the details the paper leaves implicit: the eviction missing from the clean branch of Algorithm 1 as printed, the cap printed as in Lemma 3.4, and the behaviour of the spread at .
Difficulty
The obvious argument charges every miss to a chain and bounds each chain separately. That works for chains that follow the predictions, but a chain that switches to random evictions interacts with every other chain of the phase, because all of them evict from the same pool of unmarked elements. A bound on its expected length must hold whatever the other chains evict, including evictions that depend on earlier coin flips. A second difficulty is summing. The chain errors and the chain lengths are both random, while the hypothesis controls only the total error against , not the number of chains in which the error is spread.
Formalization scope
Elements form a type with decidable equality. A request sequence is a list; predictions are one real per request, and every real sequence is allowed. Labels are 1-based next-arrival positions, with for elements never requested again. The paper prints the label with equal features; the element is meant. is computed as the minimum over all demand-paging schedules from the empty cache, which loses no generality. is harmonic k as a real number, never .
Predictive Marker is a PMF over final states. The random eviction of line 21 is uniform over the unmarked cached elements, and ties in the arg max are a parameter quantified universally. The eviction of lines 23–24 is also performed after a clean miss; as printed, it sits only in the stale branch. The expected cost lies in .
The spread takes real arguments and lengths . must be concave on , finite, and at least the spread. It must also be continuous at , which the paper does not say: without it the chain lemma fails for losses whose minimal reversed-order loss stays over several lengths. -accuracy is the pointwise condition on the given pair . The competitive ratio is written as a product, so needs no special case. Lemma 3.3 is stated pointwise for chains without random evictions, as its proof shows. Lemma 3.4 has in place of the printed , with the minimum inside the expectation because is random.
The statement must not be trivialized. is the true offline optimum, not Bélády's rule applied to the predictions. The expectation is taken over Predictive Marker's own run, never compared with itself. The spread hypothesis is satisfiable; for example, the constant loss has spread .
Out of scope: Lemma 3.2 (the special-marking algorithm SM, which enters only through Lemma 3.4's proof); Lemma 3.1 and Corollaries 1–2, whose printed constants are false for small or disagree with Theorem 3.3; the lower bounds of §3.1 and §3.4; the extensions of §4; the experiments of §5; running time and learnability.
Welcome contributions: the Marker phase structure and its equivalence with the combinatorial phases, the clean-element bounds (reusable for any marking algorithm), and a bound on the expected number of misses caused by elements evicted uniformly at random within a phase.
Selected references
- T. Lykouris, S. Vassilvitskii, Competitive Caching with Machine Learned Advice, arXiv:1802.05399v4, 2020; J. ACM 68(4), 2021. https://arxiv.org/abs/1802.05399v4
- A. Fiat, R. M. Karp, M. Luby, L. A. McGeoch, D. D. Sleator, N. E. Young, Competitive paging algorithms, J. Algorithms 12(4), 1991. https://doi.org/10.1016/0196-6774(91)90041-V
- L. A. Bélády, A study of replacement algorithms for a virtual-storage computer, IBM Systems Journal 5(2), 1966. https://doi.org/10.1147/sj.52.0078
- D. D. Sleator, R. E. Tarjan, Amortized efficiency of list update and paging rules, Comm. ACM 28(2), 1985. https://doi.org/10.1145/2786.2793
- D. Rohatgi, Near-optimal bounds for online caching with machine learned advice, SODA 2020. https://arxiv.org/abs/1910.12172
- A. Wei, Better and simpler learning-augmented online caching, APPROX/RANDOM 2020. https://arxiv.org/abs/2005.13716