# US 12,112,130 B2 · Counterfactual text stylization

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

- Number: US 12,112,130 B2
- Document ID: US12112130B2
- Status: Granted
- Kind: B2
- Application number: 17/518,471
- Filed: 2021-11-03
- Published: 2023-05-04
- Granted: 2024-10-08
- Earliest claimed: 2021-11-03
- Assignees: Adobe Inc.
- Applicants: Adobe Inc.
- Inventors: Sharmila Reddy Nangi; Niyati Himanshu Chhaya; Hyman Chung; Harshit Nyati; Nikhil Kaushik; Sopan Khosla
- Web page: https://patentgrep.com/patent/US12112130B2

## CPC

- G06F 40/253: Grammatical analysis; Style critique
- G06F 3/04847: Interaction techniques to control parameter settings, e.g. interaction with sliders or dials
- G06F 40/151: Transformation
- G06F 40/16: Automatic learning of transformation rules, e.g. from examples
- G06F 40/166: Editing, e.g. inserting or deleting
- G06F 40/216: using statistical methods
- G06F 40/30: Semantic analysis
- G06F 40/44: Statistical methods, e.g. probability models
- G06F 40/56: Natural language generation
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A text style transfer system is described that generates different stylized versions of input text by rewriting the input text according to a target style. To do so, the text style transfer system employs a variational autoencoder to derive separate content and style representations for the input text, where the content representation specifies semantic information conveyed by the input text and the style representation specifies one or more style attributes expressed by the input text. The style representation using counterfactual reasoning to identify different transfer strengths for applying the target style to the input text. Each transfer strength represents a minimum change to the input text that achieves a different expression of the target style. The transfer strengths are then used to generate style representation variants, which are each concatenated with the content representation of the input text to generate the plurality of different stylized versions of the input text.

## Claims

### Claim 1

A method comprising:
receiving, by a processing device, input text and an indication of a target style in which the input text is to be rewritten;
generating, by the processing device, a content representation specifying semantic information conveyed by the input text and a style representation specifying one or more style attributes expressed by the input text by encoding text elements of the input text into a latent vector space that indicates the content representation and the style representation;
generating, by the processing device using a neural network, a plurality of stylized versions of the input text, each of the plurality of stylized versions of the input text including different positions of punctuation relative to the text elements of the input text, and being generated by:
identifying a plurality of strengths for applying the target style to the style representation of the input text by processing the style representation for the input text using a multi-layer perceptron classifier configured to generate versions of the style representation that minimize differences from the style representation and express a different magnitude of the target style; and
applying each of the plurality of strengths of the target style to the style representation for the input text; and
outputting, by the processing device, a display of the plurality of stylized versions of the input text.

### Claim 2 (depends on 1)

The method of claim 1, wherein generating the plurality of stylized versions of the input text is performed independent of a parallel corpus of text that contrasts a style of the input text with the target style.

### Claim 3 (depends on 1)

The method of claim 1, wherein the target style defines at least one of a sentiment, a formality, or an excitement level to be conveyed by rewriting the input text in a different style.

### Claim 4 (depends on 1)

The method of claim 1, wherein generating the plurality of stylized versions of the input text is performed independent of an annotation identifying a style of the input text.

### Claim 5 (depends on 1)

The method of claim 1, further comprising generating a user interface control configured to receive input designating a strength for applying the target style to the input text and visually distinguishing one of the plurality of stylized versions of the input text that corresponds to the designated strength.

### Claim 6 (depends on 1)

The method of claim 1, wherein generating the content representation and the style representation is performed using a variational autoencoder.

### Claim 7 (depends on 6)

The method of claim 6, wherein the variational autoencoder is configured using a transformer-based architecture.

### Claim 8 (depends on 1)

The method of claim 1, wherein generating the content representation is performed using a first multitask loss and a first adversarial loss and generating the style representation is performed using a second multitask loss and a second adversarial loss.

### Claim 9 (depends on 1)

The method of claim 1, wherein generating the plurality of stylized versions of the input text comprises maintaining the content representation, generating a plurality of style representation variants by applying different strengths of the target style to the style representation; and concatenating the content representation with individual ones of the plurality of the style representation variants.

### Claim 10 (depends on 1)

