Private Text Generation by Seeding Large Language Model Prompts

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

TL;DR

Hospitals and enterprises often cannot share sensitive text or send raw records to commercial LLM APIs due to strict privacy and regulatory constraints. DP-KPS (Differentially Private Keyphrase Prompt Seeding) generates high-utility synthetic text by privately sampling sequences of domain keyphrases using private Kernel Density Estimation (KDE) and prompting a frozen, third-party LLM only with these privatized phrases. The resulting corpora achieve downstream classification accuracy comparable to real data while providing rigorous, document-level pure differential privacy with roughly $10\times$ fewer LLM API calls than evolutionary baselines.

What Problem Does This Paper Address?

Organizations holding sensitive data (such as clinical notes in hospitals) frequently want to share data with external collaborators to train predictive machine learning models. However, standard anonymization (e.g., redacting names and dates) is vulnerable to linkage and re-identification attacks.

While Differential Privacy (DP) provides formal mathematical privacy guarantees, standard DP fine-tuning requires directly exposing raw private text to the model and having access to its weights. This is impossible when using proprietary LLM APIs or when legal terms (such as those governing MIMIC clinical data) prohibit feeding clear-text private records to external services. The authors tackle this black-box, API-only regime: How can an organization generate differentially private synthetic text using a frozen LLM interface without ever showing the LLM private data in the clear?

Methods

DP-KPS relies on the post-processing property of differential privacy: any prompt sent to the LLM must already be differentially private. The pipeline consists of five stages:

  1. Privatized Vocabulary Selection ($\epsilon_{\text{voc}}$): Using the Laplace mechanism on document term histograms, the authors extract a private domain-relevant sub-vocabulary $\tilde{\mathcal{V}}$ (e.g., 1,000 terms) from a massive public dictionary $\mathcal{V}$.
  2. Keyphrase Embedding: Terms in $\tilde{\mathcal{V}}$ are mapped into high-dimensional vector representations using a public, domain-specific embedding model (e.g., BioBERT).
  3. Private Keyphrase Sequence Generation ($\epsilon_{\text{kde}}$):
  4. Direct high-dimensional sampling from private distributions is typically intractable. The authors overcome this by querying a DP Kernel Density Estimator (DP-KDE) over the finite discrete candidate set $\tilde{\mathcal{V}}$.
  5. To capture dependencies between co-occurring terms without exponential cost, they introduce an iterative sequence generation scheme backed by a logarithmic ensemble of DP-KDE data structures using zero-padded prefixes.
  6. Black-Box Prompting: The LLM is prompted once per document with generic instructions to generate text containing the sampled keyphrase sequence (e.g., "Write a medical record that contains the following terms: [beta blockers, arrhythmia, hypertension]..."). Prompts intentionally omit explicit class labels.
  7. Client-Side Domain Adaptation: Because LLM-generated phrasing can diverge from clinical test distributions, downstream users apply feature-level domain adaptation (Deep CORAL) or few-shot formatting prompts.

The overall pipeline satisfies pure document-level $(\epsilon_{\text{voc}} + \epsilon_{\text{kde}})$-DP.

Datasets

The authors evaluated downstream text classification across two benchmarks:

  • MIMIC: Medical discharge summaries categorized into a binary task (cardiac condition vs. non-cardiac). The public vocabulary $\mathcal{V}$ comprised ~386k Unified Medical Language System (UMLS) concepts filtered via SemMedDB. BioBERT was used for embeddings.
  • DBPedia-14: A 14-class Wikipedia topic classification dataset paired with the 400k-word GloVe 6B vocabulary and SentenceBERT embeddings.

No new datasets were introduced, but the benchmark setup strictly avoids leaking private class labels to LLM prompts.

Key Insights and Ideas

  • Vocabulary discretization bypasses high-dimensional sampling bottlenecks: While continuous DP-KDE sampling in $\mathbb{R}^d$ requires exponential grid searches, evaluating densities over a privatized discrete vocabulary $\tilde{\mathcal{V}}$ takes time linear in vocabulary size and embedding dimension $O(d|\tilde{\mathcal{V}}|)$.
  • Zero-padding and logarithmic ensembles preserve prefix correlations: Evaluating varying-length keyphrase prefixes usually demands separate DP mechanisms per length. By zero-padding prefixes and maintaining only $\lceil \log L \rceil$ DP-KDE structures, the error blowup is bounded to a small constant.
  • Form vs. Function of the LLM: Ablation experiments reveal that removing the LLM and training directly on raw private keyphrase sequences yields similar classification accuracy. The LLM acts primarily as a syntactic synthesizer—converting discrete semantic seeds into fluent, realistic documents—rather than introducing novel predictive world knowledge.
  • Dataset characteristics dictate sequence generation: While iterative sequence modeling excelled on concise, topical data (DBPedia-14), independent keyphrase sampling performed better on long, noisy clinical records (MIMIC), where DP noise across multi-step prefix budgets harmed accuracy.

Key Results

  • Classification Utility: On MIMIC, DP-KPS achieved 71.6%–72.2% accuracy across privacy budgets $\epsilon \in \{6, 15\}$, closely approaching the non-private real data baseline of 76.0%. On DBPedia-14, accuracy reached 77.9%–85.1% (versus 97.0% non-private).
  • Prompt Efficiency: DP-KPS outperformed the evolutionary baseline (AugPE+$\tilde{\mathcal{V}}$) by wide margins when holding prompt count equal (e.g., on MIMIC at $\epsilon=6$: 71.6% for DP-KPS vs. 50.0% for AugPE). Achieving competitive accuracy with AugPE required $10\times$ more API calls.
  • Post-Processing Impact: Domain adaptation proved critical; without Deep CORAL, MIMIC accuracy plummeted by over 12 percentage points (from 71.6% to 58.7%). Combining domain adaptation with few-shot prompting pushed accuracy up to 72.37%.

Limitations and Future Work

  • LLM Contamination on Standard Benchmarks: While MIMIC dataset licenses strictly prohibit LLM training (ensuring Claude v2 had not memorized it), DBPedia-14/Wikipedia text was almost certainly present in the LLM's pre-training corpus.
  • Text-Only Scope: Clinical workflows involve multimodal tabular values (lab tests), vital sign time series, and medical imaging. Extending DP prompt seeding to joint multimodal synthesis remains an open challenge.
  • Inherent Generative Risks: The authors caution that LLMs are susceptible to hallucinations and biases, necessitating validation on downstream target distributions before deploying synthetic records in clinical settings.

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},
}

Loading related content...

Figure