TL;DR
While large language models (LLMs) excel at generating SQLite queries, they struggle to generalize across the fragmented ecosystem of real-world database engines. This paper introduces UniQL, a human-verified benchmark that aligns 1,534 natural language questions across 16 distinct SQL dialects (generating 24,544 queries). Evaluation on leading LLMs reveals a massive gap in cross-dialect consistency, proving that current models are far from being truly dialect-universal.
What Problem Does This Paper Address?
Most text-to-SQL research and evaluation datasets (like Spider or BIRD) are heavily SQLite-centric. However, production environments rely on a highly fragmented ecosystem of database management systems (DBMSs) such as PostgreSQL, Oracle, MySQL, and T-SQL.
Even though these systems share a foundational SQL structure, they vary wildly in syntax, built-in functions, type systems, and null-handling behaviors. A query that executes perfectly in SQLite might throw a syntax error or return entirely different data in Teradata or Druid. Existing multi-system benchmarks often change the database schema or task alongside the dialect, making it impossible to isolate whether a model is failing due to the complexity of the question or the nuances of the SQL dialect itself.
Methods
The authors developed a rigorous, hybrid pipeline to construct UniQL by migrating the BIRD development set from SQLite to 15 other target database systems.
The pipeline consists of five main stages:
- Database Migration: Normalizing schemas, mapping data types, and adapting namespaces to ensure actual execution environments exist for all 15 target systems.
- Automated Translation: Utilizing a deterministic rule-based translator (SQLGlot) followed by an LLM translator (GPT-5-mini) to rewrite queries into the target dialect.
- Execution-Based Verification: Running the translated query on the target database and comparing it against the source SQLite results using a strict protocol that preserves row ordering and duplicate multiplicities.
- Iterative Rule Evolution: Using Gemini-2.5-Pro to analyze failure logs and abstract recurring error patterns into reusable, dialect-specific translation rules for subsequent rounds.
- Expert-Guided Validation: Employing human annotators to resolve ambiguous, long-tail, or dialect-dependent execution differences.
Datasets
UniQL is built on top of the BIRD development set. It expands 1,534 natural language questions across 11 databases into 16 distinct SQL dialects, yielding a total of 24,544 parallel, executable queries.
Compared to previous benchmarks, UniQL uniquely provides aligned cross-dialect data, meaning the underlying natural language intent, database schemas, and contents remain identical across all systems.
Key Insights and Ideas
- SQLite Success is a Poor Proxy: Doing well on SQLite does not guarantee cross-dialect robustness. Models frequently fail to express the exact same intent consistently when forced to switch backends.
- Documentation Density Matters: Models perform surprisingly well on complex dialects like Oracle (often outperforming their SQLite scores) not because Oracle is simple, but because it is heavily represented in LLM pretraining corpora. Conversely, rarer dialects like Teradata and Druid see massive performance drops.
- Stricter Evaluation Exposes Hidden Bugs: Standard text-to-SQL metrics often convert outputs into unordered sets, which ignores sorting errors and duplicate row mismatches. UniQL’s strict execution accuracy protocol exposes these subtle semantic failures.
Key Results
The authors evaluated a wide range of closed- and open-source LLMs in an inference-only setting.
- Overall Performance: The task remains highly challenging. Claude-4.5-Sonnet achieved the highest average execution accuracy (EX) at 54.63%, followed by Gemini-2.5-Pro (52.10%) and GPT-5-mini (50.50%). Among open-source models, DeepSeek-v4-flash led with 48.12%.
- The Consistency Gap: The authors introduced an "All-16" metric, which tracks how often a model gets a question right across all 16 dialects. Claude-4.5-Sonnet managed this for only 20.14% of the questions, while Gemini-2.5-Pro dropped to 9.19%.
- Dialect Disparities: Performance varied drastically by target system. For example, Claude-4.5-Sonnet scored 63.75% on Oracle but plummeted to 37.74% on Teradata.
Limitations and Future Work
Because UniQL directly migrates flat relational tables from BIRD, it does not evaluate native, system-specific data models or advanced features. For instance, it lacks coverage for PostgreSQL's native JSON querying, Spark SQL's complex types (arrays, maps, structs), or ClickHouse's large-scale analytical functions.
The authors suggest that future iterations should include databases natively designed for these advanced capabilities, alongside natural language questions that explicitly trigger dialect-specific operations.
Summary updated