Statement translation method and device, electronic equipment and storage medium

By training the bidirectional non-autoregression model and distilling the parallel corpus with bidirectional autoregression knowledge, the problem of insufficient generation quality of the non-autoregression model is solved, and high-quality and high-speed translation effects are achieved.

CN119443119AInactive Publication Date: 2025-02-14UNIV OF MACAU
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411481231.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-23
Publication Date
2025-02-14
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The non-autoregressive model has insufficient generation quality in natural language processing, making it difficult to improve translation quality while maintaining high-speed generation.

Method used

By training a pre-constructed bidirectional non-autoregressive model, the results of the training samples are processed using forward autoregressive model and reverse autoregressive model as training data of the bidirectional non-autoregressive model, and the parallel corpus is distilled in combination with bidirectional autoregressive knowledge to obtain high quality translation model.

Benefits of technology

It realizes the high generation speed of non-autoregressive generation models while improving the translation quality, solving the problem of insufficient generation quality of non-autoregressive models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119443119A_ABST
    Figure CN119443119A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a statement translation method and device, electronic equipment and a storage medium, and relates to the technical field of natural language processing and conversion. The method comprises the steps of obtaining a to-be-translated statement of a source language, inputting the to-be-translated statement into a pre-trained translation model, and obtaining a translated statement of a target language corresponding to the to-be-translated statement by using the translation model. The translation model is obtained by training the pre-constructed bidirectional non-autoregression model, and the data for training the bidirectional non-autoregression model is obtained according to the result of processing the training sample by the forward autoregression model and the reverse autoregression model, so that bidirectional autoregression modeling information is introduced in the training process of the bidirectional non-autoregression model; therefore, the obtained translation model has high generation quality while maintaining high generation speed of the non-autoregressive generation model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of natural language processing and conversion, and in particular to a sentence translation method, device, electronic device and storage medium. Background Art

[0002] With the development of artificial intelligence, machine translation technology has made significant progress. Traditional machine translation models usually use autoregressive methods, that is, generating one word at a time. Although this method has high generation quality, it is slow. Non-autoregressive models can generate the entire sentence at once, greatly improving the translation speed, but there are still deficiencies in generation quality.

[0003] How to solve the shortcomings of non-autoregressive models in generation quality while maintaining their advantages in high-speed generation is an important research topic in the field of natural language processing and conversion technology. Summary of the invention

[0004] In view of this, an object of the present invention is to provide a sentence translation method, device, electronic device and storage medium.

[0005] In order to achieve the above purpose, the technical solution adopted by the embodiment of the present invention is as follows:

[0006] In a first aspect, the present invention provides a sentence translation method, the method comprising:

[0007] Obtain the sentences to be translated in the source language;

[0008] The sentence to be translated is input into a pre-trained translation model, and the translation model is used to obtain a translation sentence in the target language corresponding to the sentence to be translated; wherein the translation model is obtained by training a pre-constructed bidirectional non-autoregressive model, and the data for training the bidirectional non-autoregressive model is obtained based on the results of processing training samples with a forward autoregressive model and a reverse autoregressive model.

[0009] Optionally, the method further comprises the step of training the translation model, comprising:

[0010] Acquire training corpus, and use the training corpus to train a pre-built forward autoregressive model and a pre-built reverse autoregressive model, respectively, to obtain a trained forward autoregressive model and a trained reverse autoregressive model;

[0011] Based on the training corpus, the trained forward autoregressive model and the trained reverse autoregressive model, obtaining a bidirectional autoregressive knowledge distillation parallel corpus;

[0012] The bidirectional autoregressive knowledge distillation parallel corpus is used to train a pre-constructed bidirectional non-autoregressive model to obtain the translation model.

[0013] Optionally, the step of obtaining a bidirectional autoregressive knowledge distillation parallel corpus based on the training corpus, the trained forward autoregressive model, and the trained reverse autoregressive model includes:

