Contextual Integrity in LLMs via Reasoning and Reinforcement Learning

Guangchen Lan, Huseyin A. Inan, Sahar Abdelnabi, Janardhan Kulkarni, Lukas Wutschitz, Reza Shokri, Christopher G. Brinton, Robert Sim

Abstract

As Large Language Models (LLMs) transition from passive chatbots to autonomous agents, they increasingly handle sensitive personal information. Traditional privacy approaches often struggle with the nuance of social norms—knowing when it is appropriate to share data versus when it must be protected. This paper presents CI-RL, a framework that integrates Helen Nissenbaum’s theory of Contextual Integrity (CI) into LLM training. By utilizing structured Chain-of-Thought (CI-CoT) reasoning and Reinforcement Learning (RL) via Group Relative Policy Optimization (GRPO), the researchers demonstrate that models can learn to navigate complex information flows. Evaluation on the PrivacyLens and ConfAIde benchmarks reveals that CI-RL reduces privacy leakage by up to 40%, outperforming larger baseline models despite being trained on a minimal synthetic dataset of only 700 examples.

1. Introduction

The evolution of Large Language Models into functional agents—capable of managing calendars, booking travel, and accessing medical records—presents a significant privacy challenge. The core issue is not merely the protection of data in a binary "private vs. public" sense, but rather the governance of "appropriate flow." A travel agent bot requires a user's passport number, but a restaurant reservation bot does not. Current models frequently exhibit a "helpfulness bias," where they over-share sensitive information to satisfy a prompt, or a "refusal bias," where they become overly restrictive and lose utility.

2. Theoretical Foundation: Contextual Integrity

This research adopts the framework of Contextual Integrity (CI), proposed by Helen Nissenbaum. CI posits that privacy is preserved when information flows conform to "context-relative informational norms." These norms are defined by four parameters:

  1. Context: The social setting (e.g., healthcare, finance).
  2. Actors: The sender, the subject, and the recipient.
  3. Attributes: The type of information being shared.
  4. Transmission Principles: The constraints under which the flow occurs (e.g., confidentiality, consent, or proportionality).

3. Methodology

The authors propose a two-stage approach to instill contextual awareness in LLMs:

3.1 CI-CoT (Contextual Integrity Chain-of-Thought)

To transform privacy from a classification task into a reasoning task, the researchers implemented a structured prompting strategy. Models are required to generate reasoning within <think> tags before providing a final <answer>. In the thinking phase, the model must explicitly:

  • Identify the actors and the specific task.
  • Evaluate each piece of available data as "necessary," "helpful," or "inappropriate" based on the context and transmission principles.
  • Determine the minimum amount of information required to fulfill the request safely.

3.2 CI-RL (Reinforcement Learning)

To move beyond the limitations of zero-shot prompting, the models undergo fine-tuning using Group Relative Policy Optimization (GRPO). This RL algorithm, notably used in the development of DeepSeek-R1, allows the model to optimize its policy based on relative rewards within a group of outputs.

  • Reward Function: The framework uses a rule-based reward system. Models receive positive reinforcement for including "required" keywords in the final answer and penalties for including "restricted" or sensitive keywords.
  • Format Reward: To ensure the reasoning process remains transparent, models are rewarded for strictly adhering to the <think> and <answer> tag structure.

4. Experimental Setup and Datasets

The study utilized a diverse set of data for training and evaluation:

  • Synthetic Training Set: Approximately 700 examples generated by GPT-4, covering nine domains (e.g., Education, Healthcare) and three transmission principles.
  • PrivacyLens: A benchmark testing AI assistants in complex tool-use scenarios involving human-annotated privacy boundaries.
  • ConfAIde: A multi-tier benchmark designed to evaluate a model's "Theory of Mind" regarding public and private information flows.

5. Results and Key Insights

The experimental results highlight the efficacy of reasoning-based RL for privacy:

  • Significant Leakage Reduction: CI-RL reduced privacy leakage by up to 40% on the PrivacyLens benchmark compared to baseline models.
  • Efficiency of RL: The substantial performance gains achieved with only 700 training examples suggest that CI reasoning is a latent capability within large models that can be "unlocked" with targeted RL.
  • Model Scale vs. Specialization: A 7B-parameter model (Qwen2.5-7B) fine-tuned with CI-RL outperformed a 14B-parameter baseline model in integrity scores, suggesting that specialized post-training is more effective than raw parameter count for safety-critical tasks.
  • Zero-Shot Transfer: Models trained on simple chat and email data successfully transferred their reasoning capabilities to complex tool-calling environments without further training.

6. Limitations and Future Directions

While promising, the CI-RL framework has several limitations. The current reward system relies on keyword matching, which may fail to detect subtle or paraphrased privacy leaks. Future work could incorporate "LLM-as-a-judge" to provide more nuanced feedback. Additionally, the training data is currently entirely synthetic; incorporating high-quality human-annotated data could further refine the model's understanding of complex social nuances. Finally, scaling this approach to frontier models and testing it against "entangled" data in long-form documents remains a priority for future research.

7. Conclusion

By treating privacy as a reasoning problem grounded in Contextual Integrity, the CI-RL framework provides a scalable path toward safer autonomous agents. The results demonstrate that even small models can achieve high levels of contextual awareness, balancing the trade-off between helpfulness and data protection.

Summary updated

BibTeX
@inproceedings{lan2025contextual,
  author = {Guangchen Lan and Huseyin A. Inan and Sahar Abdelnabi and Janardhan Kulkarni and Lukas Wutschitz and Reza Shokri and Christopher G. Brinton and Robert Sim},
  title = {{Contextual Integrity in LLMs via Reasoning and Reinforcement Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=Xm57IXqU0n},
}
Figure