Skip to content
Back to skills

Din Sql Eval

ASecurity

Evaluates a model's ability to generate syntactically and semantically correct SQL queries from natural language questions across diverse database schemas. It probes schema linking, handling of complex query structures (joins, nested subqueries, aggregations), and the capacity for iterative self-correction when initial generations fail. Use when the user wants to benchmark on Spider, or asks about evaluating this task. Reports Execution Accuracy (EX).

  • 3 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 11, 2026
researchpythongosqldatabaseperformance

Security analysis

A100/100

Scanned September 11, 2026

npx -y skills add qhjqhj00/research-skills-pool --skill din-sql-eval --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Din Sql Eval?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Din Sql Eval
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/qhjqhj00-din-sql-eval/badge)](https://www.skillsdirectory.com/skills/qhjqhj00-din-sql-eval)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: din-sql-eval
description: Evaluates a model's ability to generate syntactically and semantically correct SQL queries from natural language questions across diverse database schemas. It probes schema linking, handling of complex query structures (joins, nested subqueries, aggregations), and the capacity for iterative self-correction when initial generations fail. Use when the user wants to benchmark on Spider, or asks about evaluating this task. Reports Execution Accuracy (EX).
metadata:
  skill_kind: dataset_eval
  source_arxiv: 2304.11015
  bibtex_key: [REDACTED]
  confidence: high
---

# din-sql-eval

> DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction — Pourreza et al. (2023) (arXiv:2304.11015, 2023)

## What this evaluates

Evaluates a model's ability to generate syntactically and semantically correct SQL queries from natural language questions across diverse database schemas. It probes schema linking, handling of complex query structures (joins, nested subqueries, aggregations), and the capacity for iterative self-correction when initial generations fail.

## Datasets

- **Spider** — total 10181; splits: train (8659), dev (1034), test (2147)

## Metrics

- `Execution Accuracy (EX)` **(primary)** — range: percent
  - Compares the execution output of the predicted SQL query with that of the ground truth SQL query on database instances. A prediction is correct if the result sets match, allowing for multiple valid SQL formulations.
- `Exact-Set-Match Accuracy (EM)` — range: percent
  - Treats each SQL clause as a set and compares the prediction to the reference query. A query is correct only if all components match exactly; it does not consider actual values or execution results.

## Input / output format

**Input**: Natural language question, database schema (table and column names), and few-shot demonstrations. For BIRD, prompts also include sample rows from each table and concatenated external knowledge hints.

**Output**: A single SQL query string.

## Scoring recipe

```python
def compute_ex(predictions, golds, db_instances):
    correct = 0
    for pred_sql, gold_sql in zip(predictions, golds):
        pred_res = execute_sql(pred_sql, db_instances)
        gold_res = execute_sql(gold_sql, db_instances)
        if set(pred_res) == set(gold_res):
            correct += 1
    return (correct / len(predictions)) * 100
```

## Common pitfalls

- Execution accuracy (EX) permits multiple syntactically different SQL queries to be marked correct as long as they produce identical result sets on the database instances.
- Schema linking modules can introduce redundant joins or output columns when questions or schemas are ambiguous, artificially lowering accuracy if not handled carefully.
- Exact-match (EM) ignores actual data values and only checks clause structure, making it less robust than EX for evaluating functional correctness.

## Evidence (verbatim from paper)

> The exact-set-match accuracy (EM) treats each clause as a set and compares the prediction for each clause to its corresponding clause in the reference query. A predicted SQL query is considered correct only if all of its components match the ground truth. This metric does not take values into account. The execution accuracy (EX) compares the execution output of the predicted SQL query with that of the ground truth SQL query on some database instances. Execution accuracy provides a more precise estimate of the model's performance since there may be multiple valid SQL queries for a given question, and exact set match accuracy only evaluates the predicted SQL against one of them.

## Citation

```bibtex
@misc{pourreza2023dinsql,
  title={DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction},
  author={Pourreza et al. (2023)},
  year={2023},
  note={arXiv:2304.11015}
}
```

- arXiv: 2304.11015

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.