Privacy-Preserving In-Context Learning with Differentially Private Few-Shot Generation

Xinyu Tang, Richard Shin, Huseyin A. Inan, Andre Manoel, FatemehSadat Mireshghallah +4 more
2/12/2026

No official code found. Best implementation: microsoft/dp-few-shot-generation (28 stars, MIT, last commit 2023-11-28).

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.

View on arXivView PDF

Code Implementations(1)

MIT
286Shell, PythonSep 15, 20232 years agoMIT

Similar Papers

Cite this paper

@article{tang2026privacypreserving,
  title  = {Privacy-Preserving In-Context Learning with Differentially Private Few-Shot Generation},
  author = {Xinyu Tang and Richard Shin and Huseyin A. Inan and Andre Manoel and FatemehSadat Mireshghallah and Zinan Lin and Sivakanth Gopi and Janardhan Kulkarni and Robert Sim},
  year   = {2026},
  eprint = {2309.11765},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/pdf/2309.11765},
  journal = {ICLR 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2309.11765.svg)](https://codeofpaper.com/paper/2309.11765)

Discussion