EntSQL: A Benchmark for Grounding Text-to-SQL in Long-Context Enterprise Knowledge
This paper introduces EntSQL, a new Chinese-English benchmark comprising 1,066 examples across five business domains designed to evaluate the challenges of grounding Text-to-SQL generation in long-context enterprise knowledge, where current models struggle to achieve high accuracy due to the need for proprietary business understanding.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you have a very smart, well-read librarian (an AI) who knows how to speak human language and how to speak "database language" (SQL). Usually, if you ask this librarian, "How many books did we sell last month?" they can look at the library's card catalog (the database schema) and write a perfect note to the librarian's assistant to fetch the answer.
But in the real world of big companies, it's not that simple. The company has a secret rulebook that nobody outside the building knows. Maybe "last month" actually means "the fiscal quarter ending in June," or "top products" excludes items that are currently on clearance. If the librarian doesn't have this secret rulebook, they will guess, and their note will be wrong.
Enter "EntSQL": The Test for the Secret Rulebook
This paper introduces a new test called EntSQL. Think of it as a final exam for AI librarians, but instead of just asking them to read the card catalog, the exam gives them a massive, 50-page private company handbook and asks them to write a query based on it.
Here is the breakdown of what the paper found, using simple analogies:
1. The Problem: The "Missing Manual"
Existing tests for these AI librarians (like Spider or BIRD) are like giving them a generic library catalog. They are good at finding books if the catalog is clear. But in a real business, the "catalog" (the database) is useless without the "employee handbook" (private business rules).
- The Analogy: Imagine asking an AI, "How much did we spend on 'Project X'?" The database just has a column called
cost. It doesn't know that "Project X" is actually a code name for "Marketing," or that it only counts costs after a specific date. Without the private handbook, the AI is flying blind.
2. The Test: EntSQL
The researchers built a test using real (but anonymized) data from five different company departments: Finance, Treasury, HR, Business Management, and Party Building.
- The Setup: They gave the AI a question, the database structure, and a long, messy document containing the company's specific rules.
- The Difficulty: The questions were tricky. They required the AI to read a long document, find the specific rule about "fiscal years" or "bonus calculations," and then combine that with the database to write a complex computer instruction.
- The Scale: The test had over 1,000 questions. The "gold standard" answers (the correct instructions) were very long and complex, like a 400-word paragraph of code.
3. The Results: The AI is Still Struggling
The researchers tested the world's smartest AI models (like Claude, GPT-4, and others) on this exam.
- The Score: Even the best AI only got about 16% of the answers right when given the long documents.
- The Analogy: It's like giving a brilliant student a 500-page textbook and asking them to solve a math problem. They know how to do math, but they can't find the specific rule in the book that applies to this specific problem. They get lost in the text.
- The "Evidence" Hint: When the researchers gave the AI a highlighted version of the book (just the 2 or 3 sentences that mattered), the score went up to about 21%. This proves the AI isn't bad at math; it's just bad at finding the needle in the haystack.
4. Where They Failed
The researchers looked at why the AI got things wrong. It wasn't usually because the AI forgot how to write the code.
- The Main Error (54%): The AI missed the "filter." It was like asking for "red cars" and the AI bringing back "all cars" or "blue cars." It couldn't correctly apply the specific rules from the document to the data.
- The Scope Error (14%): The AI looked at the wrong time period or the wrong department. It was like calculating the budget for "2023" when the question asked for "2024."
5. The Human Gap
The researchers also asked a human expert to take the same test.
- The Gap: The human expert got about 84% right when given the highlighted notes. The AI got 20%.
- The Takeaway: There is a huge gap between what humans can do with a company handbook and what current AI can do. The AI is still very bad at understanding the "unwritten rules" of a specific business.
Summary
EntSQL is a new benchmark that says: "Stop just testing if AI can read a database. Test if it can read a company's secret rulebook and apply it."
The paper concludes that while AI is getting better at writing code, it is currently terrible at grounding that code in the messy, private, long-context knowledge that real businesses rely on. It's a reminder that for AI to truly help in the office, it needs to get much better at reading the fine print.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.