Official statistics are critical datasets for a wide variety of actors, including policymakers and businesses. For providers of official statistics, improving accessibility, governance, and disclosure of their data is of key importance. This can be improved by providing question-answering systems based on text-to-SQL approaches. However, existing text-to-SQL benchmarks do not resemble this setting. Official statistics are published as open-domain catalogs of thousands of wide tables whose columns and values are codes, and whose meaning is recorded in separate metadata rather than in a relational schema. To address this gap, we introduce LOCuST, a text-to-SQL benchmark that pairs over two thousand English and Dutch tables from Statistics Netherlands with a semantic knowledge graph. The graph describes the tables, measures, and dimension codes through labels, definitions, hierarchies, and units, and is the external knowledge a system needs to find the right tables and ground a question in the right codes. The benchmark includes expert-annotated questions for different query and aggregation types, including raw value retrieval, summations, proportion calculations, and joins. Alongside standard evaluation measures, we introduce an observation F1 metric that measures how close a query is to the ground truth even when the answers are different. We evaluate a variety of state-of-the-art LLMs and find that they struggle to write SQL that answers the questions correctly.
Figures & tables
Dataset
# Queries
# Tables ∗∗
Average # Cols/Table
Median # Cols/Table
Language
External knowledge
Spider [ 6 ]
10,181
995
5.10
4
en
✗
Spider2.0-snow [ 7 ]
547
5,137
28.11
10
en
External documents
BIRD [ 8 ]
10,962
597
7.26
5
en
Evidence sentences
BULL [ 9 ]
4,966
78
14.96
13
en, zh
Schema descriptions
BEAVER [ 10 ]
7,978
381
9.50
7
en
Domain-knowledge annotations
StatBot.Swiss [ 11 ]
456
36
6.94
5
en, de
Schema descriptions
TABLE I : Statistics for popular text-to-SQL datasets, ∗ showing the number of queries, tables, the average number of columns per table and how datasets cover a requirement for using external knowledge.
TABLE II : Example OData3 table and query result.
Fig. 1 : Schematic overview of the semantic graph for table 03753eng (School size by type of education and ideological basis). For brevity, only a selection of graph objects and predicates are shown. All measures and dimensions have concepts with labels and definitions that can be given to a model. Measures are highlighted in orange, dimension groups in dark green and connected dimension codes in light green.
Fig. 2 : Distribution of number of measures + dimensions that need to be searched for each question-answer pair’s relevant tables.
English
Dutch
Total triples
1,701,066
6,531,863
Tables
1,030
1,211
Tables with geo dim.
139
362
Tables with time dim.
1,012
1,068
Unique measures
21,157
15,400
Measure-table links
29,886
36,816
TABLE III : Metadata graph statistics for both languages
Fig. 3 : Overview of the annotation workflow and tasks involved in the benchmark.
@2
@5
@10
Model
R
PR
R
PR
R
PR
en
BM25+
0.25
0.22
0.36
0.33
0.44
0.40
ColBERTv2
0.62
0.56
0.71
0.65
0.77
0.71
nl
BM25+
0.11
0.11
0.14
0.13
0.17
0.16
ColBERTv2
0.40
0.36
0.61
0.56
0.75
0.71
TABLE IV : Baseline table retrieval performances.
TABLE V : Query generation and end-to-end results on all baseline models for the English (en) and Dutch (nl) datasets.
Fig. 4 : Execution accuracies and measure, dimension and observation F1 scores for each baseline model broken down by question type for the end-to-end task.
Metric
EX S
EX L
NF1
msr F1
dim F1
obs F1
EX S
0.83
0.31
0.15
0.18
0.22
EX L
0.83
0.37
0.17
0.20
0.24
NF1
0.31
0.37
0.43
0.54
0.63
msr F1
0.15
0.17
0.43
0.34
0.72
dim F1
0.18
0.20
0.54
0.34
0.81
obs F1
0.22
0.24
0.63
0.72
0.81
TABLE VI : Spearman correlation between the (lenient) evaluation metrics on the query generation and end-to-end task, over all questions with a generated query. ∗
TABLE VII : Number of queries, syntax errors, and wrongly chosen aggregations for each question type, and syntax errors for each domain of the test questions for all models on the English test set (end-to-end QA task). Syntax errors and percentages are relative to the number of generated queries, wrong aggregations to the generated queries without a syntax error.
Error type
Claude 5
GPT 6
LLama 4
Qwen 3.8
No query generated
0.0
0.0
1.0
0.0
Syntax errors
2.6
1.0
6.5
7.7
Incorrect table(s) ∗
4.3
3.6
4.2
5.9
Wrong aggregation ∗
8.6
4.6
19.9
11.5
Missing measures
10.6
8.4
15.6
13.9
Extra measure(s)
10.6
9.0
13.4
13.2
TABLE VIII : Common mistakes per model on the query generation task on the English test set, as a percentage of the generated queries (‘No query generated’ as a percentage of all questions).
Less than 101 pupils/students
Roman Catholic
Primary schools
Measure
Unit
AVG[‘Periods’ ]
Enrolled students
number
13755.0
TABLE IX : Query result for Example 2, pivoted over the measure (orange). Colors indicate dimension codes (light green) and the observation (blue). Labels and units are obtained from the semantic graph.
Model
EX S
EX L
msr F1
dim F1
obs F1
en
Claude 5
0.07−0.05
0.31+0.15
0.81−0.08
0.81−0.09
0.76−0.08
GPT 6
0.08−0.02
0.38+0.28
0.75−0.17
0.76−0.16
0.72−0.15
LLama 4
0.03
0.13+0.07
0.57−0.25
0.56−0.24
0.53−0.20
Qwen 3.8
0.09
0.25+0.14
0.64−0.18
0.64−0.17
0.61−0.14
nl
Claude 5
0.05−0.01
0.21+0.11
0.77−0.15
0.68−0.12
0.68−0.12
GPT 6
0.04−0.03
0.27+0.17
0.76−0.19
0.68−0.16
0.67−0.17
TABLE X : Performance for all models on the query-only generation task with a pivoting requirement. An increase or decrease to the performances of the regular SQL generations are indicated with + and - respectively.