Skip to content
Back to the collection

The Case for Learned Index Structures

Tim Kraska, Alex Beutel, Ed H. Chi, Jeffrey Dean, Neoklis Polyzotis

2017 · arXiv

Read the paper
HN score
5
Mentions
19
Readers
15
Months
14
What’s in a score?

From the abstract

Indexes are models: a B-Tree-Index can be seen as a model to map a key to the position of a record within a sorted array, a Hash-Index as a model to map a key to a position of a record within an unsorted array, and a BitMap-Index as a model to indicate if a data record exists or not. In this exploratory research paper, we start from this premise and posit that all existing index structures can be replaced with other types of models, including deep-learning models, which we term learned indexes. The key idea is that a model can learn the sort order or structure of lookup keys and use this signal to effectively predict the position or existence of records. We theoretically analyze under which conditions learned indexes outperform traditional index structures and describe the main challenges in designing learned index structures. Our initial results show, that by using neural nets we are able to outperform cache-optimized B-Trees by up to 70% in speed while saving an order-of-magnitude in memory over several real-world data sets. More importantly though, we believe that the idea of replacing core components of a data management system through learned models has far reaching implications for future systems designs and that this work just provides a glimpse of what might be possible.

Metadata: arXiv. Abstracts retain their original authors’ rights.

In the conversation

Original HN comments, with labels from simple text rules. A label describes the whole comment and may miss context or irony. Read the discussion to make up your own mind. About the labels

19 selected excerpts · 19 total mentions

