Deep dives · 2026-11-29 · Basic · By bombong
Auditing leakage with canaries: measuring privacy with planted secrets
Canaries are fake secrets with known answers that are deliberately mixed into training data. After training, you check whether the model recognizes or reproduces them to measure leakage risk. Recent research is expanding into better-exposed canary designs, audits that need only one training run, audits without inserted canaries, and audits of agent memory.
Contents
- Why it was needed: the gap between theoretical safety and actual leakage
- Core idea: the canary in the coal mine
- How it works: insert, train, distinguish
- Development: better-exposed canaries, tighter statistics
- Where it is heading: questioning the measurement, measuring without canaries, and extending to memory
- Limitations and open issues
- Practical guidance: when to use it and what to watch out for
- Further reading
- A canary audit inserts a random subset of secrets with known answers and measures leakage by how well an attacker can tell inserted ones from non-inserted ones.
- Audit results are a lower bound on privacy loss. Passing an audit does not prove safety.
- Good canaries should be conspicuous outliers that do not interfere with each other. Research optimizing for this has made audits more efficient and stronger.
- Even for the same secret, measured memorization varies widely depending on how it is presented during training and how it is queried at test time, so you need to check that conclusions are robust to these choices.
- Audits without inserted canaries have emerged for deployed models that are hard to retrain, and memory that happens outside the weights, such as agent memory, has also become a target of auditing.
Why it was needed: the gap between theoretical safety and actual leakage
Large language models (LLMs) can memorize individual training sentences verbatim and reproduce them later. An empirical privacy auditing study paper points out that even parameter-efficient fine-tuning, which updates only a small number of parameters, can memorize individual training examples to a problematic degree. A study on genomic language models paper likewise argues that models trained or fine-tuned on sensitive genomic cohorts can memorize specific sequences, creating privacy, data leakage and regulatory compliance problems.
The main theoretical tool for preventing this risk is differential privacy. It adds noise during training so that the result barely changes whether a single record is included or not, giving a mathematical guarantee that any one individual's influence does not exceed a set maximum. But this guarantee holds only when the implementation is correct and the assumptions are met. A one-run auditing study paper describes privacy auditing as a safeguard that estimates the information a model actually leaks to check whether theoretical guarantees hold in practice. A quantum machine learning auditing study paper also identifies the problem that, even with theoretical guarantees, there are few tools to actually verify deployed models.
In the end, a way was needed to put a number on "how much training data does this model leak?" Measuring this directly with real personal data is difficult, because there is no ground truth about which records remain in the model. Canaries solve this by having us create and insert data whose answers we know.
Core idea: the canary in the coal mine
Miners used to bring canaries, which are sensitive to toxic gas, into the mine shafts and treated any sign of distress in the bird as a warning. Canaries in privacy auditing play the same role. In the definition used by a canary masking study paper, a canary is "a synthetic training record containing a known secret." For example, a sentence like "My account password is 7f3a9c" is quietly mixed into the training data, and after training you check whether the model recognizes or repeats this secret.
Why use fake secrets instead of real data? First, the answer is known. The auditor decides which canaries were inserted and which were left out, so the model's responses can be checked against the ground truth. Second, insertion can be controlled. If only a random subset of candidate canaries is inserted, "inserted" and "not inserted" can be compared statistically. Third, it is safe. A synthetic canary study paper explains that because canaries contain no real personal information, people can inspect their content, and inserting them repeatedly does not harm the privacy of real data.
There is a trade-off. Canaries are human-made artifacts, so there is no guarantee they are memorized the same way as real customer records. Control and ground truth are gained at the cost of some realism. This gap is revisited later in "Limitations and open issues."
How it works: insert, train, distinguish
The basic procedure has five steps. 1) Create candidate canaries. 2) Mix a random subset of them into the training data. 3) Train the model as usual. 4) Attack the trained model to guess whether each canary was in the training data. 5) Compute the degree of leakage from how well inserted and non-inserted canaries were distinguished.
There are two main attacks in step 4. One is the membership inference attack. It guesses whether a sentence was in the training data by whether the model finds it unusually "familiar," for example by assigning it high probability. The other is training data extraction. It gives the model only the first part of a secret and checks whether it continues with the rest verbatim. The genomic language model study paper combines perplexity-based detection, canary sequence extraction and membership inference into a single pipeline to produce a worst-case memorization risk score. Planting canaries with different repetition counts also makes it possible to measure the effect of repetition on memorization.
The meaning of step 5 is important. As the metagradient canary study paper explains, the auditor's success rate becomes a lower bound on the differential privacy parameter. If an attacker guessed this well, the actual privacy loss is at least this much. If the lower bound comes out higher than the theoretical guarantee, it is a sign that something in the implementation or assumptions is wrong.
The traditional approach is expensive. According to the IBIS study paper, a standard audit must check a single canary by inserting and removing it across far more than 100 random training runs. This led to "one-run" audits, which insert many canaries together in a single training run. The same principle can be applied to synthetic data. The synthetic canary study paper retrains an auxiliary model on synthetic data generated by a model fine-tuned on sensitive data, then audits whether the original canaries surface in that auxiliary model, estimating leakage through synthetic data.
Development: better-exposed canaries, tighter statistics
The first line of work is making better canaries. The metagradient canary study paper treats the auditor's set of canaries as an optimization problem and refines the canaries using gradients with respect to the training outcome (metagradients). On image classification models trained with differential privacy, it raised the empirical lower bound several-fold over existing canaries in some cases. Canaries created by ordinary training of a small model also remained effective when auditing larger models trained with DP-SGD (a training method that adds noise to gradients during training to preserve differential privacy).
On the language model side, the synthetic canary study paper proposed creating canaries by sampling from an LLM at a high temperature of 0.8 or above, using prompts tailored to the sensitive data. Canaries made this way act like high-influence outliers and are easily identified, which makes the audit correspondingly stronger. Using this auditing method, the study also examined how model capacity and canary entropy (how hard a canary is to predict) jointly affect memorization.
One-run audits have a problem of their own. The IBIS study paper starts from a theory that canaries inserted in the same training run interfere with each other, lowering each other's membership inference scores and weakening the audit. It therefore adds a regularization term that makes canaries orthogonal to each other in embedding space, increasing each canary's score while reducing its effect on the others. It reports cutting computational cost by up to 100× with an efficient algorithm that avoids retraining the model from scratch each time.
The second line of work is statistics that extract more information from the same results. The Gauss study paper points out that existing one-run audits discard useful information by reducing each canary to a binary "in/out" guess. In the DP-SGD setting, where the model's internals are visible, it uses the fact that the normalized sum of canary-related signals asymptotically follows a Gaussian distribution to obtain a tighter lower bound from a single training run.
The third line of work is expanding the scope of application. Work has appeared on genomic language models paper and on quantum machine learning auditing paper, which uses offset quantum states as "quantum canaries." WikiMem paper built about 5,000 natural-language canaries covering 243 person-related properties from Wikidata and evaluated 200 people across 15 LLMs ranging from 410M to 70B parameters. Memorization increased with a person's web exposure and with model size. The aim is to identify memorized information at the individual level and use it to build target lists for "right to be forgotten" requests and machine unlearning.
Three auditing approaches
Multi-runMultiple training runs per canary
- Needs well over 100 training runs
- Highest cost
One-runMany canaries in one training run
- Done in a single training run
- Canaries interfere with each other
- Needs design and statistics that reduce interference
Observational / post-hocNo canaries inserted
- Audits deployed models without retraining
- Needs correction for non-member distribution shift
공통 All use membership inference to obtain a lower bound on privacy loss
Where it is heading: questioning the measurement, measuring without canaries, and extending to memory
First, there is work that validates canary measurement itself. The canary masking study paper fine-tuned language models and vision-language models (VLMs) under controlled conditions and showed that measurement results depend heavily on how canaries are presented. When a secret is given inside the training input, the model may be able to copy the secret from the input but fail to recall it once the secret is removed, even after many repetitions in training. Conversely, when the model is trained to predict the secret from surrounding context, it recalls it reliably later. Changing only when a canary appears, or which other canaries it appears with, changed the measurements substantially without any change in repetition count. The study concludes that repetition count alone cannot explain memorization, and that before extending audit conclusions to other training records, one should check that the conclusions hold when these choices change.
Second, there are audits for situations where canaries cannot be inserted. Large models that have already been trained are hard to retrain with canaries. A natural identifier study paper focused on structured random strings (NIDs), such as cryptographic hashes and shortened URLs, that already exist in training data. Because their format is fixed, any number of new strings from the same distribution can be generated, and these can serve as substitute canaries and as non-member data for comparison, enabling post hoc audits without retraining. An observational auditing study paper assumes an auditor who cannot insert canaries, decide which data are included, or retrain the model. In this case, the non-member data on hand differ in distribution from the training data, distorting membership scores. The study corrects for this by transferring relationships learned on out-of-distribution non-members to the target distribution, and adds a conservative correction in case the transfer is unstable.
Third, there is the problem of memory moving outside the weights. A deployment-time memory study paper treated the memory of long-running agents that remember users as a memorization mechanism in its own right and audited it with canaries. On LongMemEval, summaries that keep only key facts preserved nearly all personalization memory while reducing canary extraction by 76% on Gemma 3 12B and 64% on GPT-4o-mini. However, deletion that removed only the originals left information copied into summaries still retrievable in about 20% of cases. Residual information in the worst-case tier reached zero only when the entire pipeline was deleted or masked with deletion markers (tombstones).
Limitations and open issues
The most common misconception is reading audit results as proof of safety. The value a canary audit gives is a lower bound paper. An attack that fails to guess well only means "this attack, with these canaries, did not find leakage," not that there is no leakage. That is why research works to make canaries more conspicuous paperpaper and statistics tighter paper. A weak audit yields a low lower bound, making the model look safer than it is.
Second, there is the gap between canaries and real data. Canaries are outliers deliberately made to stand out, so one cannot assume that ordinary customer records are memorized to the same degree. As the canary masking study paper showed, measurements change with presentation, ordering and which other canaries are inserted alongside. Numbers from a single setting should not be applied to all data as is.
Third, there are issues of cost and access. Multi-run audits require far more than 100 training runs paper, and one-run audits must manage interference between canaries. Audits without inserted canaries need no retraining, but if the distribution of the non-member comparison data differs, results can be inflated, so a separate correction is needed paper.
Practical guidance: when to use it and what to watch out for
Canary audits are especially useful in the following cases: before releasing a model fine-tuned on sensitive data; when you have applied differential privacy training and want to check that the implementation works as guaranteed; before sharing synthetic data generated by a model trained on sensitive data paper; and when setting the summarization, retrieval and deletion configuration of agent memory paper. If the model is already deployed and cannot be retrained, first consider approaches that do not insert canaries, such as natural identifiers paper or observational auditing paper.
There are four common mistakes. One is using real personal information as canaries. The advantage of synthetic canaries is that they are safe to inspect and insert repeatedly paper. Two is looking only at repetition count and concluding that "this many repetitions leads to memorization." Results vary with presentation and testing methods paper. Three is using only one format and one attack. As in the genomic study paper, it is safer to look at perplexity, extraction and membership inference together and take the worst case as the reference. Four is deleting only the originals and considering deletion complete. Copies can remain in derived stores such as summaries paper.
When reporting results, state which canaries were inserted and how, which attacks and metrics were used, and that the values are lower bounds, so that others do not misinterpret them.
Canary auditing checklist
Design
- Are the canaries free of real personal information?
- Does the conclusion hold when the presentation format or order changes?
- Was it checked with multiple attacks (extraction, membership inference)?
Interpretation
- Were results reported as a lower bound?
- Did you avoid drawing conclusions from repetition counts alone?
After deployment
- Did you check for leakage through synthetic data as well?
- Did you also delete the derived stores of agent memory?
Further reading
To grasp the basic logic of canary auditing, that is, "insert at random, then tell them apart to get a lower bound," start with the introduction of the metagradient canary study paper. It gives a short summary of the standard procedure for auditing DP-SGD. Next, read IBIS paper for the difference between multi-run and one-run auditing and the problem of canary interference, then the Gauss study paper for improvements on the statistics side. Read in that order, the line of work connects.
For LLM practitioners, the synthetic canary study paper is the most directly useful. It covers both fine-tuning and auditing of synthetic data. After that, read the canary masking study paper to see how easily the measurement can shift. If you work with models that cannot be retrained, read the natural identifier study paper and the observational auditing study paper. If you build agents, read the deployment-time memory study paper. If you are interested in individual-level memorization and the right to be forgotten, WikiMem paper is the place to start.
Related terms
Differential privacy Membership inference attack Training data extraction Synthetic data Machine unlearning Agent memory Data exfiltration Canary token
References
Foundational papers
- Optimizing Canaries for Privacy Auditing with Metagradient Descent (2025)
- Advancing the State-of-the-Art in Empirical Privacy Auditing (2026)
- Detectability without Interference: Efficient Canary Design for Privacy Auditing in One Run (2026)
- Let's Ask Gauss: Improved One-Run Privacy Auditing (2026)
- Quantifying Memorization and Privacy Risks in Genomic Language Models (2026)
- What Should LLMs Forget? Quantifying Personal Data in LLMs for Right-to-Be-Forgotten Requests (2025)
- Shift-aware score transport for privacy auditing without retraining (2026)
Recent research
Written by AI from the listed references and reviewed. Please check the original sources for details.