Training method of translation model, sentence translation method, device, equipment, program
By optimizing the training process of the translation model through comparative retrieval and attention mechanisms, the problems of complex and redundant model structures in neural machine translation systems are solved, resulting in higher translation accuracy and a better user experience.
Patent Information
- Application Number
- CN202210220466.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-08
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2042-03-08
AI Technical Summary
In existing neural network machine translation systems, the complex model structure and redundant translation memory affect the training accuracy and speed of the translation model, leading to frequent translation errors and impacting user experience.
By comparing and retrieving similar translation memory sentences to the sentence to be translated, and using an attention mechanism to capture the similarity of different translation mechanisms, redundancy is reduced, the diversity of translation memory sentences is obtained, and the training process of the translation model is optimized.
It improves the accuracy and translation effect of the translation model, enhances the user experience, reduces training time, and adapts to different usage scenarios.
Smart Images

Figure CN114757210B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to machine translation (MT) technology, and more particularly to methods for training translation models, methods for translating sentences, apparatus, devices, software programs, and storage media. Background Technology
[0002] Currently, text or speech translation is frequently required in people's work and daily lives. Generally, dedicated translation applications or machine translation (MT) via web pages can be used. However, machine translation sometimes produces errors. Therefore, combining machine translation technology with computer-aided translation (CAT) is a widely used practice in the industry. With the advancement and improvement of MT systems, various efficient CAT interaction methods have emerged.
[0003] With the development of machine translation, Neural Machine Translation (NMT) has become a widely used next-generation translation technology. NMT systems are built on an encoder-decoder framework; however, during the translation process, the decoder performs multiple tasks, such as recording the current content to be translated, the content to be translated, and information related to the fluency of the translation. Translation memory (TM) is a database that stores pairs of source and target language segments. Translators can consult this database during translation to improve efficiency and consistency. Early work in the machine translation community focused primarily on integrating translation memory into statistical machine translation models. In recent years, with the remarkable performance of neural machine translation models on various translation tasks, more and more research aims to integrate translation memory into NMT models. However, the complex model structure and redundant translation memory affect the training accuracy and speed of the translation model, hindering its widespread adoption. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a training method, apparatus, device, software program, and storage medium for a translation model, which can reduce the complexity of the translation model. By comparing and retrieving translation memory sentences similar to the sentence to be translated, the complexity of the network structure caused by the additional memory network in related technologies can be reduced, which affects the training speed and the problem of excessive translation time during use. At the same time, to address the redundancy of translation memory sentences, translation memory fusion can be used to capture the similarity of different translation mechanisms using an attention mechanism, ensuring the diversity of translation memory (that is, the diversity of training samples), so that the accuracy of the trained translation model is higher, the translation effect is better, and the user experience is improved.
[0005] The technical solution of this invention is implemented as follows: This invention provides a method for training a translation model, the method comprising: Acquire the target translation memory statement; Retrieve the source statement corresponding to the target translation memory statement from the translation memory; The source statement and each target translation memory statement are combined to form a training sample, and the different training samples are combined to form a training sample set; Obtain the initial parameters of the translation model; In response to the initial parameters of the translation model, the translation model is used to process different training samples in the training sample set to determine the updated parameters of the translation model; Based on the update parameters of the translation model, the encoder and decoder parameters of the translation model are iteratively updated using different training samples in the training sample set.
[0006] This invention also provides a sentence translation method, the method comprising: The encoder of the translation model determines at least one latent variable at the word level corresponding to the sentence to be translated. The decoder of the translation model generates translation words corresponding to the word-level latent variables and the probability of selecting the translation words based on the at least one word-level latent variable. Based on the selection probability of the translation results, at least one translation word is selected to form a translation result corresponding to the sentence to be translated; Output the translation result.
[0007] This invention also provides a training device for a translation model, the training device comprising: The data transmission module is used to acquire the target translation memory sentences; The translation model training module is used to retrieve the source statement corresponding to the target translation memory statement from the translation memory bank; The translation model training module is used to form training samples from the source statement and the target translation memory statement, and to form a training sample set from different training samples. The translation model training module is used to obtain the initial parameters of the translation model; The translation model training module is used to process different training samples in the training sample set through the translation model in response to the initial parameters of the translation model, and determine the updated parameters of the translation model. The translation model training module is used to iteratively update the encoder and decoder parameters of the translation model using different training samples in the training sample set, based on the updated parameters of the translation model.
[0008] In the above scheme, The translation model training module is used to obtain the maximum length of the sentence to be translated and the maximum length of any translation memory sentence; The translation model training module is used to obtain the lexical distance between the sentence to be translated and any of the translated memory sentences. The translation model training module is used to determine the similarity between the sentence to be translated and any translation memory sentence based on the lexical distance, the maximum length of the sentence to be translated, and the maximum length of any translation memory sentence. The translation model training module is used to determine any translation memory sentence as the original translation memory sentence corresponding to the sentence to be translated when the similarity is greater than or equal to the similarity threshold.
[0009] In the above scheme, The translation model training module is used to calculate the attention value corresponding to each translated memory sentence through an attention function; The translation model training module is used to merge translation memory sentences with the same attention value into a single translation memory sentence; or The translation model training module is used to merge translation memory sentences with the same attention value into different training samples in the training sample subset.
[0010] In the above scheme, The translation model training module is used to determine a dynamic noise threshold that matches the usage environment of the translation model. The translation model training module is used to denoise the training sample set according to the dynamic noise threshold, so as to form a denoised training sample set that matches the dynamic noise threshold; or, The translation model training module is used to determine a fixed noise threshold corresponding to the translation model, and to denoise the training sample set according to the fixed noise threshold to form a denoised training sample set that matches the fixed noise threshold.
[0011] In the above scheme, The translation model training module is used to perform negative example processing on the training sample set to form a negative example sample set corresponding to the training sample set, wherein the negative example sample set is used to adjust the encoder parameters and decoder parameters of the translation model.
[0012] In the above scheme, The translation model training module is used to determine the supervision function corresponding to the translation model; The translation model training module is used to adjust the temperature coefficient of the supervision function; The translation model training module is used to perform negative example processing on the training sample set through the supervision function based on the vector similarity and different temperature coefficients of any two translated memory sentences in the training set, so as to form a negative example sample set corresponding to the training sample set.
[0013] In the above scheme, The translation model training module is used to randomly combine the sentences to be output from the decoder of the translation model to form a negative sample set corresponding to the training sample set; or, The translation model training module is used to randomly delete or replace the sentences to be output in the decoder of the translation model to form a negative sample set corresponding to the training sample set.
[0014] In the above scheme, The translation model training module is used to substitute different training samples from the training sample set into the loss function corresponding to the autoencoder network composed of the encoder and decoder of the translation model. The translation model training module is used to determine the encoder parameters and corresponding decoder parameters in the translation model when the loss function satisfies the convergence condition, and use them as the update parameters of the translation model.
[0015] This invention also provides a sentence translation device, the device comprising: The encoder module is used to determine at least one word-level latent variable corresponding to the sentence to be translated by the encoder of the translation model; The decoder module is used to generate, through the decoder of the translation model, a translation word corresponding to the word-level latent variable and the probability of the translation word being selected, based on the at least one word-level latent variable; The decoder module is used to select at least one translation word to form a translation result corresponding to the sentence to be translated, based on the selection probability of the translation result. The decoder module is used to output the translation result.
[0016] This invention also provides an electronic device, the electronic device comprising: Memory, used to store executable instructions; A processor, used to implement a training method for a preceding translation model when running executable instructions stored in the memory.
[0017] This invention also provides a computer-readable storage medium storing executable instructions, which, when executed by a processor, implement a training method for a preceding translation model or a preceding sentence translation method.
[0018] The embodiments of the present invention have the following beneficial effects: The technical solution provided by this invention involves: acquiring a sentence to be translated; obtaining at least two original translation memory sentences through comparison and retrieval based on the sentence to be translated; performing translation memory fusion processing on the at least two original translation memory sentences to obtain target translation memory sentences; acquiring corresponding source sentences from the translation memory bank based on each target translation memory sentence; forming training samples from the source sentences and each target translation memory sentence, and forming a training sample set from different training samples; acquiring initial parameters of the translation model; processing different training samples in the training sample set through the translation model in response to the initial parameters of the translation model to determine the update parameters of the translation model; and processing the training samples according to the update parameters of the translation model. Different training samples in the set iteratively update the encoder and decoder parameters of the translation model. By comparing and selecting translation memory sentences similar to the sentence to be translated, the complexity of the network structure caused by additional memory networks in related technologies, which affects training speed and leads to excessively long translation times, can be reduced. Furthermore, to address the redundancy of translation memory sentences, translation memory fusion can be used, leveraging attention mechanisms to capture the similarity between different translation mechanisms, ensuring the diversity of translation memories (i.e., the diversity of training samples). This results in higher accuracy and better translation performance of the trained translation model, improving the user experience. Simultaneously, it effectively utilizes the gains from existing translation memory sentences for model training, enabling the translation model to adapt to different usage scenarios. Attached Figure Description
[0019] Figure 1 This is a schematic diagram illustrating a usage scenario of the translation model training method provided in this embodiment of the invention; Figure 2 This is a schematic diagram of the composition structure of the training device for the translation model provided in an embodiment of the present invention; Figure 3 A schematic diagram illustrating the generation of translation results in a traditional approach; Figure 4 A schematic diagram of an optional process for training a translation model provided in an embodiment of the present invention; Figure 5 A schematic diagram of an optional process for training a translation model provided in an embodiment of the present invention; Figure 6 A schematic diagram of an optional process for a sentence translation method of a translation model provided in an embodiment of the present invention; Figure 7 This is a schematic diagram showing the accuracy test results of the translation model; Figure 8 This is a schematic diagram showing the training efficiency test results of the translation model. Figure 9 This is a schematic diagram illustrating the test results for different numbers of translated memorized sentences in the translation model training method of this application; Figure 10 This is a schematic diagram of the front-end display interface of the translation model provided in an embodiment of the present invention.
[0020] Figure 11 This is a schematic diagram of an optional structure of the translation model in an embodiment of the present invention; Figure 12 This is a schematic diagram of an optional translation process of the translation model in an embodiment of the present invention; Figure 13 This is a schematic diagram of an optional encoder structure in the translation model of this invention. Figure 14 This is a schematic diagram of the encoder vector concatenation in the translation model of this invention embodiment; Figure 15 This is a schematic diagram of the encoding process of the encoder in the translation model of this invention. Figure 16 This is a schematic diagram of the decoding process of the decoder in the translation model of this invention. Figure 17 This is a schematic diagram illustrating the output effect of the translation model in an embodiment of the present invention. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on the present invention. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0022] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0023] Before providing a further detailed description of the embodiments of the present invention, the nouns and terms involved in the embodiments of the present invention will be explained, and the nouns and terms involved in the embodiments of the present invention shall be interpreted as follows.
[0024] 1) The sentence to be translated is the sentence corresponding to a certain natural language that is input into the translation model before language conversion.
[0025] 2) Translation result: The translation model outputs a sentence in a certain natural language after language conversion of the source sentence.
[0026] 3) Reference statement: A pre-set reference standard for a certain natural language after the source statement has been converted into a language.
[0027] 4) Faithfulness: A parameter between 0 and 1 that characterizes the degree of similarity between the content of the target sentence and the content of the source sentence. It serves as a standard for evaluating the accuracy of the translation of the source sentence. The larger the value, the higher the degree of similarity between the content of the target sentence and the content of the source sentence, that is, the higher the accuracy of the translation.
[0028] 5) Translation: converting statements in one natural language into statements in another natural language.
[0029] 6) Neural Network (NN): Artificial Neural Network (ANN), also known as neural network or neural network-like network, is a mathematical or computational model in the fields of machine learning and cognitive science that imitates the structure and function of biological neural networks (the central nervous system of animals, especially the brain) and is used to estimate or approximate functions.
[0030] 7) Machine Translation (MT): This falls under the category of computational linguistics, and its research focuses on using computer programs to translate text or speech from one natural language into another. Neural Machine Translation (NMT) is a technique that uses neural networks for machine translation.
[0031] 8) Speech Translation: Also known as automatic speech translation, it is a technology that uses computers to translate the speech of one natural language into the text or speech of another natural language. It generally consists of two stages: speech recognition and machine translation.
[0032] 9) Encoder-decoder architecture: A commonly used network architecture in machine translation technology. It consists of two parts: an encoder and a decoder. The encoder converts the input text into a series of context vectors that can express the features of the input text. The decoder receives the output of the encoder as its own input and outputs the corresponding text sequence in another language.
[0033] 10) Translation memory is a database that records natural language sentences (or sentence fragments) and their translations. As a core component of machine-aided translation systems, it is built and expanded with user usage to eliminate repetitive translations and improve efficiency. For example, the translation memory can store bilingual translation pairs (sample pairs). These pairs can be manually translated or collected through other means (e.g., translation information from web pages collected by web crawlers). If the user provides the sentence to be translated as "I want to eat a hamburger," the translation memory can retrieve the corresponding original translation memory sentences "I like to eat hamburgers" and "I want to eat fries," as well as the source sentences "I like eat Hamburger" and "I want to eat French fries." The retrieved {I like to eat hamburgers} and {I want to eat fries} can be encoded into the translation model to guide its decoding, resulting in the translation model outputting the translation result "I want to eat Hamburger." In some embodiments, the source statement and the target translation memory statement can be combined to form training samples to train the translation model, thereby improving the translation accuracy of the translation model.
[0034] Figure 1 This is a schematic diagram illustrating a usage scenario of the translation model training method provided in this embodiment of the invention. (Refer to...) Figure 1 The terminals (including terminals 10-1 and 10-2) are equipped with translation software clients. Users can input the corresponding sentences to be translated through the translation software clients, and the chat client can also receive the corresponding translation results and display the received translation results to the users. The terminals are connected to the server 200 through network 300. Network 300 can be a wide area network, a local area network, or a combination of both, and data transmission is achieved using a wireless link.
[0035] As an example, server 200 is used to deploy and train the translation model to update the parameters of the encoder network and decoder network in the translation model. This enables the generation of a translation result for the target sentence to be translated through the encoder and decoder networks in the translation model, and the display of the translation result corresponding to the target sentence generated by the translation model through terminals (terminal 10-1 and / or terminal 10-2). To better understand the method provided in the embodiments of this application, artificial intelligence, its various branches, and the application fields, cloud technologies, and artificial intelligence cloud services involved in the method provided in the embodiments of this application will first be explained.
[0036] Artificial intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.
[0037] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning. Each of these areas will be explained in detail below.
[0038] Natural Language Processing (NLP) is an important field within computer science and artificial intelligence. It studies the theories and methods for enabling effective communication between humans and computers using natural language. NLP is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language people use in daily life—and thus it has a close relationship with linguistic research. NLP techniques typically include text processing, semantic understanding, machine translation, question answering, and knowledge graphs.
[0039] Machine learning (ML) is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to endow computers with intelligence; its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, and inductive learning.
[0040] Cloud technology refers to a hosting technology that unifies hardware, software, and network resources within a wide area network (WAN) or local area network (LAN) to achieve data computation, storage, processing, and sharing. Based on the cloud computing business model, cloud technology encompasses network technology, information technology, integration technology, management platform technology, and application technology. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will require robust system support, which can only be achieved through cloud computing.
[0041] So-called AI cloud services, also known as AI as a Service (AIaaS), are a mainstream service model for artificial intelligence platforms. Specifically, AIaaS platforms break down several common AI services and provide them as independent or packaged services in the cloud. This service model is similar to opening an AI-themed marketplace: all developers can access and use one or more AI services provided by the platform through API interfaces. Some experienced developers can also use the platform's AI framework and AI infrastructure to deploy and maintain their own dedicated cloud AI services.
[0042] The solutions provided in this application involve technologies such as natural language processing, machine learning, and artificial intelligence cloud services, which are specifically illustrated through the following embodiments.
[0043] The translation model training method provided in this application will be described in conjunction with exemplary applications and implementations of the terminals provided in the embodiments of this application.
[0044] Of course, before processing the target sentence to be translated using the translation model to generate the corresponding translation result, the translation model also needs to be trained. Specifically, this includes: acquiring the sentence to be translated, and obtaining at least two original translation memory sentences based on the sentence through comparative retrieval; performing translation memory fusion processing on the at least two obtained original translation memory sentences to obtain the target translation memory sentence; acquiring the corresponding source sentence from the translation memory bank based on each target translation memory sentence; forming training samples from the source sentences and each target translation memory sentence, and forming a training sample set from different training samples; acquiring the initial parameters of the translation model; processing different training samples in the training sample set using the translation model in response to the initial parameters of the translation model to determine the update parameters of the translation model; and iteratively updating the encoder and decoder parameters of the translation model using different training samples in the training sample set based on the update parameters of the translation model.
[0045] The structure of the translation model training device according to the embodiments of the present invention will be described in detail below. The translation model training device can be implemented in various forms. For example, the electronic device in the embodiments of this application can be a dedicated terminal with translation model training function, or it can be a server with translation model training function, such as the one mentioned above. Figure 1 Server 200. Figure 2 This is a schematic diagram of the composition of the training device for the translation model provided in an embodiment of the present invention. It can be understood that... Figure 2 This only shows an exemplary structure of the training device for the translation model, not the entire structure; implementation is possible as needed. Figure 2The structure shown may be part or all of the structure.
[0046] The translation model training apparatus provided in this embodiment of the invention includes at least one processor 201, a memory 202, a user interface 203, and at least one network interface 204. The various components in the translation model training apparatus are coupled together via a bus system 205. It can be understood that the bus system 205 is used to implement communication between these components. In addition to a data bus, the bus system 205 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 2 The general labeled all buses as Bus System 205.
[0047] The user interface 203 may include a monitor, keyboard, mouse, trackball, click wheel, buttons, touchpad, or touch screen.
[0048] It is understood that memory 202 can be volatile memory or non-volatile memory, or both. In this embodiment of the invention, memory 202 is capable of storing data to support the operation of a terminal (such as 10-1). Examples of this data include any computer programs used to operate on the terminal (such as 10-1), such as operating systems and applications. The operating system includes various system programs, such as the framework layer, core library layer, driver layer, etc., used to implement various basic services and handle hardware-based tasks. Applications can include various applications.
[0049] In some embodiments, the translation model training device provided in this invention can be implemented using a combination of hardware and software. For example, the translation model training device provided in this invention can be a processor in the form of a hardware decoding processor, which is programmed to execute the translation model training method provided in this invention. For instance, the hardware decoding processor can employ one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.
[0050] As an example of the translation model training device provided in this embodiment of the invention, which adopts a combination of hardware and software, the translation model training device provided in this embodiment of the invention can be directly embodied as a combination of software modules executed by processor 201. The software modules can be located in a storage medium, which is located in memory 202. Processor 201 reads the executable instructions included in the software modules in memory 202 and combines them with necessary hardware (e.g., including processor 201 and other components connected to bus system 205) to complete the translation model training method provided in this embodiment of the invention.
[0051] As an example, processor 201 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., wherein the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0052] As an example of the hardware implementation of the translation model training device provided in this embodiment of the invention, the device provided in this embodiment of the invention can be directly executed by a processor 201 in the form of a hardware decoding processor. For example, it can be executed by one or more application specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components to implement the translation model training method provided in this embodiment of the invention.
[0053] In this embodiment of the invention, the memory 202 is used to store various types of data to support the operation of the translation model training device. Examples of such data include: any executable instructions for operation on the translation model training device, such as executable instructions that can be included in the program implementing the translation model training method of this embodiment of the invention.
[0054] In other embodiments, the training device for the translation model provided in this invention can be implemented in software. Figure 2A training device for a translation model stored in memory 202 is shown. This device can be software in the form of programs and plugins, and includes a series of modules. As an example of a program stored in memory 202, it may include a translation model training device. The translation model training device includes the following software modules: a data transmission module 2081 and a translation model training module 2082. When the software modules in the translation model training device are read into RAM and executed by processor 201, the translation model training method provided in this embodiment of the invention will be implemented. The functions of each software module in the translation model training device in this embodiment of the invention are described below. The data transmission module 2081 is used to acquire the target translation memory statement.
[0055] The translation model training module 2082 is used to retrieve the source statement corresponding to the target translation memory statement from the translation memory bank.
[0056] The translation model training module 2082 is used to retrieve the corresponding source statement from the translation memory bank based on each target translation memory statement.
[0057] The translation model training module 2082 is used to form training samples from the source sentences and each target translation memory sentence, and to form a training sample set from the different training samples.
[0058] The translation model training module 2082 is used to obtain the initial parameters of the translation model.
[0059] The translation model training module 2082 is used to process different training samples in the training sample set through the translation model in response to the initial parameters of the translation model, and determine the updated parameters of the translation model.
[0060] The translation model training module 2082 is used to iteratively update the encoder parameters and decoder parameters of the translation model using different training samples in the training sample set, based on the update parameters of the translation model.
[0061] In some embodiments of the present invention, when the trained translation model is deployed, the electronic device in the embodiments may further include a sentence translation device. Specifically, the sentence translation device includes: The encoder module is used to determine at least one word-level latent variable corresponding to the sentence to be translated using the encoder of the translation model. The decoder module is used to generate translation words corresponding to the at least one word-level latent variable and the selection probability of the translation words based on the at least one word-level latent variable using the decoder of the translation model. The decoder module is used to select at least one translation word to form a translation result corresponding to the sentence to be translated based on the selection probability of the translation result. The decoder module is used to output the translation result.
[0062] Combination Figure 2 The training apparatus for the translation model shown illustrates the training method for the translation model provided in this embodiment of the invention. Before introducing the training method for the translation model provided in this embodiment of the invention, the process of the translation model generating corresponding translation results based on the sentence to be translated in this application is first described. Figure 3 This diagram illustrates the generation of translation results in a traditional approach. Taking the Transformer framework as an example, the main components include encoder-embeddings layer, encoder / decoder layers 1-6 (1 ≦ ith ≦ 6), decoder-embeddings layer, and decoder softmax layer. Each encoder / decoder layer is composed of other basic units. All components are organically combined to form a layer in the network, and then stacked layer by layer to form the entire network. The encoder layers convert the input sentence (source language) into semantic vectors, while the decoder layers convert the semantic vectors into output sentences (target language). When using translation memory for training, this process begins with translation memory (TM) retrieval. This step retrieves translation fragments similar to the current input from a database using a similarity metric. Afterwards, an additional dual-encoder structure or a unified vocabulary combining TM and X is used as input to the translation model for training. The drawback of this approach is that it sequentially selects the sentences most similar to the currently translated sentence from the database, but ignores the already retrieved sentences. This results in all retrieved sentences being repetitive with each other, and the redundant content brings less information gain, affecting the model training efficiency. At the same time, the translation model of related technologies processes the multiple retrieved TMs separately instead of treating them as a unified whole, which affects the translation effect of the translation model.
[0063] To address the shortcomings in this related technology, refer to Figure 4 , Figure 4 This is an optional flowchart illustrating the training method for the translation model provided in this embodiment of the invention. It can be understood that... Figure 4 The steps shown can be performed by various electronic devices running translation model training equipment, such as dedicated terminals with model training capabilities, servers with translation model training capabilities, or server clusters. The following section addresses... Figure 4 The steps shown are explained.
[0064] Step 401: The translation model training device acquires the target translation memory statement and retrieves the source statement corresponding to the target translation memory statement from the translation memory bank.
[0065] In some embodiments of the present invention, when obtaining the target translation memory statement, the statement to be translated is first obtained; then, based on the statement similarity between the statement to be translated and the original translation memory statements, a search is performed to obtain at least two original translation memory statements that match the statement to be translated; finally, the at least two original translation memory statements obtained are subjected to translation memory fusion processing to obtain the target translation memory statement. The translation memory bank can store different original translation memory statements. For example, the translation memory bank can store translation information provided by historical users. That is, whenever a user initiates a translation request, the translation memory bank can respond to the user's translation request by storing the corresponding translation information provided by the user. Each stored translation information can serve as an original translation memory statement; or, a trained translation model can automatically translate web pages in different languages collected by a crawler program and save the translation results in the translation memory bank as original translation memory statements. This application does not impose specific limitations on this.
[0066] In some embodiments of the present invention, taking the translation of sentences in a game display interface as an example, for instance, the Japanese sentences presented in the display interface of game A, and the translated Chinese sentences, can be used as target translation memory sentences and corresponding source sentences, and stored in the translation memory bank. When it is necessary to translate the Japanese sentences presented in the display interface of game B, the target translation memory sentences and corresponding source sentences that match the sentences to be translated in game B can be obtained from the translation memory bank to complete the training of the translation model.
[0067] In some embodiments of the present invention, a search is performed based on the similarity between the statement to be translated and the original translation memory statements to obtain at least two original translation memory statements that match the statement to be translated. This can be achieved in the following ways: The maximum length of the sentence to be translated and the maximum length of any translation memory sentence are obtained. The lexical distance between the sentence to be translated and any translation memory sentence is obtained. Based on the lexical distance, the maximum length of the sentence to be translated, and the maximum length of any translation memory sentence, the similarity between the sentence to be translated and any translation memory sentence is determined. When the similarity is greater than or equal to a similarity threshold, the any translation memory sentence is determined to be the original translation memory sentence corresponding to the sentence to be translated. Here, the input sentence to be translated is x, and y is any translation memory sentence. Using Formula 1, the idea of comparative retrieval is used to search based on the sentence similarity between the sentence to be translated and the original translation memory sentences to obtain at least two original translation memory sentences that match the sentence to be translated. For example, k translation memory sentences (k is an integer greater than or equal to 2) can be found in the translation memory database. Formula 1 in, and The system consists of two sets of sentences to be translated and original translation memory sentences. For example, if the sentence to be translated is "I want to eat apples", the original translation memory sentences would be "I want to eat strawberries" and "I plan to eat instant noodles". Through translation memory fusion processing, the target translation memory sentence can be "I want to eat strawberries and plan to eat instant noodles".
[0068] When performing similarity retrieval, the specific calculation method is shown in Formula 2, where Sim(x, y) is the similarity measurement function between the sentence to be translated and any translated memory sentence: Formula 2 Among them, the numerator term in Formula 2 This represents the edit distance between any two sentences (tokens). The denominator term... The maximum length of the sentence to be translated and any original translation memory sentence is used to normalize the similarity. By comparing the sentence similarity between the sentence to be translated and any original translation memory sentence, a higher original translation memory sentence that matches the sentence to be translated can be obtained, ensuring the accuracy of the translation model and reducing the impact of the translation model's erroneous translations on the user.
[0069] Step 402: The translation model training device performs translation memory fusion processing on at least two original translation memory sentences to obtain the target translation memory sentence.
[0070] In some embodiments of the present invention, translation memory fusion processing is performed on at least two original translation memory statements to obtain the target translation memory statement, which can be achieved in the following ways: The attention value for each translation memory sentence is calculated using an attention function; translation memory sentences with the same attention value are merged into a single translation memory sentence; or translation memory sentences with the same attention value are merged into different training samples within a subset of training samples. The attention value for each translation memory sentence can be calculated using an attention function, as detailed in Formula 3. Formula 3 in For translation memory nodes The state at time t+1 is represented by the states of the node's neighbors at time t and the state of the node at time t, updated through a self-attention mechanism. A supernode can be configured for each translation memory. The supernode's role is to enable communication and interaction between different translation memory statements. Nodes within the same translation memory cannot see the content of surrounding nodes, ensuring semantic integrity and facilitating the retrieval of original translation memory statements in different usage environments. Through translation memory fusion, the attention mechanism is used to capture the similarity between different translation mechanisms, ensuring the diversity of translation memories (i.e., the diversity of training samples), resulting in higher accuracy and better translation performance of the trained translation model.
[0071] In some embodiments of the present invention, in order to accelerate the training speed of the translation model, translation memory sentences with the same attention value can be discarded, and only translation memory sentences with different but the same attention value can be retained, so as to reduce the size of the training sample set.
[0072] Step 403: The translation model training device retrieves the corresponding source sentence from the translation memory bank based on each target translation memory sentence.
[0073] Step 404: The translation model training device combines the source statement and each target translation memory statement into training samples, and combines the different training samples into a training sample set.
[0074] In some embodiments of the present invention, when the number of training samples in the training sample set exceeds a threshold for the number of training samples, it is also necessary to perform noise reduction on the training sample set, specifically including: Determine a dynamic noise threshold that matches the usage environment of the translation model; The training sample set is denoised according to the dynamic noise threshold to form a denoised training sample set that matches the dynamic noise threshold; or, A fixed noise threshold corresponding to the translation model is determined, and the training sample set is denoised according to the fixed noise threshold to form a denoised training sample set that matches the fixed noise threshold. Since the usage environment of the translation model varies, the dynamic noise threshold matching the usage environment of the translation model also varies. For example, in the usage environment of academic translation, the dynamic noise threshold matching the usage environment of the translation model needs to be lower than the dynamic noise threshold in the text reading environment.
[0075] In some embodiments of the present invention, when the translation model is embedded in the corresponding hardware and the usage environment is conversational translation, the training speed of the translation model can be effectively improved and the user's waiting time can be reduced by fixing the corresponding fixed noise threshold of the translation model.
[0076] After determining the training sample set, proceed to step 405.
[0077] Step 405: The translation model training device obtains the initial parameters of the translation model.
[0078] Step 406: In response to the initial parameters of the translation model, the translation model training device processes different training samples in the training sample set using the translation model to determine the updated parameters of the translation model.
[0079] Step 407: The translation model training device iteratively updates the encoder and decoder parameters of the translation model using different training samples in the training sample set, based on the updated parameters of the translation model.
[0080] In some embodiments of the present invention, initializing the decoder network to update the parameters of the decoder network can be achieved in the following ways: The encoder of the decoder network encodes the sentence to be translated, forming an encoded result. The decoder of the decoder network decodes the encoded result. When the probability of selecting the translation result corresponding to the sentence to be translated is obtained, the parameters of the decoder network are determined. For example, if the decoder network of the initialized translation model generates three translation result words based on the corresponding sentence to be translated, namely translation result a (probability 0.45), translation result b (probability 0.5), and translation result c (probability 0.45), then the probability distribution is {0.45, 0.5, 0.45}.
[0081] Therefore, the translation model can output the translation result with the minimum loss value according to the corresponding sentence to be translated.
[0082] In some embodiments of the present invention, in response to the initial parameters of the translation model, different training samples in the training sample set are processed by the translation model to determine the updated parameters of the translation model, which can be achieved in the following ways: Substitute different training samples from the training sample set into the loss function corresponding to the autoencoder network composed of the encoder and decoder of the translation model; determine the encoder parameters and corresponding decoder parameters in the translation model when the loss function satisfies the convergence condition, and use these as the update parameters of the translation model. The loss function of the encoder network is expressed as: loss_A =∑(decoder_A(encoder(warp(x1)))-x1)2; Specifically, decoder_A is the decoder A, warp is the function of the statement to be translated, x1 is the statement to be translated, and encoder is the encoder.
[0083] During iterative training, the parameters of encoder A and decoder A are calculated as the loss function of the encoder network is solved when the loss function descends according to the gradient (e.g., maximum gradient). Training ends when the loss function converges (i.e., when it is determined that a word-level latent variable corresponding to the sentence to be translated can be formed).
[0084] During the training of the encoder network, the loss function of the encoder network is expressed as: loss_B=∑(decoder_B(encoder(warp(x2)))-x2)2; where decoder_B is the decoder B, warp is the function of the sentence to be translated, x2 is the sentence to be translated, and encoder is the encoder.
[0085] During iterative training, the parameters of encoder B and decoder B are solved by substituting the sentence to be translated into the loss function of the encoder network and calculating the parameters of the encoder B and decoder B as the loss function descends according to the gradient (e.g., the maximum gradient). Training ends when the loss function converges (i.e., when the probability of selecting the translation result corresponding to the sentence to be translated is obtained by decoding).
[0086] Therefore, the translation model can output the translation result with the minimum loss value according to the corresponding sentence to be translated, thus ensuring the accuracy of the translation result.
[0087] In some embodiments of the present invention, the method further includes: The training sample set is processed to generate a negative sample set corresponding to the training sample set, wherein the negative sample set is used to adjust the encoder and decoder parameters of the translation model.
[0088] To further illustrate the process of obtaining negative samples, please refer to [link / reference]. Figure 5 , Figure 5 This is an optional flowchart illustrating the training method for the translation model provided in this embodiment of the invention. It can be understood that... Figure 5 The steps shown can be performed by various electronic devices running translation model training equipment, such as dedicated terminals with model training capabilities, servers with translation model training capabilities, or server clusters. The following section addresses... Figure 5 The steps shown are explained.
[0089] Step 501: Determine the supervision function corresponding to the translation model.
[0090] Step 502: Adjust the temperature coefficient of the monitoring function.
[0091] Step 503: Based on the vector similarity and different temperature coefficients of any two translated memory sentences in the training set, negative example processing is performed on the training sample set using the supervision function to form a negative example sample set corresponding to the training sample set. The supervision function is referenced in Formula 4: Formula 4 in, This represents the degree of similarity between the vectors of any two translated memory sentences. The similarity calculation can be done using standard machine translation evaluation methods (BLEU, Bilingual Evaluation Understudy), cosine similarity, etc. This application does not restrict the specific similarity calculation method. It is a temperature coefficient used to control the difficulty of distinguishing between positive and negative examples in contrastive learning. By adjusting the temperature coefficient, the proportion of negative examples can be flexibly controlled.
[0092] In some embodiments of the present invention, the encoder and decoder corresponding to the translation model can also be bidirectional network models. For example, a Bi-GRU bidirectional GRU model can be used as both the encoder and decoder. Here, the Bi-GRU bidirectional GRU model is a model that can recognize inverted sentence structures. Since users may input dialogue sentences in an inverted sentence structure, that is, different from the normal sentence structure, for example, the user inputs the dialogue sentence "How is the weather today?" while the normal sentence structure is "How is the weather today?", the Bi-GRU bidirectional GRU model can recognize dialogue sentences with inverted sentence structures, thereby enriching the functionality of the trained model and improving the robustness of the final trained target model.
[0093] Combination Figure 2The translation model training device shown further illustrates the sentence translation method of the translation model provided in the embodiments of the present invention, see [link to documentation]. Figure 6 , Figure 6 This is an optional flowchart illustrating the sentence translation method of the translation model provided in this embodiment of the invention. It can be understood that... Figure 6 The steps shown can be performed by various electronic devices running the translation model training device, such as a dedicated terminal with translation processing capabilities, a server with translation processing capabilities, or a server cluster. The following section addresses... Figure 6 The steps shown are explained.
[0094] Step 601: Determine at least one word-level latent variable corresponding to the sentence to be translated using the encoder of the translation model.
[0095] Step 602: Using the decoder of the translation model, based on the at least one word-level latent variable, generate the translation word corresponding to the word-level latent variable and the probability of the translation word being selected.
[0096] Step 603: Based on the selection probability of the translation result, select at least one translation word to form a translation result corresponding to the sentence to be translated.
[0097] Step 604: Output the translation result.
[0098] When testing the trained translation model, refer to Figures 7 to 9 The model training methods for the relevant technologies are: Vaswani et al., 2017, Gu et al., 2018, Zhang et al., 2018, and Xu et al., 2020. References: Xia et al., 2019; He et al., 2021(@s); Cai et al., 2021(#2). The training method used in this application is T-Full. Figure 7 This is a schematic diagram showing the accuracy test results of the translation model. Figure 8 This is a schematic diagram illustrating the training efficiency test results of the translation model. Figure 9 The diagram illustrates the test results for different numbers of translation memory sentences in the translation model training method of this application. The accuracy score of T-Full is 58.69 to 67.76, which is significantly higher than the training methods in related technologies. This shows that this application can effectively make full use of the existing translation memory sentences to enhance model training, enabling the translation model to adapt to different usage scenarios.
[0099] Figure 10This is a schematic diagram of the front-end display interface of the translation model provided in this embodiment of the invention. The translation model shown in this embodiment can process the sentence to be translated and generate the corresponding translated text. The target to be translated is "When I have time, I want to go camping and light a campfire with my friends," entered by the user through a translation applet on an instant messaging client. The translation model processes the data to generate corresponding translated texts for users to choose from, along with the probability of each translation result being selected.
[0100] Based on the selection probability of the translation results, the selection of translation results to form a translation result corresponding to the sentence to be translated includes the following three combinations: 1) "When I can find time, I want to go camping and light a bonfire with my friends".
[0101] 2) "When I find time, go camping and light a bonfire with your friends".
[0102] 3) "When you find time, go camping friends and light a campfire".
[0103] Therefore, the translation model provided by this invention can generate multiple different translation results based on the same sentence to be translated.
[0104] The following describes the usage process of the translation model provided in this embodiment of the invention, using the specific structure of the translation model. Through the translation model, the foreign language meanings of virtual objects and virtual scenes can be obtained in a timely manner. The trained translation model can translate text information in the game scene on the game server. The translation model has a transformer structure.
[0105] Continue to refer to Figure 11 , Figure 11 This is a schematic diagram of an optional translation model in an embodiment of the present invention. The Encoder comprises N=6 identical layers, each containing two sub-layers. The first sub-layer is a multi-head attention layer, followed by a simple fully connected layer. Each sub-layer includes residual connections and normalization.
[0106] The decoder consists of N=6 identical layers, which are not identical to the encoder. Each layer contains three sub-layers: a self-attention layer, an encoder-decoder attention layer, and a fully connected layer. The first two sub-layers are based on multi-head attention layers. Specifically, Nx on the left represents the structure of one layer in the encoder, which includes two sub-layers: a multi-head attention layer and a forward propagation layer. The input and output of each sub-layer are correlated; the output of the current sub-layer serves as the input for the next. Each sub-layer is followed by a normalization operation, which improves the model's convergence speed. Nx on the right represents the structure of one layer in the decoder, which includes three sub-layers. The first sub-layer is a multi-head attention sub-layer controlled by a mask matrix, used to model the generated target sentence vector. During training, a mask matrix is needed to control the multi-head attention calculation, ensuring that only the first t-1 words are calculated at each multi-head attention iteration. The second sub-layer is the multi-head attention sub-layer, which is the attention mechanism between the encoder and decoder. It searches for relevant semantic information in the source text, and this layer is calculated using a dot product. The third sub-layer is the forward propagation sub-layer, calculated in the same way as the forward propagation sub-layer in the encoder. Each sub-layer of the decoder is also interconnected; the output of the current sub-layer serves as the input data for the next sub-layer. Furthermore, each sub-layer of the decoder is immediately followed by a normalization operation to accelerate model convergence.
[0107] Continue to refer to Figure 12 , Figure 12is a schematic diagram of an optional translation process of the translation model in an embodiment of the present invention, wherein both the encoder and decoder parts include 6 encoders and decoders. The inputs entering the first encoder are combined with embedding and positional embedding. After passing through 6 encoders, it is output to each decoder in the decoder part; the input sentence to be translated is Japanese "無双の魔呂某は言った。「これから戦場は私一人で支配します。私と戦う人がいます。After processing by the translation model, the original translation sentence "蒼天翔竜趙某は言います。「勇者の誓いは、生死よりも甚だしい!恐れないと心に抱いて、空を飛べます。" is stored in the translation memory; and the source sentence "苍天翔龙赵某说:“勇者之誓,甚于生死!心怀不惧,方能翱翔于天际!”;After obtaining the Chinese source sentence corresponding to the target translation memory sentence, which is also in Japanese, from the translation memory, the translation model is trained, and the translation result finally output by the translation model is: "无双之魔吕某说:“从此刻开始,战场由我一人主宰!可有人敢与我一战!” Continue to refer to Figure 13 , Figure 13 is a schematic diagram of an optional structure of an encoder in a translation model in an embodiment of the present invention, wherein its input consists of a query (Q) and a key (K) with dimension d and a value (V) with dimension d, all keys compute the dot product of the query, and apply the softmax function to obtain the weight of the value.
[0108] Continue to refer to Figure 13 , Figure 13 is a schematic diagram of an optional structure of an encoder in a translation model in an embodiment of the present invention, wherein Q, K and V are obtained by multiplying the vector x input to the encoder with W^Q, W^K, and W^V to obtain Q, K and V. The dimensions of W^Q, W^K, and W^V in the article are (512, 64), and then assume that the dimensions of inputs are (m, 512), where m represents the number of words. Therefore, the dimensions of Q, K and V obtained by multiplying the input vector with W^Q, W^K, and W^V are (m, 64).
[0109] Continue to refer to Figure 14 , Figure 14This is a schematic diagram of vector concatenation in the encoder of the translation model in this embodiment of the invention. Z0 to Z7 are the corresponding 8 parallel heads (with dimensions of (m, 64)). Concatenating these 8 heads yields a dimension of (m, 512). Finally, multiplying by W^O results in an output matrix with a dimension of (m, 512), which then matches the dimension of the next encoder.
[0110] Continue to refer to Figure 15 , Figure 15 This diagram illustrates the encoding process of the encoder in the translation model of this invention. The tensor obtained through self-attribution needs to undergo processing by a residual network and Later Norm, before entering a fully connected feedforward network. The feedforward network performs the same residual processing and normalization. Finally, the output tensor enters the next encoder. This process iterates six times, and the result of each iteration enters the decoder.
[0111] Continue to refer to Figure 16 , Figure 16 This is a schematic diagram of the decoding process of the decoder in the translation model of this invention, where the decoder's input and output and the decoding process are shown below: Output: The probability distribution of the output word at position i; Input: the encoder's output & the decoder's output at position i-1. Therefore, the attention mechanism in the middle is not self-attention; its K and V come from the encoder, and its Q comes from the decoder's output at the previous position.
[0112] Figure 17 This is a schematic diagram of the output effect of the translation model in an embodiment of the present invention. After training the translation model using the translation model training method provided in this application, it can translate user input and foreign language content displayed to the user in the game scene, making it easier for the user to understand and use.
[0113] In summary, the embodiments of the present invention have the following technical effects: The technical solution provided by this invention involves: acquiring a sentence to be translated; obtaining at least two original translation memory sentences through comparison and retrieval based on the sentence to be translated; performing translation memory fusion processing on the at least two original translation memory sentences to obtain target translation memory sentences; acquiring corresponding source sentences from the translation memory bank based on each target translation memory sentence; forming training samples from the source sentences and each target translation memory sentence, and forming a training sample set from different training samples; acquiring initial parameters of the translation model; processing different training samples in the training sample set through the translation model in response to the initial parameters of the translation model to determine the update parameters of the translation model; and processing the training samples according to the update parameters of the translation model. Different training samples in the set iteratively update the encoder and decoder parameters of the translation model. By comparing and selecting translation memory sentences similar to the sentence to be translated, the complexity of the network structure caused by additional memory networks in related technologies, which affects training speed and leads to excessively long translation times, can be reduced. Furthermore, to address the redundancy of translation memory sentences, translation memory fusion can be used, leveraging attention mechanisms to capture the similarity between different translation mechanisms, ensuring the diversity of translation memories (i.e., the diversity of training samples). This results in higher accuracy and better translation performance of the trained translation model, improving the user experience. Simultaneously, it effectively utilizes the gains from existing translation memory sentences for model training, enabling the translation model to adapt to different usage scenarios.
[0114] The above description is merely an embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for training a translation model, characterized in that, The training method includes: Based on the similarity between the statement to be translated and the original translated memory statements, a search is performed to obtain at least two original translated memory statements that match the statement to be translated. The attention value corresponding to each of the original translated memory sentences is calculated using an attention function; The original translation memory statements with the same attention value are merged into the target translation memory statement; Retrieve the source statement corresponding to the target translation memory statement from the translation memory; The source statement and the target translation memory statement are combined to form a training sample, and different training samples are combined to form a training sample set; Obtain the initial parameters of the translation model; In response to the initial parameters of the translation model, the translation model is used to process different training samples in the training sample set to determine the updated parameters of the translation model; Based on the update parameters of the translation model, the encoder and decoder parameters of the translation model are iteratively updated using different training samples in the training sample set.
2. The method according to claim 1, characterized in that, The process of searching based on the similarity between the statement to be translated and the original translated memory statements yields at least two original translated memory statements that match the statement to be translated, including: Obtain the maximum length of the sentence to be translated and the maximum length of any translated memory sentence; Obtain the lexical distance between the sentence to be translated and any of the translated memory sentences; Based on the lexical distance, the maximum length of the sentence to be translated, and the maximum length of any translation memory sentence, the similarity between the sentence to be translated and any translation memory sentence is determined. When the similarity is greater than or equal to the similarity threshold, any of the translation memory statements is determined to be the original translation memory statement corresponding to the statement to be translated.
3. The method according to claim 1, characterized in that, The method further includes: Determine a dynamic noise threshold that matches the usage environment of the translation model; The training sample set is denoised according to the dynamic noise threshold to form a denoised training sample set that matches the dynamic noise threshold; or, A fixed noise threshold corresponding to the translation model is determined, and the training sample set is denoised according to the fixed noise threshold to form a denoised training sample set that matches the fixed noise threshold.
4. The method according to claim 1, characterized in that, The method further includes: The training sample set is processed to generate a negative sample set corresponding to the training sample set, wherein the negative sample set is used to adjust the encoder and decoder parameters of the translation model.
5. The method according to claim 4, characterized in that, The negative example processing of the training sample set includes: Determine the supervision function corresponding to the translation model; Adjust the temperature coefficient of the monitoring function; Based on the vector similarity and different temperature coefficients of any two target translation memory sentences in the training sample set, the training sample set is processed by the supervision function to form a negative sample set corresponding to the training sample set.
6. The method according to claim 4, characterized in that, The negative example processing of the training sample set includes: The sentences to be output in the decoder of the translation model are randomly combined to form a negative sample set corresponding to the training sample set; or, The sentences to be output in the decoder of the translation model are randomly deleted or replaced to form a negative sample set corresponding to the training sample set.
7. The method according to claim 1, characterized in that, The process of responding to the initial parameters of the translation model, processing different training samples in the training sample set using the translation model, and determining the updated parameters of the translation model includes: Substitute different training samples from the training sample set into the loss function corresponding to the autoencoder network composed of the encoder and decoder of the translation model; The parameters of the encoder and the corresponding decoder in the translation model when the loss function satisfies the convergence condition are used as the update parameters of the translation model.
8. A sentence translation method, characterized in that, The method includes: The encoder of the translation model determines at least one latent variable at the word level corresponding to the sentence to be translated. The decoder of the translation model generates translation words corresponding to the word-level latent variables and the probability of selecting the translation words based on the at least one word-level latent variable. Based on the selection probability of the translated words, at least one translated word is selected to form a translation result corresponding to the sentence to be translated; Output the translation result; The translation model is trained based on the method described in any one of claims 1 to 7.
9. A training device for a translation model, characterized in that, The training device includes: The data transmission module is used to retrieve at least two original translation memory statements that match the statement to be translated based on the statement similarity between the statement to be translated and the original translation memory statements. The translation model training module is used to calculate the attention value corresponding to each of the original translation memory sentences through an attention function; and to merge the original translation memory sentences with the same attention value into the target translation memory sentence. The translation model training module is also used to obtain the source statement corresponding to the target translation memory statement from the translation memory bank; The translation model training module is also used to form training samples from the source statement and the target translation memory statement, and to form a training sample set from different training samples. The translation model training module is also used to obtain the initial parameters of the translation model; The translation model training module is also used to process different training samples in the training sample set through the translation model in response to the initial parameters of the translation model, and determine the updated parameters of the translation model. The translation model training module is further configured to iteratively update the encoder and decoder parameters of the translation model using different training samples in the training sample set, based on the updated parameters of the translation model.
10. The apparatus according to claim 9, characterized in that, The translation model training module is also used to obtain the maximum length of the sentence to be translated and the maximum length of any translation memory sentence; The translation model training module is also used to obtain the lexical distance between the sentence to be translated and any of the translated memory sentences; The translation model training module is also used to determine the similarity between the sentence to be translated and any translation memory sentence based on the lexical distance, the maximum length of the sentence to be translated, and the maximum length of any translation memory sentence. The translation model training module is further configured to determine any translation memory statement as the original translation memory statement corresponding to the statement to be translated when the similarity is greater than or equal to the similarity threshold.
11. The apparatus according to claim 10, characterized in that, The translation model training module is also used to determine a dynamic noise threshold that matches the usage environment of the translation model; The translation model training module is further configured to denoise the training sample set according to the dynamic noise threshold, so as to form a denoised training sample set that matches the dynamic noise threshold; or, The translation model training module is further configured to determine a fixed noise threshold corresponding to the translation model, and to perform denoising processing on the training sample set according to the fixed noise threshold to form a denoised training sample set that matches the fixed noise threshold.
12. The apparatus according to claim 10, characterized in that, The translation model training module is further configured to perform negative example processing on the training sample set to form a negative example sample set corresponding to the training sample set, wherein the negative example sample set is used to adjust the encoder parameters and decoder parameters of the translation model.
13. The apparatus according to claim 12, characterized in that, The translation model training module is also used to determine the supervision function corresponding to the translation model; The translation model training module is also used to adjust the temperature coefficient of the supervision function; The translation model training module is further used to perform negative example processing on the training sample set based on the vector similarity and different temperature coefficients of any two target translation memory sentences in the training sample set, through the supervision function, so as to form a negative example sample set corresponding to the training sample set.
14. The apparatus according to claim 12, characterized in that, The translation model training module is further configured to randomly combine the output statements in the decoder of the translation model to form a negative sample set corresponding to the training sample set; or, The translation model training module is also used to randomly delete or replace the sentences to be output in the decoder of the translation model to form a negative sample set corresponding to the training sample set.
15. The apparatus according to claim 10, characterized in that, The translation model training module is also used to substitute different training samples in the training sample set into the loss function corresponding to the autoencoder network composed of the encoder and decoder of the translation model. The translation model training module is further configured to use the encoder parameters and corresponding decoder parameters in the translation model when the loss function satisfies the convergence condition as the update parameters of the translation model.
16. A sentence translation device, characterized in that, The device includes: The encoder module is used to determine at least one word-level latent variable corresponding to the sentence to be translated by the encoder of the translation model; The decoder module is used to generate, through the decoder of the translation model, a translation word corresponding to the word-level latent variable and the probability of the translation word being selected, based on the at least one word-level latent variable; The decoder module is further configured to select at least one translation word to form a translation result corresponding to the sentence to be translated, based on the selection probability of the translation word; The decoder module is also used to output the translation result; The translation model is trained based on the apparatus described in any one of claims 9 to 15.
17. An electronic device, characterized in that, The electronic device includes: Memory, used to store executable instructions; The processor, when executing executable instructions stored in the memory, implements the training method of the translation model according to any one of claims 1 to 7, or implements the sentence translation method according to claim 8.
18. A computer program product comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by the processor, they implement the training method of the translation model according to any one of claims 1 to 7, or the sentence translation method according to claim 8.
19. A computer-readable storage medium storing executable instructions, characterized in that, When the executable instructions are executed by the processor, they implement the training method of the translation model according to any one of claims 1 to 7, or the sentence translation method according to claim 8.
Citation Information
Patent Citations
Training method and device of translation model, text processing method and device and storage medium
CN110598224A
Neural machine-translation method, neural machine-translation model training method, neural machine-translation model training device, and electronic equipment
CN113919373A
