The Anatomy of Piecewise-Linear Learned Indexes
Yue Chen, Yong Zhang
cs.DS
Nov 24, 2026 · v1
math.PR
TL;DR
Core probabilistic theorems on PLA learned-index fanout and hierarchy height are formalized in Lean 4/Mathlib in a 2,682-module library, PLAStochastic, with no sorrys.
Abstract
Piecewise-linear approximation (PLA) learned indexes (PGM-index, FITing-Tree, RadixSpline, PLEX, PLIN) compress sorted keys into $\pm\varepsilon$ segments, yet prior theory stops at coarse $Θ(\varepsilon^2)$ single-segment bounds. At the bottom layer, optimal greedy PLA covers $κ_{\rm opt}\varepsilon^2/v_0 \approx 3.54\,\varepsilon^2/v_0$ keys per segment on independent gaps and $κ_{\rm opt}\varepsilon^2$ under any smooth density ($v_0=1$), while anchored and chord fitters retain $Θ(\varepsilon^2/v_0)$ coverage. Across recursive layers, a law-of-large-numbers heuristic–invoked to claim $O(\log\log n)$ height for the PGM-index–suggests summing $Θ(\varepsilon^2)$ gaps averages out fluctuations. We prove this fails under Endpoint Promotion (EP): stopping-time fluctuations reset relative gap variance at every depth, locking fanout at $C_\varepsilon \approx 19.861\,\varepsilon^2$, expected height at $\log n/\log C_\varepsilon + O(1)$, and lookup at $Θ(\log n)$. To break this barrier, Rank-Equispaced Promotion (RE) samples pivots at equal rank strides. Each stride sums a fixed number of base gaps, so relative variance decays across layers and cumulative coverage squares at each step. Expected height drops to $\log_2\log_\varepsilon n + O(1)$ on independent gaps and $\log_2\log_\varepsilon n + \log_2^+(\log n/\log(\varepsilon/δ)) + O(1)$ on smooth densities with curvature $δ$. A compact bucket directory routes across unaligned RE pivots with $<1$ extra comparison per layer on average, giving RE-PGM $O(\log\varepsilon \cdot \log\log_\varepsilon n)$ expected lookup in $Θ(n/\varepsilon^2)$ space and $O(n)$ build time without radix skew sensitivity. Our constants match empirical fanout within $0.3\%$ down to $\varepsilon=2$, and all core theorems are formalized in Lean 4.
Problem
Piecewise-linear learned indexes such as the PGM-index were previously analyzed only through coarse Θ(ε²) single-segment coverage bounds. A law-of-large-numbers heuristic had been used to claim O(log log n) height for recursive PGM hierarchies.
Approach
A Brownian functional limit gives exact constants for optimal greedy PLA segment coverage and dispersion. Endpoint Promotion (EP) is analyzed via stopping-time variance decomposition. Rank-Equispaced Promotion (RE) is proposed, together with a compact CSR bucket directory for routing across layers. Eight core theorem packages are machine-checked in a Lean 4/Mathlib library, PLAStochastic, using only the standard axioms.
Results
Under EP, fanout locks at C_ε ≈ 19.861 ε², so height is Θ(log n). Under RE, height drops to log₂ log_ε n + O(1), plus a curvature term for smooth densities, giving O(log ε · log log_ε n) expected lookup. The constants match empirical fanout within 0.3% down to ε=2.
| Promotion | Input model | E[H] |
|---|
| Endpoint (EP) | Model G | log n / log C_ε + O(1) |
| Endpoint (EP) | Model K | log n / log C_ε + O(1) |
| Equispaced (RE) | Model G | log₂(log n / log ε) + O(1) |
| Equispaced (RE) | Model K (F_δ) | log₂(log n / log ε) + log₂⁺(log n / log(ε/δ)) + O(1) |
Expected hierarchy height by promotion rule and input model