[0014] The training corpus is processed using the trained forward autoregressive model and the trained reverse autoregressive model to obtain a forward autoregressive knowledge distillation corpus and a reverse autoregressive knowledge distillation corpus respectively;

[0015] The training corpus, the forward autoregressive knowledge distillation corpus and the reverse autoregressive knowledge distillation corpus are integrated to obtain the bidirectional autoregressive knowledge distillation parallel corpus.

[0016] Optionally, the training corpus includes sample sentences of a plurality of source languages, and the step of using the trained forward autoregressive model and the trained reverse autoregressive model to process the training corpus respectively to obtain the forward autoregressive knowledge distillation corpus and the reverse autoregressive knowledge distillation corpus includes:

[0017] Retranslating each of the sample sentences using the trained forward autoregressive model to obtain a first translation sentence in the target language corresponding to each of the sample sentences, wherein the forward autoregressive knowledge distillation corpus includes the first translation sentence corresponding to each of the sample sentences;

[0018] Each of the sample sentences is retranslated using the trained reverse autoregressive model to obtain a second translation sentence in the target language corresponding to each of the sample sentences, and the reverse autoregressive knowledge distillation corpus includes the second translation sentence corresponding to each of the sample sentences.

[0019] Optionally, the training corpus also includes an original translation sentence in the target language corresponding to each of the sample sentences, and the step of fusing the training corpus, the forward autoregressive knowledge distillation corpus and the reverse autoregressive knowledge distillation corpus to obtain the bidirectional autoregressive knowledge distillation parallel corpus includes:

[0020] The original translation sentence, the first translation sentence and the second translation sentence corresponding to each of the sample sentences are merged into a translation sentence list to obtain a translation sentence list corresponding to each of the sample sentences, and the bidirectional autoregressive knowledge distillation parallel corpus includes each of the sample sentences and the translation sentence list corresponding to each of the sample sentences.

[0021] Optionally, the translation model includes an encoder end and a decoder end, and the step of using the translation model to obtain a translation sentence in the target language corresponding to the sentence to be translated includes:

[0022] The encoder end encodes the sentence to be translated, obtains a sentence vector and inputs it into the decoder end of the translation model;

[0023] The decoder decodes the sentence vector according to the bidirectional graph of the target language constructed in the model training phase to obtain a translation sentence corresponding to the sentence to be translated.

[0024] Optionally, the decoder decodes the sentence vector according to the bidirectional graph of the target language constructed in the model training phase to obtain a translation sentence corresponding to the sentence to be translated, including:

[0025] The decoder decodes the sentence vector and obtains a plurality of candidate sentences and the confidence of each candidate sentence by searching the bidirectional graph during the decoding process;

[0026] The decoder determines the translation sentence corresponding to the sentence to be translated from all the candidate sentences according to the confidence of each candidate sentence.

[0027] In a second aspect, the present invention provides a sentence translation device, the device comprising:

[0028] An acquisition module is used to acquire sentences to be translated in the source language;

[0029] A processing module is used to input the sentence to be translated into a pre-trained translation model, and use the translation model to obtain a translation sentence in the target language corresponding to the sentence to be translated; wherein the translation model is obtained by training a pre-built bidirectional non-autoregressive model, and the data for training the bidirectional non-autoregressive model is obtained based on the results of processing training samples with a forward autoregressive model and a reverse autoregressive model.

[0030] In a third aspect, the present invention provides an electronic device, comprising a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions to implement the sentence translation method described in the first aspect.

[0031] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the sentence translation method as described in the first aspect above.

[0032] The sentence translation method provided by the embodiment of the present invention obtains a sentence to be translated in a source language, inputs the sentence to be translated into a pre-trained translation model, and uses the translation model to obtain a translation sentence in a target language corresponding to the sentence to be translated. Since the translation model is obtained by training a pre-built bidirectional non-autoregressive model, the data for training the bidirectional non-autoregressive model is obtained based on the results of processing training samples by a forward autoregressive model and a reverse autoregressive model, thereby introducing bidirectional autoregressive modeling information in the training process of the bidirectional non-autoregressive model, so that the obtained translation model has a high generation quality while maintaining the high generation speed of the non-autoregressive generation model.

