# US 2021/0286934 A1 · Implementing text generation

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

- Number: US 2021/0286934 A1
- Document ID: US20210286934A1
- Status: Published application
- Kind: A1
- Application number: 17/331,526
- Filed: 2021-05-26
- Published: 2021-09-16
- Earliest claimed: 2020-12-22
- Assignees: Beijing Baidu Netcom Science Technology Co., Ltd.
- Applicants: Beijing Baidu Netcom Science and Technology Co., Ltd.
- Inventors: Jiachen LIU; Zhe HU; Xinyan XIAO; Hua WU
- Web page: https://patentgrep.com/patent/US20210286934A1

## CPC

- G06F 40/56: Natural language generation
- G06F 40/117: Tagging; Marking up (details of markup languages G06F40/143); Designating a block; Setting of attributes (style sheets, e.g. eXtensible Stylesheet Language Transformation [XSLT], G06F40/154)
- G06F 40/126: Character encoding
- G06F 40/216: using statistical methods
- G06F 40/30: Semantic analysis
- G06F 40/44: Statistical methods, e.g. probability models
- G06N 3/045: Combinations of networks
- G06N 3/0455: Auto-encoder networks; Encoder-decoder networks
- G06N 3/08: Learning methods
- G06N 3/0895: Weakly supervised learning, e.g. semi-supervised or self-supervised learning
- G06N 3/09: Supervised learning
- G06N 3/096: Transfer learning
- G06N 20/00: Machine learning
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

A method for implementing text generation, a device and a medium are provided. The method includes: determining a target task type of a target text generation task from multiple task types supported by a pre-trained general text generation model; determining, based on a requirement of the target text generation task for a target output text, a first target output text attribute for the target text generation task from multiple output text attributes supported by the general text generation model; and fine tuning the general text generation model based on a target training data set associated with the target text generation task to obtain a task-specific text generation model, by taking task indication information for the target task type and first attribute indication information for the first target output text attribute as at least part of an input of the general text generation model.

## Claims

### Claim 1

A method, comprising:
determining a target task type of a target text generation task from multiple task types supported by a general text generation model, wherein the general text generation model is pre-trained;
determining, based on a requirement of the target text generation task for a target output text, at least one first target output text attribute for the target text generation task from multiple output text attributes supported by the general text generation model; and
fine tuning the general text generation model based on a target training data set associated with the target text generation task to obtain a task-specific text generation model for the target text generation task, by taking task indication information for the target task type and first attribute indication information for the at least one first target output text attribute as at least part of an input of the general text generation model.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the general text generation model is pre-trained based on multiple pre-training data sets respectively comprising training input texts and training output texts associated with corresponding task types in the multiple task types.

### Claim 3 (depends on 2)

The method according to claim 2, wherein a training output text in at least one pre-training data set of the multiple pre-training data sets is labeled with different attribute values of at least one output text attribute of the multiple output text attributes.

### Claim 4 (depends on 1)

The method according to claim 1, wherein the general text generation model at least comprises a first encoder to receive an input text and a decoder to generate an output text, wherein the task indication information and the first attribute indication information are to be input to the first encoder, and wherein fine tuning the general text generation model further comprises:
determining second attribute indication information indicating a second target output text attribute for the target text generation task; and
fine tuning the general text generation model based on the target training data set by applying the second attribute indication information as an input of a second encoder in the general text generation model.

### Claim 5 (depends on 1)

The method according to claim 1, wherein the general text generation model at least comprises a first encoder to receive an input text and a decoder to generate an output text based on an intermediate output of the first encoder, wherein the task indication information and the first attribute indication information are to be input to the first encoder, and wherein fine tuning the general text generation model further comprises:
obtaining an attribute control model configured to control the decoder to output the target output text having a third target output text attribute based on the intermediate output of the first encoder, wherein the third target output text attribute is not included in the multiple output text attributes; and
fine tuning the attribute control model and the general text generation model jointly.

### Claim 6 (depends on 5)

The method according to claim 5, wherein the attribute control model comprises at least one of:
an attribute classification model configured to determine, based on the intermediate output of the first encoder, guidance information for guiding the decoder to generate the target output text having the third target output text attribute, wherein the guidance information indicates different attribute values of the third target output text attribute; and
a language model configured to, in conjunction with the decoder, decode the intermediate output of the first encoder to generate the target output text having the third target output text attribute.

### Claim 7 (depends on 1)

The method according to claim 1, wherein the target text generation task is a first target text generation task, and the method further comprises:
determining a second target task type of a second target text generation task from the multiple task types;
determining, based on a requirement of the second target text generation task for a target output text, a further target output text attribute for the second target text generation task from the multiple output text attributes; and
fine tuning the general text generation model based on a second target training data set associated with the second target text generation task to obtain a further task-specific text generation model for the second target text generation task, by taking second task indication information for the second target task type and further attribute indication information for the further target output text attribute as at least part of an input of the general text generation model.

### Claim 8 (depends on 1)

The method according to claim 1, further comprising:
obtaining a target input text for the target text generation task;
applying the target input text, the task indication information and the first attribute indication information as an input of the task-specific text generation model; and
executing the task-specific text generation model to obtain an output of the task-specific text generation model as the target output text of the target text generation task.

### Claim 9

