How Private is Your Attention? Bridging Privacy with In-Context Learning

Soham Bonnerjee, Zhen Wei, Yeon, Anna Asch, Sagnik Nandy +1 more
4/22/2025
stat.MLcs.AIcs.CL

No confident code implementation found for this paper.

Abstract

In-context learning (ICL)-the ability of transformer-based models to perform new tasks from examples provided at inference time-has emerged as a hallmark of modern language models. While recent works have investigated the mechanisms underlying ICL, its feasibility under formal privacy constraints remains largely unexplored. In this paper, we propose a differentially private pretraining algorithm for linear attention heads and present the first theoretical analysis of the privacy-accuracy trade-off for ICL in linear regression. Our results characterize the fundamental tension between optimization and privacy-induced noise, formally capturing behaviors observed in private training via iterative methods. Additionally, we show that our method is robust to adversarial perturbations of training prompts, unlike standard ridge regression. All theoretical findings are supported by extensive simulations across diverse settings.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{bonnerjee2025private,
  title  = {How Private is Your Attention? Bridging Privacy with In-Context Learning},
  author = {Soham Bonnerjee and Zhen Wei and Yeon and Anna Asch and Sagnik Nandy and Promit Ghosal},
  year   = {2025},
  eprint = {2504.16000},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2504.16000v1}
}

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/2504.16000.svg)](https://codeofpaper.com/paper/2504.16000)

Discussion