Learned Index with Dynamic $\epsilon$

1 INTRODUCTION . Data indexing ( Graefe & Kuno , 2011 ; Wang et al. , 2018 ; Luo & Carey , 2020 ; Zhou et al. , 2020 ) , which stores keys and corresponding payloads with designed structures , supports efficient query operations over data and benefits various data retrieval applications . Recently , Machine Learning ( ML ) models have been incorporated into the design of index structure , leading to substantial improvements in terms of both storage space and querying efficiency ( Kipf et al. , 2019 ; Ferragina & Vinciguerra , 2020a ; Mitzenmacher , 2018 ; Vaidya et al. , 2021 ) . The key insight behind this trending topic of “ learned index ” is that the data to be indexed contain useful distribution information and such information can be utilized by trainable ML models that map the keys to their stored positions . State-of-the-art learned index methods ( Galakatos et al. , 2019 ; Kipf et al. , 2020 ; Ferragina & Vinciguerra , 2020b ; Ferragina et al. , 2020 ) adopt piece-wise linear segments to approximate the data distribution and introduce an important pre-defined parameter . These methods ensure that the maximal prediction error of each learned segment is no more than and provide a worst-case guarantee of querying efficiency . By tuning , various space-time preferences from users can be met . For example , a relatively large can result in a small index size while having large prediction errors , and on the other hand , a relatively small provides with small prediction errors while having more learned segments and thus a large index size . However , existing learned index methods implicitly assume that the whole dataset to be indexed contains the same characteristics for different localities and thus adopt the same for all the learned segments , leading to sub-optimal index performance . More importantly , the impact of on index performance is intrinsically linked to data characteristics , which are not fully explored and utilized by existing learned index methods . Motivated by these , in this paper , we theoretically analyze the impact of on index performance , and link the characteristics of data localities with the dynamic adjustments of . Based on the derived theoretical results , we propose an efficient and pluggable learned index framework that dynamically adjusts in a principled way . To be specific , under the setting of an illustrative learned index method MET ( Ferragina et al. , 2020 ) , we present novel analysis about the prediction error bounds of each segment that link with the mean and variance of data localities . The segment-wise prediction error embeds the space-error trade-off as it is the product of the number of covered keys and mean absolute error , which determine the index size and preciseness respectively . The derived mathematical relationships enable our framework to fully explore diverse data localities with an -learner module , which learns to predict the impact of on the index performance and adaptively choose a suitable to achieve a better space-time trade-off . We apply the proposed framework to several state-of-the-art ( SOTA ) learned index methods , and conduct a series of experiments on three widely adopted real-world datasets . Comparing with the original learned index methods with fixed , our dynamic versions achieve significant index performance improvements with better space-time trade-offs . We also conduct various experiments to verify the necessity and effectiveness of the proposed framework , and provide both ablation study and case study to understand how the proposed framework works . 2 BACKGROUND . 2.1 -BOUNDED LEARNED INDEX . Given a dataset D = { ( x , y ) |x ∈ X , y ∈ Y } , X is the set of keys over a universe U such as reals or integers , and Y is the set of positions where the keys and corresponding payloads are stored . The index such as B+-tree ( Abel , 1984 ) aims to build a compact structure to support efficient query operations over D. Typically , the keys are assumed to be sorted in ascending order to satisfy the key-position monotonicity , i.e. , for any two keys , xi > xj iff their positions yi > yj , such that the range query ( X ∩ [ xlow , xhigh ] ) can be handled . Recently , learned index methods ( Kraska et al. , 2018 ; Li et al. , 2019 ; Tang et al. , 2020 ; Dai et al. , 2020 ; Crotty , 2021 ) leverage ML models to mine useful distribution information from D , and incorporate such information to boost the index performance . To look up a given key x , the learned index first predicts position ŷ using the learned models , and subsequently finds the stored true position y based on ŷ with a binary search or exponential search . Thus the querying time consists of the inference time of the learned models and the search time in O ( log ( |ŷ − y| ) ) . By modeling the data distribution information , learned indexes achieve faster query speed than traditional B+-tree index , meanwhile using several orders-of-magnitude smaller storage space ( Ding et al. , 2020 ; Galakatos et al. , 2019 ; Ferragina & Vinciguerra , 2020b ; Kipf et al. , 2020 ; Marcus et al. , 2020 ) . Many existing learned index methods adopt piece-wise linear segments to approximate the distribution of D due to their effectiveness and low computing cost , and introduce the parameter to provides a worst-case preciseness guarantee and a tunable knob to meet various space-time trade-off preferences . Here we briefly introduce the SOTA -bounded learned index methods that are most closely to our work , and refer to the review chapter of ( Ferragina & Vinciguerra , 2020a ) for details of other methods . Specifically , Galakatos et al . ( 2019 ) greedily learn a set of piece-wise linear segments in a one-pass manner . Ferragina & Vinciguerra ( 2020b ) adopt another one-pass algorithm that achieves the optimal number of learned segments . Kipf et al . ( 2020 ) introduce a radix structure to organize the learned segments . Ferragina et al . ( 2020 ) adopt a fixed slope setting for all learned segments . Existing methods constraint all learned segments with the same , i.e. , the learning process ensures that the maximum prediction error is within a pre-defined where ∈ Z > 1 . In this paper , we will discuss the impact of in more depth and invistigate how to enhance existing learned index methods from a new perspective : dynamic adjustment of considering the diversity of different data localities . 2.2 MEAN EXIT TIME ( MET ) ALGORITHM . Here we describe an illustrative learned index algorithm MET ( Ferragina et al. , 2020 ) . Specifically , for any two consecutive keys of D , suppose their key interval ( xi − xi−1 ) is drawn according to a random process { Gi } i∈N , where Gi is a positive independent and identically distributed ( i.i.d . ) random variable whose mean is µ and variance is σ2 . The MET algorithm learns linear segments S = [ S1 , ... , Si , ... , SN ] in one pass , where Si : y = aix+ bi is the learnable linear segment and N is the total number of learned segments . The learning process is as follows : The current linear segment fixes the slope ai = 1/µ and goes through the first available data point , thus bi is also determined . Then the segment covers as many data points as possible until a data point , say ( x′ , y′ ) achieves the prediction error larger than . The violation of triggers a new linear segment , and the data point ( x′ , y′ ) will be the first available data point , and the process repeats until no data point is available . Although the MET algorithm adopts a simple learning mechanism , it makes the theoretical analysis convenient by modeling the learning process as a random walk process . Other -bounded learned index methods such as FITing-Tree ( Galakatos et al. , 2019 ) , PGM ( Ferragina & Vinciguerra , 2020b ) and Radix-Spline ( Kipf et al. , 2020 ) learn linear segments in a similar manner while having different mechanisms to determine the parameters of { Si } . Ferragina et al . ( 2020 ) reveal the relationship between and index size performance based on MET . In Section 3.3 , we present novel analysis about the impact of on not only the index size , but also the index preciseness and a comprehensive trade-off quantity , which facilitates the proposed dynamic adjustment . 3 LEARN TO VARY . 3.1 PROBLEM FORMULATION AND MOTIVATION . Before introducing the proposed framework , we first formulate the task of learning index from data with guarantee , and provide some discussions about why we need to vary . Given a dataset D to be indexed and an -bounded learned index algorithm A , we aim to learn segments S = [ S1 , ... , Si ... , SN ] as index structure such that the size of S and ∑N i=1 MAE ( Di|Si ) are both small , where Si is the i-th learned linear segment with the parameter i , MAE is the mean absolute prediction error , and Di ⊂ D is the data whose keys are covered by Si . For the remaining data D \ ⋃ j < iDj , the algorithm A repeatedly checks whether the prediction error of new data point violates the given i , and outputs the learned segment Si that covers Di . When all the is for i ∈ [ N ] take the same value , the problem becomes the one that existing learned index methods are dealing with . Now let ’ s examine the effect of parameter . To query a specific data point , say ( x , y ) , we first need to find the specific segment S′ that covers x , and then search its true position y based on the estimated one ŷ = S′ ( x ) . For the first step , we can find S′ from S in O ( log ( N ) ) ; for the second step , the search of y based on ŷ can be done in O ( log ( |ŷ − y| ) ) . In summary , we can find the true position of the queried data point in O ( log ( N ) + log ( |ŷ − y| ) ) 1 . From here , we can see that the parameter plays an important role to trade off two contradictory performance terms , i.e. , the size of the learned index N , and MAE of the whole data MAE ( D|S ) . If we adopt a small , the maximal prediction error constraint is more frequently violated , leading to a large N ; meanwhile , the preciseness of learned index is improved , leading to a small MAE ( D|S ) . On the other hand , with a large , we will get a more compact learned index ( i.e. , a small N ) with larger prediction errors ( i.e. , a large MAE ( D|S ) ) . Thus these two inversely changed terms jointly impact the querying efficiency . Actually , the effect of on index performance is intrinsically linked to the characteristic of the data to be indexed . For real-world datasets , an important observation is that the linearity degree varies in different data localities . Recall that we use piece-wise linear segments to fit the data , and determines the partition and the fitness of the segments . By varying , we can adapt to the local variations of D and adjust the partition such that each learned segment fits the data better . Formally , let ’ s consider the quantity SegErri that is defined as the total prediction error within a segment Si , i.e. , SegErri = ∑ ( x , y ) ∈Di |y − Si ( x ) | , which is also the product of the number of covered keys Len ( Di ) and the mean absolute error MAE ( Di|Si ) . Note that a large Len ( Di ) leads to a small N since |D| = ∑N i=1 Len ( Di ) . From this view , the quantity SegErri internally reflects the space-error trade-off . Later we will show how to leverage this quantity to dynamically adjust .

Summary: This paper mainly studies the index structure problem.  Existing learned index methods use a fixed value for all the learned segments. In this paper, the author contributes a deeper understanding of how the impacts the index performance, and enlightens the exploration of fine-grained trade-off adjustments by considering data local characteristics.  Experiments with real-world datasets and several state-of-the-art methods demonstrate the efficiency, effectiveness, and usability of the proposed framework.