# US 2022/0092266 A1 · Method and device with natural language processing

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

- Number: US 2022/0092266 A1
- Document ID: US20220092266A1
- Status: Published application
- Kind: A1
- Application number: 17/186,830
- Filed: 2021-02-26
- Published: 2022-03-24
- Earliest claimed: 2020-09-23
- Assignees: Samsung Electronics Co., Ltd.
- Applicants: Samsung Electronics Co., Ltd.
- Inventors: Inkyu CHOI; Jehun JEON; GyuBum HAN
- Web page: https://patentgrep.com/patent/US20220092266A1

## CPC

- G06F 40/30: Semantic analysis
- G06N 3/0442: characterised by memory or gating, e.g. long short-term memory [LSTM] or gated recurrent units [GRU]
- G06N 3/045: Combinations of networks
- G06N 3/0455: Auto-encoder networks; Encoder-decoder networks
- G06N 3/08: Learning methods
- G06N 3/09: Supervised learning
- G06N 5/02: Knowledge representation; Symbolic representation
- G06N 5/022: Knowledge engineering; Knowledge acquisition
- G06N 3/044: Recurrent networks, e.g. Hopfield networks
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

A method and device with natural language processing is disclosed. The method includes performing a word embedding of an input sentence, encoding a result of the word embedding, using an encoder of a natural language processing model, to generate a context embedding vector, decoding the context embedding vector, using a decoder of the natural language processing model, to generate an output sentence corresponding to the input sentence, generating a score indicating a relationship between the context embedding vector and each of a plurality of knowledge embedding vectors, determining a first loss based on the output sentence, determining a second loss based on the generated score, and performing training of the natural language processing model, including training the natural language processing model based on the determined first loss, and training the natural language processing model based on the determined second loss.

## Claims

### Claim 1

A processor-implemented method, the method comprising:
performing a word embedding of an input sentence;
encoding a result of the word embedding, using an encoder of a natural language processing model, to generate a context embedding vector;
decoding the context embedding vector, using a decoder of the natural language processing model, to generate an output sentence corresponding to the input sentence;
generating a score indicating a relationship between the context embedding vector and each of a plurality of knowledge embedding vectors;
determining a first loss based on the output sentence;
determining a second loss based on the generated score; and
performing training of the natural language processing model, including:
training the natural language processing model based on the determined first loss; and
training the natural language processing model based on the determined second loss.

### Claim 2 (depends on 1)

The method of claim 1, wherein the generating of the score comprises:
generating a first score indicating a relation between the context embedding vector and a first knowledge embedding vector; and
generating a second score indicating a relation between the context embedding vector and a second knowledge embedding vector.

### Claim 3 (depends on 2)

The method of claim 2, wherein the first knowledge embedding vector is a knowledge embedding vector that represents a true knowledge of the input sentence, and
the second knowledge embedding vector is a knowledge embedding vector that represents a false knowledge of the input sentence.

### Claim 4 (depends on 2)

The method of claim 2, wherein the training of the natural language processing model based on the second loss comprises:
determining the second loss using a difference between the first score and the second score; and
training the word embedding and the encoder based on the second loss.

### Claim 5 (depends on 4)

The method of claim 4, wherein the training of the word embedding and the encoder is performed to decrease the second loss.

### Claim 6 (depends on 2)

The method of claim 2,
wherein the generating of the first score comprises:
generating a first concatenated vector by concatenating the context embedding vector and the first knowledge embedding vector; and
generating the first score using the first concatenated vector and a score function, and
wherein the generating of the second score comprises:
generating a second concatenated vector by concatenating the context embedding vector and the second knowledge embedding vector; and
generating the second score using the second concatenated vector and the score function.

### Claim 7 (depends on 6)

The method of claim 6, wherein the score function is a neural network comprising a plurality of fully-connected layers.

### Claim 8 (depends on 1)

The method of claim 1, wherein the training of the natural language processing model based on the second loss comprises:
training the word embedding to include knowledge information associated with the input sentence in results of the word embedding, and
training the encoder to include the knowledge information in context embedding vector results of the encoder.

### Claim 9 (depends on 1)

The method of claim 1, further comprising:
generating the knowledge embedding vectors using knowledge graph (KG) embedding.

### Claim 10 (depends on 1)

The method of claim 1,
wherein the training of the natural language processing model based on the determined first loss includes training the word embedding, the encoder, and the decoder based on the first loss, and
wherein the training of the natural language processing model based on the determined second loss includes training the word embedding and the encoder based on the second loss.

### Claim 11 (depends on 1)

