Confidence probability-based translation model training method, use method, device and storage medium
By adjusting the scheduling sampling strategy based on the confidence probability of the target sentence, the problem of inconsistent training-test distribution in machine translation models is solved, translation quality is improved, exposure bias is mitigated, and it is suitable for online translation systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2021-05-24
- Publication Date
- 2026-07-10
AI Technical Summary
Existing machine translation models suffer from inconsistent training-test distributions during training and testing, causing scheduling sampling algorithms to degenerate into ordinary training methods, neglecting the model's real-time capabilities, and resulting in most translation predictions being identical to the standard translations, failing to effectively mitigate exposure bias.
By calculating the confidence probability of each word position in the target sentence, and combining Monte Carlo sampling and cross-entropy loss function, the scheduling sampling strategy is adjusted so that the model uses its own prediction when the confidence probability is high and uses the standard translation when the confidence probability is low. Noise is also added to alleviate algorithm degradation.
It significantly improves machine translation quality, mitigates the exposure bias problem of NMT models, and enhances translation quality, especially in online translation systems.
Smart Images

Figure CN115392266B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of artificial intelligence machine translation, and in particular to a training method, usage method, apparatus, computing device and storage medium for a machine translation model based on confidence probability-based scheduling sampling. Background Technology
[0002] Neural machine translation (NMT) models have seen significant development in recent years and have gradually become the mainstream machine translation model. NMT models typically face the problem of inconsistent training-test distributions, also known as exposure bias. A common solution to this problem is scheduled sampling, which simulates the NMT test scenario by randomly combining the model's predictions of the translated text with standard translations. However, existing scheduled sampling algorithms determine the sampling probability solely through the training steps, neglecting the model's real-time capabilities. Furthermore, most models predict the same translated text as the standard translation, causing scheduled sampling algorithms to degenerate into ordinary training methods. Summary of the Invention
[0003] In view of this, this application provides a training method, usage method, apparatus, computing device, and storage medium for a machine translation model based on confidence probability-based scheduling sampling.
[0004] According to a first aspect of this application, a method for training a translation model is provided. The method includes: acquiring a text to be trained, the text including at least a source input statement and a standard target statement corresponding to the source input statement; using the translation model to predict the target statement based on the source input statement to obtain a first predicted target statement; calculating a confidence probability for each word position in the target statement based on the standard target statement and the predicted target statement; and determining a combination of the standard target statement and the predicted target statement as the target statement input for the translation model based on the confidence probabilities.
[0005] In one embodiment, using the translation model to predict the target statement based on the source input statement to obtain the predicted target statement includes: using the first decoder in the translation model to predict the target statement based on the source input statement to obtain the translation probability of the t-th word under the condition that the prediction results of the first t-1 (t≥1) words in the target statement are known; and selecting the target word with the highest translation probability as the translation result of the t-th word in the target statement.
[0006] In one embodiment, calculating the confidence probability for each word position in the target statement based on the standard target statement and the predicted target statement includes: calculating the confidence probability at the current word position of the target word based on the translation result of the t-th word and the standard translation result of the t-th word in the standard target statement, given the prediction results of the first t-1 (t≥1) words in the target statement.
[0007] In one embodiment, the confidence probability includes any of the following: predicted translation probability ,in For the t-th word in the standard translation, X represents the portion of the target text that has already been translated, and X represents the semantic representation of the source text. The parameters of the translation model; the expectation of Monte Carlo sampling. Where k represents the number of Monte Carlo samplings, Represents the expectation; and the variance of Monte Carlo sampling. Where k represents the number of Monte Carlo samplings, Indicates variance.
[0008] In one embodiment, the method further includes: encoding the source input statement using an encoder in the translation model to output a semantic representation corresponding to the source statement; wherein the encoder includes a self-attention mechanism and a fully connected neural network.
[0009] In one embodiment, the method further includes: determining the combination of the standard target statement and the predicted target statement as the target statement input of the translation model based on the confidence probability, including: when the confidence probability at the t-th word position is less than or equal to a first threshold, using the (t-1)-th word in the standard target statement as the target statement input of the second decoder in the translation model; when the confidence probability at the t-th word position is greater than the first threshold and less than or equal to the second threshold, using the (t-1)-th word in the predicted target statement as the target statement input of the second decoder in the translation model; and when the confidence probability at the t-th word position is greater than the second threshold, using a random word as the target statement input of the second decoder in the translation model.
[0010] In one embodiment, the second decoder in the translation model has the same structure and parameters as the first decoder, and the parameters of the second decoder and the first decoder are synchronized after each iteration.
[0011] In one embodiment, the first and / or second decoder includes a self-attention mechanism, a cross-attention mechanism, and a fully connected neural network, wherein the self-attention mechanism is used for feature extraction and dimension transformation of the input statement.
[0012] In one embodiment, the method further includes: using a second decoder in the translation model to predict the target statement based on the source input statement, and obtaining the translation probability of the t-th word under the condition that the prediction results of the first t-1 (t≥1) words in the target statement are known; and calculating the cross-entropy loss function of the translation model based on the translation probability output by the second decoder.
[0013] According to a first aspect of this application, a training apparatus for a translation model is provided. The apparatus includes: an acquisition module configured to acquire a text to be trained, the text including at least a source input statement and a standard target statement corresponding to the source input statement; a prediction module configured to use the translation model to predict the target statement based on the source input statement to obtain a first predicted target statement; a confidence probability calculation module configured to calculate a confidence probability for each word position in the target statement based on the standard target statement and the predicted target statement; and a scheduling module configured to determine a combination of the standard target statement and the predicted target statement as the target statement input for the translation model based on the confidence probabilities.
[0014] According to another aspect of this application, a computing device is provided. The computing device includes: a memory configured to store computer-executable instructions; and a processor configured to perform the method described in any of the embodiments of the training method for the aforementioned translation model when the computer-executable instructions are executed by the processor.
[0015] According to another aspect of this application, a computer-readable storage medium is provided that stores computer-executable instructions, which, when executed, perform the method described in any of the embodiments of the training method for the aforementioned translation model.
[0016] This application proposes a scheduling sampling strategy based on model confidence probability. Compared with traditional scheduling sampling algorithms, this application determines the sampling strategy based on the model's real-time capability (i.e., confidence probability). The strategy is determined by setting three calculation methods for different confidence probabilities. Specifically, the model's own prediction is used for words with high confidence probabilities, while the standard translation is used for words with low confidence probabilities. Furthermore, this application mitigates algorithm degradation by adding noise to words with high confidence probabilities. Therefore, the proposed scheduling sampling strategy significantly reduces the exposure bias problem of NMT models and greatly improves translation quality. This application can be used to improve online translation systems. Attached Figure Description
[0017] Embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings, in which:
[0018] Figure 1 This illustration schematically depicts application scenarios of translation models according to some embodiments of the present disclosure;
[0019] Figure 2a The user interface of a neural network translation model applying an embodiment of this application is illustrated schematically;
[0020] Figure 2b The user interface of a neural network translation model applying an embodiment of this application is illustrated schematically;
[0021] Figure 3 The diagram illustrates an encoder-decoder architecture for a neural network translation model.
[0022] Figure 4 The diagram illustrates a schematic block diagram of a machine translation model trained based on a scheduling sampling strategy according to an embodiment of the present application.
[0023] Figure 5 The diagram illustrates an example flowchart of a training method for a machine translation model that schedules sampling based on confidence probability according to an embodiment of this application.
[0024] Figure 6 This schematically illustrates an example block diagram of a training apparatus for a machine translation model that performs scheduled sampling based on confidence probability according to this application; and
[0025] Figure 7 An example system is illustrated schematically, which includes an example computing device representing one or more systems and / or devices that can implement the various technologies described herein. Detailed Implementation
[0026] The technical solutions of this application will now be clearly and completely described with reference to the accompanying drawings. The described embodiments are merely some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0027] 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 the technology of simulating human cognitive abilities through machines. AI is a comprehensive discipline, encompassing a wide range of fields, including perception, reasoning, and decision-making capabilities, and involving 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 mainly include computer vision, speech processing, natural language processing, and machine learning / deep learning. The core capability of AI is to make judgments or predictions based on given input. For example, in facial recognition applications, it can identify the person in a photograph. In medical diagnosis, it can determine the cause and nature of a disease based on input medical images.
[0028] In artificial intelligence software technology, machine learning is a crucial technique for endowing computers with intelligent characteristics. Machine learning is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory, and many other disciplines. Machine learning 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 typically includes techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, and inductive learning.
[0029] To facilitate understanding of the embodiments of this application, several concepts will be briefly introduced below.
[0030] Exposure bias refers to the inconsistency between text generation during training and inference. This inconsistency manifests in the different inputs used during inference and training. During training, each word input comes from a ground truth sample, but during inference, the current input uses the output of the previous word.
[0031] Neural Machine Translation (NMT) is a machine translation method that has emerged in recent years. Compared to traditional Statistical Machine Translation (SMT), NMT can train a neural network that can map from one sequence to another, and the output can be a sequence of variable length.
[0032] Machine translation model (Transformer): Transformer refers to an encoder-decoder system. The encoder encodes the source language sequence and extracts information from the source language. The decoder then converts this information into another language, namely the target language, thereby completing the language translation.
[0033] Scheduled sampling is a method to address the inconsistency in input data distribution between inference and training. By primarily using true elements from the target sequence as input to the decoder in the early stages of training, it quickly guides the model from a randomly initialized state to a reasonable one. As training progresses, this method gradually uses more inferred elements as input to the decoder, thus resolving the data inconsistency problem.
[0034] BLEU (Bilingual Evaluation Understudy) is a metric used to evaluate translation quality. This metric focuses on the degree of similarity between machine and human translations of the same text, i.e., the similarity between the machine translation and the reference translation.
[0035] Figure 1 An application scenario 100 of a translation model according to some embodiments of the present disclosure is illustrated. In this application scenario, one or more user interfaces 101 communicate bidirectionally with one or more computing devices 108 via an intermediate device 105. A user 104 interacts with one or more user interfaces 101 to complete bidirectional communication with the computing device 108.
[0036] Optionally, one or more databases, such as one or more of a first database 110, a second database 120, or a third database 130, may exist to cooperate with the computing device 108 to implement functions. It should be understood that in some embodiments, one or more of these databases may be integrated into the computing device 108.
[0037] In some embodiments, the intermediate device 105 may include a network connection, such as a combination of a local area network (LAN), a wide area network (WAN), a personal area network (PAN), and / or a communication network such as the Internet. In this case, the computing device 108 may act as a server, and the user interface 101 may interact with one or more computing devices 108, for example, via a network, such as sending data to or receiving data from them. Each of the computing device 108 and the one or more user interfaces 101 may include at least one communication interface (not shown) capable of communicating through the intermediate device 105. Such a communication interface may be one or more of the following: any type of network interface (e.g., a network interface card (NIC)), a wired or wireless (such as an IEEE 802.11 wireless LAN (WLAN)) wireless interface, a Wi-MAX interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, or Bluetooth. TM Interfaces, near field communication (NFC) interfaces, etc. Further examples of communication interfaces are described elsewhere in this document.
[0038] In some embodiments, the intermediate device 105 may be a direct electrical connection, and the user interface 101 and one or more computing devices 108 may be integrated onto one or more terminal devices (not shown). The one or more terminal devices may be any type of computing device, including mobile computers (e.g., Microsoft® Surface® devices, personal digital assistants (PDAs), laptop computers, notebook computers, and devices such as the Apple iPad). TM Tablet computers, netbooks, etc.), mobile phones (e.g., cellular phones, smartphones such as Microsoft Windows® phones, Apple iPhones, and devices implementing Google® Android). TM Operating systems such as phones, Palm® devices, Blackberry® devices, etc.), and wearable devices (such as smartwatches, head-mounted devices, including smart glasses such as Google® Glass). TM (e.g., mobile devices, game consoles, smart TVs, etc.) or other types of mobile devices. In some embodiments, one or more terminal devices may also be fixed devices, such as desktop computers, game consoles, smart TVs, etc. Furthermore, when multiple terminal devices exist, the multiple terminal devices may be the same or different types of devices.
[0039] The terminal device may include a display screen (not shown) and a terminal application (not shown) that can be interacted with by the user through the display screen. The terminal application may be a local application, a web application, or a lightweight application (such as a mobile mini-program or WeChat mini-program). If the terminal application is a local application that requires installation, it can be installed on the terminal device. If the terminal application is a web application, it can be accessed through a browser. If the terminal application is a mini-program, it can be opened directly on the user's terminal without installation by searching for relevant information (such as the application's name) or scanning its graphic code (such as a barcode or QR code).
[0040] Figure 2a A user interface 200a applying a neural network translation model according to an embodiment of this application is shown. In this user interface 200a, a background translation service provided by the technology provider can be used to translate a user-inputted language A sequence into a language B sequence. Correspondingly, a background translation service provided by the technology provider can be used to translate a user-inputted language B sequence into a language A sequence. As those skilled in the art will understand, the user here can be one or more users. The user can input language A or language B in various ways, including image input, voice input, keyboard input, etc. The background translation model is trained using a training method for a neural network translation model according to an embodiment of this application.
[0041] Figure 2b A user interface 200b is shown that applies a neural network translation model according to an embodiment of this application. In this user interface 200b, a background translation service provided by the technology provider can be used to translate a user-inputted language A sequence into a language B sequence. For example… Figure 2b When a user inputs a language sequence "language sequence" into the left input box, the system processes the input through a background translation mechanism, and then outputs a language sequence "language sequence" into the right input box. This background translation model is one of the underlying technologies. The background translation model is trained using a neural network translation model training method according to an embodiment of this application. The user can input language A or language B through various methods, including image input, voice input, and keyboard input.
[0042] In machine translation tasks, the core architecture is the encoder-decoder scheme. The encoder processes variable-length input and builds a fixed-length vector representation. The decoder generates a variable-length sequence (target sequence) based on the encoded representation. Figure 3 A schematic diagram of an encoder-decoder architecture for a neural network translation model is shown. (As in...) Figure 3As shown, the variable-length input of the input encoder is X=x1,x2,…xn, the encoded representation of the encoder output is [z1,z2,…zd], and the variable-length sequence output by the decoder is Y=y1,y2,…yn.
[0043] Figure 4 The illustration schematically shows a machine translation model trained based on a scheduled sampling strategy according to an embodiment of this application. The architecture 400 includes an encoder 401 and two structurally identical decoders 402 and 403. The encoder 401 includes self-attention and feedforward (i.e., a fully connected neural network). The encoder 401 first encodes the source input statement, passes it through the self-attention mechanism and the feedforward structure, and outputs the corresponding source semantic representation X. The architecture 400 includes two decoders, a first-round decoder 402 and a second-round decoder 403. The first-round decoder 402 and the second-round decoder 403 have identical structures, each including a self-attention mechanism, a cross-attention mechanism, and a feedforward structure, and the parameters of each structure in the first-round decoder 402 and the second-round decoder 403 are kept synchronized. Here, the output of the encoder 401 is fed to the cross-attention mechanism of the first-round decoder 402 and the cross-attention mechanism of the second-round decoder 403, respectively.
[0044] The first-round decoder 402 encodes the target input statement using the self-attention mechanism. The target input statement after self-attention encoding and the source semantic representation X are then processed by a cross-attention mechanism and a fully connected neural network, outputting the translation probability predicted by the model. Here, the confidence probability of the model at different word positions in the sentence at the current time is calculated. In one embodiment, the confidence probability There are three possible calculation methods for confidence probability. You can choose to predict the translation probability: ,in This represents the t-th word in the standard translation. This represents the portion of the translation that has already been completed at the target end, where X represents the semantic representation of the source statement. These are the parameters of the NMT model. Confidence probability. The desired outcome can be selected for Monte Carlo sampling: , where k represents the number of Monte Carlo samplings, and other symbols are defined as above. Additionally, the confidence probability... The variance that can be selected for Monte Carlo sampling is: Where k represents the number of Monte Carlo samplings, This indicates the calculation of variance.
[0045] The second-round decoder 403 first determines its input at the current position based on the model confidence probability calculated by the first-round decoder 402. The model has a confidence probability conf(t) at each position t. When the confidence probability conf(t) is less than a certain threshold... If this happens, it means the model for the current position has not yet been learned well, and we continue with the (t-1)th word in the annotated translation. As input. When the confidence probability conf(t) is greater than a certain threshold. If this happens, it means the current position model has learned well enough, and more difficult random words should be used. As input. When the confidence probability conf(t) is between two thresholds, it indicates that the model has basically learned the current position, based on the model's own prediction. As the input at the current moment. The above process can be described by the following formula:
[0046]
[0047] here, and These are hyperparameters that can be adjusted based on the performance of the development set.
[0048] The second-round decoder 403 receives the above input, processes it through a self-attention mechanism, a cross-attention mechanism, and a fully connected neural network, and outputs the final prediction probability of the model, which is used to calculate the cross-entropy loss function of the learning model.
[0049] Figure 5This diagram illustrates an example flowchart of a training method 500 for a machine translation model based on confidence probability-based scheduled sampling according to an embodiment of this application. In step 501, the method 500 acquires a text to be trained, which includes at least a source input statement and a standard target statement corresponding to the source input statement. Here, the source input statement is first encoded by an encoder in the translation model. The input statement outputs a semantic representation X corresponding to the source statement through a self-attention mechanism and a fully connected neural network included in the encoder. The first-round decoder includes a self-attention mechanism, a cross-attention mechanism, and a feedforward network. The standard target statement corresponding to the source input statement is encoded by the first-round decoder, and the semantic representation of the source statement is combined with the semantic representation of its corresponding standard target statement as input to the cross-attention mechanism in the first-round decoder. In step 502, the translation model predicts the target statement based on the source input statement to obtain a first predicted target statement. In one embodiment, the first decoder in the translation model predicts the target sentence based on the source input sentence, obtaining the translation probability of the t-th word given the predicted results of the first t-1 (t≥1) words in the known target sentence; the target word with the highest translation probability is selected as the translation result of the t-th word in the target sentence. In step 503, the confidence probability for each word position in the target sentence is calculated based on the standard target sentence and the predicted target sentence. In one embodiment, the confidence probability at the current word position of the target word is calculated based on the translation result of the t-th word and the standard translation result of the t-th word in the standard target sentence, given the predicted results of the first t-1 (t≥1) words in the known target sentence. In one embodiment, the confidence probability... There are three possible calculation methods for confidence probability. You can choose to predict the translation probability: ,in This represents the t-th word in the standard translation. This represents the portion of the translation that has already been completed at the target end, where X represents the semantic representation of the source statement. These are the parameters of the NMT model. Confidence probability. The desired outcome can be selected for Monte Carlo sampling: , where k represents the number of Monte Carlo samplings, and other symbols are defined as above. Additionally, the confidence probability... The variance that can be selected for Monte Carlo sampling is: Where k represents the number of Monte Carlo samplings, This indicates the calculation of variance.
[0050] In step 504, a combination of the standard target sentence and the predicted target sentence is determined based on the confidence probability and used as the target sentence input for the translation model. Specifically, when the confidence probability at the t-th word position is less than or equal to a first threshold, the (t-1)-th word in the standard target sentence is used as the target sentence input for the second decoder in the translation model; when the confidence probability at the t-th word position is greater than the first threshold and less than or equal to a second threshold, the (t-1)-th word in the predicted target sentence is used as the target sentence input for the second decoder in the translation model; when the confidence probability at the t-th word position is greater than the second threshold, a random word is used as the target sentence input for the second decoder in the translation model. In one embodiment, the model has a confidence probability conf(t) at each position t. When the confidence probability conf(t) is less than a certain threshold... If this happens, it means the model for the current position has not yet been learned well, and we continue with the (t-1)th word in the annotated translation. As input. When the confidence probability conf(t) is greater than a certain threshold. If this happens, it means the current position model has learned well enough, and more difficult random words should be used. As input. When the confidence probability conf(t) is between two thresholds, it indicates that the model has basically learned the current position, based on the model's own prediction. As the input at the current moment. The above process can be described by the following formula:
[0051]
[0052] here, and These are hyperparameters that can be adjusted based on the performance on the development set. Here, the second decoder in the translation model has the same structure and parameters as the first decoder, and the parameters of the second decoder and the first decoder are synchronized after each iteration. The first and / or second decoder includes a self-attention mechanism, a cross-attention mechanism, and a fully connected neural network, where the self-attention mechanism is used for feature extraction and dimensionality transformation of the input sentence. The second decoder in the translation model is used to predict the target sentence based on the source input sentence, obtaining the translation probability of the t-th word given the prediction results of the first t-1 (t≥1) words in the target sentence; the cross-entropy loss function of the translation model is calculated based on the translation probability output by the second decoder.
[0053] This machine translation model training method based on confidence probability-based scheduling sampling determines the sampling strategy according to the model's real-time capability (i.e., confidence probability). The scheduling sampling strategy is determined by setting three calculation methods for different confidence probabilities. Specifically, the model's own prediction is used for words with high confidence probabilities, while the standard translation is used for words with low confidence probabilities. Furthermore, this application mitigates algorithm degradation by adding noise to words with high confidence probabilities. Therefore, the scheduling sampling strategy proposed in this application significantly reduces the exposure bias problem of NMT models and greatly improves translation quality. This application can be used to improve online translation systems.
[0054] Table 1 schematically illustrates a comparison between the translation model training method of this application and traditional methods using conventional scheduling and sampling.
[0055] Model WMT14 EN-DE WMT19 ZH-EN WMT14 EN-FR Transformer 27.90 24.97 39.90 Transformer (Scheduled Sampling) 28.60(+0.70) 25.43(+0.46) 40.62(+0.72) Transformer (this invention) 28.91(+1.01) 26.00(+1.03) 41.28(+1.38)
[0056] Table 1. Performance comparison between the translation model training method of this application and traditional training methods.
[0057] Here, we examine the changes in BLEU scores for the WMT14 EN-DE, WMT19 ZH-EN, and WMT14 EN-FR datasets, focusing on the Transformer, Transformer combined with scheduled sampling, and Transformer combined with the training method proposed in this invention. The BLEU score is a standard for machine translation evaluation; a higher BLEU score indicates better performance. Table 1 shows that for the WMT14 EN-DE dataset, the BLEU score using Transformer combined with scheduled sampling is 0.70 higher than that of the standard Transformer, while the BLEU score using Transformer combined with the training method proposed in this invention is 1.01 higher. For the WMT19 ZH-EN dataset, the BLEU score using Transformer combined with scheduled sampling is 0.46 higher than that of the standard Transformer, while the BLEU score using Transformer combined with the training method proposed in this invention is 1.03 higher. For the WMT14 EN-FR dataset, the BLEU value using Transformer combined with scheduled sampling is improved by 0.72 compared to Transformer alone, and the BLEU value using Transformer combined with the training method proposed in this invention is improved by 1.38 compared to Transformer alone.
[0058] Figure 6A schematic diagram illustrates an example block diagram of a training device 600 for a machine translation model based on confidence probability-based scheduled sampling according to this application. The device 600 includes an acquisition module 601, a prediction module 602, a confidence probability calculation module 603, and a scheduling module 604. The acquisition module 601 is configured to acquire a text to be trained, which includes at least a source input statement and a standard target statement corresponding to the source input statement. Here, the source input statement is first encoded by an encoder in the translation model. The input statement is processed by a self-attention mechanism and a fully connected neural network included in the encoder, outputting a semantic representation X corresponding to the source statement. The first-round decoder includes a self-attention mechanism, a cross-attention mechanism, and a feedforward network. The standard target statement corresponding to the source input statement is encoded by the first-round decoder, and the semantic representation of the source statement is combined with the semantic representation of its corresponding standard target statement as input to the cross-attention mechanism in the first-round decoder.
[0059] The prediction module 602 is configured to use a translation model to predict the target statement based on the source input statement, thereby obtaining a first predicted target statement. In one embodiment, the first decoder in the translation model is used to predict the target statement based on the source input statement, thereby obtaining the translation probability of the t-th word given the prediction results of the first t-1 (t≥1) words in the target statement; the target word with the highest translation probability is selected as the translation result of the t-th word in the target statement.
[0060] The confidence probability calculation module 603 is configured to calculate the confidence probability for each word position in the target sentence based on the standard target sentence and the predicted target sentence. In one embodiment, given the prediction results of the first t-1 (t≥1) words in the target sentence, the confidence probability at the current word position of the target word is calculated based on the translation result of the t-th word and the standard translation result of the t-th word in the standard target sentence. In one embodiment, the confidence probability... There are three possible calculation methods for confidence probability. You can choose to predict the translation probability: ,in This represents the t-th word in the standard translation. This represents the portion of the translation that has already been completed at the target end, where X represents the semantic representation of the source statement. These are the parameters of the NMT model. Confidence probability. The desired outcome can be selected for Monte Carlo sampling: , where k represents the number of Monte Carlo samplings, and other symbols are defined as above. Additionally, the confidence probability... The variance that can be selected for Monte Carlo sampling is: Where k represents the number of Monte Carlo samplings, This indicates the calculation of variance.
[0061] The scheduling module 604 is configured to determine a combination of a standard target statement and a predicted target statement as the target statement input to the translation model based on confidence probabilities. Specifically, when the confidence probability at the t-th word position is less than or equal to a first threshold, the (t-1)-th word in the standard target statement is used as the target statement input to the second decoder in the translation model; when the confidence probability at the t-th word position is greater than the first threshold and less than or equal to a second threshold, the (t-1)-th word in the predicted target statement is used as the target statement input to the second decoder in the translation model; when the confidence probability at the t-th word position is greater than the second threshold, a random word is used as the target statement input to the second decoder in the translation model. In one embodiment, the model has a confidence probability conf(t) at each position t. When the confidence probability conf(t) is less than a certain threshold... If the current position indicates that the model has not yet been learned well, continue using the (t-1)th word in the annotated translation. As input. When the confidence probability conf(t) is greater than a certain threshold. If this happens, it means the current position model has learned well enough, and more difficult random words should be used. As input. When the confidence probability conf(t) is between two thresholds, it indicates that the model has basically learned the current position, based on the model's own prediction. As the input at the current moment. The above process can be described by the following formula:
[0062]
[0063] here, and These are hyperparameters that can be adjusted based on the performance on the development set. Here, the second decoder in the translation model has the same structure and parameters as the first decoder, and the parameters of the second decoder and the first decoder are synchronized after each iteration. The first and / or second decoder includes a self-attention mechanism, a cross-attention mechanism, and a fully connected neural network, where the self-attention mechanism is used for feature extraction and dimensionality transformation of the input sentence. The second decoder in the translation model is used to predict the target sentence based on the source input sentence, obtaining the translation probability of the t-th word given the prediction results of the first t-1 (t≥1) words in the target sentence; the cross-entropy loss function of the translation model is calculated based on the translation probability output by the second decoder.
[0064] The training device for this machine translation model, which uses scheduled sampling based on confidence probability, determines the sampling strategy according to the model's real-time capability (i.e., confidence probability). The scheduling sampling strategy is determined by setting three calculation methods for different confidence probabilities. Specifically, the model's own prediction is used for words with high confidence probabilities, while the standard translation is used for words with low confidence probabilities. Furthermore, this application mitigates algorithm degradation by adding noise to words with high confidence probabilities. Therefore, the scheduled sampling strategy proposed in this application significantly reduces the exposure bias problem of NMT models and greatly improves translation quality. This application can be used to improve online translation systems.
[0065] Figure 7 An example system 700 is illustrated, which includes an example computing device 710 representing one or more systems and / or devices that can implement the technical solutions described in the various embodiments herein. The computing device 710 may be, for example, a server of a service provider, a device associated with a server, a system-on-a-chip, and / or any other suitable computing device or computing system. References above... Figure 6 The training device 600 for the described translation model can take the form of a computing device 710. Alternatively, the training device 600 for the translation model can be implemented as a computer program in the form of an application 716.
[0066] The example computing device 710, as illustrated in Figure 7, includes a processing system 711 communicatively coupled to each other, one or more computer-readable media 712, and one or more I / O interfaces 713. Although not shown, the computing device 710 may also include a system bus or other data and command transfer system that couples the various components to each other. The system bus may include any or a combination of different bus architectures, such as a memory bus or memory controller, a peripheral bus, a universal serial bus, and / or a processor or local bus utilizing any of the various bus architectures. Various other examples, such as control and data lines, are also conceived.
[0067] Processing system 711 represents the functionality of performing one or more operations using hardware. Therefore, processing system 711 is illustrated as including hardware elements 714 that can be configured as processors, function blocks, etc. This may include application-specific integrated circuits (ASICs) or other logic devices formed using one or more semiconductors in the hardware. Hardware element 714 is not limited by the materials in which it is formed or the processing mechanism employed therein. For example, a processor may consist of semiconductors and / or transistors (e.g., integrated circuits (ICs)). In such a context, processor-executable instructions may be electronically executable instructions.
[0068] Computer-readable medium 712 is illustrated as including memory / storage device 715. Memory / storage device 715 represents a memory / storage capacity associated with one or more computer-readable media. Memory / storage device 715 may include volatile media (such as random access memory (RAM)) and / or non-volatile media (such as read-only memory (ROM), flash memory, optical disk, magnetic disk, etc.). Memory / storage device 715 may include fixed media (e.g., RAM, ROM, fixed hard disk drive, etc.) and removable media (e.g., flash memory, removable hard disk drive, optical disk, etc.). Computer-readable medium 712 may be configured in various other ways as further described below.
[0069] One or more I / O interfaces 713 represent the functionality to allow users to input commands and information to computing device 710 using various input devices and optionally also to present information to the user and / or other components or devices using various output devices. Examples of input devices include keyboards, cursor control devices (e.g., mice), microphones (e.g., for voice input), scanners, touch functionality (e.g., capacitive or other sensors configured to detect physical touch), cameras (e.g., capable of detecting non-touch-related motion as gestures using visible or invisible wavelengths (such as infrared frequencies), etc. Examples of output devices include display devices (e.g., projectors), speakers, printers, network interface cards, haptic-responsive devices, etc. Therefore, computing device 710 can be configured in various ways, as further described below, to support user interaction.
[0070] The computing device 710 also includes an application 716. The application 716 may be, for example, referred to... Figure 6 The software instance of the training device 600 for the described translation model is implemented in combination with other elements in the computing device 710 to implement the techniques described herein.
[0071] This document describes various technologies within the general context of software and hardware components or program modules. Generally, these modules include routines, programs, objects, elements, components, data structures, etc., that perform specific tasks or implement specific abstract data types. As used herein, the terms "module," "function," and "component" generally refer to software, firmware, hardware, or a combination thereof. The technologies described herein are platform-independent, meaning they can be implemented on a variety of computing platforms with various processors.
[0072] Implementations of the described modules and technologies may be stored on or transmitted across some form of computer-readable medium. The computer-readable medium may include a variety of media accessible by the computing device 710. By way of example and not limitation, the computer-readable medium may include "computer-readable storage media" and "computer-readable signal media".
[0073] In contrast to simple signal transmission, carrier waves, or signals themselves, a "computer-readable storage medium" refers to a medium and / or device capable of persistently storing information, and / or a tangible storage device. Therefore, a computer-readable storage medium refers to a non-signal-bearing medium. Computer-readable storage media include hardware such as volatile and non-volatile, removable and non-removable media and / or storage devices implemented using methods or techniques suitable for storing information (such as computer-readable instructions, data structures, program modules, logic elements / circuits, or other data). Examples of computer-readable storage media may include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical storage devices, hard disks, cassette tapes, magnetic tapes, disk storage devices or other magnetic storage devices, or other storage devices, tangible media, or articles of art suitable for storing desired information and accessible by a computer.
[0074] "Computer-readable signal medium" refers to a signal-bearing medium configured to transmit instructions, such as via a network, to computing device 710. A signal medium typically embodies computer-readable instructions, data structures, program modules, or other data in a modulated data signal, such as a carrier wave, data signal, or other transmission mechanism. Signal media also include any information transmission medium. The term "modulated data signal" refers to a signal in which one or more of its characteristics are set or altered to encode information. By way of example and not limitation, communication media include wired media such as wired networks or direct connections, and wireless media such as acoustic, RF, infrared, and other wireless media.
[0075] As previously described, hardware element 714 and computer-readable medium 712 represent instructions, modules, programmable device logic, and / or fixed device logic implemented in hardware, which in some embodiments can be used to implement at least some aspects of the techniques described herein. Hardware elements may include components of integrated circuits or systems-on-a-chip, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), complex programmable logic devices (CPLDs), and other implementations or other hardware devices in silicon. In this context, hardware elements can serve as processing devices for executing program tasks defined by instructions, modules, and / or logic embodied by the hardware element, and as hardware devices for storing instructions for execution, such as the previously described computer-readable storage medium.
[0076] The foregoing combinations can also be used to implement the various techniques and modules described herein. Therefore, software, hardware, or program modules and other program modules can be implemented as one or more instructions and / or logic embodied on some form of computer-readable storage medium and / or by one or more hardware elements 714. The computing device 710 can be configured to implement specific instructions and / or functions corresponding to the software and / or hardware modules. Thus, for example, by using the computer-readable storage medium and / or hardware elements 714 of a processing system, modules can be implemented at least partially in hardware as modules executable as software by the computing device 710. Instructions and / or functions can be executable / operable by one or more articles of art (e.g., one or more computing devices 710 and / or processing systems 711) to implement the techniques, modules, and examples described herein.
[0077] In various embodiments, the computing device 710 can be configured in various ways. For example, the computing device 710 can be implemented as a computer-type device, including personal computers, desktop computers, multi-screen computers, laptop computers, netbooks, etc. The computing device 710 can also be implemented as a mobile device, including mobile devices such as mobile phones, portable music players, portable gaming devices, tablet computers, multi-screen computers, etc. The computing device 710 can also be implemented as a television-type device, including devices with or connected to a generally large screen in a leisure viewing environment. These devices include televisions, set-top boxes, game consoles, etc.
[0078] The techniques described herein can be supported by these various configurations of computing device 710, and are not limited to specific examples of the techniques described herein. Functionality can also be implemented, wholly or partially, on the “cloud” 720 using distributed systems, such as through platform 722 as described below.
[0079] Cloud 720 includes and / or represents platform 722 for resource 724. Platform 722 abstracts the underlying functionality of the hardware (e.g., server) and software resources of cloud 720. Resource 724 may include other applications and / or data that can be used when performing computer processing on a server located remotely from computing device 710. Resource 724 may also include services provided via the Internet and / or via subscriber networks such as cellular or Wi-Fi networks.
[0080] Platform 722 can abstract resources and functions to connect computing device 710 to other computing devices. Platform 722 can also be used to abstract resource hierarchy to provide a corresponding level of hierarchy for any encountered needs for resource 724 implemented via platform 722. Therefore, in interconnect device embodiments, the implementation of the functions described herein can be distributed throughout system 700. For example, functions can be implemented partly on computing device 710 and partly through platform 722, which abstracts the functions of cloud 720.
[0081] It should be understood that, for clarity, embodiments of this disclosure have been described with reference to different functional units. However, it will be apparent that, without departing from this disclosure, the functionality of each functional unit may be implemented in a single unit, in multiple units, or as part of other functional units. For example, functionality described as being performed by a single unit may be performed by multiple different units. Therefore, references to a particular functional unit are considered merely as references to the appropriate unit used to provide the described functionality, and not as indicating a strict logical or physical structure or organization. Thus, this disclosure may be implemented in a single unit, or may be physically and functionally distributed among different units and circuits.
[0082] It will be understood that although the terms first, second, third, etc., may be used herein to describe various devices, elements, components, or parts, these devices, elements, components, or parts should not be limited by these terms. These terms are used only to distinguish one device, element, component, or part from another device, element, component, or part.
[0083] Although this disclosure has been described in conjunction with some embodiments, it is not intended to be limited to the specific forms set forth herein. Rather, the scope of this disclosure is limited only by the appended claims. Additionally, although individual features may be included in different claims, these may be advantageously combined, and inclusion in different claims does not imply that such a combination of features is not feasible and / or advantageous. The order of features in the claims does not imply that the features must be in any particular order of their operation. Furthermore, in the claims, the word "comprising" does not exclude other elements, and the terms "a" or "an" do not exclude a plurality. Reference numerals in the claims are provided only by way of explicit example and should not be construed as limiting the scope of the claims in any way.
Claims
1. A method for training a translation model, characterized in that, include: Obtain the training text, which includes at least a source input statement and a standard target statement corresponding to the source input statement; The first decoder in the translation model is used to predict the target sentence based on the source input sentence. The translation probability of the t-th word is obtained under the condition that the prediction results of the first t-1 (t≥1) words in the target sentence are known. The target word with the highest translation probability is selected as the translation result of the t-th word in the target sentence to obtain the first predicted target sentence. Calculate the confidence probability for each word position in the target statement based on the standard target statement and the first predicted target statement; Based on the confidence probability, a combination of the standard target statement and the predicted target statement is determined as the target statement input for the translation model, including: When the confidence probability at the t-th word position is less than or equal to the first threshold, the (t-1)-th word in the standard target sentence is used as the target sentence input of the second decoder in the translation model. The second decoder in the translation model has the same structure and parameters as the first decoder. When the confidence probability at the position of the t-th word is greater than the first threshold and less than or equal to the second threshold, the (t-1)-th word in the predicted target sentence is used as the target sentence input of the second decoder in the translation model; When the confidence probability at the t-th word position is greater than the second threshold, the random word is used as the target sentence input for the second decoder in the translation model.
2. The method of claim 1, wherein calculating the confidence probability for each word position in the target statement based on the standard target statement and the first predicted target statement includes: Given the prediction results of the first t-1 (t≥1) words in the target sentence, calculate the confidence probability of the target word at its current position based on the translation result of the t-th word and the standard translation result of the t-th word in the standard target sentence.
3. The method of claim 1 or 2, wherein the confidence probability includes any one of the following: Predicting translation probability ,in For the t-th word in the standard translation, X represents the portion of the target text that has already been translated, and X represents the semantic representation of the source text. These are the parameters of the translation model; Expectations of Monte Carlo sampling Where k represents the number of Monte Carlo samplings, Expressing expectation; and Variance of Monte Carlo sampling Where k represents the number of Monte Carlo samplings, Indicates variance.
4. The method of claim 1 or 2, further comprising: The source input statement is encoded using the encoder in the translation model, and a semantic representation corresponding to the source input statement is output. The encoder described therein includes a self-attention mechanism and a fully connected neural network.
5. The method of claim 1, wherein the parameters of the second decoder and the first decoder are synchronized after each iteration.
6. The method of claim 1, wherein the first and / or second decoder comprises a self-attention mechanism, a cross-attention mechanism, and a fully connected neural network, wherein the self-attention mechanism is used for feature extraction and dimension transformation of the input statement.
7. The method of claim 1 or 2, further comprising: The second decoder in the translation model is used to predict the target sentence based on the source input sentence, so as to obtain the translation probability of the t-th word under the condition that the prediction results of the first t-1 (t≥1) words in the target sentence are known; The cross-entropy loss function of the translation model is calculated based on the translation probability output by the second decoder.
8. A training device for a translation model, characterized in that, include: The acquisition module is configured to acquire the text to be trained, the text to be trained including at least a source input statement and a standard target statement corresponding to the source input statement; The prediction module is configured to use the first decoder in the translation model to predict the target sentence based on the source input sentence, and obtain the translation probability of the t-th word under the condition that the prediction results of the first t-1 (t≥1) words in the target sentence are known, and select the target word with the highest translation probability as the translation result of the t-th word in the target sentence to obtain the first predicted target sentence; The confidence probability calculation module is configured to calculate the confidence probability for each word position in the target statement based on the standard target statement and the first predicted target statement. The scheduling module is configured to determine, based on the confidence probability, a combination of the standard target statement and the predicted target statement as the target statement input of the translation model, including: when the confidence probability at the t-th word position is less than or equal to a first threshold, using the (t-1)-th (t≥1)-th word in the standard target statement as the target statement input of the second decoder in the translation model, wherein the second decoder in the translation model has the same structure and parameters as the first decoder; when the confidence probability at the t-th word position is greater than the first threshold and less than or equal to a second threshold, using the (t-1)-th word in the predicted target statement as the target statement input of the second decoder in the translation model; and when the confidence probability at the t-th word position is greater than the second threshold, using a random word as the target statement input of the second decoder in the translation model.
9. A computing device, comprising Memory, which is configured to store computer-executable instructions; A processor configured to perform the method as described in any one of claims 1-7 when the computer-executable instructions are executed by the processor.
10. A computer-readable storage medium storing computer-executable instructions that, when executed, perform the method as described in any one of claims 1-7.