FLEX: Expert-level False-Less EXecution Metric for Reliable Text-to-SQL Benchmark

Heegyu Kim, Taeyang Jeon, Seunghwan Choi, Seungtaek Choi, Hyunsouk ChoarXiv 2024 · DOI

Abstract

Evaluation of Text-to-SQL systems has long relied on Execution Accuracy (EX), a metric prone to noise through false positives and false negatives. This paper introduces FLEX (False-Less EXecution), an LLM-based evaluation framework that leverages optimal context and structured reasoning to emulate human expert judgment. FLEX achieves a high Cohen’s kappa agreement of 87.04 with experts, significantly outperforming traditional metrics. Re-evaluating major benchmarks like Spider and BIRD reveals substantial leaderboard volatility and highlights an "annotation gap" where models are frequently penalized for correct but non-matching queries. FLEX offers a scalable, expert-level alternative for assessing the true state of the art in natural language to database interfaces.

Introduction

The primary objective of Text-to-SQL systems is to translate natural language questions into functional SQL queries. For years, the industry standard for measuring success has been Execution Accuracy (EX). Under EX, a model’s query is deemed correct if its execution result matches the result of a ground-truth query. However, this "black-box" approach is increasingly inadequate for sophisticated models.

EX suffers from two critical flaws:

  1. False Positives: A model may generate a logically flawed query that happens to return the correct result due to the specific data distribution in the test database (e.g., a missing filter for "active" records when all records in the sample are active).
  2. False Negatives: A model may produce a perfectly valid, or even superior, query that is marked incorrect because of minor formatting differences, column ordering, or errors in the benchmark's own ground-truth annotations.

As models approach human-level performance, these noisy evaluations obscure actual progress. FLEX (False-Less EXecution) is proposed to bridge this gap by moving from simple result-matching to nuanced logical analysis.

Methodology: The FLEX Framework

FLEX is an evaluation framework that utilizes Large Language Models (specifically GPT-4o) to act as an expert judge. Unlike previous LLM-based evaluators that focused solely on SQL syntax, FLEX provides the judge with Optimal Context ($C_{FLEX}$), which includes:

  • The natural language question and any provided external knowledge.
  • The comprehensive database schema.
  • Both the ground truth query and the model-generated query.
  • The actual execution results from both queries.

Reasoning Criteria

FLEX does not perform a simple string comparison. Instead, it follows a structured reasoning process based on three core pillars:

  • Schema Alignment: Verifying if the selected tables and columns correctly reflect the user's intent.
  • Filtering Conditions: Ensuring WHERE and HAVING clauses are logically sound and complete.
  • Handling Nulls and Ties: Checking for robust handling of edge cases, such as nullable columns or the use of LIMIT in the presence of tied values.

By analyzing the underlying logic rather than just the output table, FLEX can distinguish between a model being "right for the right reasons" and a model benefiting from coincidental data states.

Experimental Setup

The researchers applied FLEX to two of the most rigorous Text-to-SQL benchmarks:

  • Spider: A cross-domain benchmark focusing on complex query structures.
  • BIRD: A benchmark emphasizing large-scale databases and real-world external knowledge.

To assess the impact of this new metric, the authors re-evaluated 50 publicly available models, comparing their FLEX scores against their original EX scores to observe shifts in the global leaderboards.

Key Insights and Results

1. Superior Human Agreement

FLEX demonstrates a remarkably high correlation with human experts, achieving a 87.04 Cohen’s kappa. In contrast, the standard EX metric only achieved a 62.00, indicating that FLEX is significantly more reliable for identifying truly correct SQL logic.

2. The Annotation Gap

A major finding of the study is the "Annotation Gap." FLEX revealed that many models are frequently underestimated because they provide correct answers that differ from flawed or ambiguous reference queries in the benchmarks. On average, model scores increased by 2.6 points when evaluated with FLEX, as the metric correctly identified valid queries that EX had unfairly penalized.

3. The Difficulty Paradox

While models are generally underestimated on average, FLEX found they are often overestimated on the most difficult tasks. In the "Challenge" level of the BIRD benchmark, models frequently "stumble" into the correct result through coincidental logic. EX marks these as correct, but FLEX identifies them as false positives, suggesting that our current SOTA models may be less capable on complex tasks than previously thought.

4. Leaderboard Volatility

The transition from EX to FLEX caused significant shifts in rankings. On the Spider benchmark, some models moved by as many as eight positions. This volatility suggests that current Text-to-SQL leaderboards are partially artifacts of flawed metrics rather than true reflections of model capability.

Discussion and Limitations

While FLEX represents a significant step forward, it has limitations. The highest performance currently requires proprietary models like GPT-4o; while open-source models are improving, they do not yet match this level of evaluative precision. Additionally, FLEX is more computationally intensive and slower than the near-instantaneous EX metric, though it remains roughly 42x faster and significantly cheaper than human expert review.

Conclusion

FLEX provides a necessary evolution in Text-to-SQL evaluation. By providing a metric that is both "false-less" and expert-aligned, it allows researchers to identify the true strengths and weaknesses of their models. Future work will focus on refining these reasoning steps for even more complex enterprise-level databases and reducing the dependency on proprietary LLMs for the evaluation process.

Summary updated

BibTeX
@misc{kim2024flex,
  author = {Heegyu Kim and Taeyang Jeon and Seunghwan Choi and Seungtaek Choi and Hyunsouk Cho},
  title = {{FLEX: Expert-level False-Less EXecution Metric for Reliable Text-to-SQL Benchmark}},
  year = {2024},
  eprint = {2409.19014},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.19014},
}
Figure