Private Text Generation by Seeding Large Language Model Prompts

Supriya Nagesh, Justin Y. Chen, Nina Mishra, Tal Wagner

Abstract

We explore how private synthetic text can be generated by suitably prompting a large language model (LLM). This addresses a challenge for organizations like hospitals, which hold sensitive text data like patient medical records, and wish to share it in order to train machine learning models for medical tasks, while preserving patient privacy. Methods that rely on training or finetuning a model may be out of reach, either due to API limits of third-party LLMs, or due to ethical and legal prohibitions on sharing the private data with the LLM itself. We propose Differentially Private Keyphrase Prompt Seeding (DP-KPS), a method that generates a private synthetic text corpus from a sensitive input corpus, by accessing an LLM only through privatized prompts. It is based on seeding the prompts with private samples from a distribution over phrase embeddings, thus capturing the input corpus while achieving requisite output diversity and maintaining differential privacy. We evaluate DP-KPS on downstream ML text classification tasks, and show that the corpora it generates preserve much of the predictive power of the original ones. Our findings offer hope that institutions can reap ML insights by privately sharing data with simple prompts and little compute.

Introduction

Sharing sensitive data—such as medical records or financial histories—is a legal and ethical minefield. While synthetic data generation offers a potential solution, traditional methods often require fine-tuning Large Language Models (LLMs) on private data. This approach is computationally expensive, technically demanding, and carries significant risks if the LLM is hosted by a third party, as raw sensitive data might be exposed during the training process.

Conceptual overview of DP-KPS showing the transition from private documents to synthetic records via keyphrase seeding.

In this work, researchers from Amazon, MIT, and Tel-Aviv University introduce DP-KPS (Differentially Private Keyphrase Prompt Seeding). This method generates high-quality, privacy-preserving synthetic text by "seeding" an LLM with privatized keyphrases, bypassing the need for model fine-tuning entirely and treating the LLM as a "black-box" creative engine.

The DP-KPS Method

The core innovation of DP-KPS is moving the privacy boundary to the prompting stage. Instead of modifying the model, the system ensures that the information provided to the LLM is already differentially private. The pipeline consists of five primary steps:

The detailed DP-KPS pipeline, illustrating how public vocabulary and private documents are combined through DP-KDE to prompt an LLM.
  1. Privatized Vocabulary Generation: The process begins with a public vocabulary (e.g., a medical glossary). DP histograms are used to identify which terms are most relevant to the private dataset without leaking individual records.
  2. Embedding and KDE: These terms are mapped into a high-dimensional vector space using a pre-trained embedding model. Differentially Private Kernel Density Estimation (DP-KDE) then creates a smooth probability distribution over these embeddings that represents the private dataset.
  3. Keyphrase Seeding: An iterative sampling method picks sequences of keyphrases that frequently co-occur in the original data, providing a structural "scaffolding" for the LLM.
  4. LLM Prompting: These private keyphrase sequences seed a generic prompt, such as: "Write a medical record that contains the following terms: [beta blockers, arrhythmia, hypertension]."
  5. Domain Adaptation: Since LLM-generated text may differ in style from real records, off-the-shelf techniques like Deep CORAL are used to align the synthetic training data with the target test set.

Experimental Evaluation

The method was evaluated on two distinct text classification tasks: MIMIC-III (real-world medical records for identifying cardiac conditions) and DBPedia-14 (Wikipedia summaries across 14 categories).

Key Results

  • High Utility: On the MIMIC medical task, a classifier trained on DP-KPS synthetic data achieved 72.2% accuracy, remarkably close to the 76.0% achieved using the original private training set.
  • Privacy-Utility Tradeoff: Even at strict privacy levels ($\epsilon = 6$), DP-KPS outperformed existing baselines like AugPE by a wide margin (71.6% vs 63.8% on MIMIC).
  • Efficiency: DP-KPS is approximately 10x more efficient than iterative evolution methods, as it generates a document in a single prompt per record.

Conclusion

DP-KPS demonstrates that prompts can serve as an effective privacy boundary. By seeding LLMs with privatized landmarks, organizations can generate representative synthetic data without exposing raw records to third-party APIs or incurring the costs of DP-SGD fine-tuning. While the method currently relies on robust public vocabularies, it offers a scalable path for institutions to derive machine learning insights from sensitive data with minimal compute.

Summary updated

BibTeX
@inproceedings{nagesh2024private,
  author = {Supriya Nagesh and Justin Y. Chen and Nina Mishra and Tal Wagner},
  title = {{Private Text Generation by Seeding Large Language Model Prompts}},
  booktitle = {GenAI4Health @ NeurIPS},
  year = {2024},
  url = {https://openreview.net/forum?id=rw25QGrkNy},
}
Figure