N-Seq2Seq model construction method for machine translation
By adopting the N-Seq2Seq model in machine translation, combining multi-head attention and relative position coding, text candidate search box is introduced, long-distance dependence and translation ambiguity problems are solved, translation accuracy is improved, and computing resource requirements are reduced, and the Efficient translation effect.
Patent Information
- Application Number
- CN202411196549.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2025-01-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing machine translation technologies have difficulties in dealing with long-distance dependencies and translation ambiguity, and training large neural networks requires a large amount of computing resources, and there are problems of over-translation, insufficient translation, and generation of unnatural languages.
A new N-Seq2Seq model construction method is adopted, including encoding and decoding module, multi-head attention module, relative position encoding module and text candidate search box module. The model is optimized through ablation experiment and comparison experiment combined with the translation results of the BLEU value evaluation model. to improve accuracy and reduce computing resource requirements.
It improves the accuracy of machine translation, reduces the demand for computing resources, achieves the acceleration of model inference speed and the accuracy and efficiency of results, and has the advantages of lightweight.
Smart Images

Figure CN119250083A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of machine translation, and in particular to a method for constructing an N-Seq2Seq model for machine translation. Background Art
[0002] In recent years, with the increase of international trade and global cooperation, machine translation (MT) has become increasingly important in eliminating language barriers and promoting cross-cultural communication. The field of machine translation has made significant progress, and researchers have used various methods to deal with various problems that may arise in translation. From the earliest statistical machine translation methods, to traditional machine learning methods, to today's neural machine translation (NMT), machine translation continues to become more intelligent.
[0003] Early statistical machine translation (SMT) methods were pioneers in machine translation research and relied on phrase models and statistical alignment models. Researchers first used massively parallel corpora to estimate translation probabilities and build statistical translation models, the most famous of which include the IBM model and the phrase model. With the advancement of technology, traditional machine learning methods have become popular in machine translation because they can better capture syntactic and semantic information. Researchers have used a variety of methods, including traditional machine learning methods such as HMM and CRF to model the structure and word prediction of Chinese sentences, and methods such as SVM to classify and rank candidate translations. Although traditional machine learning methods usually require domain expertise and artificial features, they have shown good results on specific tasks and datasets.
[0004] However, both SMT and traditional machine learning methods have difficulty dealing with long-distance dependencies and translation ambiguity in translation. The rise of deep learning has revolutionized machine translation, and the Seq2Seq model has become the main translation model. The Seq2Seq model effectively solves these problems by encoding source language sentences into fixed-length representations and decoding them into target language sentences. However, there are still some problems with machine translation, such as the large amount of GPU resources and memory required to train large neural networks, as well as problems with over-translation, under-translation, and generating unnatural language.
[0005] Therefore, in the related technology, there is an urgent need for a method that can improve the accuracy of machine translation and reduce the demand for computing resources. Summary of the invention
[0006] Based on this, it is necessary to provide a method for constructing an N-Seq2Seq model for machine translation that can improve the accuracy of machine translation and reduce the demand for computing resources in response to the above technical problems.
[0007] In a first aspect, the present application provides a method for constructing an N-Seq2Seq model for machine translation. The method comprises:
[0008] Get training data;
[0009] Building an initial N-Seq2Seq model, the initial N-Seq2Seq model includes an encoding and decoding module, a multi-head attention module, a relative position encoding module, a word embedding encoding module and a text candidate search box module;
[0010] Using the training data to train the initial N-Seq2Seq model;
[0011] Ablation experiments and comparative experiments were carried out respectively, and the translation results of the model were evaluated by combining the BLEU value. The N-Seq2Seq model was determined based on the evaluation results.
[0012] Optionally, in one embodiment of the present application, the encoding and decoding module includes an encoder and a decoder, and the backbone network of the encoder and the decoder is a recurrent neural network.
[0013] Optionally, in one embodiment of the present application, the multi-head attention module includes multiple self-attention mechanisms to eliminate unimportant information of the input sequence.
[0014] Optionally, in one embodiment of the present application, the relative position encoding module is a trainable embedding code added to the self-attention mechanism, which is used to represent the relative distance between words.
[0015] Optionally, in one embodiment of the present application, the word embedding encoding module uses the WoBERT model to construct word vectors.
[0016] Optionally, in one embodiment of the present application, the text candidate search box module is located in the decoder and is used to store a candidate word set and predicted output words.
[0017] In a second aspect, the present application also provides a device for constructing an N-Seq2Seq model for machine translation. The device comprises:
[0018] A data acquisition module, used to acquire training data;
[0019] An initial model building module, used to build an initial N-Seq2Seq model, wherein the initial N-Seq2Seq model includes an encoding and decoding module, a multi-head attention module, a relative position encoding module, a word embedding encoding module, and a text candidate search box module;
[0020] An initial model training module, used for training the initial N-Seq2Seq model using the training data;
[0021] The experimental verification module is used to conduct ablation experiments and comparative experiments respectively, and evaluate the translation results of the model in combination with the BLEU value.
[0022] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor executes the steps of the methods described in the above embodiments.
[0023] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method described in each of the above embodiments are implemented.
[0024] The above-mentioned N-Seq2Seq model construction method for machine translation first obtains training data; then, builds an initial N-Seq2Seq model, the initial N-Seq2Seq model includes an encoding and decoding module, a multi-head attention module, a relative position encoding module, a word embedding encoding module and a text candidate search box module; then, uses the training data to train the initial N-Seq2Seq model; finally, conducts ablation experiments and comparative experiments respectively, combines the translation results of the BLEU value evaluation model, and determines the N-Seq2Seq model based on the evaluation results. In other words, a new machine translation model N-Seq2Seq is constructed, which adopts two attention mechanisms to focus on global information and important information in a targeted manner, which is achieved by adjusting hyperparameters, and removes non-important information; uses a word-based segmentation method and relative position encoding to improve the accuracy of text segmentation and enhance the relevance of words; introduces text candidate word boxes, and accelerates the reasoning speed of the model by predicting in advance, so as to achieve faster model reasoning speed, accurate and efficient reasoning results, and has the advantages of lightweight. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 An application environment diagram of a method for building an N-Seq2Seq model for machine translation in one embodiment;
[0026] Figure 2 A schematic diagram of a process of building an N-Seq2Seq model for machine translation in one embodiment;
[0027] Figure 3 A schematic diagram of the structure of an encoder-decoder in one embodiment;
[0028] Figure 4 Schematic diagram of the structure of a multi-head attention module in one embodiment;
[0029] Figure 5A schematic diagram of the structure of a text candidate search box module in one embodiment;
[0030] Figure 6 A structural block diagram of an N-Seq2Seq model building device for machine translation in one embodiment;
[0031] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0032] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0033] The N-Seq2Seq model construction method for machine translation provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. Among them, the terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.
[0034] In one embodiment, Figure 2 As shown in FIG. 1 , a method for constructing an N-Seq2Seq model for machine translation is provided, and the method is applied to Figure 1 The server in the example is used to illustrate the following steps:
[0035] S201: Obtain training data.
[0036] In the embodiment of the present application, the training data required includes multiple data sets, whose names are CMN, translation2019zh-en and WMT22zh-en. These data sets cover multiple fields such as politics, economy, technology, culture, history, etc., and can be used to train and evaluate machine translation models. Among them, the WMT22zh-en data set is provided by the WMT organization, covering a wider range of subject areas, and can support the application of machine translation in multiple fields. The amount of data is shown in the following table:
[0037] Dataset name Data volume CMN 29371 pairs translation2019zh-en 5.2 million pairs WMT22zh-en 2.68 million pairs
[0038] S203: Building an initial N-Seq2Seq model, wherein the initial N-Seq2Seq model includes an encoding and decoding module, a multi-head attention module, a relative position encoding module, a word embedding encoding module and a text candidate search box module.
[0039] In the embodiment of the present application, first, based on the deep learning model Seq2Seq model, an initial N-Seq2Seq model is built. The Seq2Seq model is a deep learning model specifically used to process sequence-to-sequence problems, and is also called an Encoder-Decoder model. Specifically, the initial N-Seq2Seq model includes an encoding and decoding module, a multi-head attention module, a relative position encoding module, a word embedding encoding module, and a text candidate search box module. Among them, the encoding and decoding module is the original module of the Seq2Seq model, and the multi-head attention module, the relative position encoding module, the word embedding encoding module, and the text candidate search box module are newly built modules.
[0040] In one embodiment of the present application, the encoding and decoding module includes an encoder and a decoder, and the backbone network of the encoder and the decoder is a recurrent neural network.
[0041] In one embodiment of the present application, the encoding and decoding module is the original module of the Seq2Seq model, including an encoder and a decoder, such as Figure 3 The following is a schematic diagram of the encoder-decoder structure. The encoder converts each element in the input sequence into a hidden state vector and represents the entire sequence information by forming a context vector. The decoder converts the context vector and <sos>The flag is decoded, the next output element is predicted, and the next output element and the context vector are continuously input into the decoder for prediction. When the prediction result is generated, <eos>When , the sequence generation ends and the entire translation process is completed. The same backbone network is used in both the encoder and the decoder, namely the recurrent neural network, such as the RNN model and the LSTM model.
[0042] In one embodiment of the present application, the multi-head attention module includes multiple self-attention mechanisms to eliminate non-important information of the input sequence.
[0043] In one embodiment of the present application, the multi-head attention mechanism is an improvement on the self-attention mechanism, and multiple attention mechanisms are used in parallel to represent the input sequence in different ways. The attention mechanism is used to process the similarity of texts between source languages, and can allocate most of the computing resources to more important areas when computing power is limited, thereby improving the efficiency and accuracy of processing texts. The self-attention mechanism pays attention to and extracts the internal information of the text input sequence, and learns the dependencies between different positions in the sequence by comparing different positions in the same sequence. In the self-attention mechanism, the sequence itself is paid attention to, and each element in the sequence is regarded as a "query" matrix, a "key" matrix, and a "value" matrix, and the similarity between them is calculated, and the attention distribution is constructed. In the self-attention mechanism, the "query" matrix, the "key" matrix, and the "value" matrix are all the same content.
[0044] like Figure 4 The figure shows the structure of the multi-head attention module. In the multi-head attention mechanism, the input sequence will be converted into three matrices K, Q and V and passed to multiple attention heads running in parallel. Each head calculates a set of attention weights. These weights will be multiplied by the V matrix to produce a set of different representations. These representations will be connected in series and transformed by a linear transformation to produce the final output of the multi-head attention. In the multi-head attention mechanism, a hyperparameter is used to adjust the learning of important and unimportant information. Through the adjustment of the hyperparameter, the model parameters can be reduced and the key information can be captured quickly. The multi-head attention module is placed between the output of the encoder and the input of the decoder as a elimination conversion layer. Through the attention mechanism, the unimportant information from the input sequence to the output is eliminated, thereby reducing the computational resources of the decoder and accelerating the accuracy of the prediction.
[0045] In one embodiment of the present application, the relative position encoding module is a trainable embedding code added to the self-attention mechanism, which is used to represent the relative distance between words.
[0046] In one embodiment of the present application, the distance relationship between characters and words in the text can be well represented by using a position encoding method. In the Transformer model, the position encoding is essentially an absolute position encoding, which can reflect the relative distance between characters and words, but cannot represent the order between them. The relative position encoding module of the present application is to add a set of trainable embedding codes to the self-attention mechanism. When calculating the attention, the relative distance between the current position and the noticed position is added to the calculation. This embedding code represents the distance between the i-th word and the j-th word. For example, a sentence with a length of 3 will have 5 embedding vectors that need to be encoded, as shown in the following table.
[0047] index explain 0 Relative embedding between position i and position (i-2) 1 Relative embedding between position i and position (i-1) 2 Relative embedding between position i and position i 3 Relative embedding between position i and position (i+1) 4 Relative embedding between position i and position (i+2)
[0048] In one embodiment of the present application, the word embedding encoding module uses the WoBERT model to construct word vectors.
[0049] In one embodiment of the present application, the initial word vector is represented by one-hot encoding, but when the sentence is very long, the dimension will be very large, the encoding will become sparse, the computational cost will increase, and the words it embodies are independent of each other. Based on the shortcomings of one-hot encoding, the use of Word2Vec to train word vectors has become popular, but this is a static word vector. Once the training is completed, the vector of each word is fixed and cannot be updated as the usage scenario changes. Based on the shortcomings of Word2Vec encoding, dynamic word vectors appear. Commonly used dynamic word vector methods include ELMo model, XLNet model and Bert model, among which Bert model is currently the best performing dynamic word vector model. However, the Chinese pre-training model of the Bert model constructs word vectors in units of characters, but most of them appear in the form of words in Chinese.
[0050] Therefore, this application uses the open source WoBERT model to construct word vectors. The WoBERT model uses the Jieba word segmentation, removes the redundant parts of the Bert model's built-in vocabulary, such as Chinese words with ##, and then adds 20,000 additional Chinese words (the 20,000 most frequent words in the Jieba word segmentation vocabulary), and finally the vocab.txt size of WoBERT is 33,586.
[0051] In one embodiment of the present application, the text candidate search box module is located in the decoder and is used to store a candidate word set and a predicted output word.
[0052] In one embodiment of the present application, when predicting text, it is necessary to select a word or character from all the text as the current prediction result, which will slow down the prediction speed, occupy memory, and greatly increase the error rate. The present application proposes a text candidate search box for making predictions in advance, which can reduce memory consumption and speed up the prediction speed. Figure 5 The figure shows the structure of the text candidate search box module. The text candidate search box is located in the decoder. There is a candidate word set in the text candidate search box. The candidate word set is based on the decoder output word at the previous moment to determine the possible vocabulary set at the current moment. A total of Top10 are taken as the current prediction set. Then, each word in the candidate word set is calculated for similarity with the encoder output vector to obtain the current decoder output word.
[0053] S205: Using the training data to train the initial N-Seq2Seq model.
[0054] In the embodiment of the present application, the training data is input into the constructed initial N-Seq2Seq model for training, as shown in the following table, which is the hardware environment for model training.
[0055] Experimental environment Environment selection programming language Python 3.8 frame Pytorch 1.10.0 operating system ubuntu20.04 GPU RTX 3090 (24GB) Cuda 11.3 Memory 43GB
[0056] By training on the GPU, the initial settings of the training-related parameters are shown in the following table. During training, the parameters are adjusted based on the loss and accuracy of the validation set in each round, and different parameters are set to obtain a trained N-Seq2Seq model.
[0057] Related parameter settings Value or method Number of training rounds 50 rounds Learning Rate 0.002 Number of hidden layers 768 Number of LSTM layers 2 Model training mechanism Tearcher forcing Model training method Early Stop
[0058] S207: Perform an ablation experiment and a comparative experiment respectively, evaluate the translation result of the model using the BLEU value, and determine the N-Seq2Seq model based on the evaluation result.
[0059] In the embodiment of the present application, ablation experiments and comparative experiments are carried out respectively, wherein the ablation experiment is used to understand and evaluate whether the network structure of the model is effective for the task by analyzing the principles and components inside the model, and the comparative experiment is used to select the best model. Specifically, 5 network structures are constructed, including a traditional Seq2Seq model with an LSTM network as the backbone network, a text attention Seq2Seq&Attention model with an LSTM network as the backbone network and a multi-head attention module introduced at the encoder output, a text relative position encoding Seq2Seq&Position model with an LSTM network as the backbone network and a relative position encoding module introduced, a text dynamic word vector Seq2Seq&WoBert model with an LSTM network as the backbone network and a WoBert model introduced to construct a word vector, and a text candidate search box Seq2Seq&CandidateBox model with an LSTM network as the backbone network and a text candidate search box module introduced at the decoder. Based on these 5 network structures, ablation experiments are carried out, training is continuously carried out, and the model parameter weights are adjusted. Based on the loss results of the training set, the improvement effect of the model is judged, and the model parameter weights with good effects are retained. We continued to conduct comparative experiments, comparing the traditional Transformer model with the constructed N-Seq2Seq model including Seq2Seq, WoBert, Attention, Position, and CandidateBox, and used the BLEU value as an evaluation indicator to evaluate the quality of the translation results.
[0060] In the above-mentioned N-Seq2Seq model construction method for machine translation, first, training data is obtained; then, an initial N-Seq2Seq model is constructed, and the initial N-Seq2Seq model includes an encoding and decoding module, a multi-head attention module, a relative position encoding module, a word embedding encoding module and a text candidate search box module; then, the initial N-Seq2Seq model is trained using the training data; finally, an ablation experiment and a comparative experiment are performed respectively, and the translation results of the model are evaluated in combination with the BLEU value, and the N-Seq2Seq model is determined based on the evaluation results. In other words, a new machine translation model N-Seq2Seq is constructed, which adopts two attention mechanisms, focuses on global information and important information in a targeted manner, and is achieved through hyperparameter adjustment, and removes non-important information; uses a word-based segmentation method and relative position encoding to improve the accuracy of text segmentation and enhance the relevance of words; introduces text candidate word boxes, and accelerates the reasoning speed of the model through advance prediction, thereby achieving faster model reasoning speed, accurate and efficient reasoning results, and has the advantages of lightweight.
[0061] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0062] Based on the same inventive concept, the embodiment of the present application also provides an N-Seq2Seq model construction device for machine translation for implementing the above-mentioned N-Seq2Seq model construction method for machine translation. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above-mentioned method, so the specific limitations in one or more embodiments of the N-Seq2Seq model construction device for machine translation provided below can be referred to the limitations of the N-Seq2Seq model construction method for machine translation above, and will not be repeated here.
[0063] In one embodiment, Figure 6 As shown, an N-Seq2Seq model construction device 600 for machine translation is provided, comprising: a data acquisition module 601, an initial model building module 603, an initial model training module 605 and an experimental verification module 609, wherein:
[0064] A data acquisition module, used to acquire training data;
[0065] An initial model building module, used to build an initial N-Seq2Seq model, wherein the initial N-Seq2Seq model includes an encoding and decoding module, a multi-head attention module, a relative position encoding module, a word embedding encoding module, and a text candidate search box module;
[0066] An initial model training module, used for training the initial N-Seq2Seq model using the training data;
[0067] The experimental verification module is used to conduct ablation experiments and comparative experiments respectively, and evaluate the translation results of the model in combination with the BLEU value.
[0068] In one embodiment of the present application, the encoding and decoding module includes an encoder and a decoder, and the backbone network of the encoder and the decoder is a recurrent neural network.
[0069] In one embodiment of the present application, the multi-head attention module includes multiple self-attention mechanisms to eliminate non-important information of the input sequence.
[0070] In one embodiment of the present application, the relative position encoding module is a trainable embedding code added to the self-attention mechanism, which is used to represent the relative distance between words.
[0071] In one embodiment of the present application, the word embedding encoding module uses the WoBERT model to construct word vectors.
[0072] In one embodiment of the present application, the text candidate search box module is located in the decoder and is used to store a candidate word set and a predicted output word.
[0073] Each module in the above-mentioned N-Seq2Seq model construction device for machine translation can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.
[0074] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a N-Seq2Seq model construction method for machine translation is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0075] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0076] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0077] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0078] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0079] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0080] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0081] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0082] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.< / eos> < / sos>
Claims
1. A method for constructing an N-Seq2Seq model for machine translation, characterized in that: The method comprises: Get training data; Building an initial N-Seq2Seq model, the initial N-Seq2Seq model includes an encoding and decoding module, a multi-head attention module, a relative position encoding module, a word embedding encoding module and a text candidate search box module; Using the training data to train the initial N-Seq2Seq model; Ablation experiments and comparative experiments were carried out respectively, and the translation results of the model were evaluated by combining the BLEU value. The N-Seq2Seq model was determined based on the evaluation results.
2. The method for constructing an N-Seq2Seq model for machine translation according to claim 1, characterized in that: The encoding and decoding module includes an encoder and a decoder, and the backbone networks of the encoder and the decoder are recurrent neural networks.
3. The method for constructing an N-Seq2Seq model for machine translation according to claim 1, characterized in that: The multi-head attention module includes multiple self-attention mechanisms to remove non-important information of the input sequence.
4. The method for constructing an N-Seq2Seq model for machine translation according to claim 1, characterized in that: The relative position encoding module is a trainable embedding code added to the self-attention mechanism to represent the relative distance between words.
5. The method for constructing an N-Seq2Seq model for machine translation according to claim 1, characterized in that: The word embedding encoding module uses the WoBERT model to construct word vectors.
6. The method for constructing an N-Seq2Seq model for machine translation according to claim 1, characterized in that: The text candidate search box module is located in the decoder and is used to store a candidate word set and predict output words.
7. An N-Seq2Seq model construction device for machine translation, characterized in that: The device comprises: A data acquisition module, used to acquire training data; An initial model building module, used to build an initial N-Seq2Seq model, wherein the initial N-Seq2Seq model includes an encoding and decoding module, a multi-head attention module, a relative position encoding module, a word embedding encoding module, and a text candidate search box module; An initial model training module, used for training the initial N-Seq2Seq model using the training data; The experimental verification module is used to conduct ablation experiments and comparative experiments respectively, and evaluate the translation results of the model in combination with the BLEU value.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Machine translation method and device, electronic equipment and readable storage medium
CN112329482A
Translation method and device based on artificial intelligence
CN113822079A
Low-resource neural machine translation method for fusing BERT knowledge into Seq2Seq model based on consistency Mixup
CN114970565A
Machine translation using neural network models
US20200034436A1
