IP Library Granted Patent US 11,270,079
Granted Patent B2
US 11,270,079 · App. 16/686,083 · Granted Mar 8, 2022

Translation model based training method and translation method, computer device, and storage medium

Inventors: Zhaopeng Tu (Shenzhen, CN); Xiang Kong (Shenzhen, CN); Shuming Shi (Shenzhen, CN); Tong Zhang (Shenzhen, CN)
Assignee: TENCENT TECHNOLOGY (SHENZHEN) COMPANY LIMITED
G06F40/30G06N3/0454G06N3/08
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,270,079
App. No.
16/686,083
Granted
Mar 8, 2022
Kind
B2
Abstract

A translation model based training method is provided for a computer device. The method includes inputting a source sentence to a translation model, to obtain a target sentence outputted by the translation model; determining a fidelity of the target sentence to the source sentence; using the target sentence and a reference sentence as input of a discriminator model, using the fidelity as output of the discriminator model, and training the discriminator model on a performance of calculating a similarity between the target sentence and the reference sentence; outputting the similarity by using the discriminator model; and using the source sentence as input of the translation model, using the target sentence as output of the translation model, and using the similarity as a weight coefficient, and training the translation model on a performance of outputting the corresponding target sentence according to the input source sentence.

Claims (85)

1. A translation model based training method for a computer device, comprising:

inputting a source sentence to a translation model, to obtain a target sentence outputted by the translation model;

determining a fidelity of the target sentence to the source sentence, by:

in response to that the fidelity is a coverage, obtaining a first coverage quantity of words of the target sentence that cover words of the source sentence;

obtaining a second coverage quantity of words of a reference sentence that cover the words of the source sentence;

calculating a difference between the first coverage quantity and the second coverage quantity; and

calculating a ratio of the difference to the second coverage quantity as the coverage;

using the target sentence and the reference sentence as input of a discriminator model, using the fidelity as output of the discriminator model, and training the discriminator model on a performance of calculating a similarity between the target sentence and the reference sentence;

outputting the similarity between the target sentence and the reference sentence by using the discriminator model; and

using the source sentence as input of the translation model, using the target sentence as output of the translation model, and using the similarity as a weight coefficient, and training the translation model on a performance of outputting the corresponding target sentence according to the input source sentence.

2. The method according to claim 1 , wherein the obtaining a first coverage quantity of words of the target sentence that cover words of the source sentence comprises:

aligning a vector of each word in the target sentence to a vector of a corresponding word in the source sentence to form a first alignment matrix in a process of obtaining a vector sequence of the target sentence outputted by the translation model; and

collecting, by the computer device from the first alignment matrix, statistics on the first coverage quantity of the words of the target sentence that cover the words of the source sentence.

3. The method according to claim 1 , wherein the obtaining a second coverage quantity of words of the reference sentence that cover the words of the source sentence comprises:

separately obtaining vector sequences corresponding to the reference sentence and the source sentence;

aligning vectors corresponding to same words in the vector sequence of the source sentence and the vector sequence of the reference sentence, to obtain a second alignment matrix; and

collecting, from the second alignment matrix, statistics on the second coverage quantity of the words of the reference sentence that cover the words of the source sentence.

4. The method according to claim 1 , wherein the determining fidelity of the target sentence to the source sentence comprises:

matching words in the target sentence and words in the reference sentence in response to that the fidelity is a bilingual evaluation understudy value, to obtain a quantity of same words in the target sentence and the reference sentence; and

calculating a ratio of the obtained quantity to a quantity of the words in the target sentence as the bilingual evaluation understudy value.

5. The method according to claim 1 , wherein the outputting the similarity between the target sentence and the reference sentence by using the discriminator model comprises:

encoding the target sentence by using a first neural network model in the discriminator model, to obtain a first encoding vector;

encoding the reference sentence by using a second neural network model in the discriminator model, to obtain a second encoding vector; and

inputting the first encoding vector and the second encoding vector into a third neural network model in the discriminator model for similarity calculation, to obtain the similarity between the target sentence and the reference sentence.

6. The method according to claim 1 , wherein the using the source sentence as input of the translation model, using the target sentence as output of the translation model, and using the similarity as a weight coefficient, and training the translation model on a performance of outputting the corresponding target sentence according to the input source sentence comprises:

constructing a training sample set;

initializing a loss function established based on the input of the translation model, the output of the translation model, and a translation model parameter; and

updating the translation model parameter based on the updated value.

7. The method according to claim 1 , wherein the inputting a source sentence to a translation model, to obtain a target sentence outputted by the translation model comprises:

calculating a semantic vector corresponding to the source sentence;

calculating a probability that candidate words are aligned to words in the source sentence;

selecting a calculated candidate word that has a highest alignment probability from the candidate words as an outputted word; and

connecting the outputted word to form the target sentence.

8. The method according to claim 7 , wherein the calculating a semantic vector corresponding to the source sentence comprises:

generating a vector sequence corresponding to the source sentence;

allocating an attention probability to a word vector in the vector sequence of the source sentence; and

performing weighted summation on the word vector in the vector sequence of the source sentence and the allocated attention probability, to obtain the semantic vector corresponding to the source sentence.

9. A computer device, comprising: a memory storing computer-readable instructions; and one or more processors coupled to the memory and, when executing the computer-readable instructions, configured to perform:

inputting a source sentence to a translation model, to obtain a target sentence outputted by the translation model;

