# US 12,585,887 B2 · Dataset generation and scalable training pipeline for machine learning based multi-faceted harmful content sanitization in large language models

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

- Number: US 12,585,887 B2
- Document ID: US12585887B2
- Status: Granted
- Kind: B2
- Application number: 18/418,039
- Filed: 2024-01-19
- Published: 2025-07-24
- Granted: 2026-03-24
- Earliest claimed: 2024-01-19
- Assignees: Intuit Inc.
- Applicants: Intuit Inc.
- Inventors: Hector Carrillo; Tharathorn Rimchala; Royston Soares
- Web page: https://patentgrep.com/patent/US12585887B2

## CPC

- G06F 40/40: Processing or translation of natural language (natural language analysis G06F40/20; semantic analysis G06F40/30)
- G06F 40/30: Semantic analysis
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A system for training and deploying a sanitizer model of a large language model (LLM) to sanitize the harmful language text. The system generates paired data sets for training using LLM techniques. Training includes a first training phase using a paired dataset to predict the benign language text in the paired dataset based on loss of information computed between the benign language text in the paired dataset and the sanitized language text. Training also includes a second training phase using a harm model that computes a harm score of the LLM prediction by adjusting the trained sanitizing step to reduce the harm score for subsequent LLM responses.

## Claims

### Claim 1

A method performed by a processor, the method comprising:
generating a paired dataset for training a sanitizer model of large language model (LLM) responses, the paired dataset including benign language text and harmful language text;
executing a sanitizing step in the sanitizer model of the LLM to sanitize the harmful language text in the paired dataset to produce a sanitized language text that predicts the benign language text in the paired dataset;
training the sanitizing step of the sanitizer model of the LLM, during a first training phase prior to deploying the sanitizer model using the paired dataset, to predict the benign language text in the paired dataset based on loss of information computed between the benign language text in the paired dataset and the sanitized language text; and
refining the trained sanitizing step of the sanitizer model of the LLM, during a second training phase after the deploying of the sanitizer model, wherein the refining further trains the sanitizer model using a harm model that computes a harm score indicating an amount of harmfulness of the LLM predictions, by adjusting weights of the trained sanitizing step based on a difference between the harm score of the harmful language text and the harm score of the sanitized language text to reduce the harm score for subsequent LLM responses.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
training the sanitizing step of the sanitizer model of the LLM, during the first training phase using style loss of the prediction, to predict the benign language text in the paired dataset while reducing style loss.

### Claim 3 (depends on 1)

The method of claim 1, further comprising:
training the sanitizing step of the sanitizer model of the LLM, during the first training phase using semantic preservation loss of the prediction, to predict the benign language text in the paired dataset while reducing semantic preservation loss.

### Claim 4 (depends on 1)

The method of claim 1, further comprising:
training the sanitizing step of the sanitizer model of the LLM, during the first training phase using fluency loss of the prediction, to predict the benign language text in the paired dataset while reducing fluency loss.

### Claim 5 (depends on 1)

The method of claim 1, further comprising:
computing the loss of information based on a difference between the benign language text in the paired dataset and the sanitized language text, and additional loss parameters including at least one of style loss, semantic preservation loss and fluency loss.

### Claim 6 (depends on 1)

The method of claim 1, further comprising:
refining the trained sanitizing step of the sanitizer model of the LLM, during the second training phase, by adjusting the trained sanitizing step to reduce style loss, semantic preservation loss and fluency loss.

### Claim 7 (depends on 1)

The method of claim 1, further comprising:
training the sanitizing step of the sanitizer model of the LLM, during the first training phase using the paired dataset, prior to launching the LLM for execution by end users.

### Claim 8 (depends on 1)

The method of claim 1, further comprising:
training the sanitizing step of the sanitizer model of the LLM, during the second training phase using the paired dataset, after launching the LLM for execution by end users.

### Claim 9 (depends on 1)

The method of claim 1, further comprising:
generating the harmful language text in the paired dataset by adding harmful language text to the benign language text.

### Claim 10 (depends on 5)

The method of claim 5, further comprising:
computing the semantic preservation loss based on cosine similarity between the harmful language text and the sanitized language text; and
computing the fluency loss based on a BART score of the sanitized language text.

### Claim 11

A system comprising:
a non-transitory storage medium storing computer program instructions; and
one or more processors configured to execute the computer program instructions to cause operations comprising:
generating a paired dataset for training a sanitizer model of large language model (LLM) responses, the paired dataset including benign language text and harmful language text;
executing a sanitizing step in the sanitizer model of the LLM to sanitize the harmful language text in the paired dataset to produce a sanitized language text that predicts the benign language text in the paired dataset;
training the sanitizing step of the sanitizer model of the LLM, during a first training phase prior to deploying the sanitizer model using the paired dataset, to predict the benign language text in the paired dataset based on loss of information computed between the benign language text in the paired dataset and the sanitized language text; and
refining the trained sanitizing step of the sanitizer model of the LLM, during a second training phase after the deploying of the sanitizer model, wherein the refining further trains the sanitizer model using a harm model that computes a harm score indicating an amount of harmfulness of the LLM predictions, by adjusting weights of the trained sanitizing step based on a difference between the harm score of the harmful language text and the harm score of the sanitized language text to reduce the harm score for subsequent LLM responses.

### Claim 12 (depends on 11)

The system of claim 11, wherein the operations further comprise:
training the sanitizing step of the sanitizer model of the LLM, during the first training phase using style loss of the prediction, to predict the benign language text in the paired dataset while reducing style loss.

### Claim 13 (depends on 11)

The system of claim 11, wherein the operations further comprise:
training the sanitizing step of the sanitizer model of the LLM, during the first training phase using semantic preservation loss of the prediction, to predict the benign language text in the paired dataset while reducing semantic preservation loss.

### Claim 14 (depends on 11)

The system of claim 11, wherein the operations further comprise:
training the sanitizing step of the sanitizer model of the LLM, during the first training phase using fluency loss of the prediction, to predict the benign language text in the paired dataset while reducing fluency loss.

### Claim 15 (depends on 11)

The system of claim 11, wherein the operations further comprise:
computing the loss of information based on a difference between the benign language text in the paired dataset and the sanitized language text, and additional loss parameters including at least one of style loss, semantic preservation loss and fluency loss.

### Claim 16 (depends on 11)

The system of claim 11, wherein the operations further comprise:
refining the trained sanitizing step of the sanitizer model of the LLM, during the second training phase, by adjusting the trained sanitizing step to reduce style loss, semantic preservation loss and fluency loss.

### Claim 17 (depends on 11)

The system of claim 11, wherein the operations further comprise:
training the sanitizing step of the sanitizer model of the LLM, during the first training phase using the paired dataset, prior to launching the LLM for execution by end users.

### Claim 18 (depends on 11)

The system of claim 11, wherein the operations further comprise:
training the sanitizing step of the sanitizer model of the LLM, during the second training phase using the paired dataset, after launching the LLM for execution by end users.

### Claim 19 (depends on 11)

The system of claim 11, wherein the operations further comprise:
generating the harmful language text in the paired dataset by adding harmful language text to the benign language text.

### Claim 20 (depends on 15)

The system of claim 15, wherein the operations further comprise:
computing the semantic preservation loss based on cosine similarity between the harmful language text and the sanitized language text; and
computing the fluency loss based on a BART score of the sanitized language text.
