igergov.com
← Writing
PublicationLanguage modelsSecurity · 3 min · BG EN ES DE

How to tell whether a model has learned from your data

A hidden watermark in the fine-tuning data of a language model, and an honest measure of how far you can rely on it.

The problem

Companies fine-tune language models on their own texts: contracts, documentation, correspondence with customers. This data is valuable, and once the model is trained it is hard to prove where it learned what it knows. The data owner needs a way to check later whether a given model was trained on it.

What we did

We proposed a corpus-level watermark that is embedded in the dataset before training. In every text the choice between synonyms is tilted slightly according to a secret key, and the watermark encodes a message of a few bits with an error-correcting code. Detection needs only the key and works through a statistical test (generalized likelihood ratio) whose p-values are calibrated with permutations. We added a permutation test with 5,000 repetitions, confidence intervals and a power analysis.

What it showed

The paper also reports honestly the results that do not favour the method:

  • on short texts of around 100 words the channel works, but it is too weak to be detected reliably;
  • when generating with Mistral 7B across 12 configurations and 12,720 texts, detection is 0% at very high text quality (around 99.8%);
  • in limited baseline cases there is positive detection: 8.9% offline, 5.0% with Mistral 7B and 3.0% with Llama2-13B.

The limitations and ethical use are described in detail, together with the directions towards stronger semantic channels and model-based detectors.

Why then

The paper came out in September 2025, when fine-tuning models on in-house data became widespread, and the question of whose data a model was trained on became a practical one for many organisations. It gives a method and, just as importantly, a clear measure of how far you can rely on it.

The publication

Ivo Gergov, Georgi Tsochev. Watermarking Fine-Tuning Datasets for Robust Provenance. Applied Sciences 15, 10457 (MDPI, 2025). doi:10.3390/app151910457