TL;DR
Translating natural language into database queries (text-to-SQL) looks like a nearly solved problem on standard academic leaderboards—until you point a model at real-world government statistics. This paper introduces LOCuST, a massive English and Dutch benchmark built on official data from Statistics Netherlands, where tables are wide, filled with cryptic alphanumeric codes, and require a separate semantic knowledge graph just to decipher. When tested on this realistic open-domain catalog, frontier LLMs struggle mightily, achieving at best 10% execution accuracy and revealing a massive gap between neat academic benchmarks and messy institutional reality.
What Problem Does This Paper Address?
Official statistics—census numbers, inflation rates, energy consumption—are the bedrock of policymaking and business decisions. Making this data accessible via natural language (text-to-SQL) would be transformative.
However, existing text-to-SQL benchmarks (like Spider or BIRD) live in a clean, idealized world. They typically hand the model the exact database it needs to query, use narrow tables (4–5 columns) with self-explanatory names like student_age, and cover everyday internet topics like sports or retail.
Official statistics look nothing like this. Statistical agencies publish open-domain catalogs containing thousands of wide, denormalized tables (some exceeding 1,200 columns). Instead of readable text, cells and columns are populated with opaque identifiers like A041907 or 2022SJ00.
Furthermore, statistical jargon is subtle: "green energy" might include biomass in one table and exclude it in another, and you cannot mathematically sum percentages with raw counts. To write valid SQL here, a system has to hunt through thousands of tables, look up definitions and units in external metadata, and ground user questions in exact codes. Prior benchmarks simply do not test this pipeline.
Methods
The authors structure LOCuST around a realistic three-stage task environment and pair it with a custom evaluation framework:
- Three-Stage Pipeline: Systems are evaluated on Table Retrieval (finding the right tables out of 1,000+ candidates), Query Generation (writing SQL when handed the golden tables), and End-to-End QA (doing both sequentially).
- Semantic Knowledge Graph: The authors hand-crafted an RDF knowledge graph from Statistics Netherlands' APIs using standard ontologies (Data Cube, SKOS, QUDT). It links cryptic table codes to human-readable labels, definitions, hierarchies (e.g., municipality X is part of province Y), and measurement units—allowing the framework to automatically flag nonsensical math, like summing incompatible units.
- Observation F1 (
obsF1) Metric: Standard Execution Accuracy (EX) is brutally binary: if your SQL output has one extra descriptive column or slightly different formatting, you get a zero. The authors introduce novel F1 metrics (msrF1,dimF1, and combinedobsF1) by parsing the SQL AST and checking it against the knowledge graph to measure whether the query selected the right underlying data observations, regardless of final formatting or aggregation errors. - Baselines: For retrieval, they test sparse BM25+ against a dense ColBERTv2 model trained with hard-negative mining. For SQL generation, they serialize relevant subgraphs into hierarchical prompts and test four out-of-the-box LLMs using few-shot prompting: Claude 5 Sonnet, GPT 6 Sol, Llama 4 Maverick, and Qwen 3.8-27B.
Datasets
The paper introduces LOCuST (Large-scale Official statistics Complex text-to-SQL Task), built on real Open Data tables from Statistics Netherlands (CBS) stored as Parquet files for DuckDB execution:
- Scale & Languages: Spans 22 domains with 1,299 English queries (over 1,030 tables, averaging 32.4 columns) and 1,260 Dutch queries (over 1,211 tables, averaging 34.55 columns). The Dutch metadata graph is notably larger (~6.5M triples vs. ~1.7M in English) due to granular neighborhood-level data.
- Domain-Holdout Split: Six entire domains (e.g., Energy, Education, Manufacturing) are held out exclusively for the test set (308 English, 299 Dutch questions) to test true domain transfer while keeping all 1,000+ tables in the retrieval pool.
- Expert Annotation: Queries were generated via randomized S-expressions across 8 complexity types (from simple
VALUElookups to multi-tableAGGJOINandPROPproportion calculations), drafted into natural language by GPT-4.1, and manually verified or rewritten by four experts at Statistics Netherlands.
Key Insights and Ideas
- Models find the right neighborhood, then trip at the finish line: Why is Execution Accuracy near 10% while
obsF1reaches up to 87% (when given the right table)? Models are actually decent at identifying the primary measure, almost getting the right answer, and then missing a single dimension filter—or formatting the output columns differently than expected. Binary EX hides this nuance completely;obsF1exposes it. - Dimension grounding is the universal bottleneck: Models rarely invent syntax errors in standard SQL (only 6.5% fail to execute, mostly column-binding mistakes). Instead, the #1 failure mode is missing an expected dimension filter or picking the wrong dimension code. Crucially, all four models fail on the exact same questions (45 in English, 79 in Dutch), proving the difficulty lies in navigating ambiguous statistical metadata rather than model-specific quirks.
- Pivoting breaks SQL parsers, not data selection: Official statistics routinely present data as 2D pivoted tables. When the authors ran an ablation requiring
PIVOTSQL syntax, underlying data selection (lenient obsF1) didn't budge, but syntax errors skyrocketed over 4x (from 158 to 651 queries). - Sparse search drowns in boilerplate: Standard keyword search (BM25+) fails badly at table retrieval—especially in Dutch—because statistical tables share tons of identical methodological boilerplate text, differing only by a single reported year or regional level. Dense retrieval (ColBERTv2) handles this disambiguation far better.
Key Results
- Table Retrieval: ColBERTv2 achieves a Recall@5 of 0.71 (English) and 0.61 (Dutch), decisively outperforming BM25+ (0.36 English, 0.14 Dutch).
- End-to-End QA: Performance is sobering across all frontier LLMs. In English, GPT 6 Sol leads with 0.10 strict EX (0.11 lenient EX), 0.52 numeric F1, and 0.62
obsF1. In Dutch, Qwen 3.8 hits the highest strict EX at just 0.05, while GPT 6 Sol leads inobsF1at 0.62 (with 0.03 strict EX). - Oracle Query Generation: Even when handed the exact ground-truth tables, models top out at 0.12 strict EX / 0.16 lenient EX (Claude 5 on English), though GPT 6 reaches 0.87
obsF1(English) and 0.84obsF1(Dutch). Multi-table joins (AGGJOIN) are brutal: 0% of end-to-end answers are fully correct.
Limitations and Future Work
- Verbose LLM-assisted phrasings: Because GPT-4.1 drafted the initial question suggestions, English questions tended to be overly verbose and literal compared to how real, casual users type queries. Interestingly, because GPT-4.1 struggled with Dutch, human experts had to manually rewrite Dutch questions much more heavily, inadvertently making the Dutch phrasing more creative and ambiguous.
- Unanswerable questions: Real users frequently ask statistical agencies impossible questions—requesting sums of incompatible units, querying retracted data, or relying on false premises (e.g., "Which Dutch cities have more inhabitants than Amsterdam?"). While LOCuST's knowledge graph already supports detecting incompatible unit aggregations, the current test set only evaluates answerable queries. Future work aims to incorporate unanswerable and false-premise questions directly into the benchmark.
Summary updated