AACL 2026 · Accepted Paper

SQLStructEval
Structural Evaluation of
LLM Text-to-SQL Generation

Yixi Zhou1,2,*, Fan Zhang3,*, Zhiqiao Guo4,*, Yu Chen3,†,
Haipeng Zhang2,†, Preslav Nakov5, Zhuohan Xie5
1 Hong Kong Baptist University 2 ShanghaiTech University
3 The University of Tokyo 4 University of Michigan 5 MBZUAI
* Equal contribution Corresponding authors
Asia-Pacific Chapter of the Association for Computational Linguistics

Correct answers can come from different programs.
We study how SQL structure varies across generations and equivalent inputs.

Paper overview comparing direct SQL generation with an explicit AST-based program representation.

A structural view of Text-to-SQL: compare canonical programs, then evaluate a compile-style generation pipeline.

Abstract

Large language models (LLMs) can generate SQL queries that return correct answers while differing in program structure. We introduce SQLStructEval, a framework that analyzes this behavior through canonical abstract syntax tree (AST) representations. Experiments on Spider across seven models reveal structural variation within execution-correct generations and sensitivity to question paraphrases and schema presentation. Additional 100-example subsets of BIRD Mini-Dev, Spider-Syn, and Dr.Spider provide scope validation.

As a mitigation case study, a pipeline that generates structured intermediate representations before deterministic compilation improves execution accuracy and structural agreement among correct outputs in the evaluated setting.

Structural diversity is not inherently erroneous: our measures expose differences for further inspection rather than determine semantic correctness. These findings establish structural analysis as a complementary diagnostic alongside execution-based evaluation.

Method

Sample SQL for a fixed intent. Canonicalize its representation. Inspect how structure and execution relate.

Canonical representation

Parse SQL into ASTs and normalize superficial differences, including alias choices and conjunction order. Compare the resulting canonical representations.

Execution and structure

Measure majority concentration, distinct structures and entropy, both across all outputs and within the execution-correct subset.

Input sensitivity

Compare dominant structures across question paraphrases and reordered schema presentations that preserve the intended query.

Compile-style generation

I

Question and database schema

Provide the natural language question, available tables and columns, and foreign-key relationships.

II

Structured query plan

Generate a JSON representation with explicit selection, joins, predicates, aggregation, ordering and limits.

III

Deterministic compilation and evaluation

Compile the plan into SQL, then apply the same execution checks and canonical structural analysis used for direct generation.

Results

Spider development set · 1,034 questions · 10 generations per question

+4.3 pp

Execution accuracy
Compile-style vs. Direct SQL

0.632

Correct-subset AST agreement
Up from 0.552 with Direct SQL

7

Models evaluated
Across four core experiments

GPT-5-mini: full-pipeline comparison reported in the paper
MeasureDirect SQLDIN-SQLCompile-style
Execution accuracy0.7420.7360.785
AST agreement (correct)0.5520.5790.632
Distinct structures (all)1.9081.5532.527

Agreement among correct outputs and diversity across all outputs describe different distributions. These results assess the complete pipeline; they do not isolate representation, compilation or prompting effects.

Sensitivity to equivalent inputs

For GPT-5-mini, 90.0% of evaluated questions change their majority structure under paraphrasing and 64.0% under schema presentation changes. This experiment uses 200 Spider questions.

Beyond the main benchmark

Additional 100-question subsets of BIRD Mini-Dev, Spider-Syn and Dr.Spider extend the scope check. They are descriptive subset evaluations, not full-benchmark rankings.

One answer, different structures

“Which model of the car has the minimum horsepower?”

Reference AST: a join followed by ORDER BY horsepower and LIMIT 1.
Annotated reference: ORDER BY + LIMIT
Generated AST: a join with a WHERE predicate and a MIN horsepower subquery.
Generated query: MIN subquery

Both formulations return the same result in the paper’s example. Agreement on one database does not establish equivalence on every database, for example when ties or null values change.

BibTeX

Accepted at AACL 2026. Citation metadata will be updated when the proceedings entry is available.

@inproceedings{zhou2026sqlstructeval,
  title = {{SQLStructEval}: Structural Evaluation of LLM Text-to-SQL Generation},
  author = {Zhou, Yixi and Zhang, Fan and Guo, Zhiqiao and Chen, Yu and Zhang, Haipeng and Nakov, Preslav and Xie, Zhuohan},
  booktitle = {AACL},
  year = {2026},
  address = {Hengqin, China},
  note = {Accepted; proceedings metadata forthcoming},
  url = {https://arxiv.org/abs/2604.06736}
}