Privacy-Preserving In-Context Learning with Differentially Private Few-Shot Generation
Xinyu Tang, Richard Shin, Huseyin A. Inan, Andre Manoel, Fatemehsadat Mireshghallah, Zinan Lin, Sivakanth Gopi, Janardhan Kulkarni, Robert Sim
TL;DR
The paper tackles privacy risks in in-context learning by introducing a differential-privacy (DP) framework that privately generates synthetic few-shot demonstrations from a private dataset. It presents a PATE-like algorithm that aggregates generation signals from disjoint private subsets to produce DP-compliant prompts, enabling unlimited inference without additional privacy cost. Empirical results across AGNews, TREC, DBPedia, and MIT datasets show that 4-shot DP ICL can approach non-private performance at modest privacy budgets (e.g., $\epsilon=1$ on TREC yields 50.7% accuracy, near the non-private 50.6%), and even zero-shot generation by the model itself can yield strong baselines in some cases. The work demonstrates the practicality of privacy-preserving ICL for diverse NLP tasks and discusses future improvements in sampling and offline-online LM setups to further close the privacy-utility gap.
Abstract
We study the problem of in-context learning (ICL) with large language models (LLMs) on private datasets. This scenario poses privacy risks, as LLMs may leak or regurgitate the private examples demonstrated in the prompt. We propose a novel algorithm that generates synthetic few-shot demonstrations from the private dataset with formal differential privacy (DP) guarantees, and show empirically that it can achieve effective ICL. We conduct extensive experiments on standard benchmarks and compare our algorithm with non-private ICL and zero-shot solutions. Our results demonstrate that our algorithm can achieve competitive performance with strong privacy levels. These results open up new possibilities for ICL with privacy protection for a broad range of applications.
