LLMs Leak Secrets Through Unrelated Outputs

Kayshav Bhardwaj, Yigitcan Kaya, Christopher Kruegel, Giovanni Vigna

TL;DR

If you hide a four-digit PIN in an LLM’s system prompt and tell it to generate random numbers, it will still subtly bias its choices toward that secret—even if it never prints the PIN or anything close to it. By simply scoring how likely the model’s unrelated outputs are under every possible candidate PIN, an attacker with access to the model weights can recover the exact secret nearly half the time across 10,000 possibilities.

What Problem Does This Paper Address?

Modern AI assistants routinely hold sensitive data in their context window: API keys, system instructions, private documents, and conversation history. Most privacy defenses—like secrecy prompts ("do not reveal the password") or output filters—assume that if a model’s response doesn't state or imply the secret, the secret is safe.

This paper challenges that assumption. Because an autoregressive language model conditions every single next-token prediction on its entire context window, a hidden secret warps the model’s probability distribution even when it is answering a completely unrelated prompt. The authors call this inference-time statistical channel subliminal leakage, and they ask: can an observer exploit these subtle probability shifts to recover a hidden secret, even when surface-level filters strip out any obvious clues?

Methods

The authors set up an open-weight (white-box) threat model: the adversary observes $n \ge 1$ outputs from a victim model, knows the model’s weights, the secret’s format (a four-digit PIN), and the prompt template. Crucially, the attacker doesn't need gradients, hidden activations, fine-tuning, or clever jailbreaks—just standard forward passes.

To recover the secret, the attacker uses teacher-forced likelihood scoring:

  1. Substitute a candidate PIN $s$ into the system prompt template.
  2. Run a forward pass on the victim model to compute the mean log-likelihood of the observed output tokens given that candidate prompt.
  3. Rank all candidates by their cumulative log-likelihood across $n$ observed outputs.

Scoring all 10,000 PINs across 20 outputs would require 200,000 forward passes per secret, so the authors use an approximate beam search (building a pool of ~250–320 candidates) to make full-space recovery tractable. To ensure they aren't just catching accidental verbatim leaks, they apply a strict near-copy filter that discards any generated list containing the exact PIN, any permutation of its digits, or any four-digit number at Hamming distance 1.

Datasets

Rather than using standard NLP benchmarks, the authors construct controlled synthetic tasks to measure leakage against exact uniform baselines:

  • Short-even task (default): Asking the model to generate 10 distinct random even integers between 0 and 9999.
  • Long-list & cover tasks: Generating 32 random integers, lottery draws, API-style identifiers, and a low-variation control (integers 1 to 10).
  • Evaluation splits: A 5-way detection benchmark (4 PINs + no-password control; 250 trials), a 7-way cross-model benchmark (6 PINs + control), 12 development PINs, and 50 held-out PINs for full 10,000-way recovery.
  • Probing & perplexity: 90 training / 30 test PINs for linear hidden-state probes, and a 32,768-token prefix of WikiText-103 to measure the fluency cost of noise defenses.

Key Insights and Ideas

  • Secrecy lives in the probabilities, not just the text: Even when exact copies and near-copies are completely filtered out, the model’s token probabilities still carry a strong signature of the hidden PIN.
  • Output entropy is required: When the model is asked for a low-variation list (integers 1 to 10), outputs are nearly identical across conditions and detection drops to 20.0% (random chance). Subliminal leakage needs room for plausible variation.
  • Telling the model to "be careful" isn't enough: Warning the model of a leakage audit or instructing it to "act as if no password exists" reduces leakage, but detection still remains more than double the random baseline.
  • The secret stays linearly decodable inside: Linear probes trained on first-token hidden states can decode the first PIN digit with near-perfect accuracy, showing that the model’s internal representation of the secret persists throughout generation.
  • The channel is model-specific: Scoring Qwen3-8B’s outputs using Phi-3.5-Mini or OLMo-2-7B fails to match same-model accuracy, meaning the statistical fingerprint doesn't easily transfer across different model families.

Key Results

  • Single-output detection: On Qwen3-8B’s short-even task, a single output identifies the true condition in 77.2% of trials (vs. 20.0% chance), remaining above 73% after strict near-copy filtering.
Table 1: Single-output five-way detection survives near-copy filtering. Accuracy across four PINs and a no-password control on Qwen3-8B (250 trials; chance: 20.0%). The strict filter removes exact PIN matches, digit permutations, and Hamming-distance-1 neighbors.
  • Full-space PIN recovery: Aggregating roughly 20 strictly filtered outputs on Qwen3-8B recovers 48.0% (24/50) of held-out PINs exactly out of 10,000 candidates (0.01% chance), and places 72.0% (36/50) in the top five.
Table 2: Full-space PIN recovery among 10,000 candidates from strictly filtered outputs. Left: Sample-budget sweep on 12 development PINs using the first n lists in fixed order (8.3 percentage points per PIN), used to select n = 20. Right: Final evaluation on 50 held-out PINs (n ≈20).
  • Cross-model & prompt robustness: Same-model 7-way detection (14.3% chance) hits 68.6% on Qwen3-8B, 59.1% on Phi-3.5-Mini, and 44.3% on OLMo-2-7B. Under an explicit "audit for leakage" prompt on Qwen3-8B, 5-way accuracy stays at 44.0%.
Table 3: Subliminal leakage across model families and strengthened secrecy prompts. Left: Same-model seven-way single-output detection (six PINs plus control; chance: 14.3%). Right: Five-way Qwen3-8B single-output detection under stricter system instructions (chance: 20.0%).
  • Targeted noise defense: Adding Gaussian noise ($\sigma = 4$) only to the 22 numeric token logits during generation drops 6-PIN recovery from 4/6 to 0/6, while raising WikiText-103 perplexity modestly from 8.30 to 10.27 (compared to 252 for uniform all-logit noise).

Limitations and Future Work

The authors note that their evaluation focuses on an open-weight setting (where the attacker can compute exact log-probabilities), four-digit PINs, and numeric generation tasks. Because likelihood shifts do not transfer well across model families, future work is needed to develop black-box approximations (such as sampling-based density estimation or proxy distillation). They also highlight extending this analysis to alphanumeric credentials, free-form text, and broader utility benchmarks for targeted logit-noise defenses.

Summary updated

BibTeX
@inproceedings{bhardwaj2026llms,
  author = {Kayshav Bhardwaj and Yigitcan Kaya and Christopher Kruegel and Giovanni Vigna},
  title = {{LLMs Leak Secrets Through Unrelated Outputs}},
  booktitle = {InfPriv @ NeurIPS},
  year = {2026},
  url = {https://openreview.net/forum?id=In3jVmFJBO},
}
Figure