TL;DR
BenchPress is an open-source, human-in-the-loop annotation system that leverages Retrieval-Augmented Generation (RAG) and LLMs to rapidly turn enterprise SQL logs into custom text-to-SQL benchmarks. By combining automated query decomposition with expert human verification, it slashes annotation time by up to 85% while significantly improving semantic accuracy and benchmark reliability.
What Problem Does This Paper Address?
While state-of-the-art Large Language Models (LLMs) boast near-perfect scores on public text-to-SQL datasets like Spider or BIRD, their performance plummets when confronted with real-world enterprise databases.
Enterprise data environments introduce unique hurdles that public datasets lack:
- Schema Complexity & Ambiguity: Massive, messy databases with overlapping, inconsistent column names (e.g., multiple distinct tables using
user_iddifferently). - Domain-Specific Terminology: Highly specialized acronyms and jargon unique to specific industries or institutions.
- Privacy Constraints: Proprietary data cannot simply be uploaded to public clouds or commercial APIs for external labeling.
To safely deploy text-to-SQL tools, companies must evaluate them on their own data. While enterprise database logs contain an abundance of real SQL queries, manually annotating these logs with their corresponding natural language (NL) questions is an incredibly slow, expensive task that requires scarce database administrator (DBA) expertise.
Methods
BenchPress introduces a human-in-the-loop workflow designed to solve the SQL-to-NL annotation bottleneck. The system operates in a multi-step pipeline:
- Decomposition (Optional): For highly complex, nested SQL queries, BenchPress automatically rewrites the query into a series of logical Common Table Expressions (CTEs) or subqueries.
- Context Retrieval (RAG): The system uses dense vector embeddings (via Sentence-BERT) to search an internal vector store of previously annotated queries. It pulls semantically similar SQL-NL pairs and relevant schema tables to ground the LLM prompt.
- Candidate Generation: An LLM generates four distinct candidate natural language descriptions based on the retrieved context.
- Recomposition: If the query was split in step 1, BenchPress automatically merges the subquery descriptions back into a single, cohesive explanation.
- Human Feedback Loop: A domain expert reviews the four candidates to select, rank, edit, or discard them. Annotators can also inject external domain knowledge directly into the prompt to guide future generations.
Datasets
The authors evaluated BenchPress using a mix of public and private datasets:
- Spider, BIRD, and FIBEN: Standard, clean public benchmarks used for cross-comparison.
- BEAVER (DW): A private, enterprise-oriented dataset built from real-world SQL logs across industries like education, tech, and manufacturing. It spans over 300 schemas and nearly 4,000 highly complex queries characterized by low schema uniqueness and high data sparsity.
Key Insights and Ideas
- Flipping the Problem Works: Instead of trying to generate synthetic SQL from natural language, starting with real, messy enterprise SQL logs and translating back to natural language yields much more realistic benchmarks.
- The Power of Decomposition: Complex enterprise queries overwhelm LLMs and human annotators alike. Breaking nested queries down into CTEs reduces cognitive load and drastically improves translation precision.
- The "Cold-Start" Reality: In enterprise settings, you often start with zero annotations. BenchPress handles this by incrementally growing its RAG knowledge base as the human annotator interacts with the system, making the tool smarter with every query processed.
Key Results
The authors conducted a controlled user study with 18 participants, comparing BenchPress against purely manual annotation and a vanilla LLM (e.g., standard ChatGPT UI without RAG or task-specific integration).
- Massive Speedups: For a standard set of 30 queries, the manual group took 183.9 minutes to annotate. BenchPress cut that down to just 28.1 minutes—an 85% reduction in human effort.
- Higher Accuracy: BenchPress achieved an overall annotation accuracy of 93.0% (and 86.1% on the difficult Beaver dataset), outperforming both the vanilla LLM (83.1%) and manual efforts (73.9%).
- Superior Semantic Fidelity: To test if the generated descriptions actually preserved the original SQL logic, the authors ran a "backtranslation" task (asking an LLM to regenerate SQL solely from the annotated text). BenchPress descriptions yielded the highest proportion of fully correct, executable SQL queries.
Limitations and Future Work
Currently, BenchPress focuses strictly on the SQL-to-NL direction to build the initial benchmark dataset. The authors note that a natural next step is integrating text-to-SQL generation directly into the loop for iterative, automated validation. Additionally, they plan to explore using BenchPress to systematically rephrase existing public benchmarks into more realistic, ambiguous, or underspecified variants to better stress-test current state-of-the-art models.
Summary updated