[0033] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0035] Figure 1 A schematic structural block diagram of an electronic device provided by an embodiment of the present invention is shown;

[0036] Figure 2 A flow chart of a sentence translation method provided by an embodiment of the present invention is shown;

[0037] Figure 3 A schematic diagram of a flow chart of a model training process provided by an embodiment of the present invention is shown;

[0038] Figure 4 A functional unit block diagram of a sentence translation device provided by an embodiment of the present invention is shown.

[0039] Icon: 100 - electronic device; 110 - memory; 120 - processor; 130 - communication module; 200 - sentence translation device; 201 - acquisition module; 202 - processing module. DETAILED DESCRIPTION

[0040] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0041] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.

[0042] It should be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0043] Please refer to Figure 1 , is a block diagram of an electronic device 100. The electronic device 100 includes a memory 110, a processor 120, and a communication module 130. The memory 110, the processor 120, and the communication module 130 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses or signal lines.

[0044] The memory 110 is used to store programs or data. The memory 110 may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc.

[0045] The processor 120 is used to read / write data or programs stored in the memory 110 and execute corresponding functions.

[0046] The communication module 130 is used to establish a communication connection between the electronic device 100 and other communication terminals through the network, and to send and receive data through the network.

[0047] It should be understood that Figure 1The structure shown is only a schematic diagram of the structure of the electronic device 100. The electronic device 100 may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown. Figure 1 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0048] Please refer to Figure 2 , a sentence translation method provided by an embodiment of the present invention includes steps S101 to S102.

[0049] S101, obtaining a sentence to be translated in a source language.

[0050] The source language may be any language, such as Chinese, English, French, etc. The sentence to be translated is a sentence expressed in the source language and needs to be translated into another language.

[0051] S102, inputting the sentence to be translated into a pre-trained translation model, and using the translation model to obtain a translation sentence in the target language corresponding to the sentence to be translated.

[0052] The target language may be any language except the source language. For example, when the source language is English, the target language may be any language except English.

[0053] The translation model is obtained by training a pre-built bidirectional non-autoregressive model. The data for training the bidirectional non-autoregressive model is obtained based on the results of processing training samples by the forward autoregressive model and the reverse autoregressive model.

[0054] In an embodiment of the present invention, the training process of the translation model may include: Figure 3 Steps S201 to S203 are shown.

[0055] S201, obtaining training corpus, and using the training corpus to respectively train a pre-built forward autoregressive model and a pre-built reverse autoregressive model to obtain a trained forward autoregressive model and a trained reverse autoregressive model.

[0056] The training data includes a plurality of sample sentences in the source language and an original translation sentence in the target language corresponding to each sample sentence.

[0057] In a forward autoregressive model, the generation or prediction of the series is done in the forward order of the time series, i.e. from the beginning to the end of the series.

[0058] In the reverse autoregressive model, the generation or forecasting of the series is done in the reverse order of the time series, that is, from the end of the series to the beginning.

[0059] A pre-built forward autoregressive model is trained using multiple sample sentences and the original translation sentence corresponding to each sample sentence to obtain a trained forward autoregressive model. The trained forward autoregressive model can convert sentences from a source language into a target language in a forward order.

[0060] A pre-built reverse autoregressive model is trained using multiple sample sentences and the original translation sentence corresponding to each sample sentence to obtain a trained reverse autoregressive model. The trained reverse autoregressive model can convert sentences from the source language to the target language in reverse order.

[0061] S202, based on the training corpus, the trained forward autoregressive model and the trained reverse autoregressive model, a bidirectional autoregressive knowledge distillation parallel corpus is obtained.

[0062] In a possible implementation, the implementation process of step S202 may include sub-steps S202 - 1 to S202 - 2 .

[0063] S202-1, using the trained forward autoregressive model and the trained reverse autoregressive model to process the training corpus respectively to obtain the forward autoregressive knowledge distillation corpus and the reverse autoregressive knowledge distillation corpus.

