DyePack: Provably Flagging LLM Test Set Contamination Using BackdoorsDyePack: Provably Flagging Test Set Contamination in LLMs Using Backdoors
The authors propose DyePack, which mixes backdoor samples with random targets into the benchmark test set to detect training contamination; the authors claim that on MMLU-Pro, 8 backdoors detect all contaminated models with an FPR as low as 0.000073%.
- The test sets of open benchmarks are easily (intentionally or unintentionally) mixed into training data, and contaminated models obtain inflated scores, harming evaluation fairness; existing detection methods mostly rely on logits or cover only the pretraining stage, and cannot provide false positive rate guarantees.
- Before benchmark release, about 10% of test samples are replaced with backdoor samples carrying a trigger phrase, and each backdoor's target is sampled independently and uniformly from the output subspace; at evaluation time, the number of activated backdoors in the model is counted, and its binomial distribution is used to precisely compute the false positive rate (FPR) before determining contamination.
- Tested on MMLU-Pro, Big-Bench-Hard, and Alpaca with 5 open-source 7B/8B models; the authors claim all contaminated models were detected, with FPRs as low as 0.000073% and 0.000017% respectively with 8 backdoors, and 0.127% with 6 backdoors on Alpaca; also effective on Qwen-2.5-32B.
- The authors note that detection ability depends on the success of the backdoor attack itself, that detection of all contaminated models is not guaranteed, and that the method applies only to newly released future benchmarks and cannot be retroactively applied to existing benchmarks; the experiments cover only 7B/8B models and one LoRA fine-tuned 32B model, and mixed training is validated only up to the 1.6M token scale.
- Threat model
- The defender is the benchmark developer, who before release mixes 10% backdoor samples with random targets into the test set; the flagged party is a model trained on that test set (intentionally or unintentionally contaminated). Detection requires only query access, without loss, logits, or model internals; contamination is simulated by fine-tuning for one epoch on the test set.
- Evaluated models
- Llama-2-7B-ChatLlama-3.1-8B-InstructMistral-7B-InstructGemma-7B-itQwen-2.5-7B-InstructQwen-2.5-32B
- Benchmarks
- MMLU-ProBig-Bench-HardAlpaca
- Metrics
- FPR#activated backdoorsbackdoor effectiveness (ratk)Clean AccuracyBackdoor Accuracy
A University of Maryland research team proposed the DyePack framework, which mixes backdoor samples with random targets into a benchmark test set before its release, to identify models that used the test set during training. The method draws on the idea of bank dye packs, judging contamination by whether a model exhibits backdoor behavior, without needing access to loss, logits or model internals; because each backdoor target is generated independently at random, the number of backdoors activated by a clean model follows a binomial distribution, allowing the false positive rate to be computed exactly before any accusation. Evaluation on five open-source models including Llama-2-7B-Chat showed that on MMLU-Pro and Big-Bench-Hard, eight backdoors detected all contaminated models, with false positive rates as low as 0.000073% and 0.000017% respectively; on the open-generation dataset Alpaca, six backdoors detected all contaminated models, with a false positive rate of 0.127%. The authors note that the method must be embedded before a benchmark is released, does not apply to already-released benchmarks, and that detection capability also depends on the success rate of the backdoor attack itself.
Why it was selectedThe authors propose a contamination detection framework that mixes multiple backdoor samples into a test set before its release, with a false positive rate that can be computed exactly, providing benchmark developers with a transferable anti-contamination design.
Paper analysis
What problem does this paper attempt to solve?
How to detect whether a model was trained on a benchmark test set when only model outputs are available, and provide a computable false positive rate guarantee.
Core question: how can benchmark developers, after releasing a test set, detect whether a given model was trained on that test set (test set contamination), without falsely flagging clean models when marking contamination.
- Problem setting: the authors state that the public nature of open benchmarks makes them easy targets for test set contamination, and contaminated models obtain inflated scores and dominate leaderboards, harming evaluation fairness; contamination may be intentional (the authors mention related allegations about Meta Llama-4, which the company denied) or the unintentional mixing in of web corpora.
- Shortcomings of existing methods (according to the paper): preventive measures such as n-gram matching are imperfect and rely on unverifiable vendor transparency; post-hoc methods such as MIA and memorization probing fail against contamination at the fine-tuning stage; the methods of Oren et al. (2023) and Zhang et al. (2024) require access to logits, which is often unavailable in practice.
- Core observation: like a bank mixing dye packs into banknotes, mixing backdoor samples into the test set means models trained on these samples will exhibit backdoor behavior; but if a single backdoor has a fixed target, a model's bias toward a certain option when uncertain could cause false positives of up to 10% (MMLU-Pro has 10 options).
- The paper proposes: the DyePack framework—multiple backdoors + randomly and independently sampled targets, so that the number of backdoors activated by a clean model follows a binomial distribution, thereby allowing the FPR to be computed exactly before flagging any model.
- Threat model:
- Defender: the benchmark developer, who mixes backdoor samples into the test set before release.
- Detected party: a model trained on the released test set (whether intentionally or unintentionally contaminated).
- Detector capability: only query access is needed, without loss, logits, or any model internals.
- Victim system: the credibility of open benchmarks and their leaderboards.
What related research exists?
Related work falls into four groups: contamination prevention and dynamic benchmarks, post-hoc contamination detection, backdoor attacks, and using backdoors for dataset ownership verification.
LLM test set contamination: prevention and dynamic benchmarks
- Radford et al. (2019), Brown et al. (2020), Achiam et al. (2023) and others use higher-order n-gram matching, and Lee et al. (2023) use embedding similarity retrieval for pretraining decontamination; the paper notes that such methods are imperfect (Yang et al., 2023) and depend on vendor transparency, and cannot be verified without public training data.
- Qian et al. (2024), Wu et al. (2024), White et al. (2024) propose dynamic benchmarks that periodically update questions; the paper notes that their challenges include infeasible human evaluation, no guarantee of data quality, disputed LLM evaluation, and copyright issues.
LLM test set contamination: post-hoc detection
- Shi et al. (2023) use membership inference attacks (MIA) to identify test samples in training data; Golchin and Surdeanu (2023, 2024) use prompts and quiz methods to exploit model memorization to detect pretraining-stage contamination. The paper notes that these methods fail for fine-tuning-stage contamination because during fine-tuning the loss is usually added only to the response, and that they ignore FPR and provide no false positive guarantee.
- Oren et al. (2023) use an exchangeability test to check whether the model assigns higher log-likelihood to a particular test sample order; the paper acknowledges that it provides an FPR guarantee but notes that it applies only to pretraining contamination, fails when samples are shuffled, and requires logits. Zhang et al. (2024) compare model confidence across different data versions for a statistical test, and the paper notes that it likewise requires logits.
Backdoor attacks
- Gu et al. (2017), Dai and Chen (2019), Chen et al. (2021), Cheng et al. (2023) and others study backdoor attacks in CV and NLP; Xu et al. (2024) and Li et al. (2024) demonstrate their effectiveness on LLMs. The paper states that this work repurposes backdoors for a constructive purpose: embedding detection signals in the test set.
Backdoors for dataset ownership verification
- Li et al. (2022) and Guo et al. (2023) use backdoor attacks for dataset ownership verification on ImageNet models. The paper notes that ownership verification and contamination detection have different goals (confirming attribution vs. discovering unintended overlap); building on this, this work targets LLMs and a broader range of datasets, and introduces multiple backdoors with random targets to precisely compute the FPR.
Baselines and benchmarks: The paper does not implement comparison baseline methods; the experiments use three datasets: MMLU-Pro, Big-Bench-Hard, and Alpaca. The authors position the method as: not requiring logits, covering both pretraining- and fine-tuning-stage contamination, and providing a bounded FPR guarantee.
How does the paper address this problem?
Before release, samples with multiple backdoors and random targets are mixed in; after release, the number of activated backdoors is counted, and the binomial distribution is used to precisely compute the FPR before determining contamination.
Overall idea: before release, the benchmark developers mix a small number of samples carrying multiple backdoor triggers, with targets sampled at random, into the test set; at evaluation time they count the number of backdoors activated by the model under test, use the property that the activation count of a clean model follows a binomial distribution to compute the false positive rate exactly, and flag contamination only when the count exceeds a threshold. The framework is named DyePack.
Test set preparation (before release)
- Output space partition: partition the output space Y into K mutually disjoint subspaces Y1…YK; multiple-choice benchmarks naturally correspond to the options (10 for MMLU-Pro, 7 for Big-Bench-Hard), and open-ended tasks can be partitioned by verifiable properties (Alpaca is partitioned into 10 subspaces by answer prefix, see Appendix A).
- Random targets: for each backdoor trigger i (B in total), independently and uniformly sample a target subspace Ti ∼ Uniform(1, K), i.e., the answer for each backdoor is randomly assigned, which is the key to the computable FPR.
- Mixed release: the released test set is the union of normal samples and B groups of backdoor samples after shuffling; the experiments assume 90% are original samples and 10% are replaced with backdoor samples. Trigger phrases are generated by GPT-4o to ensure semantic naturalness (prompts see Figure 4 in Appendix C).
Backdoor verification (after release)
- Majority vote to determine activation: for each trigger i, count the output subspace Ki most frequently used by the model on samples containing that trigger; if Ki equals the preset target Ti, the backdoor is recorded as activated. The authors claim that majority voting acts as smoothing, so the framework remains robust even if some samples fail to trigger.
- Counting: the total number of activated backdoors is the sum of the activation indicators of each trigger; the more activations, the stronger the evidence of contamination.
Exact computation of FPR
- Core theorem (Theorem 3.1): for any clean model, after accounting for the randomness of the random targets, the number of activated backdoors follows a binomial distribution Binomial(B, 1/K); the key to the proof is that the clean model is independent of the random targets, so each backdoor activation probability is exactly 1/K.
- Two corollaries: Corollary 3.2 gives a Chernoff-Hoeffding upper bound, supporting the intuition that "more activations mean stronger evidence"; Corollary 3.3 uses the binomial probability mass function to give the exact FPR, and all FPRs in the experiments are computed from it.
- Meaning of the threshold: given a threshold τ, the FPR is the probability that a clean model activates at least τ backdoors, and can serve as an interpretable evidence score attached to each evaluation.
Key implementation points of the experiments
- Contamination simulation: all models are fine-tuned for one epoch on the test set to simulate contamination; Appendix F additionally has a setting that trains on the test set mixed with larger data.
- Evaluation protocol: all questions use zero-shot prompting, without few-shot and CoT; the authors claim this makes anomalously high scores more indicative of data exposure rather than prompt engineering.
- Training configuration (Appendix D Table 4): distributed training on 4 RTX A5000, BF16, AdamW; learning rate varies by model (Llama-2-7B-Chat 2e-5, Llama-3.1-8B-Instruct 1e-5, Mistral-7B-Instruct and Gemma-7B-it 5e-6, Qwen-2.5-7B-Instruct 2e-5).
What experiments did the paper conduct?
On 5 7B/8B models × 3 datasets, all contaminated models were detected, and with 8 backdoors the FPR on MMLU-Pro is as low as 0.000073%.
Experimental setup
- Models under test: Llama-2-7B-Chat, Llama-3.1-8B-Instruct, Mistral-7B-Instruct, Gemma-7B-it, Qwen-2.5-7B-Instruct, 5 in total; the generalization experiment additionally adds Qwen-2.5-32B (LoRA fine-tuned).
- Datasets: MMLU-Pro (excluding samples overlapping with MMLU, taking 7 subcategories, K=10), Big-Bench-Hard (removing 5 categories with inconsistent formats, K=7), Alpaca (sampling 10,000 entries, partitioned into K=10 subspaces by answer prefix).
- Contamination method: fine-tuning for one epoch on the test set; backdoor samples account for 10% of the test set, and targets are uniformly sampled from the output subspaces.
- Metrics: number of activated backdoors / total number of backdoors and the corresponding FPR (computed exactly per Corollary 3.3); Appendix E additionally reports Clean Accuracy and Backdoor Accuracy; the ablation uses backdoor effectiveness (ratk, the ratio of the accuracy gain on backdoor samples to the change in accuracy on normal samples).
- Comparison baselines: the paper does not implement other detection methods for comparison.
- Number of repetitions: not reported in the paper.
Main results
Table 1 (multiple-choice datasets) and Table 2 (Alpaca) report the number of activated backdoors and the FPR for each model at B=1 to 8; the table below takes the B=8 row (format: contaminated model activated/total (FPR) | clean model):
Swipe horizontally to read the table
Dataset Llama-2-7B Llama-3.1-8B Qwen-2.5-7B Mistral-7B Gemma-7B MMLU-Pro contaminated 8/8 (1e-8) 7/8 (7.3e-7) 8/8 (1e-8) 8/8 (1e-8) 8/8 (1e-8) MMLU-Pro clean 1/8 (57.0%) 1/8 (57.0%) 1/8 (57.0%) 1/8 (57%) 0/8 (100%) BBH contaminated 8/8 (1.7e-7) 8/8 (1.7e-7) 8/8 (1.7e-7) 8/8 (1.7e-7) 8/8 (1.7e-7) BBH clean 1/8 (70.9%) 0/8 (100%) 1/8 (70.9%) 0/8 (100%) 0/8 (100%) Alpaca contaminated 4/8 (5.02%) 8/8 (1e-8) 8/8 (1e-8) 8/8 (1e-8) 8/8 (1e-8) Alpaca clean 0/8 (100%) 0/8 (100%) 0/8 (100%) 0/8 (100%) 0/8 (100%) According to Table 1 and Table 2 (BBH is Big-Bench-Hard).
- The authors claim that the framework separates contaminated models from clean models in all settings, and that the FPR is provably bounded; the summary figures given in the abstract are: with 8 backdoors, the guaranteed FPR for detecting all contaminated models on MMLU-Pro is as low as 0.000073%, on Big-Bench-Hard 0.000017%, and on Alpaca with 6 backdoors 0.127%.
- Value of multiple backdoors: on MMLU-Pro a single backdoor can achieve an FPR of at most 10%, while 8 backdoors can reduce the FPR for flagging all contaminated models to 7.3e-7, which the authors claim is more than 10^5 times smaller.
- Exception: on Alpaca, Llama-2-7B activates only 2/4 (5.23%) and 4/8 (5.02%) at B=4 and B=8, with an FPR higher than other models; Appendix E shows that several models have Backdoor Accuracy below 100% in some settings (e.g., Llama-3.1-8B on MMLU-Pro with B=8 is 85.96%), and the authors claim that the majority voting mechanism keeps the framework robust when some triggers fail.
Ablation on dataset scale and number of backdoors
- What was tested: 21 sub-benchmarks of different scales (about 305 to 4127 entries) were constructed by randomly merging the 7 categories of MMLU-Pro, to examine the effect of dataset size on FPR and ratk (Figure 2, Llama-2-7B-Chat; other models see Figures 7–10 in Appendix G).
- Results: the authors claim that with a fixed number of backdoors, the FPR decreases as the dataset grows and ratk increases as the dataset grows, and the two are negatively correlated; the more backdoors, the flatter the decrease of FPR with scale.
- Optimal number of backdoors: Figure 3 shows that within the covered range of scales, the number of backdoors that minimizes the FPR generally increases with dataset size (with a few noisy points); the authors accordingly suggest using more backdoors for large datasets and fewer for small datasets.
Generalization to larger models
- What was tested: Qwen-2.5-32B was fine-tuned with LoRA, and the main experiments were repeated on the three datasets (Table 3).
- Results: the contaminated model activates 8/8 on MMLU-Pro with B=8 (FPR 1e-8), and the clean model 3/8 (3.8%); on Big-Bench-Hard and Alpaca with B=8, the contaminated model is 8/8 (1.7e-7 and 1e-8 respectively), and the clean model 0/8.
- Authors' interpretation: in theory the FPR guarantee is independent of model scale (Theorem 3.1 does not assume scale or architecture); the authors also believe that larger models more easily memorize backdoor shortcuts, so DyePack may be more effective on large models, which is their expectation rather than a conclusion verified in this paper.
Mixed-data training and impact on evaluation quality
- Mixed training (Appendix F, Table 6): Mistral-7B and Gemma-7B were trained on 1.5k MMLU-Pro entries (as Drelease) + 5.2k Big-Bench-Hard entries, 1.6M tokens in total, with the MMLU-Pro subset as the detection target; with B=8, Mistral-7B activates 8/8 (1e-8) and Gemma-7B activates 5/8 (4.3e-4), and the authors claim it remains effective in the harder setting.
- Evaluation quality (Appendix I): the authors theoretically argue that a clean model's expected accuracy on backdoor samples is 1/K; in the Appendix E table, clean models achieve about 10% on MMLU-Pro backdoor samples and about 14.3% on Big-Bench-Hard, consistent with this.
- Ranking stability (Appendix I): the authors claim that among 100 pairwise model comparisons (two datasets × 5 B values × 10 model pair combinations), the minimum injection rate needed to flip any ranking is about 28.1%, far higher than the proportion they actually use; they also note that leaderboard operators know which samples are backdoors and can directly report clean accuracy.
Other ablations and analyses
- Changes in Clean Accuracy (Appendix E, Table 5): after fine-tuning for one epoch, Llama-2-7B on MMLU-Pro rises from 16.11 to about 57.95–65.66 (varying with B), and on Big-Bench-Hard from 24.98 to about 60.30–62.43, which the authors use to illustrate the inflation caused by contamination.
- Negative ratk data points (Appendix G): Llama-3.1-8B-Instruct and Qwen-2.5-7B-Instruct already have relatively high clean accuracy, and in some settings the clean accuracy drops slightly after fine-tuning, resulting in negative ratk; the authors remove these points from the figures.
- Figure 6 heatmap (Appendix H): the authors claim that for small datasets the FPR increases as the number of backdoors increases, while for large datasets it decreases as the number of backdoors increases.
What are some points that can be further explored?
The authors state that detection ability depends on the success of the backdoor attack itself and that the method is only for future benchmarks; the experiments cover 7B/8B models and 1.6M token mixed training.
Limitations noted by the authors and future directions
- Depends on the success of the backdoor attack (Section 7 Limitations): the ability to detect contamination ultimately depends on whether the underlying backdoor attack succeeds, which is not entirely within the control of the DyePack framework.
- Does not guarantee detection of all contaminated models (Section 7): the authors do not claim that backdoor attacks are unavoidable or undefendable, and the method does not guarantee detection of all contaminated models; the dynamics of backdoor attack and defense are outside the scope of this paper.
- Only for future benchmarks (Section 7): DyePack is a proactive tool for future benchmark developers and cannot be retroactively applied to existing benchmarks that have already been released without protection mechanisms.
- Larger-scale mixed training left for the future (Appendix F): the authors acknowledge that extending the mixed training experiments to corpora of 10B–20B token scale could provide more understanding, but they lack the corresponding computational resources.
Scope of experimental coverage
- Models under test: the main experiments use 5 open-source 7B/8B models (Llama-2-7B-Chat, Llama-3.1-8B-Instruct, Mistral-7B-Instruct, Gemma-7B-it, Qwen-2.5-7B-Instruct); the only larger model is Qwen-2.5-32B, fine-tuned with LoRA (Section 4.4).
- Datasets: 7 subcategories of MMLU-Pro, 22 categories of Big-Bench-Hard, and 10,000 sampled entries of Alpaca; the scale ablation uses 21 merged subsets (about 305–4127 entries).
- Contamination simulation: fine-tuning for one epoch on the test set only; mixed-data training covers only 1.6M tokens (1.5k MMLU-Pro + 5.2k Big-Bench-Hard), and only Mistral-7B and Gemma-7B were tested (Appendix F).
- Backdoor implementation: trigger phrases are generated by GPT-4o, backdoor samples account for 10% of the test set, and the number of backdoors B takes values 1, 2, 4, 6, 8; the paper does not report the number of experimental repetitions.
- Comparison: the paper does not experimentally compare DyePack with other contamination detection methods; the shortcomings of related methods are discussed only in Related Work.
Summarize the main content of the paper
DyePack uses multiple backdoors with random targets to turn test set contamination detection into a decision problem with an exactly computable FPR, and in the experiments it detects all contaminated models.
A paper about benchmark protection: it turns backdoor attacks into a tool for detecting LLM test set contamination, aimed at future benchmark developers.
- Problem to solve: the test sets of open benchmarks may be used (intentionally or unintentionally) for training, and contaminated models obtain inflated scores; existing detection methods either rely on vendor transparency, require logits, or fail against contamination at the fine-tuning stage, and most have no false positive rate guarantee.
- Key points of the method: before release, replace 10% of test samples with backdoor samples carrying trigger phrases, with each backdoor's target independently and uniformly sampled from K output subspaces; at evaluation time, count the number of activated backdoors by majority vote. The activation count of a clean model follows Binomial(B, 1/K) (Theorem 3.1), so the FPR can be computed exactly before flagging any model (Corollary 3.3), and detection requires only query access.
- Main results:
- On MMLU-Pro and Big-Bench-Hard, with 8 backdoors all 5 contaminated 7B/8B models were detected, with guaranteed FPRs as low as 0.000073% and 0.000017% respectively (abstract; Table 1).
- On the Alpaca open-ended generation task, 6 backdoors detected all contaminated models, with FPR 0.127% (Table 2).
- A single backdoor on MMLU-Pro has an FPR of at most 10%; 8 backdoors reduce the FPR for flagging all contaminated models to 7.3e-7 (Table 1).
- Also detected on the LoRA fine-tuned Qwen-2.5-32B: on MMLU-Pro with B=8, contaminated 8/8 (1e-8), clean 3/8 (3.8%) (Table 3).
- Appendix I: among 100 pairwise comparisons, the minimum injection rate needed to flip a ranking is about 28.1%, and the authors state that the actual amount used is far below this.
- Authors' conclusions and implications: the authors claim that DyePack covers both pretraining and fine-tuning stage contamination, does not require logits, and provides interpretable evidence of contamination, and can serve as a defense to protect the integrity of future benchmarks; they also acknowledge that detection depends on the success of the backdoor attack itself, does not guarantee detection of all contaminated models, and cannot be retroactively applied to already released benchmarks.