A method for determining a multilingual translation model and related device

By sampling and multi-task learning based on the number of corpus in multi-language translation model training, the problem of imbalanced corpus in the translation direction is solved, and translation accuracy and storage efficiency are improved.

CN114676707BActive Publication Date: 2024-10-01TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210283840.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-22
Publication Date
2024-10-01
Estimated Expiration
2042-03-22

AI Technical Summary

Technical Problem

During the training process of the multi-language translation model, due to the imbalance of the number of corpus in different translation directions, the model overly focuses on the direction with a large number of corpus and ignores the direction with a small number of corpus, affecting the translation accuracy, and over-sampling will increase the storage space occupied.

Method used

By obtaining training corpus in multiple translation directions, the sampling parameters are determined according to the number of corpus, and the same number of sample sets are obtained to avoid oversampling. Multi-task learning is used to train the model to balance the number of corpus in each translation direction.

Benefits of technology

It improves the translation accuracy of the multi-language translation model in different translation directions, avoids the waste of storage resources, and improves the generalization degree of the model and the utilization of storage resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114676707B_ABST
    Figure CN114676707B_ABST
Patent Text Reader

Abstract

The present application discloses a method for determining a multilingual translation model and a related device, which can be applied to various scenarios such as artificial intelligence, natural language processing, and machine learning. The translation directions corresponding to n training tasks are determined by sampling parameters, and the training corpus is sampled based on the corresponding translation directions to obtain n sample sets, which correspond one-to-one to the n training tasks. The n sample sets include the same number of corpora, and the training corpora in the same sample set belong to the same translation direction, which can avoid ignoring the translation direction with a small number of training corpora. The source language of the training corpora in the n sample sets is input into the initial multilingual translation model, and n loss functions corresponding one-to-one to the n sample sets are obtained according to the corresponding target language corpora, and then the total loss function is determined based on the n loss functions, and the initial multilingual translation model is trained according to the total loss function to improve the generalization of the model and ensure the translation accuracy under different translation directions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of machine learning, and in particular to a method for determining a multilingual translation model and related devices. Background Art

[0002] With the widespread application of machine translation technology, machine translation has gradually expanded to multilingual machine translation. Multilingual machine translation means that the same model can support translation between multiple languages, thereby meeting users' needs for multiple translation directions.

[0003] The training of multilingual machine translation models (multilingual translation models) requires training corpora in multiple translation directions. Usually, the number of training corpora in multiple translation directions is not balanced. In order to avoid excessive attention to translation directions with a large number of training corpora and ignoring translation directions with a small number of training corpora during the training of the multilingual translation model, the training accuracy is affected, and the accuracy of the translation of the trained multilingual translation model is affected. Usually, the translation directions with a small number of training corpora can be oversampled to increase the proportion of translation directions with a small number of training corpora to avoid affecting the accuracy of the model. However, oversampling may affect the space occupied by the multilingual translation model during training.

[0004] Therefore, there is an urgent need for a method to determine a multilingual translation model with higher accuracy. Summary of the invention

[0005] In order to solve the above technical problems, the present application provides a method and related device for determining a multilingual translation model, which eliminates the need to oversample training corpora for translation directions with less training corpora, thereby reducing the space occupied by the model.

[0006] The embodiments of the present application disclose the following technical solutions:

[0007] On the one hand, the present application provides a method for determining a multilingual translation model, the method comprising:

[0008] Acquire training corpora including N translation directions, wherein the training corpora include source language corpora and target language corpora corresponding to the translation directions, where N>1;

[0009] Determine sampling parameters corresponding to the N translation directions respectively according to the amount of corpora belonging to the N translation directions respectively in the training corpora;

[0010] Determine the translation directions corresponding to the n training tasks by the sampling parameters, and sample the training corpus based on the corresponding translation directions to obtain n sample sets, wherein the n sample sets correspond to the n training tasks one by one, the n sample sets include the same number of corpora, and for a target sample set in the n sample sets, the training corpora in the target sample set all belong to the translation direction corresponding to the target sample set;

[0011] Inputting the source language corpus of the training corpus in the n sample sets into the initial multilingual translation model, and obtaining n loss functions according to the corresponding target language corpus, wherein the n loss functions correspond one-to-one to the n sample sets;

[0012] A total loss function is determined based on the n loss functions, and the initial multilingual translation model is trained according to the total loss function to obtain a multilingual translation model for translation in the N translation directions.

[0013] On the other hand, the present application provides a device for determining a multilingual translation model, the device comprising:

[0014] An acquisition module, used to acquire training corpora under N translation directions, wherein the training corpora include source language corpora and target language corpora of the corresponding translation directions, where N>1;

[0015] A determination module, used to determine the sampling parameters corresponding to the N translation directions respectively according to the amount of corpus of the training corpus belonging to the N translation directions respectively;

[0016] A sampling module, used to determine the translation directions corresponding to the n training tasks through the sampling parameters, and sample the training corpus based on the corresponding translation directions to obtain n sample sets, wherein the n sample sets correspond to the n training tasks one by one, the n sample sets include the same number of corpora, and for a target sample set in the n sample sets, the training corpora in the target sample set all belong to the translation direction corresponding to the target sample set;

[0017] A training module, used for inputting the source language corpus of the training corpus in the n sample sets into the initial multilingual translation model, and obtaining n loss functions according to the corresponding target language corpus, wherein the n loss functions correspond one-to-one to the n sample sets;

[0018] The training module is further used to determine a total loss function based on the n loss functions, and train the initial multilingual translation model according to the total loss function to obtain a multilingual translation model for translation in the N translation directions.

[0019] In another aspect, an embodiment of the present application provides a computer device, the computer device comprising a processor and a memory:

