Dataset Protection via Watermarked Canaries in Retrieval-Augmented LLMs

Yepeng Liu, Xuandong Zhao, Dawn Song, Yuheng Bu · Submission to ICLR 2026 · Rejected

TL;DR

CanaryTrace prevents proprietary datasets from being secretly ingested into Retrieval-Augmented Generation (RAG) knowledge bases without authorization. Instead of altering or watermarking every document in an IP dataset, CanaryTrace leaves the original data completely untouched and injects a handful of synthetic, watermarked "canary" documents that share the dataset's topical style but contain unique fictional entities. When a suspected black-box RAG system is queried about these entities, it retrieves the canaries and leaks the embedded watermark into its answers, enabling provable ownership detection with as few as 12 queries.

What Problem Does This Paper Address?

Retrieval-Augmented Generation (RAG) enriches large language models with external text corpora. However, dataset creators have little recourse when a third party incorporates their proprietary or copyrighted data into a RAG knowledge base without permission.

Prior dataset membership inference techniques suffer from major trade-offs:

  • Paraphrase-based watermarking rewrites every document, degrading text quality, introducing factual errors, and failing completely on low-entropy domains (e.g., source code, mathematical formulas, poetry).
  • Poisoning/backdoor attacks degrade dataset utility or make malicious alterations.
  • Logit-based watermarking requires white- or gray-box access to the model's next-token probabilities, which commercial black-box APIs do not provide.

The authors ask: Can we reliably detect unauthorized dataset usage through black-box queries without modifying a single word of the original proprietary corpus?

Methods

CanaryTrace operates in two phases: Protection and Detection.

[Sample d ∈ D_IP] 
       │
       ▼
Extract Attributes (topic, style, word count)
       │
       ▼
Synthesize Fictional Entities & Descriptions
       │
       ▼
Generate Canary Document via Watermarked LLM (Zhao et al.) 
  + Targeted Black-Box Query
       │
       ▼
Insert Canaries into D_IP (|D_s| ≪ |D_IP|)
       │
       ▼ (if stolen by Malicious RAG)
Query RAG ──> Concatenate Responses ──> Watermark Z-Score Test
  1. Canary Dataset Synthesis:
  2. Attribute Extraction: GPT-4o-mini extracts key attributes (topic, subtopic, tone, word count) from randomly sampled documents in the IP dataset.
  3. Entity & Description Synthesis: To prevent semantic collision with existing web corpora, the LLM invents novel, plausible fictional entities (e.g., synthetic drug or supplement names) and synthetic background descriptions conditioned on the extracted attributes.
  4. Watermarked Article Synthesis: A watermarked generator (Llama-3.1-70B-Instruct using the Zhao et al. fixed green/red token partitioning) writes the canary article.
  5. Query Generation: An LLM formulates a question answerable only by reading that specific canary document.
  6. Canary Pre-filtering: Canaries are audited against automated fact-checkers (e.g., Gemini-2.5-Flash-Lite) to discard obvious hallucinations and retain only stealthy, realistic texts.
  7. Black-Box Membership Detection:
  8. The data owner issues $N$ targeted questions to the suspected RAG pipeline.
  9. Because the canary contains unique entities, the retriever pulls it into context, and the generator naturally reproduces green-list tokens in its response.
  10. The owner concatenates the model’s textual responses, calculates a green-token $z$-score statistic, and conducts a formal hypothesis test with bounded false-alarm guarantees.

Datasets

The authors evaluate CanaryTrace across several retrieval and downstream tasks:

  • Base Knowledge Corpus: MS MARCO (200,000 documents; scaled to 2,000,000 in ablations) to represent standard web-scale retrieval.
  • IP Datasets (Protected):
  • NFCorpus: Bio-medical information retrieval benchmark.
  • CQADupStack-Mathematica: A specialized, low-entropy technical Q&A dataset where paraphrasing is typically destructive.
  • Downstream Utility Benchmarks:
  • DROP: Reading comprehension requiring discrete numerical and logical reasoning.
  • Chinese-Poem: Tang dynasty poetry, used to test whether protection degrades stylistically delicate content.

Key Insights and Ideas

  • Zero Perturbation of Original Data: Because only a tiny fraction of synthetic canaries ($|D_s| \ll |D_{\text{IP}}|$) are appended, the original IP documents experience zero distortion ($\text{MAUVE} = 0.999$, $\text{BLEU} = 0.997$).
  • Fictional Entities as "Semantic Magnets": Real-world entities suffer from semantic overlap with existing background corpora. Synthetic entities create isolated embeddings that act like retrieval magnets—achieving 100% target retrieval accuracy compared to ~89% for unmodified original documents.
  • Watermark Diffusion Through Generation: Even though the generator is unwatermarked, conditioning on a green-token-biased context causes green tokens to persist into the black-box generation.
  • Robust Against Partial Theft: Even if an adversary steals only 20% of the protected dataset, inserting just 0.054% canaries guarantees (with 99% probability) that enough canaries are captured to confirm unauthorized use.

Key Results

  • Superior Detectability with Low Quota: On NFCorpus, CanaryTrace reaches 100% TPR @ 1% FPR using only 12 queries. In comparison, the full-dataset paraphrasing baseline (Ward) achieves only 79.2% TPR at the same quota.
  • Unlocking Low-Entropy Protection: On the Mathematica dataset, Ward collapses (0.049% TPR @ 1% FPR) because technical formulas cannot be paraphrased with sufficient redundancy. CanaryTrace achieves 100% TPR @ 1% FPR in just 10 queries.
  • Preserved Downstream Accuracy: On DROP, CanaryTrace maintains the original 0.772 score (Ward drops to 0.767). On Chinese poetry, where wording alterations destroy poetic meter and tone, CanaryTrace maintains the original 0.908 appreciation score, while Ward plummets to 0.719.
  • Multiple Queries per Canary: Querying a single canary 14 times with distinct questions allows 100% detection with as few as 5 inserted canaries.

Limitations and Future Work

  • Fact-Checking Defenses: If an adversary runs rigorous external fact-checking or web-search-backed entity verification before indexing, fictional canaries could be flagged (though the authors show ~23.8% survive Gemini-2.5-Flash-Lite fact-checking filters).
  • Dependency on Context Utilization: If a RAG system employs aggressively constrained system prompts or extreme extractive summarizers, watermark token diffusion into the final response could be reduced (though tests with strict prompts showed 100% TPR remained achievable with 14 queries).
  • Retriever Architecture Reliance: Canaries must reliably embed close to the generated query; while validated across Contriever and ANCE, drastic changes in embedding spaces or multi-modal RAG settings remain open for exploration.

Summary updated

BibTeX
@inproceedings{liu2025dataset,
  author = {Yepeng Liu and Xuandong Zhao and Dawn Song and Yuheng Bu},
  title = {{Dataset Protection via Watermarked Canaries in Retrieval-Augmented LLMs}},
  booktitle = {R2-FM @ ICML},
  year = {2025},
  url = {https://openreview.net/forum?id=sxdaF5I6rg},
}
Figure