NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

SCARE: A Benchmark for SQL Correction and Question Answerability Classification for Reliable EHR Question Answering

Gyubok Lee, Woosog Chay, Edward ChoiarXiv 2025 · DOI

Introduction

Text-to-SQL models offer a transformative way for clinicians to interact with complex Electronic Health Record (EHR) databases using natural language. However, the high-stakes nature of clinical environments makes direct deployment risky. A model might generate a flawed SQL query that misses critical patient data, or it might attempt to answer a vague or unanswerable question, potentially leading to medical errors.

SCARE (SQL Correction and Answerability REasoning) is a new benchmark designed to serve as a "safety layer" for these systems. It evaluates the ability of AI models to verify and correct generated SQL queries while identifying ambiguous or unanswerable user inputs before they are executed.

The Post-hoc Verification Task

Unlike traditional text-to-SQL research that focuses on initial generation, SCARE emphasizes post-hoc verification. This involves an independent safety component that inspects a candidate SQL query and the original user question to make a four-way decision:

  1. Preserve: Retain the SQL if it is correct.
  2. Correct: Fix the SQL if the question is answerable but the initial query is flawed.
  3. Clarify: Identify if the question is ambiguous (e.g., "Is the patient stable?").
  4. Reject: Identify if the question is unanswerable given the database schema.
Overview of the SCARE post-hoc safety layer and its four-way decision process.

Several strategies were benchmarked, including two-stage classifiers, single-turn integrated models, and hybrid variants that use classification reasoning to guide the correction process.

The SCARE Benchmark

The SCARE dataset consists of 4,200 triples (Question, Candidate SQL, Expected Output) grounded in three major EHR databases: MIMIC-III, MIMIC-IV, and eICU. The benchmark is perfectly balanced, with 1,050 instances for each of the four categories.

Examples of the four question types in the SCARE benchmark, including user questions, candidate SQL, and expected answers.

Candidate SQL queries were sourced from seven different text-to-SQL models (ranging from specialized models like CodeS-15B to general-purpose LLMs like GPT-4o) to ensure a realistic variety of errors.

Key Insights and Results

The researchers identified several critical challenges in building reliable clinical SQL interfaces:

  • The Preservation-Correction Trade-off: There is a tension between fixing errors and maintaining correct queries. Aggressive models often "break" perfect SQL, while conservative ones fail to catch errors.
  • Ambiguity is the Primary Challenge: While LLMs are proficient at identifying out-of-scope questions (achieving >90% recall), they struggle with linguistic ambiguity. Terms like "high-risk" or "sufficient data" are difficult for models to flag as requiring clarification, with the best F1-score for ambiguity detection peaking at only 54.0%.
  • Correction Performance: The best-performing model (Single-Turn-Veri-Cls using Gemini-1.5-Flash) achieved a Correction Rate (CR) of 53.8%, successfully fixing about half of the flawed queries.
  • Reasoning Matters: Hybrid approaches that explicitly classify the question before attempting correction consistently outperformed purely integrated systems.

Conclusion and Future Work

SCARE highlights that while current LLMs are promising for SQL verification, significant gaps remain, particularly in handling nuanced clinical ambiguity. Future work should explore multi-turn dialogues to resolve these ambiguities and test models against the massive, proprietary schemas found in production hospital environments.

Summary updated

BibTeX
@misc{lee2025scare,
  author = {Gyubok Lee and Woosog Chay and Edward Choi},
  title = {{SCARE: A Benchmark for SQL Correction and Question Answerability Classification for Reliable EHR Question Answering}},
  year = {2025},
  eprint = {2511.17559},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.17559},
}
Figure