[0020] The memory is used to store program code and transmit the program code to the processor;

[0021] The processor is configured to execute the method described above according to the instructions in the program code.

[0022] On the other hand, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method described in the above aspects.

[0023] On the other hand, an embodiment of the present application provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the method described in the above aspects.

[0024] It can be seen from the above technical solution that by obtaining training corpora including N translation directions, sampling parameters corresponding to the N translation directions can be determined according to the number of corpora under the N translation directions respectively belonging to the training corpora. The translation directions corresponding to the n training tasks can be determined by the sampling parameters, and the training corpora are sampled based on the corresponding translation directions to obtain n sample sets. Since the n sample sets correspond to the n training tasks one-to-one, the number of corpora included in the n sample sets is the same and the training corpora in the same sample set belong to the same translation direction, so that when the translation direction with less training corpora is determined to correspond to the sample set, a relatively large number of training corpora can be sampled for training. Therefore, training through the n sample sets can avoid excessive attention to the direction with a large number of corpora and ignoring the translation direction with a small number of training corpora. The source language of the training corpus in the n sample sets is input into the initial multilingual translation model, and n loss functions corresponding to the n sample sets are obtained according to the corresponding target language corpus. Then, the total loss function is determined based on the n loss functions, and the initial multilingual translation model is trained according to the total loss function, so that through multi-task learning, the translation directions of the training corpus involved in each model training are relatively more, and the number of training corpus for each translation direction is not too small. The diversity of training corpus can effectively improve the generalization degree of the model and ensure the translation accuracy of the trained multilingual translation model in different translation directions. In addition, there is no need to oversample the training corpus, which improves the utilization rate of storage resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0026] Figure 1 A scene diagram of a method for determining a multilingual translation model provided in an embodiment of the present application;

[0027] Figure 2 A flowchart of a method for determining a multilingual translation model provided in an embodiment of the present application;

[0028] Figure 3 A schematic diagram of the structure of a multi-language translation model provided in an embodiment of the present application;

[0029] Figure 4 A schematic diagram of a training process of a multilingual translation model provided in an embodiment of the present application;

[0030] Figure 5 A structural diagram of a multi-language translation model training device provided in an embodiment of the present application;

[0031] Figure 6 A structural diagram of a terminal device provided in an embodiment of the present application;

[0032] Figure 7 A structural diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] The embodiments of the present application are described below in conjunction with the accompanying drawings.

[0034] In the process of training a multilingual translation model, there may be an imbalance in the amount of corpora in different translation directions, which may cause the multilingual translation model obtained by training the corpus to over-focus on the translation directions with a larger amount of corpora and ignore the translation directions with a smaller amount of corpora, affecting the translation ability of the multilingual translation model in different translation directions and the translation accuracy of the multilingual translation model.

[0035] In the related art, in order to solve the problem that the imbalance in the number of corpora in different translation directions affects the translation ability of multilingual translation models in different translation directions, oversampling of the training corpora in translation directions with a smaller number of corpora is usually adopted. However, oversampling will take up a large storage space and affect the utilization of storage resources.

[0036] To this end, an embodiment of the present application provides a method for determining a multilingual translation model, which can avoid the impact of the imbalance in the number of corpora in different translation directions on the translation ability of the multilingual translation model in different translation directions.

[0037] The method for determining the multilingual translation model provided in the embodiment of the present application can be implemented by a computer device, which can be a terminal device or a server, wherein the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. Terminal devices include but are not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, etc. The terminal device and the server can be directly or indirectly connected via wired or wireless communication, and this application does not limit this.

[0038] The embodiments of the present application can be applied to various scenarios, including but not limited to artificial intelligence, natural language processing, machine learning, etc.

[0039] It is understandable that in the specific implementation of the present application, the training corpus used may involve relevant data such as user information. When the above embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0040] The embodiments of the present application relate to artificial intelligence (AI), which is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that the machines have the functions of perception, reasoning and decision-making.

[0041] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. Basic artificial intelligence technologies generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operating / interactive systems, mechatronics and other technologies. Artificial intelligence software technologies mainly include computer vision technology, speech processing technology, natural language processing technology, as well as machine learning / deep learning, autonomous driving, smart transportation and other major directions.

[0042] The solution provided in the embodiment of the present application involves natural language processing, machine learning and other technologies of artificial intelligence, for example, obtaining training corpus through natural language processing, and implementing multi-language translation through machine learning, etc., wherein:

[0043] Natural language processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field will involve natural language, that is, the language people use in daily life, so it is closely related to the study of linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question answering, knowledge graph and other technologies.

[0044] Machine Learning (ML) is a multi-disciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers 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 make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning and other technologies.

[0045] Figure 1 A schematic diagram of a multilingual translation model determination scenario provided in an embodiment of the present application is shown, wherein the server 100 is used as the aforementioned computer device for illustration.

[0046] Specifically, the server 100 obtains training corpora under N translation directions. N can be an integer greater than 1, for example, N is 3, and the N translation directions include translation direction A, translation direction B, and translation direction C. In some possible implementations, N can be hundreds or thousands, and the multilingual translation model obtained by training can provide translations between hundreds or thousands of languages. However, the number of corpora under N translation directions is usually unbalanced. For example, the number of corpora under the translation direction of Chinese to English may be large, for example, it may be millions, while the number of corpora for translation between small languages, such as Dutch to Malay, may be small, for example, there are only tens of thousands.

[0047] Exemplarily, there are 100,000 training corpora under translation direction A, 200,000 training corpora under translation direction B, and 1,000 training corpora under translation direction C, among which the difference in the number of training corpora under translation direction B and translation direction C is quite large.

