Source-linked AI summary
DeID-GPT: Zero-shot Medical Text De-Identification by GPT-4
Zhengliang Liu, Yue Huang, Xiaowei Yu, Lu Zhang, Zihao Wu, Chao Cao, Haixing Dai, Lin Zhao, Yiwei Li, Peng Shu, Fang Zeng, Lichao Sun, Wei Liu, Dinggang Shen, Quanzheng Li, Tianming Liu, Dajiang Zhu, Xiang Li
TL;DR
Medical free-text records need effective de-identification because they contain private information and existing methods may lack generalizability or require scenario-specific fine-tuning. DeID-GPT uses HIPAA-guided prompts with ChatGPT or GPT-4 and achieves the paper’s strongest reported de-identification performance, while online access and closed implementation constrain hospital deployment.
Problem
Medical free-text de-identification requires effective methods because existing rule-based and learning-based approaches can lack generalizability or require scenario-specific fine-tuning.
Method
DeID-GPT uses HIPAA identifiers in explicitly designed prompts and sends them with original clinical reports to ChatGPT or GPT-4 for de-identification.
Results
GPT-4 achieves over 0.99 de-identification accuracy in zero-shot evaluation with an optimal explicit prompt, outperforming GPT-3-powered ChatGPT and other baselines.
Takeaways & Limitations
LLMs can de-identify medical data while preserving the original text structure and meaning, supporting further healthcare privacy research.
Takeaways & Limitations
Online-only APIs and closed implementation details prevent direct hospital deployment and full validation of HIPAA compliance and quality-management requirements.
Abstract
from arXiv · showhide
The digitization of healthcare has facilitated the sharing and re-using of medical data but has also raised concerns about confidentiality and privacy. HIPAA (Health Insurance Portability and Accountability Act) mandates removing re-identifying information before the dissemination of medical records. Thus, effective and efficient solutions for de-identifying medical data, especially those in free-text forms, are highly needed. While various computer-assisted de-identification methods, including both rule-based and learning-based, have been developed and used in prior practice, such solutions still lack generalizability or need to be fine-tuned according to different scenarios, significantly imposing restrictions in wider use. The advancement of large language models (LLM), such as ChatGPT and GPT-4, have shown great potential in processing text data in the medical domain with zero-shot in-context learning, especially in the task of privacy protection, as these models can identify confidential information by their powerful named entity recognition (NER) capability. In this work, we developed a novel GPT4-enabled de-identification framework (``DeID-GPT") to automatically identify and remove the identifying information. Compared to existing commonly used medical text data de-identification methods, our developed DeID-GPT showed the highest accuracy and remarkable reliability in masking private information from the unstructured medical text while preserving the original structure and meaning of the text. This study is one of the earliest to utilize ChatGPT and GPT-4 for medical text data processing and de-identification, which provides insights for further research and solution development on the use of LLMs such as ChatGPT/GPT-4 in healthcare. Codes and benchmarking data information are available at https://github.com/yhydhx/ChatGPT-API.
I. Introduction
Medical free-text records enable data sharing but frequently contain identifiable information, creating privacy concerns. DeID-GPT applies HIPAA-guided prompts with ChatGPT or GPT-4 to generate de-identified reports.
- Motivation: Clinical notes commonly contain identifiable or confidential patient information despite their value for healthcare research and data-driven solutions.Examples include consultation, nursing, discharge, procedure, operative, radiology, and pathology reports.
- Large Language Models: LLMs have attracted interest because their language-processing capabilities support contextual medical text analysis and downstream tasks.GPT-4 is described as capable of generating, editing, and collaborating on technical writing tasks.
- Motivation: LLMs can mask sensitive medical information while preserving the overall structure and meaning of the text.This capability motivates their use for privacy protection in clinical free-text processing.
- DeID-GPT Framework: DeID-GPT incorporates HIPAA identifiers into prompts, then sends the prompts and original clinical reports to ChatGPT or GPT-4 for redaction.The framework is described as having two major steps: prompt construction and LLM-based generation of de-identified reports.
Zero-shot and Few-Shot In-Context Learning
Zero-shot and few-shot in-context learning adapt LLMs to new tasks through prompt instructions and examples without additional fine-tuning. Prompt engineering therefore becomes central, although effective prompts may require expert knowledge and inference can be computationally costly.
- Mechanism: Prompts help LLMs infer task structures and patterns, enabling adaptation without collecting labeled data for extensive fine-tuning.The passage describes this behavior as similar to explicit fine-tuning at prediction, representation, and attention levels.
- Definitions: Zero-shot learning uses task instructions without examples, whereas few-shot learning supplies input-output examples within the prompt.Both approaches let LLMs perform new tasks without further training or fine-tuning.
- Trade-offs: Effective prompting trades off reduced fine-tuning needs against higher inference costs and possible expert effort to craft prompts with examples.The supplied discussion identifies these as limitations of zero-shot and few-shot in-context learning.
- Prompt Engineering: Prompt engineering customizes LLM capabilities through instructions that influence subsequent interactions and outputs.Prompts can be manually created or learned automatically, with manually created prompts favored where interpretability matters.
De-Identification Methods
Medical text de-identification has progressed from manual review to rule-based and learning-based automation, but existing approaches remain costly, time-consuming, or sensitive to domain shift. HIPAA identifiers must be mapped to dataset-specific PHI categories for evaluation and processing.
- Manual Methods: Manual de-identification relies on human annotators and is costly and time-consuming.The cited estimate is $50 per hour for annotators reading around 20,000 words per hour.
- Rule-based Methods: Rule-based methods automate de-identification using predefined word patterns, regular expressions, and lookup dictionaries.Pseudonymisation is given as an example of an automated approach.
- Learning-based Methods: Learning-based methods provide scalable pipelines but can perform unstably under domain shift and depend heavily on preprocessing.The cited cross-institute methods were trained and tested on relatively small datasets.
- PHI Categorization: The semantic similarity voting approach assigns each HIPAA identifier to the most similar dataset PHI category when similarity exceeds a threshold, otherwise using Others.Similarity is calculated with the same GPT used for later de-identification to improve consistency.
Applications of ChatGPT/GPT-4
The paper reviews ChatGPT and GPT-4 applications across healthcare, social media, content generation, search, coding, and security analysis. These applications reflect broad language-processing capabilities but also include stated access and technical limitations.
- Healthcare: Healthcare applications include clinical information extraction, radiology report summarization, mental disorder detection, and COVID-19 research summarization.The review presents healthcare as a prominent application prospect for LLMs.
- Social Media: ChatGPT and GPT-4 can support social-media chatbots and analyze posts, comments, and tweets.The stated uses include improving engagement, generating content, and maintaining a safe environment.
- Content Generation: ChatGPT and GPT-4 generate natural-sounding content such as articles, blog posts, social-media posts, and product descriptions.The passage emphasizes personalization and rapid generation of large content volumes.
- Search Engine: ChatGPT and GPT-4 offer conversational, contextual responses to natural-language search queries rather than relying only on rigid keyword matching.The described benefit is a more intuitive and user-friendly search process.
- Coding: Coding use cases include interpreting code inputs, providing contextual information, and generating code, but cost, accessibility, and technical limitations remain.The passage specifically notes difficulty with some debugging and performance-optimization queries.
- Security: ChatGPT and GPT-4 can analyze code snippets, logs, and other text-based data to help detect security vulnerabilities.The stated purpose is to identify potential vulnerabilities before attackers exploit them.
III. Datasets
The study benchmarks DeID-GPT on the 2014 i2b2/UTHealth de-identification challenge dataset, which contains free-form clinical notes with manually annotated PHI and surrogate replacements.
- The benchmark is the 2014 i2b2/UTHealth de-identification challenge dataset.
- The dataset contains 1,304 free-form clinical notes from 296 diabetic patients.
- Names, professions, locations, ages, dates, contacts, and IDs were manually replaced with surrogate information to protect privacy.
- Figure 4 shows an original clinical-note excerpt, while Figure 5 shows the same excerpt de-identified by ChatGPT/GPT-4.
IV. Methodology
The methodology evaluates ChatGPT and GPT-4 for clinical-note anonymization using API access, manual GPT-4 testing, prepared clinical-note text, and reserved human-annotated sensitive entities.
- The study evaluates ChatGPT, powered by GPT-3.5, and GPT-4 on anonymizing clinical notes.
- The workflow spans data preprocessing, model access, anonymization, and evaluation.
- XML files containing complete clinical notes are converted into cleaned text files for LLM input.
- Sensitive entities identified by human annotators are reserved for performance evaluation.
- Figure 6 presents ChatGPT API code components alongside the steps for generating an anonymized example.
- The API workflow submits prompts and clinical notes, then returns model-generated text for anonymization.
A Simple and Versatile Framework
DeID-GPT uses zero-shot or few-shot in-context learning with designed prompts to simplify de-identification, reduce annotation and fine-tuning needs, and adapt across settings.
- The workflow targets simpler clinical-data de-identification for subsequent research and collaboration.
- In-context learning eliminates fine-tuning, saving time and reducing pipeline complexity.
- Zero-shot and few-shot learning can reduce the need for large-scale annotation efforts.
- Contextual information helps the model adapt to new tasks and domains without code or procedural changes across hospitals, languages, and data formats.
- The study develops a method to validate ChatGPT and GPT-4’s advantages for de-identification.
- DeID-GPT is framed as a ChatGPT-based de-identification method using an original dataset and a HIPAA-compliant prompt.
- The prompt template contains a task statement, command, and specific rules.
Designing Prompts to Incorporate HIPAA Guidelines
The prompting strategy maps HIPAA identifiers to dataset PHI categories and structures instructions around the task, replacement rule, and information-specific redaction requirements.
- Designing Prompts to Incorporate HIPAA Guidelines: HIPAA defines 18 identifiers requiring de-identification because they can identify, locate, or contact individuals.
- Designing Prompts to Incorporate HIPAA Guidelines: The benchmark’s PHI categories are mapped to HIPAA identifiers to guide de-identification.
- Designing Prompts to Incorporate HIPAA Guidelines: The authors design an optimized prompt template to redact sensitive information while adhering to HIPAA guidelines.
- Designing Prompts to Incorporate HIPAA Guidelines: The task statement is placed first so the autoregressive model can better understand the requested task.
- Designing Prompts to Incorporate HIPAA Guidelines: A special rule instructs the model to replace sensitive information with “[redacted]”.
- Designing Prompts to Incorporate HIPAA Guidelines: The “[redacted]” token supports explainability and subsequent evaluation, surrogate replacement, and data-sharing.
- Designing Prompts to Incorporate HIPAA Guidelines: Specific rules identify information to obscure, such as strings that might be locations or addresses.
- Prompting Caveats: Bad prompts illustrate failures from task-only wording, punctuation, multitask statements, and unspecified output requirements.
V. Experiment & Results
The experiment compares GPT-based methods with BERT-family baselines for clinical-note de-identification and evaluates GPT-4 through manually tested samples because its API was unavailable.
- Baselines: ChatGPT and GPT-4 were compared against BERT, RoBERTa, and ClinicalBERT baselines.The baselines used downloaded pretrained weights; BERT-family models were initialized on local Nvidia 3090 GPUs.
- Baselines: BERT provides the classic bidirectional transformer architecture used for contextual language understanding.The passage identifies BERT as a widely used transformer-based language model with domain-specific offshoots.
- Baselines: RoBERTa refines BERT through larger batches, more training data, dynamic masking, and removal of the next sentence prediction objective.It is described as a more refined version of BERT.
- Baselines: ClinicalBERT was pretrained further on MIMIC-III, which contains 2,083,180 clinical notes from 38,597 patients.The notes came from Beth Israel Deaconess Medical Center admissions between 2001 and 2012.
- Evaluation: GPT-4 evaluation used 50 randomly selected testing samples generated through the OpenAI web interface.Other methods were tested on all i2b2/UTHealth test cases, and all outputs used the same evaluation script.
Results
GPT-4 achieved the strongest reported de-identification accuracy with explicit prompting, while prompt design substantially affected LLM performance and the evaluation used entity-wise accuracy.
- Performance: Over 0.99 accuracy: GPT-4 achieved the highest zero-shot de-identification accuracy with an optimal explicit prompt.It outperformed GPT-3-powered ChatGPT and the other baselines.
- Prompting: Explicit prompts define the task, desired output, and concrete examples, whereas implicit prompts state the desired outcome without detailed guidance.The paper refers to Figure 8 for an example of an effective explicit prompt.
- Comparison: RoBERTa and ClinicalBERT exceeded 90% accuracy but required rigorous supervised NER fine-tuning.The authors contrast this engineering-intensive process with the streamlined LLM workflow.
- Prompting: ChatGPT accuracy improved from 0.686 to 0.929 with an optimally designed prompt.GPT-4 was less sensitive to prompt defects but reached a higher accuracy level with optimal prompting.
- Evaluation: Entity-wise accuracy measures the percentage of sensitive entities removed after processing.The reported accuracy formula uses true positives, true negatives, false positives, and false negatives.
- Performance: Table 2 reports the clinical-notes de-identification results with LLMs.The table is identified as presenting the complete experimental results.
- Evaluation: The prompting-based methods perform zero-shot learning.This note accompanies the reported prompting evaluation.
Error Analysis
Error analysis distinguishes recognition errors in GPT-4 and ChatGPT from task misunderstandings in Llama and Falcon, while overly long prompts can also hinder performance.
- LLM error patterns: GPT-4 and ChatGPT errors predominantly involved failing to recognize relevant entities.The authors attribute these errors to limitations in proficiency and experience with the task.
- LLM error patterns: Llama and Falcon errors primarily reflected fundamental misunderstanding of the de-identification task.The passage gives nonsensical prompt repetition as an example.
- Prompt effects: Excessively lengthy prompts can make LLMs struggle to grasp the task meaning.Prompt length is identified as an additional source of difficulty in the error analysis.
- Overall assessment: Only a small subset of evaluated LLMs showed potential for swift practical application, leaving most with substantial room for improvement.This conclusion follows the reported differences in error types across models.
- Deployment constraints: Online-only access prevents ChatGPT and GPT-4 from being applied in hospitals where patient data cannot be sent to unauthorized external parties.The authors therefore investigate locally deployed DeID-GPT and other open-source alternatives.
- Domain coverage: The paper notes that no LLMs were specifically tailored to the medical text and specialties used in this work.It proposes domain-specific pretraining and architectural adaptations as future directions.
Improving De-Identification with LLMs through Fine-tuning
The paper discusses fine-tuning and local deployment as future directions, alongside extending LLM-based de-identification beyond healthcare and integrating broader medical data modalities.
- Fine-tuning: GPT-4 fine-tuning on clinical notes and reports is expected to improve its already strong zero-shot performance.The discussion links this possibility to the anticipated public release of GPT-4’s API service.
- Local deployment: Replicating GPT-4-like performance locally with other LLMs is identified as necessary for stronger data privacy and security.The passage frames local deployment as a continuing investigation.
- Broader applications: LLM-based de-identification could potentially generalize to financial, market-research, and legal data requiring privacy protection.Examples include account numbers, transaction details, participant information, and records shared in legal proceedings.
- Supported conclusion: The study reports excellent de-identification abilities for ChatGPT and GPT-4 compared with other LLMs.Clinicians partnered with the authors to evaluate these models on medical text anonymization.
- Multimodal directions: GPT-4’s multimodal capabilities could support joint analysis of radiological, pathological, textual, and genomic medical data.The passage presents this as a future exploration for diagnosis, treatment, follow-up, and prognosis.
- Expert feedback: Medical expert feedback could contribute to adapting reinforcement learning by human feedback into reinforcement learning by expert feedback.The proposed RLEF direction is intended for the medical domain.