This paper, presented at ICLR 2024, tackles a growing tension in the world of Large Language Models (LLMs): how do we use private data to guide a model’s behavior without the model accidentally leaking that data to the world?
TL;DR
The authors propose a framework for Privacy-Preserving In-Context Learning (ICL). Instead of putting raw private examples directly into an LLM's prompt, they use a differentially private (DP) algorithm to generate synthetic few-shot demonstrations. These synthetic prompts provide the same performance boost as real data but come with formal mathematical guarantees that the original private records cannot be leaked or identified.
What Problem Does This Paper Address?
In-Context Learning (ICL) is the "magic" of LLMs: you give a model a few examples of a task (e.g., "Review: Great movie! Label: Positive") in the prompt, and it learns to perform the task without any weight updates.
However, if those examples contain sensitive information—like medical records or private emails—there is a massive privacy risk. LLMs are known to "regurgitate" their prompts or leak training and prompt data through clever "jailbreaking" attacks. Even if you strip out personally identifiable information (PII), an adversary with a little bit of outside knowledge can often re-identify individuals.
The core challenge is: How can we leverage the power of ICL on private datasets while providing a "gold standard" privacy guarantee?
Methods: A Two-Step Framework
To solve this, the authors introduce a two-step framework that separates the private data from the final inference step.
- DP Few-Shot Generation (The Core Innovation): Instead of using the private dataset during inference, the system uses it once (offline) to generate synthetic examples.
- Partitioning: The private data is split into disjoint subsets.
- Noisy Aggregation: For every token generated in the synthetic example, the LLM looks at each subset and predicts the next token. These predictions are aggregated, and noise (Gaussian or Exponential) is added to the result. This approach is inspired by the Private Aggregation of Teacher Ensembles (PATE) framework.
- Reduce Vocab Publicly (RVP): To prevent the noise from making the text nonsensical, a "public" instruction (containing no private data) is used to narrow down the vocabulary to the top-K most likely tokens before the private data is even consulted.
- Inference: The resulting synthetic examples are then used as standard few-shot demonstrations. Because of the Post-Processing Property of Differential Privacy, these synthetic examples can be used for an infinite number of user queries without ever "using up" more of the privacy budget.
Datasets and Evaluation
The researchers evaluated their method on several standard benchmarks to test both utility and privacy:
- Text Classification: AGNews (news categories), DBPedia (ontology classification), and TREC (question types).
- Information Extraction (Slot Filling): MIT Movies (extracting genres and directors).
Key Insights and Results
- Competitive Accuracy: On the TREC dataset, the DP-generated 4-shot prompt ($\epsilon=1$, representing a very strong privacy guarantee) achieved 50.7% accuracy. This significantly outperformed the 0-shot baseline (35.4%) and matched the performance of the non-private 4-shot solution (50.6%).
- Minimal Utility Loss: Across most datasets, the gap between the non-private "gold standard" and the DP-protected version was remarkably small, often within a few percentage points.
- Immunity to Membership Inference: The authors tested their method against Membership Inference Attacks (MIA)—where an attacker tries to guess if a specific record was used in the prompt. While non-private ICL is highly vulnerable (MIA AUC of ~81.8%), the DP-generated prompts reduced the attacker's success to the level of a random guess (~50.5%), effectively neutralizing the attack.
- Stability via RVP: Restricting the vocabulary using a public prompt was crucial. Without it, the DP noise often forced the model to pick random, irrelevant tokens, leading to "word salad" synthetic examples.
Limitations and Future Work
While promising, the approach has a few notable limitations:
- Computational Cost: The generation process is expensive. Because it requires an API call for every token across every subset of data, generating a single synthetic prompt can cost significantly more than a standard LLM query.
- Factual Errors: Longer synthetic generations sometimes contain factual errors or repetitive sentences, though this did not seem to hurt the ICL performance significantly for the tested tasks.
- Resampling Efficiency: The current algorithm resamples the private data for every token generated. Fixing the subsets for the entire generation might be more efficient but requires more complex privacy analysis.
- Scaling to "Harder" Tasks: While it works well for classification and slot-filling, it remains to be seen how this holds up for complex reasoning or long-form creative writing tasks.
Summary updated