[0048] The server 100 determines the sampling parameters corresponding to the N translation directions according to the number of corpora under the N translation directions. In some possible implementations, the sampling parameters (e.g., sampling probabilities) under the N translation directions have a certain relationship with the number of training corpora under the translation directions. For example, the sampling probability under translation direction A can be 0.1, the sampling probability under translation direction B can be 0.2, and the sampling probability under translation direction C can be 0.001. For another example, the sampling probability under translation direction A can be 0.1, the sampling probability under translation direction B can be 0.15, and the sampling probability under translation direction C can be 0.05.

[0049] The server 100 can determine the translation directions corresponding to the n training tasks according to the determined sampling parameters (i.e., the sampling probabilities under N translation directions). The sampling probability under translation direction A is 0.1, the sampling probability under translation direction B is 0.15, and the sampling probability under translation direction C can be 0.05. The n training tasks are: Task 1, Task 2 and Task 3, for example, and each task corresponds to a translation direction. The sampling probability that the translation direction of Task 1 is translation direction A is 0.1, the sampling probability that the translation direction is translation direction B is 0.15, and the sampling probability that the translation direction is translation direction C is 0.05. The sampling obtains 3 tasks. For example, the translation direction corresponding to Task 1 is A, the translation direction corresponding to Task 2 is A, and the translation direction corresponding to Task 3 is C.

[0050] The server 100 samples the training corpus according to the determined translation directions corresponding to the n training tasks to obtain n sample sets. For example, the server samples the training corpus according to the determined translation directions corresponding to Task 1, Task 3, and Task 3 to obtain three sample sets, wherein the sample set corresponding to Task 1 includes b training corpora under translation direction A, the sample set corresponding to Task 2 includes b training corpora under translation direction A, and the sample set corresponding to Task 3 includes b training corpora under translation direction C. The number of corpora included in the three sample sets is b.

[0051] Since the n sample sets correspond to n tasks respectively, the n sample sets include the same number of corpora and the training corpora in the same sample set belong to the same translation direction. When a translation direction with a smaller number of corpora is determined to correspond to a training task, a relatively larger number of training corpora can be sampled for training (for example, the translation direction corresponding to Task 3 is translation direction B). Therefore, by training a multilingual translation model with n sample sets, it is possible to avoid the multilingual translation model from paying too much attention to the translation direction with a larger number of corpora and ignoring the translation direction with a smaller number of corpora.

[0052] When the model is trained by n sample sets, each sample set includes b training corpora, and a total of n*b training corpora, the source language corpora in each sample set can be used as the input of the initial multilingual translation model, and the output of the initial multilingual translation model can be compared with the target language corpora to obtain the loss function. Since there are n sample sets, n loss functions can be obtained. The server 100 determines the total loss function based on the n loss functions, and trains the initial multilingual translation model according to the total loss function. Through multi-task learning, the translation directions of the training corpora involved in each model training are relatively large, and the number of training corpora for each translation direction is not too small. The generalization degree of the model is improved through the diversity of training corpora, and the multilingual translation model is prevented from ignoring the translation direction with a small number of corpora, ensuring the translation ability of the multilingual translation model in different translation directions. And there is no need to oversample the training corpora, which improves the utilization rate of storage resources.

[0053] Figure 2 This is a flowchart of a method for determining a multilingual translation model provided in an embodiment of the present application. In this embodiment, the server 100 is used as the aforementioned computer device for illustration. The method includes the following steps:

[0054] S202: The server obtains training corpora including N translation directions.

[0055] Wherein, N>1, and N may be any integer greater than 1. In some possible implementations, the server 100 may obtain training corpora under several thousand translation directions.

[0056] The training corpus includes the source language corpus and the target language corpus under the corresponding translation direction. For example, the translation direction is Chinese to English (Chinese to English), the corresponding source language is Chinese, the target language is English, and the training corpus under the translation direction of Chinese to English includes Chinese corpus and English corpus. The translation direction is English to Chinese (English to Chinese), the corresponding source language is English, the target language is Chinese, and the training corpus under the translation direction of English to Chinese includes English corpus and Chinese corpus. Among them, the Chinese corpus and English corpus in Chinese to English and English to Chinese can be the same, but they are different translation directions.

[0057] In some cases, since the number of speakers of many languages is small, the corresponding amount of training corpus is small. For example, among N translation directions, there are Chinese-English translation, English-Chinese translation, Chinese-Japanese translation, Chinese-Korean translation, Dutch-Malay translation, etc. The amount of training corpus for Chinese-English translation is much larger than that for Dutch-Malay translation. Exemplarily, there are 10,000,000 training corpus for Chinese-English translation and 100,000 training corpus for Dutch-Malay translation, and the difference between the amount of training corpus for Chinese-English translation and that for Dutch-Malay translation is 9,900,000. Herein, one corpus can be a word, a sentence, or multiple related sentences, etc.

[0058] In some possible implementation manners, a preset first threshold (preset difference threshold) can be set. For example, the preset difference threshold can be 9,000,000. When the maximum value of the difference between the amounts of corpus under any two of the N translation directions is greater than the preset difference threshold, the multi-language translation model can be trained by the method for determining the multi-language translation model provided by this solution. For example, the difference between the amount of training corpus for Chinese-English translation and that for Dutch-Malay translation is 9,900,000, and this difference is greater than the preset difference threshold, so the multi-language translation model can be trained by the method provided by this solution, avoiding the multi-language translation model ignoring the translation direction with less training corpus due to the imbalance of the amount of training corpus.

