Abstract
Priority queues (PQs) are foundational data structures in computer science, yet they are traditionally bound by an $O(\log n)$ performance limit for core operations. This paper introduces Learning-Augmented Priority Queues (LAPQ), a framework that integrates machine-learned predictions to accelerate operations. By utilizing skip lists as the underlying structure, the authors develop mechanisms for "dirty" comparisons, pointer hints, and rank predictions. These structures achieve near $O(1)$ performance when predictions are accurate while remaining robust against poor advice. Empirical results on Dijkstra’s algorithm and sorting benchmarks demonstrate significant speedups over traditional binary and Fibonacci heaps.
1. Introduction
Priority queues are indispensable in algorithmic tasks ranging from task scheduling to shortest-path computations like Dijkstra’s algorithm. In the standard comparison-based model, a priority queue containing $n$ elements requires $\Omega(\log n)$ time for operations such as Insert and ExtractMin. While sophisticated structures like Fibonacci heaps offer $O(1)$ amortized time for some operations, they remain complex to implement and still face logarithmic costs for extractions.
The emerging field of learning-augmented algorithms suggests a middle ground: using potentially inaccurate "advice" from a machine learning model to bypass worst-case lower bounds. This paper applies this paradigm to priority queues, proposing the Learning-Augmented Priority Queue (LAPQ).
2. The Learning-Augmented Framework
The core idea of LAPQ is to use a prediction model to guide the insertion process. The authors explore three distinct models of advice:
- Dirty Comparisons: The algorithm uses a "dirty" comparator—a fast but occasionally inaccurate heuristic. A combination of randomized binary search and exponential search is used to verify and correct the position.
- Pointer Predictions: Upon inserting a key $u$, the model provides a pointer to a predicted predecessor already present in the queue. The algorithm then performs a "Bottom-Up" followed by a "Top-Down" search on a skip list to finalize the position.
- Rank Predictions: The model predicts the absolute rank of an element within the total set of elements to be inserted. An auxiliary van Emde Boas (vEB) tree manages these predicted ranks, mapping them to specific positions in the skip list.
3. Structural Innovation: Why Skip Lists?
A significant contribution of this work is the identification of skip lists as the ideal substrate for learning-augmented PQs. Traditional binary heaps are inherently rigid; their tree structure necessitates $O(\log n)$ comparisons during ExtractMin to maintain the heap property, regardless of how well the insertion was predicted.
In contrast, skip lists allow for $O(1)$ deletions and extractions once an element is located. By using a skip list, the authors decouple the search (finding the insertion point) from the maintenance (updating the structure). This allows the search phase to be accelerated by predictions—reducing complexity to $O(\log \text{error})$—without compromising the integrity of the data structure.
4. Experimental Evaluation
The authors evaluated LAPQ across two primary domains:
- Synthetic Sorting: Using "class" (grouped ranks) and "decay" (temporal perturbation) noise models to test sensitivity to prediction error.
- Shortest Path Algorithms: Running Dijkstra’s algorithm on real-world city maps (Brussels, Paris, New York, London) and synthetic Poisson Voronoi Tessellations (PVT).
For the Dijkstra benchmarks, the authors utilized a "Key Rank" heuristic. They observed that different shortest-path queries on the same map often result in similar relative orderings of nodes. Thus, a model can be trained on a single run to provide highly accurate advice for subsequent queries on that same topology.
5. Key Results
The LAPQ demonstrates both theoretical optimality and practical efficiency:
- Theoretical Bounds: In the pointer prediction model, insertion time scales with $O(\log \text{error})$. If the prediction is perfect, the operation takes $O(1)$ time. The authors proved that these skip-list-based designs are theoretically optimal for the provided prediction models.
- Empirical Performance: In sorting tasks, LAPQ matched or exceeded the performance of specialized learning-augmented sorting algorithms like Double-Hoover and Displacement Sort.
- Dijkstra Speedups: On the London road network, LAPQ reduced the number of comparisons by nearly 75% compared to a standard binary heap when provided with high-quality predictions. On PVT graphs, the "key rank" predictions were so reliable that they outperformed "perfect" node rank predictions due to the uniform spatial structure of the synthetic graphs.
6. Discussion and Limitations
While LAPQ offers a clear path to sub-logarithmic priority queues, several considerations remain:
- Overhead: The rank prediction model’s reliance on a vEB tree introduces an $O(\log \log N)$ amortized overhead. While small, the constant factors in vEB implementations can be significant.
- Static Universe: The current rank prediction model assumes a finite universe of keys ($N$), which may not be suitable for infinite streaming data.
- Complexity: The implementation of skip lists and vEB trees is more involved than that of a standard binary heap, which may impact adoption in performance-critical systems where code maintainability is a priority.
7. Conclusion
Learning-Augmented Priority Queues represent a significant step forward in data structure design. By shifting the complexity of priority queue operations from the structure's inherent constraints to the accuracy of a prediction model, LAPQs achieve performance levels previously thought impossible under the comparison-based model. Most importantly, they maintain robustness, ensuring that even in the face of poor predictions, performance never degrades significantly below that of standard structures.
Summary updated