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

In the healthcare domain, the ability to query Electronic Health Records (EHRs) using natural language is a transformative capability for clinicians. However, Text-to-SQL models—which translate natural language questions into database queries—face a significant "reliability gap." In a clinical setting, a model that generates a plausible but incorrect SQL query, or attempts to answer a question for which the database lacks data, can lead to dangerous medical misinformation.

Existing systems struggle with three primary challenges: a severe data imbalance where answerable questions far outnumber unanswerable ones; a distribution shift between training datasets and real-world queries; and the lack of a robust mechanism to "err on the side of caution." To address these, researchers from LG AI Research and KAIST developed PLUQ (Pseudo-Labeled Unanswerable Questions), a self-training framework designed to prioritize reliability and accuracy in EHR environments.

Methodology: The PLUQ Framework

The PLUQ framework utilizes a multi-step pipeline designed to teach the model when to provide an answer and when to remain silent.

1. Seed Model Fine-tuning

The process begins by fine-tuning a "seed" model (GPT-3.5-Turbo) on available training data. This data includes the relational schema of the MIMIC-IV database, ensuring the model understands the specific table structures and column names required for valid SQL generation.

2. Self-Training via Pseudo-Labeling

To address the scarcity of unanswerable questions in training sets, the framework employs a self-training loop. The seed model predicts answers for an unlabeled test set. Questions that the model identifies as unanswerable are "pseudo-labeled" and integrated back into the training set. This synthetic expansion of the "null" class helps the model learn the boundaries of the database's knowledge more effectively.

3. Two-Stage Filtering for Reliability

To ensure the final output is trustworthy, PLUQ applies two distinct filtering layers:

  • Maximum Token Entropy: The system calculates the statistical uncertainty (entropy) for every token generated. If the entropy of any token exceeds a predefined threshold—indicating the model is "guessing"—the system automatically labels the question as unanswerable.
  • Execution-Based Filtering: The generated SQL is executed against a demo database. If the query results in an error, returns an empty set, or yields a "None" value, it is filtered out and treated as unanswerable to prevent the delivery of potentially misleading null results as factual answers.

Experimental Setup

The methodology was validated using the EHRSQL 2024 dataset, which is built upon the MIMIC-IV (Medical Information Mart for Intensive Care) demo database. The training set consisted of 5,124 samples, of which only 450 were originally unanswerable. The development and test sets contained approximately 1,160 entries each. The model was evaluated primarily on the Reliability Score (RS), a metric that heavily penalizes incorrect SQL queries while rewarding correct ones and neutralizes the impact of correctly identified unanswerable questions.

Key Insights and Results

PLUQ achieved the #1 ranking on the EHRSQL 2024 official leaderboard, demonstrating the efficacy of the self-training approach.

Performance Metrics

On the test set, PLUQ achieved an RS(10) score of 81.32. This performance was significantly higher than the second-place team (74.89). The importance of the reliability penalty was highlighted by the fact that several competing models scored in the negative thousands because they frequently provided incorrect answers rather than admitting uncertainty.

The Value of Uncertainty

Ablation studies confirmed that the "secret sauce" of the system was the multi-stage filtering. Removing the entropy-based filtering or the unanswerable information from the prompt led to substantial drops in the reliability score. This confirms that high token entropy is a highly effective proxy for identifying likely errors in SQL generation.

Conclusion and Future Work

The PLUQ framework demonstrates that for high-stakes domains like healthcare, a model's ability to say "I don't know" is as important as its ability to provide a correct answer. By leveraging pseudo-labeling and entropy-based filtering, the researchers created a system that significantly outperforms standard Text-to-SQL approaches in reliability.

Future research will focus on expanding this framework to include unstructured medical data, such as clinical notes. Integrating these sources with structured relational databases would provide a more holistic view of patient health and further enhance the utility of Text-to-SQL systems in clinical decision-making.

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