The method of claim 1, further comprising determining, by a counterfactual reasoning module, a plurality of probability values that correspond to a minimum change to the input text that results in output text expressing a different magnitude of the target style using a counterfactual generation loss, wherein the each of the plurality of the strengths used to generate the plurality of stylized versions of the input text are defined by one of the plurality of probability values.

### Claim 11

A system comprising:
a memory component; and
a processing device coupled to the memory component, the processing device to perform operations comprising:
disentangling a style representation and a content representation for input text by encoding text elements of the input text into a latent vector space that indicates the content representation and the style representation, the content representation specifying a semantic meaning of the input text and the style representation specifying one or more style attributes expressed by the input text;
generating a plurality of variants of the style representation for the input text by:
identifying a plurality of strengths for applying a target style to the style representation of the input text by processing the style representation for the input text using a multi-layer perceptron classifier configured with an objective to generate versions of the style representation that minimize differences from the style representation and express a different magnitude of the target style; and
outputting the plurality of variants of the style representation in a target style embedding by applying each of the plurality of strengths of the target style to the style representation for the input text;
generating stylized text that includes a plurality of stylized versions of the input text, each of the plurality of stylized versions of the input text including different positions of punctuation relative to the text elements of the input text, and being generated by concatenating one of the plurality of variants of the style representation with the content representation; and
outputting a display of the plurality of stylized versions of the input text.

### Claim 12 (depends on 11)

The system of claim 11, further comprising training the multi-layer perceptron classifier to identify the plurality of strengths on disentangled style representations for the target style using counterfactual generation loss.

### Claim 13 (depends on 11)

The system of claim 11, further comprising outputting a user interface control configured to receive input designating a strength for applying the target style to the input text and visually distinguishing one of the plurality of stylized versions of the input text that corresponds to the designated strength.

### Claim 14 (depends on 11)

The system of claim 11, wherein generating the content representation and the style representation is performed using a variational autoencoder.

### Claim 15 (depends on 14)

The system of claim 14, wherein the variational autoencoder is configured using a transformer-based architecture.

### Claim 16 (depends on 11)

The system of claim 11, wherein generating the content representation is performed using a first multitask loss and a first adversarial loss and generating the style representation is performed using a second multitask loss and a second adversarial loss.

### Claim 17 (depends on 11)

The system of claim 11, wherein disentangling the style representation from the input text is performed independent of a parallel corpus of text that contrasts a style of the input text with the target style.

### Claim 18 (depends on 11)

The system of claim 11, wherein the target style defines at least one of a gender tone or a political inclination to be expressed by the plurality of stylized versions of the input text.

### Claim 19

A non-transitory computer-readable storage medium storing executable instructions, which when executed by a processing device, cause the processing device to perform operations comprising:
receiving input text;
displaying a user interface that includes at least one control configured to define one or more style attributes for a target style in which the input text is to be rewritten;
generating a content representation specifying semantic information conveyed by the input text and a style representation specifying one or more style attributes expressed by the input text by encoding text elements of the input text into a latent vector space that indicates the content representation and the style representation;
generating, using a neural network, a plurality of stylized versions of the input text, each of the plurality of stylized versions of the input text including different positions of punctuation relative to the text elements of the input text, and being generated by:
identifying a plurality of strengths for applying the target style to the style representation of the input text by processing the style representation for the input text using a multi-layer perceptron classifier configured to generate versions of the style representation that minimize differences from the style representation and express a different magnitude of the target style; and
applying each of the plurality of strengths of the target style to the style representation for the input text;
displaying the plurality of stylized versions of the input text in the user interface, each of the plurality of stylized versions of the input text being generated by applying a different strength of the target style to the input text;
receiving input at the at least one control modifying at least one of the one or more style attributes; and
modifying a display of the user interface to visually distinguish one of the plurality of stylized versions of the input text from others of the plurality of stylized versions of the input text, the visually distinguished one of the plurality of stylized versions of the input text being defined by the one or more style attributes resulting from the input at the at least one control.

### Claim 20 (depends on 19)

The non-transitory computer-readable storage medium of claim 19, wherein the generating the plurality of the stylized versions of the input text include concatenating the content representation with individual style representation variants formed by the applying the different strength of the target style to the style representation of the input text.
