Adaptive Learned Index
Recorded replay, operation 3,459
Details
This is a C++20 ordered index for 64-bit keys. A small line predicts where a key sits, a bounded search corrects the guess, and new keys wait in a buffer beside each leaf, while a cost-based policy decides when merging that buffer is worth the work.
My preregistered claim failed. The adaptive policy did not beat a fixed rebuild threshold on the primary data. At full scale, rebuilds barely paid and ALEX stayed 1.2x to 3.4x faster.
Results
- Primary claim, failed
- 0.948 [0.907, 0.994]Adaptive policy over a fixed threshold, geometric mean on the primary data. Above 1 would have meant the policy won.
- Small data, exploratory
- 1.300 [1.286, 1.313]Adaptive policy over a near-never-merge threshold, without retuning. Geometric mean of four workloads, and append_only lost at 0.917.
- Full-size data, exploratory
- 0.981 and 0.956Adaptive policy over the same near-never-merge threshold, on two datasets.
- Against ALEX
- 1.2x to 3.4x slowerPrimary data, with 23 to 32 percent less memory than ALEX.
- Against PGM
- 1.1x to 2.8x slowerLookups on full data, and about 2.5x larger than PGM.
- Against a sorted array
- 1.7x to 3.1x fasterLookups on full data, with 3.1x at 0.021 index bytes per key.
- Wrong answers
- 0 in 2,032,984,796 operationsDifferential fuzzing across 500,000 random index shapes, with 75.5M rebuilds and 64.4M splits.
- Tests
- 69 of 69 scored mutants caughtFrom a hand-written list of 72, 3 of them equivalent. Library coverage is 98.26 percent of lines and 93.07 percent of branches.
- Replication
- 2,450 measured processesAcross 12 runs, with 0 checksum mismatches.
The replay
Every key, prediction and cost above comes from a recorded trace: wiki_ts_200M_uint64 at stride 2048, the shifting_hotspot workload, seed 102, 20,000,000 operations, digest 63e7fc3fbf8b9bf2. The comparisons are replayed from those keys with the index's own search.
This is the first rebuild in that trace small enough to draw, so it is unlikely to be a typical one. Costs were frozen so the recording repeats, which makes 1,836 ns and 1,480 ns the policy's estimates rather than timings.
Limits
- Single-threaded and in-memory, with no concurrency, durability or production use.
- It does not beat ALEX or PGM on throughput or lookup time on full data.
- The policy did not beat fixed thresholds overall.
- The 1.300 is exploratory, and preregistered applies to the update experiment only.
- Most of the bytes that rebuilds saved were directory shifting rather than key copying.
Method
The report has the tables, recorded runs and failures.