jacksmith21006
Strong recommendation · rule
All comes down to the cost. We can see that the TPUs were about 1/2 as much as using Nvidia before the TPU 3.0. This is based on doing the same task with the TPUs versus Nvidia with AWS. But it might be a bigger difference and Google taking margins. Could have been the other way but think WaveNet proves not that direction. Would hope we get an even bigger price difference with this generation. BTW, you are mixing up graphic generations and ML generations. Google never did or will graphics. For ML Google is 2 generations ahead. Hard to imagine Nvidia ever catching up as so much of the AI breakthroughs are coming from Google. A perfect example is WaveNet. Google is using a…
Read the full comment
NN for audio in real time at 16k cycles a second. That is competing with using the old way of doing this. The Google approach gets a better result but people are only willing to pay too much more for a better result. So Google had to price WaveNet competitively to the old approach which they have. I suspect that would have been impossible using Nvidia. The cost in running would have been just too high. The computation required for WaveNet is huge and the old way it is minimal. Also we are going to need to really separate training with inference. They have different requirements and the costs in running are different. Has Nvidia done an inference only solution? Or do they still always mix them? "Google would have made a CPU to compete with Intel. " I do a lot of surfing and have to say one of the more silly things to read. There is little gains today with CPUs. Why on earth would you invest in doing your own? Google has ported all their stuff to Power so they have a backup and not reliant on Intel. But CPUs are NOT the future and would be crazy to invest into them at this point. Processing is moving to TPU type processors and we will see more and more traditional things. A fantastic paper on this from Jeff Dean at Google I suggest you read. https://arxiv.org/abs/1712.01208 One thing I love about Google is they do NOT reinvent the wheel. If there is something that can work like the Linux kernel they use. Versus having an ego of having to do yourself. They did all their own network silicon by hiring the Lanai team several years ago because there was nothing that could work for their needs. They then created a determinate network stack so they could do Spanner. There was nothing off the shelve. Heck they laid their own fiber under the ocean to make possible. Spanner is the first and only horizontally scalable RDBMS solution to exist. Google beat the speed of light by using their custom silicon, custom stack that is determinate, their own fiber. Then using atomic clocks with GPS to remove the latency from speed of light out of the equation. Highly recommend the papers including the Spanner paper. https://ai.google/research/pubs/pub39966 The network uses custom silicon inside and then they put the intelligence on out edge. Then they control exactly the traffic so they get a determinate result. This also allows them to use far cheaper hardware as do not need to over provision as they never drop packets on the ground or need much memory for buffers. Google would have used Nvidia in a second if they could do what they need. But what is being done in AI (ML) today requires unique silicon. Just not possible without as the power footprint would be prohibitive. I do expect Google more and more to leverage on client ML where needed with their PVC. So it is NOT just the TPUs but for somethings you are going to need on client. Take the new voices as an example. They are doing 6 voices as each has a different model. The cost in switching models is prohibitive in the cloud. So you will see them eventually move to some things being done on the client. But they are so far ahead they have tons of time. I would not be surprised if we do not seen anyone else do Wavenet for a couple of years. What Nvidia should be working on is finding a way to do WaveNet at a reasonable cost for Amazon and others. But the long term is the big cloud providers will do their own silicon. Google set the path with the TPUs and now the others will have to do the same to keep up. But just makes sense as the cloud providers have the data to iterate. MS is using a FPGA which was foolish, IMO. Never going to get there with that route. BTW, you need to realize how this works for inference. You keep the model in memory. Google invented Capsule networks that use dynamic routing and are going to cause different patterns in memory access and would be curious if the TPU 3.0 were optimized for such? They have a huge advantage of inventing the algorithms and then get to make their own silicon optimized. Something Nvidia really needs to be able to better compete, IMO. BTW2, Google using Power did include the excellent Nvidia memory interconnect as part of the spec. Not sure did Google license or does Nvidia give away? The spec is called Open Power if not aware? https://www.theregister.co.uk/2016/04/07/open_power_summit_p...
sulam
Strong recommendation · rule
I highly recommend people give this paper a read. I think it points the way to a radical redesign of fundamental parts of the system stack over the next 5-10 years. If you work in systems and you aren’t thinking about this stuff, you’re about to be lapped. The Case for Learned Index Structures: https://arxiv.org/pdf/1712.01208v1.pdf
malisper
Recommendation · rule
> OTOH the standard library sort can be improved if you know the distribution of the numbers you're sorting (e.g., small numbers can bucket sort, small lists can use a sorting network, etc). If this thing can efficiently almost-correctly-sort because it's better at these types of pattern matching, we can just run a final pass of insertion sort to make it useful! I haven't read this paper, but that strategy was exactly the strategy behind "The Case for Learned Index Structures"[0]. The idea was you could train a model to predict the location of a row based on a primary key. After computing the model, you could then go through every row and compute a bound on how far off the model is from the actual row. To perform a lookup, you start off at the model's guess, then look around based on the bound on the model for a row with the given primary key. [0] https://arxiv.org/abs/1712.01208
ndr
Recommendation · rule
> One big downside is that is has a margin of error which is very often unacceptable. You should look at the paper they mention The Case for Learned Index Structures[0]. It covers B-Tree-Index and how to use Hybrid Indexes to bound the errors so that "bad" answers from the model perform no worse than the standard data structure. For a lighter read this paper was also covered by Adrian Colyer in an issue of the morning paper[1]. [0] https://arxiv.org/abs/1712.01208 [1] https://blog.acolyer.org/2018/01/08/the-case-for-learned-ind... [edit: formatting]
yencabulator
Neutral mention · rule
The LLM is still a "normal algorithm", just one with a fairly large dataset to use. Assigning the algorithm part of LLMs magical properties hinders understanding. The work needed to pick the next output token is very much a classical algorithm. Algorithms can be based on training and/or use data just fine, too. https://arxiv.org/abs/1712.01208 (Now, the weights used, those we kinda really don't understand the same way we understand the processing, and the approach to looking for structures in weights sometimes looks more like archeology or anthropology than computer science.) It sounds like you're trying to express some kind of "but LLMs are so much more" thought. Yes, very much, they are. It's because of the size of the data, there's interesting emergence there. They're still a normal algorithm. (And our brains aren't quite like that; biological things are much more random/chaotic and generally non-reproducible.)
kevindamm
Neutral mention · rule
In theory, you can treat the objects as i.i.d. giving them a uniform prior. In practice, of course only the inputs are inputs and if you were to take that into account then you could avoid collisions, but as you say, you can't really know that ahead of time. Unless you can, such as when there is structure to the inputs or some other source of non-uniformity that you can account for. The topic of learned indexes is worth investigating if you're interested: https://arxiv.org/abs/1712.01208 https://arxiv.org/abs/2012.12501
gopalv
Neutral mention · rule
> we'll see another explosion in practical CPU throughput, combined with a little help from algs and data structures The learned index[1] is basically a variation of this sort of "hint" which relies on getting the right answer most of the time, but from learning the distribution function as a model instead of relying on the programmer to heuristic it. (from that paper) > The key idea is that a model can learn the sort order or structure of lookup keys and use this signal to effectively predict the position or existence of records I haven't seen anything mix this sort of work with an Eytzinger traversal, but there's always diminishing returns for these. [1] - https://arxiv.org/abs/1712.01208
emayljames
Neutral mention · rule
The Case for Learned Index Structures Tim Kraska, Alex Beutel, Ed H. Chi, Jeffrey Dean, Neoklis Polyzotis "Our initial results show, that by using neural nets we are able to outperform cache-optimized B-Trees by up to 70% in speed while saving an order-of-magnitude in memory over several real-world data sets. More importantly though, we believe that the idea of replacing core components of a data management system through learned models has far reaching implications for future systems designs and that this work just provides a glimpse of what might be possible." https://arxiv.org/abs/1712.01208
seg_lol
Neutral mention · rule
Could you have someone walk towards the camera with a focus test card and form a map between the sensor and the focus data from the lens itself (FFT, etc)? It would be something analogous to the 'learned indexes' paper. You could then provide any tweening function to give you that focus feeling you need. http://www.vldb.org/pvldb/vol13/p1162-ferragina.pdf https://arxiv.org/abs/1712.01208
KirinDave
Neutral mention · rule
This article represents an ongoing trend that we've seen over the last 3 years as a resurgence in optimization techniques for directly modeling tasks which historically were considered "not amenable to optimization techniques." We saw this last year as well with the landmark, "The Case for Learned Index Structures" [0] and in prior years with Coda Hale's "usl4j And You" [1], which can easily be woven in realtime into modern container control planes. We've also seen research in using search and strategy based optimization techniques [2] (such as Microsoft's Z3 SMT prover[3]) to validate security models. Some folks are even using Clojure's core.logic at request time to…
Read the full comment
validate requests against JWTs for query construction! [0]: https://arxiv.org/abs/1712.01208 [1]: https://codahale.com/usl4j-and-you/ [2]: http://www0.cs.ucl.ac.uk/staff/b.cook/FMCAD18.pdf (and by the way, this made it to prod last year, so an SMT solver is validating all your S3 security policies for public access!) [3]: https://github.com/Z3Prover/z3
yorwba
Neutral mention · rule
This seems like a fairly natural generalization of the idea in "The Case for Learned Index Structures" [1]: speed up some classical algorithm based on heuristics by modeling the data with a neural network that can be tuned to the specific task that the general algorithm is applied to. That said, the O(N) claim is purely sensational. It all depends on being able to determine the distribution parameters with sufficient accuracy in O(N) time, which isn't really guaranteed for all kinds of data you might want to sort. [1] https://arxiv.org/abs/1712.01208
visarga
Neutral mention · rule
On the one hand, DeepZip does neural net based compression. On the other hand, in "The Case for Learned Index Structures" [1] paper, they replace B-Trees with neural nets: > by using neural nets we are able to outperform cache optimized B-Trees by up to 70% in speed while saving an order of magnitude in memory over several real world data sets Basically ML/DL is coming for the classic data structures, replacing some of them with learning based versions. [1] https://arxiv.org/abs/1712.01208
jacksmith21006
Strong recommendation · rule
Google completely gave away K8s including even the brand. So not sure what you think Google will do? They are giving away everything they learned with Borg and you somehow take it as a negative? Really? Do think from a business standpoint not sure why Google would give up the K8s brand but it is good for everyone. I really worry that Google will stop opens sourcing and more important sharing so much through papers when people b*tch so much. Starting to be hard to see why they even do it any longer. Who else have a huge competitive advantage with something like Borg and just gives it away to the industry? But I am someone super curious and just probably spend more time on https://research.google.com/pubs/papers.html Read most of the paper. But then what they presented at NIPS. My favorite paper right now is https://arxiv.org/abs/1712.01208 Bigger example is how much they give away in terms of AI/ML.
KirinDave
Neutral mention · rule
Gosh, I have a few! Fistly, wavelet trees! Wavelet trees with something like RRR encoding for the bit vectors lets you work with massive datasets in positively tiny space and constant time. They're not even expensive to construct! My favorite introduction to the whole space of rank/select-friendly structures is Alex Bowe's tutorial: https://alexbowe.com/wavelet-trees/ I constantly agitate for people to realize that we now have an algorithm for O(n) generalized sorting. It's called discrimination sort, and while it's a complex subject its quite elegant once you internalize the algorithm. There's a talk by Prof. Henglein here:…
Read the full comment
https://www.youtube.com/watch?v=sz9ZlZIRDAg 2017 saw the recommendation of a truly phenomenal approach to indexing data, using simple leaning structures. These indexes are poorly explored, there's still a ton of headroom here, but the paper is an incredibly cool read and very approachable: https://arxiv.org/abs/1712.01208 Another really cool family of algorithms and associated structures in distributed systems is CRDTs. They're poorly understood, but in research they have largely superseded operational transforms. The Wikipedia page branches off into lots of good research: https://en.wikipedia.org/wiki/Conflict-free_replicated_data_... If we slightly broadened the lens of what is an algorithm, my favoriate category-theoretic approaches to solving problems include Recursion Schemes which are a technique to totally separate the specification of recursive algorithms over data structures from both the structures and the code that the algorithm runs to compute a result (Patrick from Github has a great series on them here: https://blog.sumtypeofway.com/). I also love the modern and rapidly growing "Ghosts of Forgotten Proofs" as a way to let the compiler assert you've properly built and/or terminated values: https://github.com/matt-noonan/gdp-paper/releases/download/j...
jacksmith21006
Neutral mention · rule
Would say Google has a couple gems. DeepMind comes to mind. Also Google Brain has done some pretty interesting things. Probably my favorite of late is from Jeff Dean https://arxiv.org/abs/1712.01208 We just got YouTube TV recently and also something that is pretty impressive by Google and saves me a ton of money as my cable provider was awful charging for every TV monthly. Another example of something I find really interesting is Spanner. https://research.google.com/archive/spanner.html
jacksmith21006
Neutral mention · rule
Thought one of the more interesting ideas is the Jeff Dean paper on using the TPU for more traditional CS operations like an index lookup. Like to see this progress and get more data on the difference is power required using a CPU and traditional algorithms versus using a TPU and new algorithms like Jeff outlined. https://arxiv.org/abs/1712.01208 The Case for Learned Index Structures

Keep following the thread.

More in Databases

More from the same topics.