# US 2021/0240803 A1 · Method for watermarking a machine learning model

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0240803 A1
- Document ID: US20210240803A1
- Status: Published application
- Kind: A1
- Application number: 16/779,737
- Filed: 2020-02-03
- Published: 2021-08-05
- Earliest claimed: 2020-02-03
- Assignees: NXP B.V.
- Applicants: NXP B.V.
- Inventors: Wilhelmus Petrus Adrianus Johannus MICHIELS
- Web page: https://patentgrep.com/patent/US20210240803A1

## CPC

- G06F 21/16: Program or content traceability, e.g. by watermarking
- G06N 3/02: Neural networks
- G06N 3/0464: Convolutional networks [CNN, ConvNet]
- G06N 3/08: Learning methods
- G06N 3/09: Supervised learning
- G06N 5/04: Inference or reasoning models
- G06N 20/00: Machine learning
- G06N 7/01: Probabilistic graphical models, e.g. probabilistic networks
- G06N 20/10: using kernel methods, e.g. support vector machines [SVM]
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

A method is provided for watermarking a machine learning model. In the method, a first subset of a labeled set of ML training samples is selected. The first subset is of a predetermined class of images. A first pixel pattern is selected and inserted into each sample of the first subset. One or more of a location, position, orientation, and transformation of the first pixel pattern is varied for each of the samples. Each sample of the first subset is relabeled to have a different label than the original label. The ML model is trained with the labeled set of ML training samples and the first subset of relabeled ML training samples. To detect the watermark, a second subset of training samples is selected, and the first pixel pattern is inserted into each sample. The second subset is used during inference operation to detect the presence of the watermark.

## Claims

### Claim 1

A method for watermarking a machine learning model (ML), the method comprising:
selecting a labeled set of ML training samples to use for training the ML model;
selecting a first subset of the labeled set of ML training samples for use in generating a watermark in the ML model, wherein the first subset is of a predetermined class of images;
selecting a first pixel pattern;
inserting the first pixel pattern into each sample of the first subset of the labeled ML training data samples, wherein one or more of a location and transformation of the first pixel pattern is varied for each of the samples of the first subset;
relabeling each sample of the first subset of labeled ML training data samples to have a different label than the first subset had before relabeling; and
training the ML model with the labeled set of ML training samples and the first subset of relabeled ML training samples having the first pixel pattern to produce a trained and watermarked ML model.

### Claim 2 (depends on 1)

The method of claim 1, wherein inserting the first pixel pattern into each sample of the first subset of the labeled ML training data samples further comprises varying one or more of a size, rotation, and transparency of the first pixel pattern for each of the samples of the first subset.

### Claim 3 (depends on 1)

The method of claim 1, wherein the ML model includes a neural network.

### Claim 4 (depends on 1)

The method of claim 1, further comprising:
selecting a second subset of samples for use in detecting the watermark;
inserting the first pixel pattern into each sample of the second subset, wherein the pixel pattern is inserted into a same location of each sample of the second subset; and
during inference operation of a ML model to be tested for presence of the watermark, inputting the second subset having the first pixel pattern into the ML model being tested, wherein the watermark is determined to be present in the ML model being tested if the ML model outputs results consistent with the training to create the watermark.

### Claim 5 (depends on 4)

The method of claim 4, wherein inserting the first pixel pattern into each sample of the second subset further comprises varying one or more of a scale, rotation, transparency, and the location of the first pixel pattern for each of the samples of the second subset.

### Claim 6 (depends on 5)

The method of claim 5, wherein inserting the first pixel pattern into each sample of the first subset further comprises transforming the first pixel pattern by a first range of locations, wherein a base location is determined randomly, and the first range is a predetermined offset from the base location.

### Claim 7 (depends on 6)

The method of claim 6, wherein the location of the pixel pattern of the second subset is varied by a second range of locations smaller than the first range of locations.

### Claim 8 (depends on 1)

The method of claim 1, wherein relabeling each sample of the first subset of labeled ML training data samples to have a different label than the labeled set of ML training samples further comprises relabeling each sample of the first subset to cause the ML model to output a different result during inference operation of the ML model than an outputted result of the labeled set of ML training samples.

### Claim 9 (depends on 1)

The method of claim 1, further comprising:
selecting a third subset of samples of the predetermined class of images;
inserting a third pixel pattern into each sample of the third subset; and
training the ML model with the third subset, wherein labels on the third subset are not changed from labels of the predetermined class of images.

### Claim 10 (depends on 9)

The method of claim 9, wherein inserting a third pixel pattern into each sample of the third subset further comprises inserting a plurality of pixel patterns into the third subset, wherein the third subset is not relabeled.