[0064] The forward autoregressive knowledge distillation corpus includes the first translation sentence in the target language corresponding to each sample sentence.

[0065] In the embodiment of the present invention, each sample sentence is retranslated by using the trained forward autoregressive model to obtain a first translated sentence corresponding to each sample sentence.

[0066] The reverse autoregressive knowledge distillation corpus includes a second translation sentence in the target language corresponding to each sample sentence.

[0067] In the embodiment of the present invention, each sample sentence is retranslated by using the trained reverse autoregressive model to obtain a second translated sentence corresponding to each sample sentence.

[0068] S202-2, integrating the training corpus, the forward autoregressive knowledge distillation corpus and the reverse autoregressive knowledge distillation corpus to obtain a bidirectional autoregressive knowledge distillation parallel corpus.

[0069] The bidirectional autoregressive knowledge distillation parallel corpus includes each sample sentence and a translation sentence list corresponding to each sample sentence.

[0070] In the embodiment of the present invention, the translation sentence list corresponding to each sample sentence is obtained by merging the original translation sentence, the first translation sentence and the second translation sentence corresponding to each sample sentence into a translation sentence list.

[0071] S203, using the bidirectional autoregressive knowledge distillation parallel corpus to train the pre-built bidirectional non-autoregressive model to obtain a translation model.

[0072] In the bidirectional non-autoregressive model learning process, the model first uses the Transformer encoder-decoder architecture to generate the probability distribution of candidate translations for all positions in parallel; the model searches forward in the directed acyclic graph to model the set of all forward paths that can constitute the target sentence; the model uses reverse edges in the directed acyclic graph to perform reverse search to model the set of all reverse paths that can constitute the target sentence; the probabilities of possible bidirectional paths are added together to obtain the final sentence prediction probability under bidirectional autoregressive modeling.

[0073] Furthermore, the bidirectional non-autoregressive model structure is as follows:

[0074] The bidirectional non-autoregressive model is based on the Transformer encoder-decoder architecture. The decoder upsamples the source language sentence by λ times before inputting it into the decoder. The decoder generates the target language sentence based on the source language sentence processed by the encoder.

[0075] In the design of the decoder, a bidirectional graph (i.e., a data structure that can represent the relationships between all words in the target language, and these relationships can be bidirectional) is introduced to capture the contextual dependencies between adjacent words in the target language sentence, thereby enhancing the decoder's ability to handle long-distance dependencies and complex language structures.

[0076] The method of modeling sentence prediction probability satisfies the following formula:

[0077]

[0078] Where A is all possible paths that can output the target language sentence, including the forward path set and reverse path set X is the vector representation of the source language sentence, Y is the vector representation of the target language sentence, P θ () represents the path probability, P BC is the generation probability of the target language sentence. It can be understood that the target language sentence predicted by the bidirectional non-autoregressive model is the sum of the probabilities of all possible paths that can generate the target language sentence in the bidirectional graph.

[0079] The path probability satisfies the following formula:

[0080]

[0081] in, are words in the target language sentences, is the node output word on the path The predicted probability of is the jump probability between nodes on the forward path, is the probability of hopping between nodes on the reverse path, is the forward one-way path probability, is the reverse one-way path probability.

[0082] The jump probability is modeled using the decoder-side output latent variable self-attention mechanism, satisfying the following formula:

[0083]

[0084] Q=VW Q ,K=VW K

[0085] Among them, E is the jump probability, W Q ,W K is the weight matrix, V is the hidden variable output by the decoder, and Q and K are both hidden variable vectors output by the decoder.

[0086] The word prediction probability uses the decoder output latent variable combined with the Softmax function output to satisfy the following formula:

[0087]

[0088] in, is the word prediction probability, W P is the weight matrix, is the hidden variable of the i-th node on path a.

[0089] The bidirectional autoregressive model uses two sets of edges of the bidirectional graph to perform Beam-Search decoding search in the decoding stage, and merges the search results into the same candidate list. The path with the highest output probability is the final decoding result. The path construction method and search algorithm satisfy the following formula:

