Paper Rundown: Online List Labeling with Predictions
Algorithms with Predictions?
Many algorithms and data structures can benefit from predictions, at least when the predictions are treated carefully. The prediction could come from a neural network trained on historical inputs, or from some simpler model that has useful information about future inputs. The goal is to use those predictions when they help, while still behaving reasonably when they are wrong.
Online List Labeling
The goal of this paper is to build a data structure, called LearnedLLA, that uses input predictions to improve over the classical List Labeling Array.
(If you need a refresher on the classical LLA model, I wrote a short post on LLAs here.)
Prediction Model
The authors made the assumption that for every item arriving in the LearnedLLA, we would get a predicted rank . Define the rank estimation error of an element , as:
Then define as the maximal error of all the predictions.
LearnedLLA
LearnedLLA, like the classical LLA, contains an array of size for some ( in the case of LearnedLLA), and a calibrator tree of height . The twist is that each node in the calibrator tree can hold its own LLA. That LLA can be any implementation you like, from the classical version to a state-of-the-art one with amortized cost per insertion.
A closer look on LearnedLLA
At all times, a LearnedLLA instance with capacity is split into partitions , where , such that each partition is handled by its own black-box LLA, and for any and , if then . This structure is reflected in LearnedLLA's calibrator tree. Each node in the tree has a set of assigned ranks and assigned slots, with all ranks divided equally among the nodes at the same height. The root is responsible for slots and all ranks , its left child is responsible for ranks , and its right child is responsible for ranks , and so on. The leaves of the calibrator tree contain nodes, each one has slots and responsible for a rank (assuming is a power of two). To put this more precisly, the th node at height has assigned ranks
,
and assigned slots
.
Each node in the calibrator tree either corresponds to an LLA — we call these nodes actual LLAs — or it does not, in which case we call them potential LLAs, as they could become LLAs during runtime. It's useful to think of all other nodes in T to be "potential" LLAs. Each root to leaf path could only have one and only one actual LLA. At initialization, all leaves of corrospond to actual LLAs. We define to be the number of ranks assigned to an actual LLA , and let be the number of elements present in an actual LLA .
Insertion
Insertion is fairly simple. To insert some element with a predicted rank :
- Find and , where and are the actual LLAs that hold 's predecessor and successor, respectively.
- Find , where is the actual LLA responsible for rank .
- Compute i where:
- If would exceed the threshold density of , merge it with its sibling LLA in the calibrator tree, and call
initon the potential LLA at their parent. Otherwise, callinserton .
Main Results
Insertion Cost
For arbitrary predictions, using the classical LLA model as a black box, they prove that their insertion algorithm achieves a amortized cost per insertion.
-
When predictions are perfect (i.e., each predicted rank exactly matches the true target position), the insertion cost is constant — .
-
When predictions are poor — specifically, if at least one prediction is maximally wrong (as far from the target as possible) — the insertion cost falls back to , matching the complexity of traditional, non-predictive LLA.
More generally, for any LLA insertion algorithm with an amortized cost of (where is an admissible "reasonable" list labeling cost function), plugging it into the LearnedLLA model as a black box yields an amortized insertion cost of .
They also prove a stronger distributional result:
- For prediction errors sampled from an unknown distribution with mean and variance , their algorithm achieves an expected cost of . That means for distributions with constant mean and variance.
Optimality
Under their prediction model, they prove that any deterministic list labeling algorithm must achieve .
Open Questions.
There is one issue that kept bothering me: if only one prediction is maximally bad, and the rest are perfect, their algorithm can still incur . I dig into that in the follow-up post.
References
-
McCauley, S., Moseley, B., Niaparast, A., & Singh, S. (2023). Online List Labeling with Predictions. arXiv:2305.10536
-
Bender, Michael A., Alex Conway, Martín Farach-Colton, Hanna Komlós, Michal Koucký, William Kuszmaul, and Michael Saks. Nearly Optimal List Labeling. arXiv, 2024. https://doi.org/10.48550/arXiv.2405.00807
-
Bender, M. A., Demaine, E. D., & Farach-Colton, M. (2000). Cache-oblivious B-trees. In Proceedings of the 41st Annual Symposium on Foundations of Computer Science (pp. 399–409). IEEE.