Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Vectorized and performance-portable Quicksort (2022)(googleblog.com ↗)
    21comments
  2. Training a 4B model to produce 81% faster query plans than Postgres(rohanbansal.com ↗)
    14comments
  3. Small programming tricks(will-keleher.com ↗)
    136comments
  4. Accurate Models of AMD Matrix Cores(arxiv.org ↗)
    3comments
  5. Dream-RSI: Recursive Self-Improvement through Evolving Worlds(arxiv.org ↗)
    46comments
  6. How good are frontier models at physics?(arxiv.org ↗)
    3comments
  7. Mistral X Mozilla: Private, Multilingual AI Browsing(mistral.ai ↗)
    169comments
  8. Tell the speakers that you liked their talks(ohhelloana.blog ↗)
    60comments
  9. Show HN: An e-ink frame that hears birds and draws them as 1800s illustrations(github.com/arnegiacomo ↗)
    230comments
  10. The Siberian Ice Maiden and the Scythian World(patrickwyman.substack.com ↗)
    discuss
  11. How big are factorials?(thegreenplace.net ↗)
    27comments
  12. Learning Programming in an Age of LLMs(ploeh.dk ↗)
    164comments
  13. Claude Cowork and chat are now one Claude(claude.com ↗)
    176comments
  14. The DeepMind Institute(deepmind.com ↗)
    26comments
  15. Reversing Factorio's RNG(gegell.github.io ↗)
    2comments
  16. The Google Play app review process now regularly takes longer than a week(gultsch.social ↗)
    302comments
  17. Hackers Got Inside a Flock Camera(wired.com ↗)
    185comments
  18. ER visits for gambling disorders doubled after expanded online gambling market(utoronto.ca ↗)
    99comments
  19. A coffee shop owner used AI to make a menu poster. Then came the angry DMs(businessinsider.com ↗)
    83comments
  20. Show HN: How Stale Is Your AI? Release age and training cutoff for 20 models(stale.jock.pl ↗)
    41comments
  21. Kyber (YC W23) Is Hiring a Forward Deployed Engineer(ycombinator.com ↗)
    discuss
  22. Why a fast-growing German AI startup is moving its parent company from the US(euronews.com ↗)
    6comments
  23. Can we stop with the uptime percentages?(jim-nielsen.com ↗)
    91comments
  24. Salesforce Global Outage(salesforce.com ↗)
    153comments
  25. Show HN: I made a flight simulator, except you're just a passenger(inflightsimulator.com ↗)
    199comments
  26. A warning about 'model welfare'(mustafa-suleyman.ai ↗)
    337comments
  27. Scaling Golang CI by Replacing actions/setup-go(cloudx.ai ↗)
    19comments
  28. This Code Is CRAP (2011)(googleblog.com ↗)
    47comments
  29. Introducing System One Models and Jev(typesafe.ai ↗)
    470comments
  30. Anatomy of a Texture(agentlien.github.io ↗)
    8comments

Training a 4B model to produce 81% faster query plans than Postgres

109 pointsby 1h agorohanbansal.com
14 comments
1h agoHN ↗

But how will you know that the query plan actually does what your query asked for?

58m agoHN ↗

I imagine you can perform operations on query plans to transform them and determine equivalence?

52m agoHN ↗

`pg_hint_plan` has a debug log so you can verify Postgres actually used the hint or not! Used this during evaluations

45m agoHN ↗

I would like to think that pg_hint_plan is designed in such a way that any hint it accepts must be a valid plan for the query. I’m quite confident that schemes with this property that can also express high quality plans are possible and not even excessively complicated.

This is not to say that it’s possible to genetically verify that a proposed algorithm does what you want it to — that would be undecidable or NP-hard or co-NP-hard depending on how you formulate the question.

35m agoHN ↗

I wouldn't be very excited about adding a 4B param model to my database deployment, but using this kind of approach while testing an app to identify query plans where Postgres is leaving performance on the table seems valuable without much risk.

41m agoHN ↗

Aren't optimizations suppose to be deterministic?

35m agoHN ↗

They are not. Choice among several query plans depends on various summary statistics about the data, which might not be the most recent.

28m agoHN ↗

Including the input parameters.

It's not unusual for us to end up with bad query plans because the shape of our data can vary pretty greatly. In many cases, a Foo has 1 Bar. But in some cases, a Foo has a million Bars. That can cause the query optimizer to treat lookups on the bar table as if there are few elements there (causing a scan instead of a seek).

For the general case, the optimizer gets it right. However, the fringe case is one that causes the entire system to crash. It's a bit akin to how an insertion sort can be faster than quick sort when n is small. The optimizer might make a bad assumption about the size of n which makes it pick an expensive n lookup when log(n) is available (but slower for small n).

27m agoHN ↗

I'd like to contribute my amateur hour entry into this thread, although I did administer and develop mssql stuff for awhile.

sure optimizations based on stats, but the stats are the wildcard, in my experience query plans can change suddenly.

Queries are translated into plans according to statistics. However the transforms will be deterministic and should only change one valid plan to another. I could very easily see a neural network manipulate transforms the same way the current programming does, its just that the neural networks are by nature really nicely suitable because the "decisions" are based on training, and this training can be closed world type things like the ai assists that chess engines are now getting. Obviously ai still can't play chess but apparently its very good at ranking board positions just by developing that much statistical info because its training comes not from reading the web, but playing a gazzilian games against itself in a "closed" chess world of its own.

I'm thinking that the ai does "this legal transform of the query plan should be applied to this pattern of data (statistics, cardinality, etc)" simply because the ai encountered it in closed world training, much like the chess thing.

Just a theory tho feel free to correct!

35m agoHN ↗

I paid ~$800 to rent a 2x H100 SXM node from Lambda for ~95 hours, and ~$400 in OpenAI API fees to generate the Astra trajectory demonstrations.

a tiny 4B model went from not being able to understand the harness it was wrapped in, to achieving a 1.81x geometric mean speedup and a summed latency decrease of 44.7% across a workload of join-heavy SQL queries

I can’t find it in the article (may have skimmed it too much), but I suspect they didn’t include those ~95 hours in the benchmark numbers.

I think all database vendors know their query optimizers could do much better if they could afford to spend lots of time to derive query plans.

⇒ this may be useful for some workloads, but even then, can you afford to spend hours every now and then to update your 4B model to ensure it still picks a good query plan?

19m agoHN ↗

⇒ this may be useful for some workloads, but even then, can you afford to spend hours every now and then to update your 4B model to ensure it still picks a good query plan?

I think this would be likely comparable to a scheduled backup, so I think it would be an acceptable maintenance window. However, deterministic algorithms would likely beat re-training (or re-fine-tuning) the model. For example, one could analyze actual distributions or whatever (instead of assuming uniform), and then some plans would automatically be eliminated.

Imo a good thought experiment is to look at places that are hyper-optimized, like compilers. Would LLMs bring anything to the table (architecturally or performance-wise) to a piece of software that has been carefully crafted for decades? (Methinks no.)

30m agoHN ↗

Frontier intelligence is extremely powerful; the distillation I did off Astra trajectories is proof enough that large models are not going anywhere

Wouldn't admitting this invite trouble due to accusations of distillation flying around between closed and open models.

15m agoHN ↗

I don't think anybody's denying that small models are doing distillation, the issue at hand is frontier lab vs frontier lab when it comes to big models.