[0090]

[0091]

[0092] in, is the generation probability of the target language sentence Y in the Beam-Search process when the forward unidirectional path distribution is known, is the generation probability of the target language sentence Y in the Beam-Search process when the reverse unidirectional path distribution is known, is the probability of a node jump in the forward path, is the probability of a node jump in the reverse path.

[0093] In the decoding stage, the decoder outputs hidden variables and jump probabilities, which can be output in parallel at one time using the GPU, and the path search algorithm can be completed in a highly serial manner by the CPU.

[0094] In the embodiment of the present invention, the process of "obtaining a translation sentence in the target language corresponding to the sentence to be translated by using the translation model" in step S102 may be as follows:

[0095] First, the encoder side of the translation model encodes the sentence to be translated to obtain a sentence vector; after upsampling the sentence vector, it is input into the decoder side of the translation model.

[0096] Then, the decoder decodes the sentence vector according to the bidirectional graph of the target language constructed in the model training phase to obtain the translation sentence corresponding to the sentence to be translated.

[0097] In an embodiment of the present invention, the decoder decodes the sentence vector, and during the decoding process, a bidirectional Beam-Search is performed on the bidirectional graph simultaneously, and possible forward and reverse paths are constructed at the same time to obtain multiple candidate sentences and the confidence of each candidate sentence.

[0098] The decoder determines the translation sentence corresponding to the sentence to be translated from all candidate sentences based on the confidence of each candidate sentence.

[0099] Optionally, the decoder may use the candidate sentence with the highest confidence as the translation sentence corresponding to the sentence to be translated.

[0100] In order to execute the corresponding steps in the above embodiments and various possible methods, a method for implementing the sentence translation device 200 is provided below. Figure 4 , Figure 4 This is a functional module diagram of a sentence translation device 200 provided in an embodiment of the present invention. It should be noted that the basic principle and technical effects of the sentence translation device 200 provided in this embodiment are the same as those of the above-mentioned embodiment. For the sake of brief description, for parts not mentioned in this embodiment, reference can be made to the corresponding contents in the above-mentioned embodiment. The sentence translation device 200 includes:

[0101] The acquisition module 201 is used to acquire the sentence to be translated in the source language.

[0102] The processing module 202 is used to input the sentence to be translated into a pre-trained translation model, and use the translation model to obtain a translation sentence in the target language corresponding to the sentence to be translated; wherein the translation model is obtained by training a pre-built bidirectional non-autoregressive model, and the data for training the bidirectional non-autoregressive model is obtained by processing the training samples based on the forward autoregressive model from the source language to the target language and the reverse autoregressive model from the target language to the source language.

[0103] Optionally, the above modules can be stored in the form of software or firmware. Figure 1 The memory shown in the figure or solidified in the operating system (OS) of the electronic device, and can be Figure 1 Meanwhile, the data and program codes required for executing the above modules can be stored in the memory.

[0104] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0105] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0106] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, electronic device, or network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.

[0107] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A sentence translation method, characterized in that: The method comprises: Obtain the sentences to be translated in the source language; The sentence to be translated is input into a pre-trained translation model, and the translation model is used to obtain a translation sentence in the target language corresponding to the sentence to be translated; wherein the translation model is obtained by training a pre-constructed bidirectional non-autoregressive model, and the data for training the bidirectional non-autoregressive model is obtained based on the results of processing training samples with a forward autoregressive model and a reverse autoregressive model.

2. The sentence translation method according to claim 1, characterized in that: The method further comprises the step of training the translation model, which comprises: Acquire training corpus, and use the training corpus to train a pre-built forward autoregressive model and a pre-built reverse autoregressive model, respectively, to obtain a trained forward autoregressive model and a trained reverse autoregressive model; Based on the training corpus, the trained forward autoregressive model and the trained reverse autoregressive model, obtaining a bidirectional autoregressive knowledge distillation parallel corpus; The bidirectional autoregressive knowledge distillation parallel corpus is used to train a pre-constructed bidirectional non-autoregressive model to obtain the translation model.