[0059] Alternatively, a preset second threshold can also be set. For example, the preset second threshold can be 90%. When the maximum value of the ratio of the amounts of corpus under any two of the N translation directions (the amount of corpus of the translation direction with less corpus / the amount of corpus of the translation direction with more corpus) is greater than the preset second threshold, the multi-language translation model can be trained by the method for determining the multi-language translation model provided by this solution. For example, the ratio of the amount of training corpus for Chinese-English translation to that for Dutch-Malay translation is 99%, and this ratio is greater than the preset second threshold, so the multi-language translation model can be trained by the method provided by this solution.

[0060] Wherein, the source-language corpus and the target-language corpus in the training corpus can be parallel corpus or non-parallel corpus. Parallel Texts refer to texts written in different languages and having a translation relationship with each other. Exemplarily, when the source-language corpus and the target-language corpus in the training corpus are parallel corpus, the source-language corpus is "你好" and the target-language corpus is "hello".

[0061] S204: The server determines the sampling parameters corresponding to the N translation directions according to the amounts of corpus of the training corpus respectively belonging to the N translation directions.

[0062] Since the number of corpora under different translation directions is unbalanced, the ratio can be adjusted by adjusting the factor to increase the sampling rate of the training corpora under the translation direction with a smaller number of corpora. The translation direction with a smaller number of corpora can be determined by the proportion of the number of corpora in the translation direction in the total number of corpora being lower than a preset third threshold (preset ratio threshold). The proportion of the number of corpora in the translation direction in the total number of corpora can be determined by formula (1).

[0063]

[0064] Among them, P i Indicates the proportion of the corpus in this translation direction in the total corpus, D i Indicates the number of corpora in this translation direction, ∑ j D j Indicates the number of corpora in all directions.

[0065] In some possible implementations, the translation direction whose proportion of the corpus quantity in the total corpus quantity is lower than a preset third threshold (preset ratio threshold) can be defined as the target translation direction. For example, the preset third threshold can be 0.01%. i When it is less than 0.01%, the adjustment factor can increase the sampling rate of the training corpus in the target translation direction.

[0066] Specifically, the sampling probability P of the training corpus under the target translation direction after adjustment by the adjustment factor i ′ can be determined by formula (2).

[0067]

[0068] Among them, P′ i represents the sampling probability of the training corpus under the target translation direction, and α represents the adjustment factor. α can be set to a positive number less than 1 as needed. The smaller α is, the higher the probability of P′ i The larger the value, the more it tends to the target translation direction. Therefore, the adjustment factor is used to increase the sampling rate of the training corpus under the target translation direction.

[0069] In this way, the server 100 can calculate the number of corpora D belonging to N translation directions according to the training corpora. i , determine the sampling parameters P corresponding to the N translation directions i ′.

[0070] S206: The server determines the translation directions corresponding to the n training tasks through sampling parameters, and samples the training corpus based on the corresponding translation directions to obtain n sample sets.

[0071] The n training tasks refer to training tasks for training a multilingual translation model, wherein n may be 10. It should be noted that the expressions in this specification are case-sensitive, N represents the translation direction, and n represents the training task.

[0072] Multilingual translation, also known as Multilingual Neural Machine Translation (MNMT), refers to a technology that can translate between multiple languages ​​through a multilingual translation model.

[0073] Specifically, the server 100 may determine the number of training tasks n, and then determine the translation directions corresponding to the n training tasks through sampling parameters, wherein each training task corresponds to a translation direction, and multiple training tasks may correspond to the same translation direction. Figure 1 As shown, the sampling probability of translation direction A is 0.1, the sampling probability of translation direction B is 0.15, and the sampling probability of translation direction C is 0.05. The server 100 determines the translation directions corresponding to the three training tasks based on the sampling parameters. The translation directions corresponding to the three training tasks can be: translation direction A, translation direction A and translation direction C, respectively.

[0074] The server 100 samples the training corpus based on the translation directions corresponding to the n training tasks to obtain n sample sets. The n sample sets correspond to the n training tasks one by one, and the n sample sets include the same number of corpora. For the target sample set in the n sample sets, the training corpora in the target sample set all belong to the translation direction corresponding to the target sample set.

[0075] Exemplarily, each sample set may include b training corpora. The server 100 samples and obtains n sample sets based on the determined translation directions corresponding to the n training tasks, where each sample set includes b training corpora. In this way, the number of sample sets for the n training tasks is the same, which can avoid the impact of the translation ability of the multilingual translation model on different translation directions due to the imbalance of training corpora.

[0076] The number of corpora b included in the sample set is not limited by the number of corpora under different translation directions. For example, it can be greater than the number of corpora corresponding to the translation direction with the least number of corpora, or it can be equal to the number of corpora corresponding to the translation direction with the least number of corpora, or it can be greater than the number of corpora corresponding to the translation direction with the least number of corpora. When b is greater than the number of corpora corresponding to the translation direction with the least number of corpora, when sampling the training corpus of the translation direction, the training corpus can be resampled to obtain b training corpora. Although the training corpus of the translation direction is resampled, since it only includes n training tasks at the same time, it also takes up less memory space.

[0077] In order to ensure the training speed and the accuracy of the calculated gradient, the training corpus will be packaged during the model training process, that is, the training corpus will be batched, so as to improve the parallelism of the model. In this embodiment, a batch includes the training corpus included in a sample set, for example, including b training corpora.

[0078] Among them, the number of corpora included in the sample set can be determined according to the cache of the device for training the multilingual translation model. In the related art, a batch includes training corpora for multiple translation directions, so it is necessary to train the translation capabilities of the model in multiple translation directions at the same time during training. In the present solution, a batch includes training corpora for one direction, and the translation capabilities of the model in multiple directions can be trained through multiple trainings. For example, taking the device for training the multilingual translation model as server 100, the available cache of the server 100 is m, and n translation directions are trained, and each translation direction has b training data. In the related art, the available cache m of the server needs to support the simultaneous training of b training data for n translation directions, while in the present solution, the available cache m of the server only needs to support the training of b training data for one translation direction.

