TL;DR
This paper introduces BEAVER, the first benchmark for text-to-SQL tasks specifically designed for enterprise databases. They found that current large language models (LLMs) struggle significantly with this new benchmark, highlighting a critical gap between LLM performance on public datasets and real-world enterprise applications.
What Problem Does This Paper Address?
The current landscape of text-to-SQL benchmarks primarily relies on web tables and human-generated question-SQL pairs. While LLMs achieve impressive results on these benchmarks, this success doesn't necessarily translate to enterprise environments. Enterprise databases are often far more complex, featuring intricate schemas, multi-table joins, aggregations, and nested queries. Furthermore, the proprietary nature of enterprise data means LLMs trained on public data lack the domain-specific knowledge required to navigate these complexities. This disconnect poses a significant challenge for deploying LLMs effectively in real-world business intelligence and data analysis scenarios.
Methods
The authors introduce BEAVER, a novel benchmark comprising natural language queries and SQL statements derived from real enterprise query logs. To better understand LLM performance, they also define three intermediate tasks: Table Retrieval (identifying relevant tables from a large corpus), Column Mapping (linking natural language phrases to specific table columns), and Join Key Detection (identifying columns for joining tables). These intermediate tasks serve as valuable diagnostic tools to pinpoint weaknesses in LLM performance. They then evaluate several state-of-the-art LLMs on both the end-to-end text-to-SQL task and these intermediate tasks.
Datasets
The primary dataset introduced is BEAVER, which consists of anonymized data from three real-world private data warehouses. This dataset includes natural language questions, corresponding SQL statements, and annotations for column mapping, gold tables, and join keys. For comparative analysis, they also use subsets of the Spider and Bird datasets, adapting them to have a comparable number of tables per database as BEAVER.
Key Insights and Ideas
- The "Web Table" vs. "Enterprise Table" Divide: The core insight is that the characteristics of web tables (simpler schemas, less complex queries) are fundamentally different from enterprise databases, leading to a significant performance drop for LLMs.
- Intermediate Tasks as Diagnostic Tools: Breaking down the text-to-SQL problem into table retrieval, column mapping, and join key detection reveals that LLMs struggle with each of these sub-tasks in the enterprise context, not just the final SQL generation.
- Domain-Specific Knowledge is Crucial: The complexity of enterprise schemas and queries often requires domain-specific knowledge that LLMs trained on general web data lack.
- The Value of Gold Annotations: Providing LLMs with gold answers for intermediate tasks significantly boosts performance, highlighting the importance of these steps and the challenges LLMs face in performing them independently.
Key Results
- Dramatic Performance Degradation: Off-the-shelf LLMs achieved a mere ~5% end-to-end execution accuracy on BEAVER, a stark contrast to their performance on public benchmarks like Spider (where GPT-4 can achieve >85% accuracy).
- Table Retrieval Challenges: LLMs struggled significantly with table retrieval on BEAVER, with recall and perfect recall scores being substantially lower compared to Spider and Bird. This indicates difficulty in identifying the correct set of tables from a large enterprise database.
- Column Mapping and Join Key Detection Difficulties: Performance on column mapping and join key detection was also significantly lower on BEAVER, underscoring the complexity of enterprise schemas and the relationships between tables.
- Query Complexity Matters: As query complexity (measured by joins, aggregations, and nesting depth) increases, LLM performance on BEAVER decreases, further highlighting the challenges of enterprise data.
- Impact of Intermediate Task Guidance: Providing gold answers for intermediate tasks led to substantial improvements in end-to-end accuracy, with join key detection providing the largest boost.
Limitations and Future Work
- Limited Domain Diversity: Due to privacy and legal constraints, the BEAVER dataset is limited in the diversity of domains represented.
- Ambiguity and Implicit Assumptions: Enterprise users' queries can be ambiguous and rely on implicit assumptions, which LLMs struggle to handle.
- Future Work: The authors suggest exploring human-in-the-loop approaches where LLMs ask clarifying questions and iterative refinement. They also propose developing comprehensive methods for identifying and presenting schema mappings to users. The BEAVER benchmark itself is intended to drive future research in building more robust text-to-SQL systems for enterprise environments.
Summary updated