Achieving contextual integrity in LLMs through reasoning and reinforcement learningContextual Integrity in LLMs via Reasoning and Reinforcement Learning
The authors propose the CI-CoT prompting and CI-RL reinforcement learning framework, training an LLM on about 700 synthetic data samples to follow contextual integrity, and the authors claim a leakage rate reduction of up to 40% on PrivacyLens.
- When LLM agents act on behalf of users, they can access large amounts of mixed information; the authors argue that existing models lack contextual integrity (CI) judgment and will leak information inconsistent with the context even without an attack.
- First use CI-CoT prompting to have the model reason item by item about whether each attribute is appropriate to share before answering, then use GRPO with a rule-based reward (proportion of required keywords minus proportion of restricted keywords) to perform RL post-training on about 700 GPT-4 synthetic data samples.
- The authors report: on the synthetic test set, Integrity and Complete improved for all 6 models; on PrivacyLens, CI-CoT reduced the leakage rate of each model, and CI-RL reduced it further while maintaining helpfulness; improvements were also seen on the single-model slices of ConfAIde.
- The authors note: the training data are synthetic and lack human annotation; the keyword rewards are coarse; models above 14B were not tested; no head-to-head comparison with system-level defenses such as AirGapAgent was conducted; and error bars from multiple runs are not reported.
- Threat model
- The victim system is an LLM agent performing tasks on behalf of a user, with access to mixed user information; the risk is that the model leaks information inconsistent with the context without malicious intervention; external attacks such as prompt injection are listed by the authors as motivation but are outside the scope of the evaluation.
- Evaluated models
- Qwen2.5-1.5B-InstructQwen2.5-3B-InstructQwen2.5-7B-InstructQwen2.5-14B-InstructMistral-7B-Instruct-v0.3Llama-3.1-8B-InstructDeepSeek-R1-Distill-Llama-8BDeepSeek-R1-Distill-Qwen-14BClaude 3.7 SonnetGemini 2.5 FlashClaude 3.7 Sonnet ThinkingGemini 2.5 Pro
- Benchmarks
- 作者构建的合成 CI 数据集(729 条,训练/验证/测试 590/66/73)PrivacyLensConfAIde
- Metrics
- Integrity (I)Utility (U)Complete (C)Leakage Rate (LR)Adjusted Leakage Rate (ALR)Helpfulness [0-3]Pearson 相关系数
The researchers propose a method for training LLMs with explicit reasoning and reinforcement learning, so that the model follows contextual integrity when deciding which information to disclose, and reduces inappropriate information disclosure. The method uses about 700 automatically generated synthetic samples covering different contexts and information disclosure norms; the authors state that across models of multiple sizes and families it reduced inappropriate disclosure while maintaining task performance, and that the improvement transfers to benchmarks such as PrivacyLens, which has human annotations and evaluates privacy leakage in AI assistant operations and tool calls. The code has been released on GitHub.
Paper analysis
What problem does this paper attempt to solve?
How to make LLM agents that perform tasks on behalf of users share only appropriate information according to contextual integrity (CI) norms.
Core question: when an LLM agent performs tasks on behalf of a user, how does it determine which information is appropriate to disclose in that context (contextual integrity, CI), avoiding leaking information that should not be shared.
- Scenario and importance: agents interacting with external parties on a user's behalf (e.g., scheduling, sending emails) can access mixed user data; the authors argue that strict information isolation is infeasible in practice (e.g., retrieval systems are granted broad file access), and that attacks such as prompt injection further amplify leakage risk.
- Existing shortcomings: the authors cite [5, 25, 30] to argue that current LLMs often cannot distinguish information appropriate to disclose from information that should be kept confidential; existing system-level defenses (firewalls, data minimization) act outside the model.
- Core hypothesis: the authors hypothesize that LLM reasoning ability, though not trained for CI, can be guided through structured reasoning for CI judgments, and that CI is essentially a reasoning task that can be reinforced with RL like math and code.
- Proposed approach: CI-CoT (explicitly assessing the disclosure appropriateness of each attribute before reasoning) and CI-RL (a post-training framework with GRPO + rule-based rewards), validated with about 700 synthetic data entries; the authors state this is the first use of RL to instill CI reasoning ability in LLMs.
- Threat model:
- Victim system: an LLM agent performing tasks on behalf of a user, with access to a context mixing necessary and restricted information.
- Source of risk: the model itself unintentionally leaking confidential information without malicious intervention; prompt injection is listed as a motivating threat but is outside the experimental scope.
- Defense goal: reduce inappropriate disclosure while maintaining task completion.
- The paper does not posit an active attacker, and the experiments do not include adversarial attack evaluation.
What related research exists?
Related work falls into three categories: CI evaluation benchmarks, inference-time CI defense systems, and reasoning and safety; the authors position this paper as in-model training orthogonal to system-level defenses.
Inference-time CI evaluation benchmarks
- CI-Bench [5]: a synthetic benchmark that evaluates AI assistants' CI judgments along dimensions such as roles, information types, and transmission principles; the paper cites its results as showing that LLM assistants struggle with nuanced appropriateness judgments.
- ConfAIde [25]: a four-tier benchmark that progressively introduces actors, motives, and realistic meeting scenarios; the paper cites its empirical findings as showing persistent limitations in LLMs' compliance with CI driven by social reasoning.
- PrivacyLens [30]: extends CI evaluation to agent actions and tool calls, with privacy norms drawn from the literature and crowdsourcing; the paper cites its finding of a gap between LLM behavior in probe-style question answering and in realistic agent scenarios.
Inference-time CI agents (system-level defenses)
- AirGapAgent (Bagdasarian et al. [3]): a two-stage architecture in which a "data minimizer" LLM first filters user data before passing it to the LLM that interacts with third parties.
- Abdelnabi et al. [1]: automatically distills task-level privacy and integrity rules from simulations and enforces them with three firewalls at the input, data, and trajectory levels.
- Ghalebikesabi et al. [7]: a CI-aware form-filling assistant that first generates "information flow cards" and then decides field by field whether to share.
Reasoning and safety (Appendix G)
- H-CoT [22], BoT [49], OverThink [20]: hijacking, backdoor, and slowdown attacks targeting reasoning models; GuardReasoner [24], ThinkGuard [40], SafeChain [17]: use explicit reasoning to enhance safety moderation or analyze the safety risks of long CoTs. The authors state that these works focus on responses to unsafe queries and are orthogonal to this paper's direction.
Baselines and benchmarks: the baselines in this paper are the untrained versions of each model (the left column of each row in Tables 1 and 3); evaluation uses the authors' own synthetic CI dataset (729 entries) plus PrivacyLens and ConfAIde.
Positioning: the authors state that, unlike the system-level defenses above, this paper directly trains LLMs to internalize CI norms, which is orthogonal to and potentially complementary with them.
How does the paper address this problem?
First use CI-CoT prompting to explicitly reason about disclosure appropriateness, then use GRPO with a keyword rule-based reward to perform RL post-training on synthetic data (CI-RL).
Overall approach: treat CI as a reasoning task—first have the model explicitly reason about the disclosure appropriateness of each attribute before answering (CI-CoT), then internalize this behavior with reinforcement learning (CI-RL), with automatically generated synthetic datasets as training data.
CI-CoT: chain-of-thought prompting for contextual integrity
- Structured output: the model first reasons within the <think> tags, then gives the final answer within the <answer> tags (Figure 2).
- Reasoning content: describe the task and context; for each personal attribute, judge whether sharing it is necessary, helpful, optional or inappropriate, and give reasons based on CI principles (purpose, roles, transmission principles).
- Usage: a pure inference-time method, used directly as a prompt template without updating parameters.
Synthetic dataset construction (three stages, Figure 3)
- Initial seeds: sample scenarios (email/chat messages), domains (10, including Hospitality, Healthcare, Finance, following [5]) and transmission principles (three: Confidentiality, Proportionality, Consent) to form seeds.
- Vignettes: GPT-4 expands each seed into a vignette containing a user task and CI fields (sender, recipient, subject), and generates two sets of information categories: those required by the task (required) and those restricted by principles (restricted); 3–5 per seed, 795 vignettes in total.
- Final samples: GPT-4 fills the vignettes into concrete key-value pairs (including natural conversation history), uses neutral key names to avoid leaking annotation cues, and provides required/restricted annotations; short keywords are extracted from the annotations for use in the string-matching reward. Appendix B gives the full generation prompts and examples.
CI-RL: reinforcement learning for CI
- Algorithm: GRPO [31], removing the critic network, with group-relative advantage estimation; implemented on the VERL framework [32].
- Reward function: R = (|Apresent|)/(|A|) − (|Dpresent|)/(|D|), i.e., the proportion of required keywords contained in the answer minus the proportion of restricted keywords; the reward is -1 when valid <think> or <answer> tags are missing (Equation 2).
- Key hyperparameters (Appendix F): batch size B=32, group size G=16, mini-batch 128, learning rate 1×10⁻⁶, KL weight β=0.001, clipping ϵ=0.2, maximum response length 2048, training sampling temperature 0.7.
Evaluation methods
- Synthetic set metrics: Integrity (proportion of samples containing no restricted keywords), Utility (proportion containing all required keywords), Complete (proportion satisfying both), all computed by keyword string matching.
- External benchmarks: PrivacyLens uses GPT-4o to judge Helpfulness (0–3 points) and a few-shot classifier to determine leakage, computing LR and ALR computed only over helpful responses; ConfAIde computes the Pearson correlation between human and model judgments and the string-matching leakage rate.
What experiments did the paper conduct?
Training 6 open-source models on 729 synthetic data samples improved Integrity/Complete for all of them, and the leakage rate also decreased when transferred to PrivacyLens and ConfAIde.
Experimental Setup
- Models evaluated: Qwen2.5-1.5B/3B/7B/14B-Instruct, Mistral-7B-Instruct-v0.3, Llama-3.1-8B-Instruct (Table 1); ablations add DeepSeek-R1-Distill-Llama-8B and DeepSeek-R1-Distill-Qwen-14B (Table 2); on PrivacyLens, Claude 3.7 Sonnet, Gemini 2.5 Flash, Claude 3.7 Sonnet Thinking, Gemini 2.5 Pro (Table 3).
- Datasets: synthetic CI dataset of 729 entries, with a train/validation/test split of 590/66/73; external benchmarks PrivacyLens and ConfAIde (the paper does not state their respective sample sizes).
- Baselines: the untrained original version of each model; on PrivacyLens, CI-CoT and CI-RL are each compared with the original model.
- Metrics: on the synthetic set, I/U/C (keyword matching); on PrivacyLens, LR, ALR, Helpfulness (0–3).
- Evaluation method: PrivacyLens evaluation uses GPT-4o (2024-11-20) at temperature 0; the authors state that to avoid the judge favoring their own generations, they do not report results for OpenAI models [27].
- Number of runs: the paper does not report multiple runs; in the NeurIPS checklist the authors state that due to compute constraints they did not run multiple sets of experiments, and there are no error bars.
Main Results
Synthetic test set (n=73); in each row the left column is the baseline and the right column is +CI-RL (from Table 1, units %):
Swipe horizontally to read the table
Model I baseline→CI-RL U baseline→CI-RL C baseline→CI-RL Qwen2.5-1.5B-IT 37.5→59.4 35.9→43.7 4.7→26.6 Qwen2.5-3B-IT 31.2→57.8 53.1→51.6 12.5→28.1 Qwen2.5-7B-IT 46.9→75.0 62.5→67.2 29.7→48.4 Mistral-7B-IT 38.8→89.1 67.3→82.8 24.5→73.4 Llama-3.1-8B-IT 61.9→79.7 64.3→79.7 38.1→62.5 Qwen2.5-14B-IT 51.6→78.1 67.2→64.1 37.5→50.0 - The authors state that CI-RL improves I and C on all models while maintaining or improving U; the exceptions in the table are slight decreases in U for Qwen2.5-3B-IT and Qwen2.5-14B-IT.
- The authors state that larger models have higher absolute scores, and that after CI-RL, Qwen2.5-7B-IT's I and C exceed those of untrained Qwen2.5-14B-IT.
PrivacyLens Transfer Evaluation
- CI-CoT prompting: according to Table 3, LR and ALR decrease for all four frontier/reasoning models, e.g., Claude 3.7 S's LR drops from 30.4% to 23.1% and ALR from 35.9% to 25.4%; Gemini 2.5 Flash's LR drops from 29.0% to 19.7%. Helpfulness mostly decreases (e.g., Gemini 2.5 Flash from 2.75 to 2.31), with Claude 3.7 S as an exception (2.49 to 2.69).
- CI-RL training: on open-source models, CI-RL further reduces leakage compared with CI-CoT, e.g., Qwen2.5-7B-IT's LR goes from a baseline of 50.3% through 44.8% with CI-CoT to 33.7% with CI-RL, with Helpfulness maintained at 2.08 (baseline 1.99); Mistral-7B-IT's ALR drops from 52.1% to 29.6%.
- Exception: Llama-3.1-8B-IT's LR under both CI-CoT (21.3%) and CI-RL (18.5%) is higher than the baseline of 18.2%, but ALR drops from 38.9% to 29.4%; the authors do not explain this exception.
- The authors state that frontier models' leakage rates are overall lower than those of small open-source models, with higher helpfulness; the introduction states a maximum leakage reduction of 40% (corresponding to the relative reductions in the table values).
LLM vs. LRM Ablation
- Setup: Llama-3.1-8B-Instruct vs. DeepSeek-R1-Distill-Llama-8B, Qwen2.5-14B-Instruct vs. DeepSeek-R1-Distill-Qwen-14B (Table 2).
- Results: after CI-RL, the instruct models are higher across the board, e.g., Llama-3.1-8B-IT's C is 62.5% versus 45.3% for the corresponding R1-Distill; Qwen2.5-14B-IT's C is 50.0% versus 46.9% for the corresponding R1-Distill.
- Authors' interpretation: the authors suggest the gap may stem from the distilled models being primarily optimized for the science and code domains, rather than an inherent limitation of the LRM paradigm itself.
ConfAIde External Reproduction (Appendix A, single model Qwen2.5-7B-IT only)
- Tier 1/2: Pearson correlation between human and model judgments; Tier 1 rises from 0.58 to 0.67, Tier 2.a from 0.51 to 0.69, Tier 2.b stays flat at 0.48 (Table 5).
- Tier 3: string-matching leakage rate drops from 0.91 to 0.52 (Table 6).
- Tier 4: Leaks Secret drops from 0.80 to 0.30, Omits Info rises from 0.10 to 0.15, "leaks or omits" drops from 0.85 to 0.45 (Table 7); the authors do not explain the rise in Omits Info.
Other Ablations and Analyses
- Reward weight ablation (Table 4, Qwen2.5-7B-IT, α/γ in Eq. 3): at (0.25, 1), I is highest at 82.8%; at (1, 0.5), C is highest at 59.4%; the authors state that increasing α favors helpfulness and increasing γ favors completeness.
- Output length (Appendix F): CI-RL models average 244.72 tokens on PrivacyLens (60–836); the number of thinking tokens correlates weakly with both helpfulness and leakage, and the authors suggest long reasoning chains may be unnecessary in this domain.
- Training trajectory example (Appendix D): shows Qwen2.5-7B-IT after 2400 training steps switching from sharing salary to not sharing on a validation sample.
What are some points that can be further explored?
The authors list limitations including synthetic data, reward granularity, and model scale; the experiments cover 6 open-source models and 3 benchmarks, with no multiple runs.
Limitations and Future Directions Noted by the Authors
- Synthetic data: high-quality CI data depends on human annotation but is scarce and expensive; this paper uses synthetic data to validate feasibility; the authors state that future work should incorporate human-annotated data (Section 7.1).
- Model scale and LRMs: models above 14B were not tested; the authors state that future work should conduct more empirical studies on larger models and on LRMs trained for multi-domain reasoning (Section 7.1).
- Coarse rewards: keyword rule-based rewards are simple and auditable but coarse-grained; the authors state that a CI-specific reward model could be trained, or a rubric-guided LLM judge used (Section 7.1).
- Lack of head-to-head comparison: no direct comparison with system-level defenses such as AirGapAgent; the authors plan head-to-head and hybrid evaluations reporting the completeness/helpfulness trade-off, false positives and false negatives, and cost and latency (Section 7.1).
- Norm evolution and customization: privacy norms drift with context and over time; the authors state that future work could support policy injection, periodic rule updates, and extraction of CI rules from governance documents (Section 7.1).
- SFT comparison and complex contexts: the authors state that comparing SFT and RL is an important direction, and that the training data are semi-structured inputs, which should be extended to more complex contexts (Section 7.1).
Scope of Experimental Coverage
- Training/evaluation on the synthetic set covers 6 open-source instruct models (1.5B–14B) and 2 DeepSeek-R1 distilled models; on PrivacyLens, 4 additional frontier/reasoning models are tested (Tables 1–3).
- The external benchmarks are PrivacyLens (GPT-4o judge) and a single-model slice of ConfAIde (Qwen2.5-7B-IT only, Appendix A).
- The synthetic data comprise 729 entries, covering 9 application domains (of the original 10 domains, Work does not appear in Table 8) and 3 transmission principles; the test set is n=73.
- The paper does not report multiple runs or error bars (the authors answer No to item 7 of the NeurIPS checklist).
- The paper does not report the evaluation sample sizes for PrivacyLens and ConfAIde, nor human evaluation agreement.
Summarize the main content of the paper
Using CoT prompting plus GRPO rule-based rewards to internalize contextual integrity reasoning into LLMs; after training on synthetic data, it can transfer to human-annotated benchmarks.
An alignment/training methods paper: addressing the problem that LLM agents acting on behalf of users may leak information inconsistent with the context, it proposes teaching contextual integrity (CI) as a reasoning task.
- Method: CI-CoT has the model evaluate, item by item within <think>, whether each attribute is appropriate to share before answering; CI-RL post-trains with GRPO and a rule-based reward (proportion of required keywords minus proportion of restricted keywords, with -1 for format errors) on 729 synthetic data samples generated by GPT-4.
- Synthetic set results (Table 1, n=73): after CI-RL, Integrity and Complete improved for all 6 open-source models, e.g., for Mistral-7B-IT, I rose from 38.8% to 89.1% and C from 24.5% to 73.4%; Utility decreased slightly for Qwen2.5-3B/14B.
- Transfer results (Table 3): on PrivacyLens, CI-CoT reduced LR/ALR for each model, and CI-RL reduced them further while maintaining helpfulness, e.g., for Qwen2.5-7B-IT, LR fell from 50.3% to 33.7%; the authors claim a leakage rate reduction of up to 40%. The exception is Llama-3.1-8B-IT, whose LR did not decrease.
- Other findings: after CI-RL, instruct models outperform the corresponding DeepSeek-R1 distilled models (Table 2); on the single-model slice of ConfAIde, the leakage or omission rate fell from 0.85 to 0.45 (Table 7).
- Authors' conclusions: the authors believe structured reasoning plus RL can reduce inappropriate disclosure while maintaining task performance, and argue that CI reasoning should become part of the agent alignment pipeline; limitations include synthetic data, coarse keyword rewards, and not testing larger models or adaptive attacks.
Related papers
Show 2 more papers
- AgentPrivArena评测/基准arXiv