Abstract
Large Language Models (LLMs) exhibit powerful In-Context Learning (ICL) capabilities, but the inclusion of sensitive user data in prompts poses significant privacy risks, especially when interacting with untrusted model providers. This paper presents LDP-ICL, a framework that applies Local Differential Privacy (LDP) to labels within ICL prompts. By employing $k$-ary randomized response ($k$-RR) to perturb labels, the framework ensures formal privacy guarantees. Theoretical analysis, viewing ICL as implicit gradient descent, explains the model's robustness to label noise. Empirical evaluations across four classification tasks demonstrate that LDP-ICL maintains high utility, often approaching non-private performance at reasonable privacy budgets.
Introduction
In-Context Learning (ICL) allows LLMs to perform new tasks by prepending a few demonstration examples to the query. However, these demonstrations often contain sensitive information, such as medical diagnoses or financial status. In scenarios where the LLM provider is untrusted, sending raw labels constitutes a major privacy breach. Standard Differential Privacy (DP) typically relies on a trusted central curator; however, in the LLM ecosystem, the model provider acts as the aggregator, necessitating a Local Differential Privacy (LDP) approach where noise is added by the user before data transmission.
Methodology
The LDP-ICL framework protects sensitive labels by applying a perturbation mechanism before they are included in the prompt sent to the LLM.
Label Perturbation via $k$-RR
The core of the framework is the $k$-ary Randomized Response ($k$-RR) mechanism. For a given label $y$ in a task with $k$ possible classes, the mechanism outputs the true label with probability $p$ and a random incorrect label with probability $(1-p)/(k-1)$. This probability $p$ is directly tied to the privacy budget $\epsilon$, ensuring that the LLM provider cannot definitively infer the original label.
Theoretical Perspective: ICL as Implicit Gradient Descent
The researchers provide a novel theoretical grounding by modeling the Transformer's attention mechanism as a form of implicit gradient descent. Under this view, the demonstration set acts as a mini-batch of training data that updates the model's internal representation. This allows for a formal derivation of the relationship between label noise and the final prediction probability, explaining why LLMs are naturally robust to a certain degree of label perturbation.
Experimental Results
The framework was evaluated on four binary classification datasets: SST-2 (sentiment), Subj (subjectivity), Ethos (hate speech), and SMS_Spam (spam detection), using GPT-3.5-turbo as the backbone model.
Privacy-Utility Trade-off
As shown in the experimental results, there is a clear trade-off between the privacy budget $\epsilon$ and classification accuracy. Notably, for $\epsilon \ge 3$, the performance of LDP-ICL is nearly indistinguishable from non-private ICL. Even at high privacy levels (low $\epsilon$), LDP-ICL significantly outperforms Zero-Shot Learning (ZSL), indicating that the model successfully leverages the noisy demonstrations to recognize the task structure.
The Semantic Advantage
A key insight is the "semantic advantage" of LLMs. Unlike traditional statistical methods that treat labels as abstract symbols, LLMs use their pre-trained knowledge to "denoise" the prompt. The model can recognize that a text has "positive" sentiment even if the provided label is "negative," allowing it to maintain high performance despite the LDP noise. This makes LDP-ICL particularly effective for natural language tasks where the model has strong prior knowledge.
Conclusion and Future Work
LDP-ICL provides a practical method for utilizing the power of ICL while maintaining formal privacy guarantees for sensitive labels. While this work focuses on label privacy, future research is needed to address the privacy of the input text (features) themselves, which may also contain sensitive information. Additionally, extending the framework to multi-class and generative tasks remains an open challenge for the research community.
Summary updated