[0079] In this way, through the method provided by this solution, the space occupied by training can be reduced to 1 / n, which effectively reduces the space occupied by the device cache when the number of corpora is the same, and can support a larger number of training corpora when the device cache is fixed.

[0080] S208: The server inputs the source language corpus of the training corpus in the n sample sets into the initial multilingual translation model, and obtains n loss functions according to the corresponding target language corpus.

[0081] The server 100 can input the source language corpus of the training corpus in the n sample sets into the initial multilingual translation model through multi-task learning, and then compare the output of the initial multilingual translation model with the corresponding target corpus to obtain n loss functions. Each training task is used as a single task in multi-task learning.

[0082] Multi-task learning (MTL) is a learning method that learns multiple related tasks together. In this embodiment, each of the n training tasks can share the learned information during learning, which can improve the generalization of the model.

[0083] In the process of training the model, it is usually divided into two processes: forward propagation and back propagation. Forward propagation refers to the process of training data starting from the input layer, passing through the hidden layer, and reaching the output layer. Back propagation, also known as error back propagation, allows information from the loss function to flow backward through the network for gradient updates. Back propagation is usually combined with optimization methods, such as gradient descent. Back propagation can be divided into gradient calculation and gradient update. Usually, after the gradient calculation is completed, the calculated gradient will be used to update the parameters of the model.

[0084] Specifically, Figure 3 As shown, the server 100 inputs the source language corpus of the training corpus in the n sample sets into the initial multilingual translation model, and calculates the log-likelihood loss of each sample set through forward propagation. The log-likelihood loss L of the i-th sample set i It can be determined by formula (3).

[0085]

[0086] Among them, θ represents the parameters of the initial multilingual translation model, represents the input variable, i.e., the training corpus. Represents an output variable.

[0087] In this embodiment, the training of each translation direction can be regarded as a training task. The translation direction corresponding to the training task is determined according to the sampling probabilities corresponding to the N translation directions. Through multi-task learning, n training tasks are sampled each time for joint training, thereby improving the generalization degree of the multilingual translation model.

[0088] S210: The server determines a total loss function based on the n loss functions, and trains the initial multilingual translation model according to the total loss function to obtain a multilingual translation model for translation in N translation directions.

[0089] After the forward propagation is completed, the server 100 can perform gradient calculation through backpropagation (BP) to determine the loss function.

[0090] The gradient is used to indicate that the directional derivative of the function at that point has the maximum value along that direction, that is, the function changes fastest along that direction at that point and the rate of change is the largest. Following the direction of the gradient, it is easier to find the maximum value of the function, so the gradient descent method can be used to obtain the minimized loss function, thereby optimizing the model parameters. The gradient descent method can be used to obtain the loss function and the model parameters more quickly.

[0091] In some possible implementations, considering the computing speed, Pytorch can be used to separate the gradient calculation from the gradient update, and the gradient update can be performed after the gradient calculation of multiple training tasks is completed.

[0092] Specifically, Figure 4 As shown, the server 100 can calculate the sampling probability P′(L) corresponding to each of the N translation directions according to the number of training corpora under the N translation directions, and then sample n training tasks according to the probability, and obtain n batches of training corpora from the training corpora corresponding to the n training tasks, where each batch includes b training corpora. The log-likelihood loss corresponding to each training task is calculated by forward propagation, and after the forward propagation is completed, the gradient calculation of the backward propagation is performed. The server 100 can calculate the gradient corresponding to each sample set according to the n loss functions. After all training tasks have completed their gradient calculations, all gradients are accumulated for gradient update. It can be obtained by formula (4).

[0093]

[0094] in, represents the gradient of the i-th training task. The updated parameter θ can be determined by formula (5).

[0095]

[0096] This method of updating the model parameters by the sum of the gradients of n training tasks after the gradient calculation of n training tasks is completed is equivalent to sending n*b training data to the initial multilingual training model for forward propagation and back propagation.

[0097] This method can be implemented by the following pseudo code:

[0098] Input: NMT Modelθ, Translation direction Training Corpus / / Input: multilingual translation model parameters θ, translation direction Training Data

[0099] Output: NMT Modelθ / / Output: multi-language translation model parameters θ.

[0100] 1.Calculate the sampling probabilityP′(L i )for the translation direction Li / / Calculate the translation direction L i The sampling probability P′(L i )

[0101] 2. while θ is not converged / / When θ does not converge, enter the following while loop:

[0102] 3.Sample a set of n points {L i} n from the prior distribution P′(L i ) / / From the prior distribution P′(L i ) to extract a set of n points {L i} n

[0103] 4.for L i in T: / / If L i Inside T, enter the following for loop:

[0104] 5.do forward propagation and calculate the gradient / / Perform forward propagation and calculate gradients

[0105] 6.end for / / End the for loop

[0106] 7.calculate the total gradient: / / Calculate the total gradient

[0107] 8.update the parameters by the total gradient / / update the parameters according to the total gradient

[0108] 9.end while / / End the while loop

[0109] The method for determining the multilingual translation model can train the multilingual translation model by inputting the initial parameters, translation direction and training data of the multilingual translation model, and obtain the model parameters after training. The trained model can realize the translation of multiple translation directions, and will not pay too much attention to the translation direction with a large number of corpora due to the large difference in the number of corpora of different translation directions in the training data. Specifically, firstly, according to the translation direction and the training data, the sampling probability of each translation direction is calculated, and n training tasks are extracted from the training corpus, each training task corresponds to a translation direction, and the gradients corresponding to the n training tasks are respectively propagated forward. When all the gradient calculations are completed, the total gradient is calculated, and then the model parameters are updated according to the total gradient to realize the training of the model.

