Introduction
Electronic Medical Records (EMRs) contain vast amounts of critical healthcare data stored in relational databases. Accessing this information typically requires SQL expertise, creating a barrier for healthcare professionals. Text-to-SQL models aim to bridge this gap, allowing users to query databases using natural language. While current state-of-the-art models report over 90% accuracy on medical benchmarks like MIMICSQL, this research suggests such high performance may be an "illusion of success."
The authors argue that existing datasets often feature high similarity between training and testing questions, leading models to memorize templates rather than learn database schemas. This paper introduces a more challenging evaluation framework, MIMICSQL 2.0, to expose these generalization gaps and explores data augmentation techniques to improve model robustness.
Methods and Approach
To address the limitations of current medical text-to-SQL models, the researchers proposed a multi-faceted approach involving a novel data split and advanced training strategies.
MIMICSQL 2.0: A New Evaluation Split
The authors created MIMICSQL 2.0 by partitioning data based on table usage. Specifically, if a table appears in a FROM clause in the training set, it is restricted to INNER JOIN clauses in the test set, and vice versa. This forces models to generalize across different SQL structures rather than relying on memorized patterns.
Model and Data Augmentation
The study utilized the T5 (Text-to-Text Transfer Transformer) model with execution-guided decoding. To enhance diversity without manual annotation, the team employed back-translation—translating English questions into French or German and back to English to generate synthetic paraphrases. Additionally, they incorporated out-of-domain training using the Spider dataset, a complex, cross-domain benchmark, to teach the model more robust SQL logic.
Experimental Results
The experiments revealed a significant performance gap when models were moved from standard splits to the more rigorous MIMICSQL 2.0.
The Generalization Gap
On the original MIMICSQL split, the T5 model achieved an impressive 93.7% execution accuracy (ACC_EX). However, on the new MIMICSQL 2.0 split, the base T5 model’s performance plummeted to 27.8% ACC_EX on template-based data. This confirms that high accuracy on standard benchmarks is largely due to overlapping distributions.
Improving Robustness
The inclusion of the Spider dataset significantly bolstered performance, raising the T5 model's accuracy on the new split to 83.9% ACC_EX. Furthermore, the combination of T5, Spider data, and back-translation achieved 52.8% ACC_EX when evaluating on paraphrased data—effectively matching the performance of models trained on expensive, human-annotated paraphrases (51.9%).
Discussion and Future Directions
The findings demonstrate that medical text-to-SQL is far from a solved problem. While synthetic data and cross-domain training provide a path forward, several challenges remain. Current medical datasets lack the query complexity (e.g., nested queries) found in general-domain benchmarks like Spider. Moreover, real-world hospital databases are often more fragmented and complex than the simplified relational version of MIMIC-III used here.
Future research should focus on developing medical datasets with higher query complexity and testing models across different hospital systems to ensure they can adapt to diverse EHR schemas.
Summary updated