A non-transitory computer-readable storage medium storing instructions, which when executed by a processor, configure the processor to perform the method of claim 1.

### Claim 12

A device, the device comprising:
a memory storing a natural language processing model; and
a processor configured to:
perform a word embedding of an input sentence;
encode a result of the word embedding, using an encoder of the natural language processing model, to generate a context embedding vector;
decode the context embedding vector, using a decoder of the natural language processing model, to generate an output sentence corresponding to the input sentence;
generate a score indicating a relationship between the context embedding vector and each of a plurality of knowledge embedding vectors;
determine a first loss based on the output sentence;
determine a second loss based on the generated score; and
perform a training of the natural language processing model, including:
a training of the natural language processing model based on the determined first loss; and
a training of the natural language processing model based on the determined second loss.

### Claim 13 (depends on 12)

The device of claim 12, wherein the processor is configured to:
generate a first score indicating a relation between the context embedding vector and a first knowledge embedding vector; and
generate a second score indicating a relation between the context embedding vector and a second knowledge embedding vector.

### Claim 14 (depends on 13)

The device of claim 13, wherein the first knowledge embedding vector is a knowledge embedding vector that represents a true knowledge of the input sentence, and
the second knowledge embedding vector is a knowledge embedding vector that represents a false knowledge of the input sentence.

### Claim 15 (depends on 13)

The device of claim 13, wherein the processor is configured to:
determine the second loss using a difference between the first score and the second score; and
train the word embedding and the encoder based on the second loss.

### Claim 16 (depends on 13)

The device of claim 13, wherein the processor is configured to:
generate a first concatenated vector by concatenating the context embedding vector and the first knowledge embedding vector, and generate the first score using the first concatenated vector and a score function; and
generate a second concatenated vector by concatenating the context embedding vector and the second knowledge embedding vector, and generate the second score using the second concatenated vector and the score function.

### Claim 17 (depends on 16)

The device of claim 16, wherein the score function is a neural network comprising a plurality of fully-connected layers.

### Claim 18 (depends on 12)

The device of claim 12, wherein the processor is configured to:
train the word embedding to include knowledge information associated with the input sentence results of the word embedding; and
train the encoder to include the knowledge information in context embedding vector results of the encoder.

### Claim 19 (depends on 12)

The device of claim 12, wherein the processor is configured to:
generate the knowledge embedding vectors using knowledge graph (KG) embedding.

### Claim 20

A device comprising:
a memory storing a natural language processing model; and
a processor configured to:
perform word embedding on an input sentence;
generate a context embedding vector by encoding a result of the word embedding using an encoder of the natural language processing model; and
generate an output sentence corresponding to the input sentence by decoding the context embedding vector using a decoder of the natural language processing model,
wherein respective results of each of the word embedding and the generating of the context embedding vector include information of one or more words of the sentence and knowledge information associated with the input sentence.

### Claim 21

A device comprising:
a processor configured to:
generate a context embedding vector by encoding, using an encoder of a natural language processing model, a result of an embedding of an input sentence;
decode the context embedding vector using a decoder of the natural language processing model; and
perform one or more operations of the device based on a result of the decoding of the context embedding vector,
wherein the context embedding vector respectively represents knowledge information and context of the input sentence, and
wherein the result of the embedding of the input sentence represents embedded one or more words of the input sentence and knowledge information of the one or more words of the input sentence.

### Claim 22 (depends on 21)

The device of claim 21, wherein the processor is further configured to train the natural language processing model, including the processor being configured to:
perform a training word embedding of a training input sentence;
encode a result of the training word embedding, using the encoder, to generate a training context embedding vector;
decode the training context embedding vector, using the decoder, to generate a training output sentence corresponding to the training input sentence,
wherein the training of the natural language processing model includes training the training word embedding and the encoder based on a determined loss corresponding to determined relationships between the training context embedding vector and each of a plurality of knowledge embedding vectors.

### Claim 23 (depends on 22)

The device of claim 22, wherein, for the training of the natural language processing model, the processor is further configured to:
determine an output loss based on the output sentence, and train at least the encoder and decoder based on the determined output loss; and
determine the loss corresponding to the determined relationships based on a scoring of the relationships between the training context embedding vector and each of a plurality of knowledge embedding vectors.

### Claim 24 (depends on 23)

The device of claim 23, wherein, for the scoring of the relationships, the processor is configured to:
generate a first score, indicating a relation between the training context embedding vector and a first knowledge embedding vector, using a score function;
generate a second score, indicating a relation between the training context embedding vector and a second knowledge embedding vector, using the score function; and
score the relationships dependent on the first score and the second score.
