Large language models (LLMs) are transforming healthcare applications by enhancing data analysis, yet their adoption remains constrained by stringent privacy requirements that limit access to sensitive medical data. Anonymization offers a pathway to address this challenge; however, existing techniques often lack contextual understanding and exhibit low accuracy, compromising either patient privacy or the utility of clinical content. In this paper, we propose an end-to-end, modular agentic LLM system for processing sensitive healthcare data with contextual awareness. The system is orchestrated by a central agent coordinating specialized components for structured data retrieval, clinical narrative generation, anonymization, public LLM querying, and secure deanonymization. Locally hosted LLMs handle all privacy-sensitive steps, including context generation and anonymization, while public LLMs are used exclusively for reasoning on pre-anonymized inputs. We evaluate our system on a synthetic clinical dataset and benchmark it against five state-of-the-art named entity recognition (NER) techniques. Our approach achieves high precision and a recall of 93.6%, significantly outperforming baselines such as spaCy (33% precision, 89% recall) and Presidio (41% precision, 90% recall). Additional evaluation on real-world clinical notes from the MIMIC-III dataset demonstrates strong generalization to unstructured narratives, achieving a clean transformation rate of 98.6%. We further evaluate medical richness, showing that anonymized outputs retain clinically relevant information and semantic structure, preserving downstream utility. Adversarial re-identification experiments confirm that no true identifiers can be reconstructed, highlighting the framework’s effectiveness in balancing privacy, robustness, and clinical usefulness.
Azzam et al. (Wed,) studied this question.