Inadvertent Context Leakage in Language Models
This paper demonstrates that advanced language models inadvertently leak sensitive in-context secrets, such as credentials and health records, through their benign responses to ordinary prompts, revealing that this vulnerability is an inherent byproduct of model capability rather than a fixable bug.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Modern artificial intelligence is increasingly being asked to act as a personal assistant, managing calendars, reading private emails, and holding onto sensitive details like health records or financial data. To do this, the computer program must keep a running list of these secrets in its immediate memory while it works, a space researchers call the context window. The prevailing belief has been that if the model is told to keep a secret and refuses to say it out loud, the secret is safe. Security checks usually work like a simple filter: if the text the computer writes does not contain the secret word-for-word, the system assumes no leak has occurred. This approach treats the conversation as a single channel of communication, assuming that what is not said is also not known.
However, a new study suggests that this view is incomplete. The researchers found that even when a model correctly refuses to reveal a secret, the very way it constructs its sentences carries hidden clues about that secret. The secret changes the model's internal state, and that change ripples out into the text it generates, altering patterns in word choice, sentence length, and formatting in ways that are invisible to a human reader but detectable to a computer. It is as if the model is whispering the secret through a different part of its voice, even while its mouth is firmly shut.
The team behind this research, working with eight of the most advanced language models available, set out to test whether these hidden signals were real. They created a scenario where a model was given a secret number and instructed to keep it confidential. They then asked the model to perform ordinary, harmless tasks, such as writing a short story or generating a list of statistics. The models consistently refused to state the number directly when asked, passing all standard safety checks. Yet, when the researchers analyzed the text the models produced in response to these innocent requests, they found that the secret number was encoded in the statistical properties of the output.
To prove this, the researchers built a specialized decoder, a tool trained to listen for these specific statistical patterns. When they fed the benign text into this decoder, it successfully reconstructed the secret numbers with startling accuracy. For two-digit secrets, the decoder recovered the full number almost perfectly across several top-tier models. Even for four-digit secrets, which are harder to guess by chance, the decoder achieved an exact match about 82 percent of the time on the most capable models. This happened without the model ever being tricked into saying the number, and without the attacker having any special access to the model's internal workings; they only saw the final text, just as a regular user would.
The study revealed that the ability to leak information was not a bug that could be easily patched, but rather a side effect of the model's intelligence. The more capable the model was at following instructions and understanding complex tasks, the more sensitive it became to the secrets in its memory, and the more information it inadvertently leaked. The researchers tested models from different companies, including Anthropic, Google, OpenAI, and xAI. They found that while some models were more resistant than others, the most powerful ones generally leaked the most. In fact, the models that were best at following the instruction to "keep this secret" were often the ones that leaked the most information through these subtle channels. This suggests that the very mechanisms that make these assistants helpful and obedient are also what make them vulnerable.
The researchers also explored whether this leakage could be used to learn about a user's private life beyond just numbers. They tested whether the model's output could reveal if a specific memory, such as a health condition or a financial event, was present in its context. Using a trained classifier, they found that the model's routine responses could reveal the presence of these memories with a success rate far higher than random guessing. This was true even when the model never mentioned the memory in its text. The study showed that the model's internal state, shaped by the user's private data, left a statistical fingerprint on every sentence it wrote.
Perhaps most concerning was an experiment where the researchers tried to extract a full nine-digit Social Security number from a simulated personal agent. In this scenario, the attacker did not just listen for leaks; they actively engineered the conversation to force the model to encode the secret into a specific feature of its response, such as the number of exclamation marks used. By using a technique that optimized the prompt to trigger this behavior, the attacker successfully recovered the first digit of the number in nearly 97 percent of attempts on one leading model, and the remaining eight digits in about 76 percent of those cases. This worked even when the context was very long, containing hundreds of thousands of words, and even though the model never wrote the number itself.
The study concludes that the current methods of protecting privacy in these systems are insufficient. Simply telling a model to be discreet or filtering its output for specific words does not stop the information from leaking through the statistical patterns of its language. The researchers argue that as long as a model holds private data in its immediate memory while generating text, that data will influence the output in ways that can be decoded. They suggest that fixing this problem will require more than just better instructions or filters; it may demand a fundamental change in how these models are trained to ensure their output remains statistically independent of the secrets they hold. Until then, the secrets we entrust to our digital assistants may be safer in our own minds than in the machine's memory.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.