Inadvertent Context Leakage in Language Models
AuthorsJaiden Fairoze, Neal Mangaokar, Kamalika Chaudhuri, Sanjam Garg, Saeed Mahloujifar
Resources
The study shows that language models may leak secrets indirectly through ordinary responses, even when they refuse to reveal them explicitly.
Key results
Exact secret recovery achieved by Claude Opus 4.6 and Gemini 3.1 Pro.
Exact-match reconstruction from benign outputs.
Per-digit reconstruction accuracy versus a 10% chance baseline.
Advantage over chance when inferring sensitive memory predicates.
Phase 1 success rate in the active prompt-injection attack.
Phase 2 success rate conditioned on leading-digit recovery.
What the paper found
The paper shows that language models can leak secrets without ever stating them: an adaptive black-box adversary reads secret-dependent patterns in token choices, response length, formatting, and style from ordinary benign outputs, even when direct extraction is refused. Across eight proprietary models, Claude Opus 4.6 and Gemini 3.1 Pro achieved 100% exact reconstruction of 2-digit secrets; Claude Opus 4.6 reached 82% exact match for 4-digit secrets, while Gemini 3.1 Pro reached 41% per-digit accuracy for 8-digit secrets versus a 10% chance baseline. The attack also inferred whether sensitive memories, including health conditions and financial events, were present in context using CIMemories, achieving a 0.319 advantage over chance, compared with 0.058 for a conventional linguistic judge. The authors link leakage to suppression: stronger instructions to protect a value can distort the model’s output distribution more sharply, making the value easier to decode, and leakage strongly correlates with suppression across models at Spearman ρ = 0.95. In an active prompt-injection attack, a GRPO-trained Qwen-2.5-7B generator made production-style agents encode Social Security Number digits through exclamation-mark counts; Claude Opus 4.6 revealed the leading digit in 97.1% of trials and the remaining eight digits in 76.5% of successful first-phase trials, while Gemini 3.1 Pro achieved 88.6% and 46.8%. The findings apply to Claude, Gemini, GPT-5.4, and Grok models and suggest that filtering and refusal training are insufficient without making output distributions invariant to protected context.
Original abstract
For AI agents to be useful beyond simple chat, they must hold sensitive user context such as calendars, credentials, health records, and financial data. We study whether the mere presence of such secrets in a model's context window introduces hidden correlations into the model's benign outputs, allowing reconstruction even when the model correctly refuses direct extraction. We further study whether an adversary can actively engineer prompts that amplify this effect, using the model as a covert carrier to transmit secrets through seemingly innocuous text. In both cases, this limited leakage is exploited using a novel adaptive attack that assumes black-box access to the underlying model. In controlled experiments across eight proprietary models, we find that 2-digit in-context secrets are reconstructed with near-perfect accuracy and 4-digit secrets at 82\% exact match, all from outputs the model produces in response to ordinary, non-adversarial requests. We observe that more capable models leak more: stronger instruction-following amplifies sensitivity to in-context secrets, suggesting leakage is a byproduct of capability as opposed to a patchable bug. We show this leakage enables two practical attacks: (1) a trained classifier that infers semantic predicates about user memories (e.g., health conditions, financial events) from routine natural-language outputs, and (2) an RL-trained adversary that extracts full Social Security Numbers from a production-style agent.
Read the original paperMore in AI Safety
Browse all 57 papers →Aligning AI Teams
Siddarth Srinivasan, Morgan Jane Matthews, Jascha Sohl-Dickstein, Erik Jones
Aligned AI agents can behave less safely as a team, but assigning clear safety roles may help restore responsible behavior.
Centered Ablation: Why Last-Layer Directional Ablation Under-Fires or Collapses, and a Closed-Form Fix
Quy-Anh Dang, Chris Ngo
A simple centering fix makes language-model behavior ablation more reliable while helping distinguish genuine safety effects from text collapse.
Teaching Vision-Language-Action Models to Stop Safely
Zheyuan Liu, Chuhan Wang, Jinduo Guo, Yue Huang, Xiangchi Yuan, Ningshan Ma, Meng Jiang
SAFI teaches robots how to safely stop an in-progress task while preserving their ability to perform other tasks.