[0110] This training method can meet the requirement that the training data comes from multiple translation directions, and each model training involves relatively more translation directions of the training corpus, and the number of training corpus for each translation direction is not too small. The diversity of training corpus can effectively improve the generalization of the model and ensure the translation accuracy of the trained multilingual translation model in different translation directions. In addition, at the hardware level, this method does not increase the disk usage.

[0111] In the aforementioned Figure 1-Figure 4 Based on the corresponding embodiment, Figure 5 4 is a device structure diagram of a device for determining a multilingual translation model, wherein the device 500 for determining a multilingual translation model comprises an acquisition module 502, a determination module 504, a sampling module 506 and a training module 508;

[0112] An acquisition module 502 is used to acquire training corpora under N translation directions, wherein the training corpora include source language corpora and target language corpora of the corresponding translation directions, where N>1;

[0113] A determination module 504 is used to determine the sampling parameters corresponding to the N translation directions respectively according to the amount of the training corpus belonging to the N translation directions respectively;

[0114] A sampling module 506 is used to determine the translation directions corresponding to the n training tasks through the sampling parameters, and sample the training corpus based on the corresponding translation directions to obtain n sample sets, wherein the n sample sets correspond to the n training tasks one by one, the n sample sets include the same number of corpora, and for a target sample set in the n sample sets, the training corpora in the target sample set all belong to the translation direction corresponding to the target sample set;

[0115] A training module 508 is used to input the source language corpus of the training corpus in the n sample sets into the initial multilingual translation model, and obtain n loss functions according to the corresponding target language corpus, wherein the n loss functions correspond to the n sample sets one by one;

[0116] The training module 508 is further configured to determine a total loss function based on the n loss functions, and train the initial multilingual translation model according to the total loss function to obtain a multilingual translation model for translation in the N translation directions.

[0117] In a possible implementation, the training module 508 is specifically used to:

[0118] Determine n gradients corresponding to the n sample sets based on the n loss functions;

[0119] A total loss function is determined according to the n gradients, and the initial multilingual translation model is trained according to the total loss function to obtain a multilingual translation model for the N translation directions.

[0120] In a possible implementation, the training module 508 is specifically used to:

[0121] By back-propagating the n loss functions in the initial multilingual translation model, n gradients corresponding to the n sample sets are determined.

[0122] In a possible implementation, the amount of corpora included in the sample set is determined based on a cache of a device for training the multilingual translation model.

[0123] In a possible implementation manner, a maximum value of a difference in the amount of corpus under any two translation directions among the N translation directions is greater than a preset difference threshold.

[0124] In a possible implementation, the determining module 504 is specifically configured to:

[0125] According to the amount of corpus belonging to the N translation directions respectively, the sampling parameters corresponding to the N translation directions are determined by adjusting factors, and the adjusting factors are used to increase the sampling rate of the training corpus under the target translation direction, and the target translation direction is a translation direction in which the amount of corpus in the total amount of corpus is lower than a preset ratio threshold.

[0126] It can be seen that by obtaining training corpora including N translation directions, sampling parameters corresponding to the N translation directions can be determined according to the number of corpora that belong to the training corpora under the N translation directions. The sampling parameters can be used to determine the translation directions corresponding to the n training tasks, and the training corpora are sampled based on the corresponding translation directions to obtain n sample sets. Since the n sample sets correspond to the n training tasks one-to-one, the number of corpora included in the n sample sets is the same, and the training corpora in the same sample set belong to the same translation direction, so that when a translation direction with less training corpora is determined to correspond to the sample set, a relatively large number of training corpora can be sampled for training. Therefore, training through the n sample sets can avoid excessive attention to the direction with a large number of corpora and ignoring the translation direction with a small number of training corpora. The source language of the training corpus in the n sample sets is input into the initial multilingual translation model, and n loss functions corresponding to the n sample sets are obtained according to the corresponding target language corpus. Then, the total loss function is determined based on the n loss functions, and the initial multilingual translation model is trained according to the total loss function, so that through multi-task learning, the translation directions of the training corpus involved in each model training are relatively more, and the number of training corpus for each translation direction is not too small. The diversity of training corpus can effectively improve the generalization degree of the model and ensure the translation accuracy of the trained multilingual translation model in different translation directions. In addition, there is no need to oversample the training corpus, which improves the utilization rate of storage resources.

[0127] The embodiment of the present application further provides a computer device, which is the computer device described above and may include a terminal device or a server, and the aforementioned multilingual translation model determination device may be configured in the computer device. The computer device is described below in conjunction with the accompanying drawings.

[0128] If the computer device is a terminal device, see Figure 6 As shown, the embodiment of the present application provides a terminal device, taking the terminal device as a mobile phone as an example:

[0129] Figure 6 FIG. 1 is a block diagram showing a partial structure of a mobile phone related to a terminal device provided in an embodiment of the present application. Figure 6 The mobile phone includes: a radio frequency (RF) circuit 1410, a memory 1420, an input unit 1430, a display unit 1440, a sensor 1450, an audio circuit 1460, a wireless fidelity (WiFi) module 1470, a processor 1480, and a power supply 1490. Those skilled in the art can understand that Figure 6The mobile phone structure shown in the figure does not constitute a limitation on the mobile phone, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0130] Combine the following Figure 6 A detailed introduction to the various components of the mobile phone:

