LG AI Research & KAIST at EHRSQL 2024: Self-Training Large Language Models with Pseudo-Labeled Unanswerable Questions for a Reliable Text-to-SQL System on EHRs

Yongrae Jo, Seongyun Lee, Minju Seo, Sung Ju Hwang, Moontae Lee

Abstract

Text-to-SQL models are pivotal for making Electronic Health Records (EHRs) accessible to healthcare professionals without SQL knowledge. With the advancements in large language models, these systems have become more adept at translating complex questions into SQL queries. Nonetheless, the critical need for reliability in healthcare necessitates these models to accurately identify unanswerable questions or uncertain predictions, preventing misinformation. To address this problem, we present a self-training strategy using pseudo-labeled unanswerable questions to enhance the reliability of text-to-SQL models for EHRs. This approach includes a two-stage training process followed by a filtering method based on the token entropy and query execution. Our methodology’s effectiveness is validated by our top performance in the EHRSQL 2024 shared task, showcasing the potential to improve healthcare decision-making through more reliable text-to-SQL systems.

Introduction

Translating natural language questions into SQL queries (Text-to-SQL) is a transformative technology for healthcare, enabling clinicians to query complex databases like Electronic Health Records (EHRs) without technical expertise. However, the high-stakes nature of medical data demands extreme reliability. If a model generates a SQL query for a question that the database cannot answer—such as requesting a lab result that was never recorded—it risks producing dangerous misinformation.

The primary challenge is ensuring the model knows when to say "I don't know." Most existing models are optimized to always provide an answer, leading to "hallucinations" when faced with unanswerable queries. Furthermore, existing datasets often suffer from a significant class imbalance, with far fewer unanswerable questions than answerable ones, making it difficult for models to learn the boundaries of their knowledge.

Methodology: The PLUQ Framework

To address these challenges, researchers from LG AI Research and KAIST developed PLUQ (Pseudo-Labeled Unanswerable Questions). PLUQ is a self-training framework designed to enhance reliability through a multi-stage process and uncertainty-based filtering.

The PLUQ self-training pipeline, illustrating the transition from a seed model to a null-augmented training set.

The PLUQ methodology consists of four main components:

  1. Seed Model Fine-Tuning: A "seed" model (specifically GPT-3.5-Turbo) is initially fine-tuned on a small, labeled dataset of EHR questions and their corresponding SQL queries.
  2. Pseudo-Labeling and Augmentation: This seed model predicts answers for an unlabeled test set. Questions identified as unanswerable (returning a 'null' value) are selected to augment the original training data, helping to balance the dataset's representation of unanswerable queries.
  3. Final Fine-Tuning: The model undergoes a second round of fine-tuning on this augmented, "null-heavy" dataset.
  4. Two-Stage Filtering Pipeline:
    • Maximum Token Entropy: The model calculates the entropy (uncertainty) of every generated token. If any token's entropy exceeds a predefined threshold, the entire query is flagged as unanswerable.
  5. Execution-Based Filtering: Any generated SQL query that results in an execution error or returns invalid values from the database is automatically discarded and labeled as 'null'.

Experimental Setup

The study utilized the EHRSQL 2024 shared task dataset, which is based on the MIMIC-IV demo database—a de-identified relational database containing real-world clinical data. The training set originally contained 5,124 samples, but only 450 were labeled as "unanswerable." This imbalance was the primary target of the PLUQ self-training strategy.

Results and Discussion

PLUQ achieved the top ranking in the EHRSQL 2024 shared task. The primary evaluation metric was the Reliability Score (RS), which rewards correct SQL generation while heavily penalizing incorrect answers. Correctly identifying an unanswerable question yields zero points, effectively encouraging caution.

Leaderboard results for the EHRSQL 2024 shared task, showing PLUQ's superior performance across various Reliability Score (RS) metrics.

As shown in the results table, PLUQ achieved an RS(10) score of 81.32 on the test set, significantly outperforming the closest competitor, ProbGate (74.21). A notable strength of the PLUQ model is its stability; the minimal difference between its RS(0) and RS(10) scores indicates a high degree of success in avoiding the "penalty zone" of incorrect answers.

Ablation studies further highlighted the importance of the filtering stages. While execution filtering provided a baseline for reliability, the addition of entropy-based filtering (Ent Filtering) was crucial for achieving the highest scores in more penalized settings like RS(10).

Conclusion and Future Work

The success of PLUQ demonstrates that self-training with pseudo-labels and uncertainty-based filtering can significantly improve the reliability of Text-to-SQL systems in sensitive domains like healthcare. However, several challenges remain. The model's performance is currently tied to the specific schema of the MIMIC-IV database, and its generalization to other EHR systems requires further investigation. Additionally, while PLUQ led the competition, its RS(N) score—the most severe penalty setting—remained negative, suggesting that even state-of-the-art models are not yet ready for fully autonomous clinical deployment.

Future research will focus on improving generalization and exploring the integration of unstructured medical text, such as clinical notes, with structured SQL data to provide a more comprehensive patient overview.

Summary updated

BibTeX
@inproceedings{jo2024lg,
  author = {Yongrae Jo and Seongyun Lee and Minju Seo and Sung Ju Hwang and Moontae Lee},
  title = {{LG AI Research \& KAIST at EHRSQL 2024: Self-Training Large Language Models with Pseudo-Labeled Unanswerable Questions for a Reliable Text-to-SQL System on EHRs}},
  booktitle = {ClinicalNLP @ NAACL},
  year = {2024},
  url = {https://openreview.net/forum?id=kDG311Ub0C},
}
Figure