Interesting... at my current job, my team and I are solving this problem of how to make sure LLM understand our SQL data warehouse to answer analytical questions for clients. We have a 20-year old database with rotting schema as the blog post describes. So we had to rebuild the database in a way that is well structured and governed. Once that hard work is done, we slap dbt models on top of business metrics with model…
Any text-to-SQL benchmark should address difficulties of real-world data stores
11–20 of 24 posts
Re: Any text-to-SQL benchmark should address difficulties of real-world data stores
#12Ideally you ask the agent the thing you want to know / business question you want answered.
An agentic loop then runs. The agent can look at the schema, look at any existing SQL scripts available that query similar tables, run a few limit 10 probe queries. Analyze the data, do some joins, check the data again. Show you the data, ask for feedback, etc.
Pure zero / one shot SQL generation isn’t the solution and isn’t how humans do things. We look at the schema, run some queries, do some joins, spot check the totals / row counts, etc.
Re: Any text-to-SQL benchmark should address difficulties of real-world data stores
#13> It is widely known that an LLM can only find data it has seen before. What does this mean? It’s obviously not literally true, so what is the author trying to convey?
I think in context they meant something like 'it is unsurprising that an LLM can find data it has already seen before.' The intent is to point out that benchmarks tend to use public data. In context I don't think they were actually trying to claim LLMs are useless at unfamiliar data, just that the benchmarks have a specific flaw.
Re: Any text-to-SQL benchmark should address difficulties of real-world data stores
#14However, in my experience the answer a business user needs is rarely the answer to the question they initially ask. Asking for clarification, pushing back on poorly framed or conceived asks where most of the value comes from. LLMs are still too eager to jump into the code, and the sycophancy problem is especially challenging in this space.
Re: Any text-to-SQL benchmark should address difficulties of real-world data stores
#15The biggest issue with business users (who don’t know SQL) writing SQL with an LLM is that there is no one to validate that query and now that business user will treat that LLM response as canon to share in meetings, presentations, and with clients. The LLM may have forgotten a filter, used the wrong definition of revenue, or misunderstood the user’s intent by writing a query that answers their question in the most l…
https://nchammas.com/writing/custom-query-language-design#wh...
Users can't "own" queries they don't understand. An LLM helping a user avoid annoying syntax errors is very useful; but helping a user write a query they ultimately cannot understand is fraught with the problems you describe.
Re: Any text-to-SQL benchmark should address difficulties of real-world data stores
#16Re: Any text-to-SQL benchmark should address difficulties of real-world data stores
#17Re: Any text-to-SQL benchmark should address difficulties of real-world data stores
#18I will concede that single shot is a dead end path. However, if you run a research agent with parallel hypothesis generation, multiple outer loops, etc., the chances you encounter the correct query go up dramatically. The game is to force a supervisor to compare two queries that attempt to accomplish the same report but have different results. Involving the human operator in this loop can take you the remainder.
Re: Any text-to-SQL benchmark should address difficulties of real-world data stores
#19Oouch!
Re: Any text-to-SQL benchmark should address difficulties of real-world data stores
#20The biggest issue with business users (who don’t know SQL) writing SQL with an LLM is that there is no one to validate that query and now that business user will treat that LLM response as canon to share in meetings, presentations, and with clients. The LLM may have forgotten a filter, used the wrong definition of revenue, or misunderstood the user’s intent by writing a query that answers their question in the most l…
I recently shared a similar rationale for why a custom query language can help users even in the age of LLMs. https://nchammas.com/writing/custom-query-language-design#wh... Users can't "own" queries they don't understand. An LLM helping a user avoid annoying syntax errors is very useful; but helping a user write a query they ultimately cannot understand is fraught with the problems you describe.