[0131] The RF circuit 1410 can be used for receiving and sending signals during the process of sending and receiving information or making calls. In particular, after receiving the downlink information of the base station, it is sent to the processor 1480 for processing; in addition, the designed uplink data is sent to the base station. Usually, the RF circuit 1410 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (Low Noise Amplifier, referred to as LNA), a duplexer, etc. In addition, the RF circuit 1410 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to the Global System of Mobile communication (Global System of Mobile communication, referred to as GSM), General Packet Radio Service (General Packet Radio Service, referred to as GPRS), Code Division Multiple Access (Code Division Multiple Access, referred to as CDMA), Wideband Code Division Multiple Access (Wideband Code Division Multiple Access, referred to as WCDMA), Long Term Evolution (Long Term Evolution, referred to as LTE), email, Short Messaging Service (SMS), etc.

[0132] The memory 1420 can be used to store software programs and modules. The processor 1480 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 1420. The memory 1420 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 1420 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0133] The input unit 1430 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the mobile phone. Specifically, the input unit 1430 may include a touch panel 1431 and other input devices 1432. The touch panel 1431, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 1431 or near the touch panel 1431 using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel 1431 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 1480, and can receive and execute commands sent by the processor 1480. In addition, the touch panel 1431 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 1431, the input unit 1430 may also include other input devices 1432. Specifically, other input devices 1432 may include but are not limited to one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, etc.

[0134] The display unit 1440 may be used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 1440 may include a display panel 1441. Optionally, the display panel 1441 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch panel 1431 may cover the display panel 1441. When the touch panel 1431 detects a touch operation on or near it, it is transmitted to the processor 1480 to determine the type of touch event. Subsequently, the processor 1480 provides a corresponding visual output on the display panel 1441 according to the type of touch event. Although in Figure 7 In the embodiment, the touch panel 1431 and the display panel 1441 are used as two independent components to realize the input and output functions of the mobile phone, but in some embodiments, the touch panel 1431 and the display panel 1441 can be integrated to realize the input and output functions of the mobile phone.

[0135] The mobile phone may also include at least one sensor 1450, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 1441 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 1441 and / or the backlight when the mobile phone is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can be configured in the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be repeated here.

[0136] The audio circuit 1460, the speaker 1461, and the microphone 1462 can provide an audio interface between the user and the mobile phone. The audio circuit 1460 can transmit the received audio data to the speaker 1461 after converting the received audio data into an electrical signal, which is converted into a sound signal for output; on the other hand, the microphone 1462 converts the collected sound signal into an electrical signal, which is received by the audio circuit 1460 and converted into audio data, and then the audio data is output to the processor 1480 for processing, and then sent to another mobile phone through the RF circuit 1410, or the audio data is output to the memory 1420 for further processing.

[0137] WiFi is a short-range wireless transmission technology. The mobile phone can help users send and receive emails, browse web pages and access streaming media through the WiFi module 1470. It provides users with wireless broadband Internet access. Figure 7 A WiFi module 1470 is shown, but it is understandable that it is not an essential component of the mobile phone and can be omitted as needed without changing the essence of the invention.

[0138] The processor 1480 is the control center of the mobile phone. It uses various interfaces and lines to connect various parts of the entire mobile phone. It executes various functions of the mobile phone and processes data by running or executing software programs and / or modules stored in the memory 1420, and calling data stored in the memory 1420. Optionally, the processor 1480 may include one or more processing units; preferably, the processor 1480 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 1480.

[0139] The mobile phone also includes a power supply 1490 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 1480 through a power management system, so that the power management system can manage functions such as charging, discharging, and power consumption management.

[0140] Although not shown, the mobile phone may also include a camera, a Bluetooth module, etc., which will not be described in detail here.

[0141] In this embodiment, the processor 1480 included in the terminal device also has the following functions:

[0142] Acquire training corpora including N translation directions, wherein the training corpora include source language corpora and target language corpora corresponding to the translation directions, where N>1;

[0143] Determine sampling parameters corresponding to the N translation directions respectively according to the amount of corpora belonging to the N translation directions respectively in the training corpora;

[0144] Determine the translation directions corresponding to the n training tasks by the sampling parameters, and sample the training corpus based on the corresponding translation directions to obtain n sample sets, wherein the n sample sets correspond to the n training tasks one by one, the n sample sets include the same number of corpora, and for a target sample set in the n sample sets, the training corpora in the target sample set all belong to the translation direction corresponding to the target sample set;

[0145] Inputting the source language corpus of the training corpus in the n sample sets into the initial multilingual translation model, and obtaining n loss functions according to the corresponding target language corpus, wherein the n loss functions correspond one-to-one to the n sample sets;

[0146] A total loss function is determined based on the n loss functions, and the initial multilingual translation model is trained according to the total loss function to obtain a multilingual translation model for translation in the N translation directions.

[0147] If the computer device is a server, the present application embodiment also provides a server, see Figure 7 As shown, Figure 7The structural diagram of the server 1500 provided in the embodiment of the present application, the server 1500 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1522 (for example, one or more processors) and a memory 1532, and one or more storage media 1530 (for example, one or more mass storage devices) storing application programs 1542 or data 1544. Among them, the memory 1532 and the storage medium 1530 can be short-term storage or permanent storage. The program stored in the storage medium 1530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the server. Furthermore, the central processing unit 1522 can be configured to communicate with the storage medium 1530 and execute a series of instruction operations in the storage medium 1530 on the server 1500.

[0148] The server 1500 may also include one or more power supplies 1526, one or more wired or wireless network interfaces 1550, one or more input and output interfaces 1558, and / or one or more operating systems 1541, such as Windows Server 2003 or Windows Server 2008. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM etc.

