How to use LLMs to generate accurate SQL for real-world data
Hey HN, We are Zain and Ashish, founders of Vanna AI. We recently embarked on an experiment to see if large language models (specifically LLMs) could help in generating SQL queries for real-world datasets. We initially started this project as a web app but realized that it was most useful and had broadest applicability as a Python package since you can then incorporate it into an existing workflow (Jupyter notebook, Slackbot, etc). We've had some good success with customer datasets but we've generally heard a lot of skepticism so we decided to write a paper about the methodology we're using…
How to use LLMs to generate accurate SQL for real-world data launched on August 17, 2023 with 21 votes, #1,542 of 4,347 launches that month and more than 75% of that year's launches. The site was still online in September 2026, 3 years on.
In plain words
Vanna AI is a Python package that uses large language models to generate SQL queries for real-world databases. Developers can integrate it into existing workflows like Jupyter notebooks or Slackbots to automate SQL creation. The tool is open source and includes a server component for storing metadata, with plans for a fully local version available soon.
written from the facts on this page · September 2026
From the sources
🤖 Chat with your SQL database 📊. Accurate Text-to-SQL Generation via LLMs using Agentic Retrieval 🔄. - vanna/papers/ai-sql-accuracy-2023-08-17.md at main · vanna-ai/vanna
In the maker’s words, at launch
Hey HN, We are Zain and Ashish, founders of Vanna AI. We recently embarked on an experiment to see if large language models (specifically LLMs) could help in generating SQL queries for real-world datasets. We initially started this project as a web app but realized that it was most useful and had broadest…
Does a similar job
all alternatives →
Vanna AI – Open-sourced text-to-SQL in Python2023 · vanna.ai · ▲33Hey there HN! We've just open-sourced Vanna – a Python package that allows you to transform questions into SQL. We've leveraged LLMs to enable you to "ask" databases what you need, bypassing the need to "write" complex SQL. Quick Overview: - "Train" using DDL statements, documentation, or known correct SQL statements. - "Ask" questions in natural language and receive SQL, tables, and charts in return. - Open Source Flexibility: Swap storage mechanisms, customize LLMs, and choose your databases. - Local or Hosted: Operate everything locally or use our hosted version for free (including…
Python package for generating accurate SQL via LLMs using RAG2023 · github.com · ▲7Hello HN! We’ve been working hard on Vanna, our RAG framework for SQL generation and we’ve been updating our documentation. Please have a look — we have a ton of Jupyter notebooks for any combination of desired use cases. At it’s heart, we have abstractions that help you: - “train” a RAG “model” i.e. add metadata for the retrieval augmentation system to reference when constructing the LLM prompt (yes, we know that the terms “train” and “model” are somewhat confusing and we’re open to changing those terms if you can suggest better ones) - “ask” questions, which will generate SQL, run it,…
Why write code if the LLM can just do the thing? (web app experiment)Nov 2025 · github.com · ▲436I spent a few hours last weekend testing whether AI can replace code by executing directly. Built a contact manager where every HTTP request goes to an LLM with three tools: database (SQLite), webResponse (HTML/JSON/JS), and updateMemory (feedback). No routes, no controllers, no business logic. The AI designs schemas on first request, generates UIs from paths alone, and evolves based on natural language feedback. It works—forms submit, data persists, APIs return JSON—but it's catastrophically slow (30-60s per request), absurdly expensive ($0.05/request), and has zero UI…
Marvin – build AI functions that use an LLM as a runtime2023 · github.com · ▲127Hey HN! We're excited to share our new open-source project, Marvin. Marvin is a high-level library for building AI-powered software. We developed it to address the challenges of integrating LLMs into more traditional applications. One of the biggest issues is the fact that LLMs only deal with strings (and conversational strings at that), so using them to process structured data is especially difficult. Marvin introduces a new concept called AI Functions. These look and feel just like regular Python functions: you provide typed inputs, outputs, and docstrings. However, instead of relying on…
Dataherald AI – Natural Language to SQL Engine2023 · github.com · ▲215Hi HN community. We are excited to open source Dataherald’s natural-language-to-SQL engine today (https://github.com/Dataherald/dataherald). This engine allows you to set up an API from your structured database that can answer questions in plain English. GPT-4 class LLMs have gotten remarkably good at writing SQL. However, out-of-the-box LLMs and existing frameworks would not work with our own structured data at a necessary quality level. For example, given the question “what was the average rent in Los Angeles in May 2023?” a reasonable human would either assume the…
Improve Text-to-SQL Accuracy with LLM2023 · github.com · ▲17A repository that contains models, datasets, and fine-tuning techniques for DB-GPT, with the purpose of enhancing model performance in Text-to-SQL - eosphoros-ai/DB-GPT-Hub
More ai this month
the category →



Paintings by AI models: programs run through a simulation of oil paint.
AI · 20d ago · stillwet.art

PixVerse R2▲381A real-time world model you can explore and change
AI · 28d ago · world.pixverse.video
Source: Show HN post ↗ · launch text quoted in part
Launched alongside, August 2023
the whole month →
Resend▲1,325An entire collection of pre-built components with a much faster development experience.
Dev tools · 2023 · resend.com



Lottielab▲869Create and ship lottie animations to sites and apps faster
Dev tools · 2023 · lottielab.com

Outlines is a Python library that focuses on text generation with large language models. Brandon and I are not LLM experts and started the project a few months ago because we wanted to understand better how the generation process works. Our original background is probabilistic, relational and symbolic programming. Recently we came up with a fast way to generate text that matches a regex (https://blog.normalcomputing.ai/posts/2023-07-27-regex-guide...). The basic idea is simple: regular expressions have an equivalent Deterministic-Finite Automaton (DFA) representation. We…
AI · 2023 · github.com