3. The sentence translation method according to claim 2, characterized in that: The step of obtaining a bidirectional autoregressive knowledge distillation parallel corpus based on the training corpus, the trained forward autoregressive model and the trained reverse autoregressive model comprises: The training corpus is processed using the trained forward autoregressive model and the trained reverse autoregressive model to obtain a forward autoregressive knowledge distillation corpus and a reverse autoregressive knowledge distillation corpus respectively; The training corpus, the forward autoregressive knowledge distillation corpus and the reverse autoregressive knowledge distillation corpus are integrated to obtain the bidirectional autoregressive knowledge distillation parallel corpus.

4. The sentence translation method according to claim 3, characterized in that: The training corpus includes sample sentences of a plurality of source languages, and the steps of using the trained forward autoregressive model and the trained reverse autoregressive model to process the training corpus respectively to obtain the forward autoregressive knowledge distillation corpus and the reverse autoregressive knowledge distillation corpus include: Retranslating each of the sample sentences using the trained forward autoregressive model to obtain a first translation sentence in the target language corresponding to each of the sample sentences, wherein the forward autoregressive knowledge distillation corpus includes the first translation sentence corresponding to each of the sample sentences; Each of the sample sentences is retranslated using the trained reverse autoregressive model to obtain a second translation sentence in the target language corresponding to each of the sample sentences, and the reverse autoregressive knowledge distillation corpus includes the second translation sentence corresponding to each of the sample sentences.

5. The method according to claim 4, characterized in that The training corpus also includes an original translation sentence in the target language corresponding to each of the sample sentences. The step of fusing the training corpus, the forward autoregressive knowledge distillation corpus and the reverse autoregressive knowledge distillation corpus to obtain the bidirectional autoregressive knowledge distillation parallel corpus includes: The original translation sentence, the first translation sentence and the second translation sentence corresponding to each of the sample sentences are merged into a translation sentence list to obtain a translation sentence list corresponding to each of the sample sentences, and the bidirectional autoregressive knowledge distillation parallel corpus includes each of the sample sentences and the translation sentence list corresponding to each of the sample sentences.

6. The sentence translation method according to claim 1, characterized in that: The translation model includes an encoder end and a decoder end, and the step of using the translation model to obtain a translation sentence in the target language corresponding to the sentence to be translated includes: The encoder end encodes the sentence to be translated, obtains a sentence vector and inputs it into the decoder end of the translation model; The decoder decodes the sentence vector according to the bidirectional graph of the target language constructed in the model training phase to obtain a translation sentence corresponding to the sentence to be translated.

7. The sentence translation method according to claim 6, characterized in that: The decoder decodes the sentence vector according to the bidirectional graph of the target language constructed in the model training phase to obtain a translation sentence corresponding to the sentence to be translated, including: The decoder decodes the sentence vector and obtains a plurality of candidate sentences and the confidence of each candidate sentence by searching the bidirectional graph during the decoding process; The decoder determines the translation sentence corresponding to the sentence to be translated from all the candidate sentences according to the confidence of each candidate sentence.

8. A sentence translation device, characterized in that: The device comprises: An acquisition module is used to acquire sentences to be translated in the source language; A processing module is used to input the sentence to be translated into a pre-trained translation model, and use the translation model to obtain a translation sentence in the target language corresponding to the sentence to be translated; wherein the translation model is obtained by training a pre-built bidirectional non-autoregressive model, and the data for training the bidirectional non-autoregressive model is obtained based on the results of processing training samples with a forward autoregressive model and a reverse autoregressive model.

9. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions to implement the sentence translation method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the sentence translation method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Neural machine translation decoding acceleration method based on non-autoregression

    CN111382582A

  • Machine translation model training method and device, equipment and storage medium

    CN115204197A

  • Systems and methods for translating natural language queries into a constrained domain-specific language

    US20220358125A1