[0149] The steps performed by the server in the above embodiment can be based on Figure 7 The server structure shown.

[0150] In addition, an embodiment of the present application further provides a storage medium, wherein the storage medium is used to store a computer program, and the computer program is used to execute the method provided in the above embodiment.

[0151] The embodiments of the present application also provide a computer program product including instructions, which, when executed on a computer, enables the computer to execute the method provided in the above embodiments.

[0152] A person of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium can be at least one of the following media: read-only memory (English: Read-only Memory, abbreviated: ROM), RAM, magnetic disk or optical disk, etc. Various media that can store program codes.

[0153] It should be noted that each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiments. The device and system embodiments described above are merely schematic, in which the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.

[0154] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a technician familiar with the technical field within the technical scope disclosed in the present application should be included in the protection scope of the present application. Moreover, based on the implementation methods provided in the above aspects, the present application can also be further combined to provide more implementation methods. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for determining a multilingual translation model, characterized in that: The method comprises: Acquire training corpora including N translation directions, wherein the training corpora include source language corpora and target language corpora corresponding to the translation directions, where N>1; According to the amount of corpus belonging to the N translation directions respectively, the sampling parameters corresponding to the N translation directions are determined by adjusting factors, wherein the adjusting factors are used to increase the sampling rate of the training corpus under the target translation direction, and the target translation direction is a translation direction in which the amount of corpus in the total amount of corpus is lower than a preset ratio threshold; Determine the translation directions corresponding to n training tasks by the sampling parameters, one training task corresponds to one translation direction, and sample the training corpus based on the translation directions corresponding to the n training tasks to obtain n sample sets, the n sample sets correspond to the n training tasks one-to-one, the n sample sets include the same number of corpora, and for a target sample set in the n sample sets, the training corpora in the target sample set all belong to the translation direction corresponding to the target sample set; Inputting the source language corpus of the training corpus in the n sample sets into the initial multilingual translation model, and obtaining n loss functions according to the corresponding target language corpus, wherein the n loss functions correspond one-to-one to the n sample sets; A total loss function is determined based on the n loss functions, and the initial multilingual translation model is trained according to the total loss function to obtain a multilingual translation model for translation in the N translation directions.

2. The method according to claim 1, characterized in that: The determining of the total loss function based on the n loss functions, and training the initial multilingual translation model according to the total loss function to obtain the multilingual translation model for the N translation directions includes: Determine n gradients corresponding to the n sample sets based on the n loss functions; A total loss function is determined according to the n gradients, and the initial multilingual translation model is trained according to the total loss function to obtain a multilingual translation model for the N translation directions.

3. The method according to claim 2, characterized in that The determining, based on the n loss functions, n gradients corresponding to the n sample sets comprises: By back-propagating the n loss functions in the initial multilingual translation model, n gradients corresponding to the n sample sets are determined.

4. The method according to claim 1, characterized in that: The amount of corpus included in the sample set is determined based on the device cache for training the multilingual translation model.

5. The method according to claim 1, characterized in that The maximum value of the difference in the amount of corpus under any two translation directions among the N translation directions is greater than a preset difference threshold.

6. A device for determining a multilingual translation model, characterized in that: The device comprises: An acquisition module, used to acquire training corpora under N translation directions, wherein the training corpora include source language corpora and target language corpora of the corresponding translation directions, where N>1; A determination module, configured to determine sampling parameters corresponding to the N translation directions respectively according to the amount of corpus belonging to the training corpus respectively under the N translation directions by means of an adjustment factor, wherein the adjustment factor is used to increase the sampling rate of the training corpus under the target translation direction, and the target translation direction is a translation direction in which the amount of corpus in the total amount of corpus is lower than a preset ratio threshold; A sampling module, used to determine the translation directions corresponding to n training tasks through the sampling parameters, one training task corresponds to one translation direction, and sample the training corpus based on the corresponding translation directions corresponding to the n training tasks to obtain n sample sets, the n sample sets correspond to the n training tasks one by one, the n sample sets include the same number of corpora, and for a target sample set in the n sample sets, the training corpora in the target sample set all belong to the translation direction corresponding to the target sample set; A training module, used for inputting the source language corpus of the training corpus in the n sample sets into the initial multilingual translation model, and obtaining n loss functions according to the corresponding target language corpus, wherein the n loss functions correspond one-to-one to the n sample sets; The training module is further used to determine a total loss function based on the n loss functions, and train the initial multilingual translation model according to the total loss function to obtain a multilingual translation model for translation in the N translation directions.

7. The device for determining a multilingual translation model according to claim 6, characterized in that: The training module is used to: Determine n gradients corresponding to the n sample sets based on the n loss functions; A total loss function is determined according to the n gradients, and the initial multilingual translation model is trained according to the total loss function to obtain a multilingual translation model for the N translation directions.

8. The device for determining a multilingual translation model according to claim 7, characterized in that: The training module is used to: By back-propagating the n loss functions in the initial multilingual translation model, n gradients corresponding to the n sample sets are determined.

9. The device for determining a multilingual translation model according to claim 6, characterized in that: The amount of corpus included in the sample set is determined based on the device cache for training the multilingual translation model.

10. The device for determining a multilingual translation model according to claim 6, characterized in that: The maximum value of the difference in the amount of corpus under any two translation directions among the N translation directions is greater than a preset difference threshold.

11. A computer device, characterized in that: The computer device comprises a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is configured to execute the method according to any one of claims 1 to 5 according to the instructions in the program code.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method according to any one of claims 1 to 5.

13. A computer program product comprising instructions, which, when executed on a computer, causes the computer to execute the method according to any one of claims 1 to 5.