Leveraging Open-Source Language Models for Privacy-Preserving Text-to-SQL Generation in Electronic Health Records

Grace Chan, Po-Chih Kuo


Abstract
Electronic Health Records (EHRs) are valuable sources of clinical information, yet querying them often requires specialized knowledge of structured query languages. Large Language Models (LLMs) enable more intuitive access through natural language queries; however, achieving reliable performance often requires domain-specific fine-tuning, and proprietary LLMs may raise privacy concerns because sensitive data must be transmitted to external servers. To address these challenges, we propose a fully open-source, locally deployable framework that integrates two complementary models, Llama-Coder-13B and DeepSeek-Coder-6.7B, fine-tuned using schema-aware prompts. Their outputs undergo confidence-based filtering and rule-based aggregation, leveraging the strengths of both models to improve accuracy and reliability. Evaluated on the EHRSQL 2024 shared task using the Reliability Score (RS), our approach achieves an RS(0) of 82.69 and an RS(10) of 44.99, outperforming other open-source baselines. Although a performance gap remains compared to proprietary LLMs, our system offers a practical privacy-preserving alternative while maintaining competitive performance among open-source approaches.
Anthology ID:
2026.rocling-main.1
Volume:
Proceedings of the 38th Conference on Computational Linguistics and Speech Processing (ROCLING 2026)
Month:
November
Year:
2026
Address:
National Tsing Hua University. Hsinchu, Taiwan.
Editors:
Po-Chih Kuo, Lung-Hao Lee, An-Zi Yen, Fernando Henrique Calderon Alvarado, Carlos Argueta
Venue:
ROCLING
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
1–11
Language:
URL:
https://aclanthology.org/2026.rocling-main.1/
DOI:
Bibkey:
Cite (ACL):
Grace Chan and Po-Chih Kuo. 2026. Leveraging Open-Source Language Models for Privacy-Preserving Text-to-SQL Generation in Electronic Health Records. In Proceedings of the 38th Conference on Computational Linguistics and Speech Processing (ROCLING 2026), pages 1–11, National Tsing Hua University. Hsinchu, Taiwan.. Association for Computational Linguistics.
Cite (Informal):
Leveraging Open-Source Language Models for Privacy-Preserving Text-to-SQL Generation in Electronic Health Records (Chan & Kuo, ROCLING 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.rocling-main.1.pdf