Introduction
Learned indices have emerged as a powerful alternative to traditional B-trees, offering superior query speeds and significantly reduced memory footprints by treating indexing as a machine learning task. However, a major hurdle remains: the "slow-to-build" problem. Training neural network models from scratch for every new dataset is computationally expensive and often two orders of magnitude slower than building a B-tree. This paper introduces agile model reuse, a "lazy" approach that bypasses training by adapting pre-trained models from a library of synthetic datasets. The resulting structure, the Recursive Model Reuse Tree (RMRT), builds up to 200x faster than standard learned indices while maintaining or exceeding their lookup performance.
The Challenge of Training from Scratch
The core idea of a learned index is to use a model to approximate the Cumulative Distribution Function (CDF) of keys, predicting their position in a sorted array. While effective for lookups, the training phase is a bottleneck, especially when data is frequently updated. The authors propose a shift in perspective: instead of training a new model for every dataset, can we reuse models from similar distributions?
Methodology: Agile Model Reuse
The proposed framework for agile model reuse is built upon four key components:
1. Synthetic Dataset Library
To ensure broad applicability, the authors pre-train a collection of models on synthetic datasets. These datasets are designed to cover a wide variety of CDF shapes. By discretizing the "CDF space," the library provides a representative set of models that can be adapted to real-world data distributions.
2. Fast Similarity Matching and Domain Adaptation
When a new dataset is indexed, the system identifies the "closest" synthetic dataset in the library using a fast, histogram-based distance metric. Once a model is selected, it undergoes Domain Adaptation. This process uses simple affine mappings (linear transformations) to shift and scale the model's input and output ranges. Crucially, this adaptation does not require updating the neural network's weights, making it extremely fast.
3. Recursive Model Reuse Tree (RMRT)
For complex or highly skewed datasets, a single model might not suffice. The RMRT structure applies the reuse logic recursively. It partitions the data and finds the best reusable model for each partition, resulting in an unbalanced tree that naturally adapts to varying data densities.
Performance Evaluation
The authors evaluated RMRT using the SOSD (Search on Sorted Data) benchmark, which includes real-world datasets like Amazon book popularity (amzn), Facebook user IDs (face), OpenStreetMap (osm), and Wikipedia edits (wiki).
Key Results
- Rapid Construction: On the
facedataset, RMRT built two orders of magnitude faster than a standard neural-network-based Recursive Model Index (RMI). - High-Speed Lookups: RMRT achieved the fastest lookup times across all real datasets. For instance, on
amzn, RMRT's 189 ns lookup time was 64% faster than a B-tree and 38% faster than the PGM-index. - Robustness to Skew: The recursive nature of RMRT allows it to maintain stable performance even as data skewness increases, a scenario where traditional RMIs often struggle.
Insights and Future Directions
The success of RMRT stems from the insight that indices are essentially CDF approximators. Since many datasets share similar distribution shapes, models are highly transferable. This "lazy" approach replaces expensive backpropagation with simple search and basic arithmetic.
Furthermore, the authors provide mathematical proofs for error bounds based on distribution similarity, allowing for guaranteed query correctness. They also demonstrate that the similarity metric can act as a buffer for updates; models can tolerate a certain amount of data drift before requiring a refresh.
Future work includes expanding library coverage for "edge case" distributions and exploring learning-based techniques to further optimize the search for reusable models within the priority queue.
Summary updated