Privacy-preserving large language models for structured medical information retrieval

Isabella C. Wiest, Dyke Ferber, Jiefu Zhu, Marko van Treeck, Sonja K. Meyer, Radhika Juglan, Zunamys I. Carrero, Daniel Paech, Jens Kleesiek, Matthias P. Ebert, Daniel Truhn, Jakob Nikolas KatherNpj Digit. Medicine 2024 · DOI

Abstract

This study investigates the use of local, quantized Large Language Models (LLMs) for the automated extraction of structured clinical information from unstructured medical narratives. By deploying the Llama 2 model family on-premise, the researchers aimed to circumvent the privacy and regulatory hurdles associated with cloud-based AI. The results indicate that a 70B parameter model, enhanced with grammar-based sampling and chain-of-thought prompting, can achieve high-fidelity data retrieval—reaching 100% sensitivity for specific conditions like liver cirrhosis—thereby providing a viable, privacy-preserving alternative for clinical data processing.

The Challenge of Unstructured Clinical Data

An estimated 80% of clinical data is currently stored as "dark matter": unstructured free text, images, and videos that remain largely inaccessible for large-scale quantitative analysis. While advanced cloud-based LLMs like GPT-4 have demonstrated remarkable capabilities in structuring this data, their use in healthcare is restricted by significant legal and ethical barriers. Under frameworks such as the EU's GDPR, exporting sensitive patient data to third-party servers is often prohibited, creating a need for high-performance models that can run on local hospital hardware.

Privacy-First Methodology: Local LLM Deployment

To address this, researchers developed a pipeline utilizing the open-source Llama 2 family of models (7B, 13B, and 70B parameters). To ensure these models could operate on standard hardware without compromising performance, the team employed quantization, a technique that reduces the numerical precision of model weights to lower memory requirements.

Key technical innovations included:

  • Grammar-Based Sampling: Utilizing the llama.cpp framework, the researchers enforced a specific JSON schema on the model’s output. This eliminated the risk of "hallucinated" malformed data structures, ensuring the output was immediately ready for database integration.
  • Prompt Engineering: The study compared zero-shot and one-shot prompting strategies. They also implemented "Chain-of-Thought" (CoT) reasoning, requiring the model to extract a specific text excerpt before making a final binary classification (true/false).

Dataset and Expert Validation

The pipeline was evaluated using 500 medical histories from the MIMIC-IV database. To establish a gold-standard ground truth, three blinded medical experts independently reviewed the reports, focusing on five key clinical features: liver cirrhosis, ascites, abdominal pain, shortness of breath, and confusion.

Distribution and ground truth status of clinical features across the 500-report dataset.

Performance Benchmarks: The Superiority of the 70B Model

The study found a clear correlation between model size and performance. While the smaller 7B model required extensive prompt engineering (such as providing explicit definitions) to achieve acceptable results, the 70B parameter model proved remarkably robust, maintaining high accuracy regardless of the prompt structure.

Key results for the 70B model included:

  • Liver Cirrhosis: 100% sensitivity and 96% specificity.
  • Ascites: 95% sensitivity and 95% specificity.
  • Abdominal Pain: 84% sensitivity and 97% specificity.

Overall, the 70B model achieved over 90% accuracy across all tested features, demonstrating that local models can indeed rival the performance of proprietary cloud-based solutions.

Nuanced Retrieval: Explicit vs. Implicit Features

A critical finding was the difference between explicit and implicit information retrieval. The models were nearly perfect at identifying features explicitly mentioned in the text (e.g., the word "ascites"). However, identifying implicit features—such as inferring "confusion" from a description of a patient being disoriented—remained more challenging. Even in these nuanced tasks, the 70B model significantly outperformed its smaller counterparts, which were more prone to hallucinations or misinterpreting unrelated findings.

Conclusion and Future Outlook

This research proves that on-site deployment of quantized LLMs is a feasible and effective strategy for medical research hospitals. While the study was limited to English-language notes and identified some demographic biases, it sets a foundation for future work. The researchers anticipate that newer open-source models, such as Llama 3 or Mistral, will further close the performance gap, enabling the secure processing of millions of hospital records for advanced clinical analytics.

Summary updated

BibTeX
@article{wiest2024privacy,
  author = {Isabella C. Wiest and Dyke Ferber and Jiefu Zhu and Marko van Treeck and Sonja K. Meyer and Radhika Juglan and Zunamys I. Carrero and Daniel Paech and Jens Kleesiek and Matthias P. Ebert and Daniel Truhn and Jakob Nikolas Kather},
  title = {{Privacy-preserving large language models for structured medical information retrieval}},
  journal = {Npj Digit. Medicine},
  year = {2024},
  doi = {10.1038/s41746-024-01233-2},
}
Figure