### Claim 11

A method for watermarking a machine learning model (ML), the method comprising:
selecting a labeled set of ML training samples of a predetermined class to train the ML model;
selecting a first subset of the labeled set of ML training samples for use in generating a watermark into the ML model;
selecting a first pixel pattern;
inserting the first pixel pattern into each sample of the first subset of the labeled ML training data samples, wherein one or more of a location and transformation of the first pixel pattern is varied for each of the samples of the first subset, wherein a range of locations is determined from a base location and an offset from the base location, and wherein the base location is determined randomly;
relabeling each sample of the first subset of labeled ML training data samples to have a different label than the first subset had before relabeling;
training the ML model with the labeled set of ML training samples and the first subset of relabeled ML training samples having the first pixel pattern to produce a trained ML model;
selecting a second subset of samples for use in detecting the watermark;
inserting the first pixel pattern into each sample of the second subset, wherein the first pixel pattern is inserted into a same location of each sample of the second subset; and
during inference operation of an ML model to be tested for the watermark, inputting the second subset having the first pixel pattern into the ML model being tested, wherein the watermark is determined to be present in the ML model being tested if the ML model outputs results consistent with the training to create the watermark.

### Claim 12 (depends on 11)

The method of claim 11, wherein inserting the first pixel pattern into each sample of the first subset further comprises varying one or more of a size, rotation, and transparency, and the location of the first pixel pattern for each of the samples of the first subset.

### Claim 13 (depends on 12)

The method of claim 12, wherein inserting the first pixel pattern into the same location of each sample of the second subset further comprises varying one or more of the location, size, rotation, and transparency of the first pixel pattern of each of the second samples by a smaller variation than the variation of first pixel patterns of the first subset.

### Claim 14 (depends on 11)

The method of claim 11, wherein the ML model includes a neural network.

### Claim 15 (depends on 11)

The method of claim 11, wherein the second subset includes at least some of the samples used for the first subset.

### Claim 16 (depends on 11)

The method of claim 11, wherein the labeled set of ML training samples comprises images.

### Claim 17 (depends on 11)

The method of claim 11, wherein relabeling each sample of the first subset of labeled ML training data samples to have a different label than the labeled set of ML training samples further comprises relabeling each sample of the first subset to cause the ML model to output a different result during inference operation of the ML model than an outputted result of the labeled set of ML training samples.

### Claim 18 (depends on 11)

The method of claim 11, further comprising:
selecting a third subset of the predetermined class of images;
inserting a third pixel pattern into each sample of the third subset; and
training the ML model with the third subset, wherein labels on the third subset are not changed from labels of the predetermined class of images.

### Claim 19 (depends on 18)

The method of claim 18, wherein inserting a third pixel pattern into each sample of the third subset further comprises inserting a plurality of pixel patterns into the third subset.

### Claim 20 (depends on 11)

A computer program stored on a non-transitory medium comprising executable instructions that, when executed, carry out or control the method of claim 11.

### Claim 21

A method for watermarking a machine learning (ML) model, the method comprising:
providing a labeled set of ML training samples to use for training the ML model;
selecting a first subset of the labeled set of ML training samples for use in generating a watermark in the ML model, wherein the first subset is of a predetermined class of images;
providing a first pixel pattern for the watermark;
inserting the first pixel pattern into each sample of the first subset of the labeled ML training data samples;
relabeling each sample of the first subset of the labeled set of ML training samples with a different label;
selecting a second subset of samples from the ML training samples in the predetermined class of images;
providing a plurality of pixel patterns, wherein each pixel pattern of the plurality of pixel patterns is different from the first pixel pattern in at least one aspect;
inserting a pixel pattern of the plurality of pixel patterns in each sample of the second subset of samples; and
training the ML model with the labeled set of ML training samples to produce a trained and watermarked ML model.

### Claim 22 (depends on 21)

The method of claim 21, wherein inserting a pixel pattern of the plurality of pixel patterns in each sample of the second subset of samples further comprises varying one or more of a scale, rotation, transparency, and the location of the first pixel pattern for each of the samples of the first subset.

### Claim 23 (depends on 21)

The method of claim 21, wherein inserting the first pixel pattern into each sample of the first subset of the labeled ML training data samples further comprises varying one or more of a scale, rotation, transparency, and the location of the first pixel pattern for each of the samples of the first subset.

### Claim 24 (depends on 21)

The method of claim 21, wherein inserting a pixel pattern of the plurality of pixel patterns in each sample of the second subset of samples further comprises training the ML model without relabeling the samples of the second subset of samples.
