Live data from Hacker News

Show HN: Natural-SQL-7B, a strong text-to-SQL model

github.com

81–90 of 171 posts

Re: Show HN: Natural-SQL-7B, a strong text-to-SQL model

#81
One Problem I always see in such apps is that the ai can't see in to the database or into all entries, so queries without stating data EXACTLY as in the database run into issues.

example: give me the revenue for all logistics firms

but in the database these might not be called "logistics" and may be called "transport" (or anything)

maybe there are some counters to this like finding unique values per column or even better use a grammar based approach, wich will select only valid entries.

but the simple text to SQL is at this point not the "hard thing to solve"

Re: Show HN: Natural-SQL-7B, a strong text-to-SQL model

#82

Earlier quoted context omitted.

1. If you are a a programmer I think you should learn SQL. It will give you a different perspective on programming that I think is invaluable. (I.e. programming without for loops) 2. Combining and slicing data is a craft, and doing it subtly wrong in one step can lead to fatal errors in the outcome. And most importantly, it can be very difficult to notice. Numbers don't smell. That is why I would be very hesitant to…

What makes you think that SQL doesn't have "for loops"? Ever heard of LATERAL joins/CROSS APPLY? SELECT loop.value, x.squared FROM generate_series(1,5) AS loop(value) CROSS JOIN LATERAL (SELECT loop.value * loop.value AS squared) AS x;

What is the point of the cross join? This would work as well:

   SELECT loop.value, loop.value * loop.value
   FROM generate_series(1,5) AS loop(value)

Re: Show HN: Natural-SQL-7B, a strong text-to-SQL model

#83
post #21

So it looks like it scores 76.5% on SQL-Eval [0], a bit behind GPT-4 at 83% and sqlcoder-15b at 78%. What kind of applications would this be useful for? What can you build with an AI data science intern that's right 75% of the time? As a programmer who always has to look stuff up when I SQL, I could definitely see asking something like this for a first draft of a query but it seems like I'm slightly better off asking…

This kind of approach could be a way to make these models reliable. Encode your business restrictions in the database, if they are rigorous enough, if the query passes then it's valid in your business world.

Re: Show HN: Natural-SQL-7B, a strong text-to-SQL model

#84
Like many uses of AI, very good as a "seed" especially if it comes up with nuggets like grouping on a range instead of a single value. But as with almost any database, devil is in details. Different products have different interp of "quantity" (e.g. box vs. unit), coupons and discounts are modeled in weird ways, weights are assumed to be pounds/kg and are mixed without assigning units, etc. etc.

Re: Show HN: Natural-SQL-7B, a strong text-to-SQL model

#85
Natural language-derived SQL will be useful for programming language integration involving type-safe SQL. I'm currently using manifold-sql[1] for this, and having the ability to transform English directly to SQL type-safely is amazing.

1. https://github.com/manifold-systems/manifold/blob/master/man...

Re: Show HN: Natural-SQL-7B, a strong text-to-SQL model

#87

Earlier quoted context omitted.

1. If you are a a programmer I think you should learn SQL. It will give you a different perspective on programming that I think is invaluable. (I.e. programming without for loops) 2. Combining and slicing data is a craft, and doing it subtly wrong in one step can lead to fatal errors in the outcome. And most importantly, it can be very difficult to notice. Numbers don't smell. That is why I would be very hesitant to…

Honestly I would rather write stuff in code thats inefficient than deal with one more stored procedure. Its like a black box

That will be interesting soon when 80% of your code will be ai-generated black boxes…

Re: Show HN: Natural-SQL-7B, a strong text-to-SQL model

#88
post #84

Like many uses of AI, very good as a "seed" especially if it comes up with nuggets like grouping on a range instead of a single value. But as with almost any database, devil is in details. Different products have different interp of "quantity" (e.g. box vs. unit), coupons and discounts are modeled in weird ways, weights are assumed to be pounds/kg and are mixed without assigning units, etc. etc.

Good point. However, AI may also train on the database metadata, including DDL comments, locale, etc. and perform data sampling to glean the nuances that are "understood".

Re: Show HN: Natural-SQL-7B, a strong text-to-SQL model

#89
post #21

So it looks like it scores 76.5% on SQL-Eval [0], a bit behind GPT-4 at 83% and sqlcoder-15b at 78%. What kind of applications would this be useful for? What can you build with an AI data science intern that's right 75% of the time? As a programmer who always has to look stuff up when I SQL, I could definitely see asking something like this for a first draft of a query but it seems like I'm slightly better off asking…

I would wonder how many of the 25% are actually dangerous to run, considering the target audience might be someone who is rusty at SQL and etc.

Re: Show HN: Natural-SQL-7B, a strong text-to-SQL model

#90
post #87

Earlier quoted context omitted.

Honestly I would rather write stuff in code thats inefficient than deal with one more stored procedure. Its like a black box

That will be interesting soon when 80% of your code will be ai-generated black boxes…

Ian Malcom gif
Post reply on HN