determining fidelity of the target sentence to the source sentence, by:

in response to that the fidelity is a coverage, obtaining a first coverage quantity of words of the target sentence that cover words of the source sentence;

obtaining a second coverage quantity of words of a reference sentence that cover the words of the source sentence;

calculating a difference between the first coverage quantity and the second coverage quantity; and

calculating a ratio of the difference to the second coverage quantity as the coverage;

using the target sentence and the reference sentence as input of a discriminator model, using the fidelity as output of the discriminator model, and training the discriminator model on a performance of calculating a similarity between the target sentence and the reference sentence;

outputting the similarity between the target sentence and the reference sentence by using the discriminator model; and

using the source sentence as input of the translation model, using the target sentence as output of the translation model, and using the similarity as a weight coefficient, and training the translation model on a performance of outputting the corresponding target sentence according to the input source sentence.

10. The computer device according to claim 9 , wherein the obtaining a first coverage quantity of words of the target sentence that cover words of the source sentence comprises:

aligning a vector of each word in the target sentence to a vector of a corresponding word in the source sentence to form a first alignment matrix in a process of obtaining a vector sequence of the target sentence outputted by the translation model; and

collecting, from the first alignment matrix, statistics on the first coverage quantity of the words of the target sentence that cover the words of the source sentence.

11. The computer device according to claim 9 , wherein the obtaining a second coverage quantity of words of the reference sentence that cover the words of the source sentence comprises:

separately obtaining vector sequences corresponding to the reference sentence and the source sentence;

aligning vectors corresponding to same words in the vector sequence of the source sentence and the vector sequence of the reference sentence, to obtain a second alignment matrix; and

collecting, from the second alignment matrix, statistics on the second coverage quantity of the words of the reference sentence that cover the words of the source sentence.

12. The computer device according to claim 9 , wherein the determining fidelity of the target sentence to the source sentence comprises:

matching words in the target sentence and words in the reference sentence in response to that the fidelity is a bilingual evaluation understudy value, to obtain a quantity of same words in the target sentence and the reference sentence; and

calculating a ratio of the obtained quantity to a quantity of the words in the target sentence as the bilingual evaluation understudy value.

13. The computer device according to claim 9 , wherein the outputting the similarity between the target sentence and the reference sentence by using the discriminator model comprises:

encoding the target sentence by using a first neural network model in the discriminator model, to obtain a first encoding vector;

encoding the reference sentence by using a second neural network model in the discriminator model, to obtain a second encoding vector; and

inputting the first encoding vector and the second encoding vector into a third neural network model in the discriminator model for similarity calculation, to obtain the similarity between the target sentence and the reference sentence.

14. The computer device according to claim 9 , wherein the using the source sentence as input of the translation model, using the target sentence as output of the translation model, and using the similarity as a weight coefficient, and training the translation model on a performance of outputting the corresponding target sentence according to the input source sentence comprises:

constructing a training sample set;

initializing a loss function established based on the input of the translation model, the output of the translation model, and a translation model parameter;

calculating an updated value of the translation model parameter; and

updating the translation model parameter based on the updated value.

15. The computer device according to claim 9 , wherein the inputting a source sentence to a translation model, to obtain a target sentence outputted by the translation model comprises:

calculating a semantic vector corresponding to the source sentence;

calculating a probability that candidate words are aligned to words in the source sentence;

selecting a calculated candidate word that has a highest alignment probability from the candidate words as an outputted word; and

connecting the outputted word to form the target sentence.

16. The computer device according to claim 15 , wherein the calculating a semantic vector corresponding to the source sentence comprises:

generating a vector sequence corresponding to the source sentence;

allocating an attention probability to a word vector in the vector sequence of the source sentence; and

performing weighted summation on the word vector in the vector sequence of the source sentence and the allocated attention probability, to obtain the semantic vector corresponding to the source sentence.

17. A non-transitory computer-readable storage medium storing computer program instructions executable by at least one processor to perform:

inputting a source sentence to a translation model, to obtain a target sentence outputted by the translation model;

determining a fidelity of the target sentence to the source sentence, by:

in response to that the fidelity is a coverage, obtaining a first coverage quantity of words of the target sentence that cover words of the source sentence;

obtaining a second coverage quantity of words of a reference sentence that cover the words of the source sentence;

calculating a difference between the first coverage quantity and the second coverage quantity; and

calculating a ratio of the difference to the second coverage quantity as the coverage;

using the target sentence and the reference sentence as input of a discriminator model, using the fidelity as output of the discriminator model, and training the discriminator model on a performance of calculating a similarity between the target sentence and the reference sentence;

outputting the similarity between the target sentence and the reference sentence by using the discriminator model; and

using the source sentence as input of the translation model, using the target sentence as output of the translation model, and using the similarity as a weight coefficient, and training the translation model on a performance of outputting the corresponding target sentence according to the input source sentence.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 15, 2019
From: TU, ZHAOPENG; KONG, XIANG; SHI, SHUMING; ZHANG, TONG
To: TENCENT TECHNOLOGY (SHENZHEN) COMPANY LIMITED
Reel/Frame 051030/0519 →
Priority Claims (1)
CN 201711354563.0 · Dec 15, 2017 · national
Continuity (2)
Continuation PCTCN2018120293 · Dec 11, 2018
Related Publication 20200081982A1 · Mar 12, 2020