An electronic device, comprising:
at least one processor; and
a memory communicatively connected with the at least one processor, wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to:
determine a target task type of a target text generation task from multiple task types supported by a general text generation model, wherein the general text generation model is pre-trained;
determine at least one first target output text attribute for the target text generation task from multiple output text attributes supported by the general text generation model based on a requirement of the target text generation task for a target output text; and
fine tune the general text generation model based on a target training data set associated with the target text generation task to obtain a task-specific text generation model for the target text generation task, by taking task indication information for the target task type and first attribute indication information for the at least one first target output text attribute as at least part of an input of the general text generation model.

### Claim 10 (depends on 9)

The electronic device according to claim 9, wherein the general text generation model is pre-trained based on multiple pre-training data sets respectively comprising training input texts and training output texts associated with corresponding task types in the multiple task types.

### Claim 11 (depends on 10)

The electronic device according to claim 10, wherein a training output text in at least one pre-training data set of the multiple pre-training data sets is labeled with different attribute values of at least one output text attribute of the multiple output text attributes.

### Claim 12 (depends on 9)

The electronic device according to claim 9, wherein the general text generation model at least comprises a first encoder to receive an input text and a decoder to generate an output text, wherein the task indication information and the first attribute indication information are to be input to the first encoder, and wherein the instructions upon execution further cause the at least one processor to:
determine second attribute indication information indicating a second target output text attribute for the target text generation task; and
wherein fine tuning the general text generation model comprises fine tuning the general text generation model based on the target training data set by applying the second attribute indication information as an input of a second encoder in the general text generation model.

### Claim 13 (depends on 9)

The electronic device according to claim 9, wherein the general text generation model at least comprises a first encoder to receive an input text and a decoder to generate an output text based on an intermediate output of the first encoder, wherein the task indication information and the first attribute indication information are to be input to the first encoder, and wherein fine tuning the general text generation model comprises:
obtaining an attribute control model configured to control the decoder to output the target output text having a third target output text attribute based on the intermediate output of the first encoder, wherein the third target output text attribute is not included in the multiple output text attributes; and
fine tuning the attribute control model and the general text generation model jointly.

### Claim 14 (depends on 13)

The electronic device according to claim 13, wherein the attribute control model comprises at least one of:
an attribute classification model configured to determine, based on the intermediate output of the first encoder, guidance information for guiding the decoder to generate the target output text having the third target output text attribute, wherein the guidance information indicates different attribute values of the third target output text attribute; and
a language model configured to, in conjunction with the decoder, decode the intermediate output of the first encoder to generate the target output text having the third target output text attribute.

### Claim 15 (depends on 9)

The electronic device according to claim 9, wherein the target text generation task is a first target text generation task, and the instructions upon execution further cause the at least one processor to:
determine a second target task type of a second target text generation task from the multiple task types;
determine a further target output text attribute for the second target text generation task from the multiple output text attributes based on a requirement of the second target text generation task for a target output text; and
fine tune the general text generation model based on a second target training data set associated with the second target text generation task to obtain a further task-specific text generation model for the second target text generation task, by taking second task indication information for the second target task type and further attribute indication information for the further target output text attribute as at least part of an input of the general text generation model.

### Claim 16 (depends on 9)

The electronic device according claim 9, wherein the instructions upon execution further cause the at least one processor to:
obtain a target input text for the target text generation task;
apply the target input text, the task indication information and the first attribute indication information as an input of the task-specific text generation model; and
execute the task-specific text generation model to obtain an output of the task-specific text generation model as the target output text of the target text generation task.

### Claim 17

A non-transitory computer readable storage medium storing computer instructions for causing a computer to:
determine a target task type of a target text generation task from multiple task types supported by a general text generation model, wherein the general text generation model is pre-trained;
determine, based on a requirement of the target text generation task for a target output text, at least one first target output text attribute for the target text generation task from multiple output text attributes supported by the general text generation model; and
fine tune the general text generation model based on a target training data set associated with the target text generation task to obtain a task-specific text generation model for the target text generation task, by taking task indication information for the target task type and first attribute indication information for the at least one first target output text attribute as at least part of an input of the general text generation model.

### Claim 18 (depends on 17)

The non-transitory computer readable storage medium according to claim 17, wherein the general text generation model is pre-trained based on multiple pre-training data sets respectively comprising training input texts and training output texts associated with corresponding task types in the multiple task types.

### Claim 19 (depends on 17)

The non-transitory computer readable storage medium according to claim 17, wherein the general text generation model at least comprises a first encoder to receive an input text and a decoder to generate an output text, wherein the task indication information and the first attribute indication information are to be input to the first encoder, and wherein the instructions upon execution further cause the computer to:
determine second attribute indication information indicating a second target output text attribute for the target text generation task; and
wherein fine tuning the general text generation model comprises fine tuning the general text generation model based on the target training data set by applying the second attribute indication information as an input of a second encoder in the general text generation model.

### Claim 20 (depends on 17)

The non-transitory computer readable storage medium according to claim 17, wherein the general text generation model at least comprises a first encoder to receive an input text and a decoder to generate an output text based on an intermediate output of the first encoder, wherein the task indication information and the first attribute indication information are to be input to the first encoder, and wherein fine tuning the general text generation model comprises:
obtaining an attribute control model configured to control the decoder to output the target output text having a third target output text attribute based on the intermediate output of the first encoder, wherein the third target output text attribute is not included in the multiple output text attributes; and
fine tuning the attribute control model and the general text generation model jointly.
