Tibetan-Chinese neural machine translation method based on encrypted parallel corpora
Generating encrypted parallel corpus through Caesar cipher replacement and adding KL divergence interaction solves the problems of unstable data enhancement and misaligned content in Tibetan-Chinese neural machine translation, improves translation performance and stability, and achieves translation under different resource conditions. Effective translation effect.
Patent Information
- Application Number
- CN202410093791.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-23
- Publication Date
- 2024-08-30
AI Technical Summary
The existing data enhancement methods in Tibetan-Chinese neural machine translation have unstable returns under different scenarios and the contents of the expanded corpus are not aligned, and cannot effectively improve translation performance.
The Caesar cipher single-letter substitution is used to generate encrypted parallel corpus, and the symmetric KL divergence is added to the loss function of the Tibetan-Chinese translation model to explicitly interact the plaintext and encrypted corpus to ensure that the content of the source and target sentences are aligned and improve translation performance.
By generating high-quality encrypted corpus and ensuring the content alignment of the expanded corpus, the stability and performance of machine translation are improved, especially in both low- and high-resource situations.
Smart Images

Figure CN118569274A
Abstract
Description
Technical Field
[0001] The invention relates to a Tibetan-Chinese neural machine translation method based on encrypted parallel corpus, belonging to the technical field of machine translation in natural language processing. Background Art
[0002] In recent years, neural machine translation has approached human translation performance in multiple language pairs. It is worth noting that this impressive translation performance requires a large parallel corpus to support it. In order to enable each language pair to have such a large amount of data support, researchers have proposed many data enhancement methods. Data enhancement methods usually use additional monolingual corpora or modify existing parallel corpora to expand training data, thereby improving translation performance.
[0003] Data augmentation methods using monolingual corpora are usually divided into two steps: first, use the existing parallel corpus to train a source-to-target or target-to-source translation model, and then use the model to translate the source monolingual corpus or the target monolingual corpus. The parallel corpus generated in this way is called a synthetic corpus. Secondly, the parallel corpus is mixed with the synthetic corpus to retrain a more powerful source-to-target translation model. Obviously, the translation model trained in the first step determines the contribution of the synthetic corpus to the translation performance. Therefore, this type of method relies heavily on the translation model that generates the synthetic corpus, and the performance of this model cannot be consistently guaranteed in various scenarios. This results in the contribution of this type of data augmentation method to translation performance being unstable or even having a negative impact.
[0004] Data augmentation methods that modify existing parallel corpora usually replace words or phrases in the source sentence or (and) the target sentence with other words or phrases. The replaced sentence pairs are used as additional corpora together with the parallel corpus to train the source-to-target translation model. Although many studies have proven the effectiveness of such methods, the sentence pairs obtained by such methods do not have good fluency, and there is also a phenomenon that the replaced words or phrases are not aligned in the content of the source and target sentences.
[0005] Therefore, there is an urgent need for a data augmentation method that can maintain stable effectiveness in different scenarios and ensure alignment of the expanded corpus content. Summary of the invention
[0006] The present invention aims at the technical problems of unstable benefits or misaligned content of expanded corpus in existing data enhancement methods for Tibetan-Chinese language pairs, and proposes a Tibetan-Chinese neural machine translation method based on encrypted parallel corpus. An encrypted parallel corpus with the same semantics and grammatical structure as the plaintext is generated by single-letter substitution of the Caesar cipher, and then input into the Tibetan-Chinese translation model to calculate the negative log-likelihood loss of the encrypted Tibetan-Chinese sentence pair; and the symmetric KL divergence (Kullback-Leibler divergence) is added to the loss function of the Tibetan-Chinese translation model to explicitly interact with the plaintext and encrypted parallel corpus. The process of generating the encrypted corpus is relatively independent and the corpus quality is very high, which can ensure the content alignment of the source and target sentences and improve the translation performance.
[0007] The objective of the present invention is achieved through the following technical solutions:
[0008] A Tibetan-Chinese neural machine translation method based on encrypted parallel corpus, comprising the following steps:
[0009] Step 1: Preprocess the Tibetan-Chinese parallel corpus to obtain the Tibetan-Chinese parallel corpus D after word segmentation f ;
[0010] Step 1.1: Delete the Tibetan-Chinese sentence pairs whose source or target sentence length is greater than 150 characters or zero. The Tibetan-Chinese data after deletion is recorded as D = {(s1, t1), (s2, t2), ..., (s i , t i ),…,(s M , t M )}, where (s i , t i ) represents the i-th Tibetan-Chinese sentence pair, consisting of the Tibetan sentence s i and the corresponding Chinese sentence t i The subscript M represents the number of sentence pairs in the corpus.
[0011] Step 1.2: Use the word segmentation tool to segment the Tibetan-Chinese parallel corpus. The segmented words are recorded as in represents the i-th Tibetan sentence s i The result after word segmentation processing is Represents the i-th Chinese sentence t i The result after word segmentation processing.
[0012] Step 2: Use the Caesar cipher technology to encrypt the Tibetan-Chinese parallel corpus Df after word segmentation to generate the encrypted Tibetan-Chinese parallel corpus cipher (D f );
[0013] Step 2.1: Create a Tibetan alphabet to encrypt Tibetan text. The Tibetan alphabet used is composed of 34 consonant letters. The specific content and order of the alphabet are as follows:
[0014] Step 2.2: Based on the Tibetan alphabet described in step 2.1, use the Caesar cipher technique to parse the Tibetan sentences in the Tibetan-Chinese parallel corpus Df after word segmentation. Perform single letter replacement to generate a set of encrypted Tibetan sentences The encrypted Tibetan sentences and the corresponding Chinese sentences constitute the encrypted Tibetan-Chinese parallel corpus cipher (D f )={(cipher(S f ), T f )}, where S f Representation corpus D f The set of all Tibetan sentences in T f Representation corpus D f All Chinese sentences in the cipher(S f ) represents the corpus S f The encrypted result is Represents Tibetan sentences The encrypted result.
[0015] Step 3: For corpus D f and cipher(D f ) to perform BPE processing and obtain the corpus D after BPE processing bpe and cipher(D bpe );
[0016] Step 3.1: Use the SentencePiece tool to learn the Tibetan-Chinese parallel corpus D f =(S f , T f ) and the encrypted corpus cipher(D f )={(cipher(S f ), T f )} and perform Byte Pair Encoding. The encoded corpus is denoted as D bpe =(S bpe , T bpe ) and cipher(D bpe )={(cipher(S bpe ), T bpe )}, where D bpe , S bpe , T bpe 、cipher(D bpe ) and cipher(S bpe) represents the corpus D f , S f , T f 、cipher(D f ) and cipher(S f ) after BPE processing. and encrypted sentence pairs Recorded as and
[0017] Step 4: Use the Tibetan-Chinese parallel corpus D processed by BPE bpe and encrypted parallel corpus cipher(D bpe ) jointly train a Tibetan-Chinese neural machine translation model;
[0018] Step 4.1: To use the plaintext parallel corpus D bpe and encrypted parallel corpus cipher(D bpe ) jointly train the Tibetan-Chinese translation model and define a plaintext Tibetan-Chinese sentence pair The loss function is as follows:
[0019]
[0020] Where α1, α2 and β are loss weight parameters; Θ represents the model parameters to be learned; p Θ (t|s) represents the probability that the output of sentence s is sentence t under the condition of model parameter Θ; Represents a plaintext Tibetan-Chinese sentence pair Or encrypted sentence pairs The negative log-likelihood loss function of ; Represents the consistency loss, by calculating the model for Tibetan sentences and encrypted sentences The first two terms of formula (1) make the model Tibetan sentence and encrypted sentences Generate the corresponding Chinese sentences. The third term of formula (1) makes the Tibetan sentence and encrypted sentences We perform explicit interaction and urge the model to output consistent probability distributions for the two sentences. The third term of formula (1) is as follows:
[0021]
[0022] in represents the KL divergence function. In order to avoid excessive interference of formula (2) on the model prediction behavior, a temperature hyperparameter is used to soften the output distribution of formula (2). The softened output of a pair (s, t) is as follows:
[0023]
[0024] where z t represents the logit function of the output label t, and τ represents the temperature hyperparameter.
[0025] Step 4.2: The above formula (1) is the loss function of the Tibetan-Chinese translation model. The Tibetan-Chinese parallel corpus D after BPE processing is used. bpe and encrypted Tibetan-Chinese parallel corpus cipher(D bpe ) minimizes the loss function to jointly train the Tibetan-Chinese neural machine translation model.
[0026] Step 5: Use the Tibetan-Chinese neural machine translation model to translate the Tibetan sentences into Chinese sentences.
[0027] So far, after steps 1 to 5, we first use 34 Tibetan consonants to create a Tibetan alphabet, and use Caesar encryption technology to replace single letters in Tibetan sentences in the Tibetan-Chinese parallel corpus according to the Tibetan alphabet, and obtain an encrypted parallel corpus consisting of encrypted Tibetan sentences and corresponding Chinese sentences. Then, the Tibetan-Chinese parallel corpus and the encrypted parallel corpus are used to jointly train the translation model to enhance the model performance from the perspective of inputting "multilingual" data. At the same time, the symmetric KL divergence is also used in the model training stage to make the output distribution of Tibetan sentences and encrypted Tibetan sentences interact explicitly, further improving the translation performance of the model. Finally, the trained translation model is used to translate the Tibetan test sentences into Chinese sentences.
[0028] Beneficial effects:
[0029] Compared with the prior art, the method of the present invention has the following advantages:
[0030] 1. A Tibetan-Chinese neural machine translation method based on encrypted parallel corpus. Compared with the data augmentation method based on modifying the parallel corpus, all letters of the Tibetan sentence are replaced regularly according to the alphabet to obtain the extended corpus, rather than just replacing a word or phrase to obtain the extended corpus. Therefore, the content alignment of the extended corpus can be guaranteed; and KL divergence is added to make the extended corpus interact explicitly with the parallel corpus, effectively improving the translation performance of the machine translation.
[0031] 2. A Tibetan-Chinese neural machine translation method based on encrypted parallel corpus. Compared with the data augmentation method based on translating monolingual corpus, it can obtain high-quality expanded predictions using simple encryption technology. The quality of the expanded corpus is not limited by the scale of the existing parallel corpus, and can achieve stable returns under both low-resource and high-resource conditions. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 The present invention discloses a flow chart of a Tibetan-Chinese neural machine translation method based on encrypted parallel corpus. DETAILED DESCRIPTION
[0033] The present invention will be described in detail below with reference to the accompanying drawings and embodiments. The technical problems solved by the technical solution of the present invention and the beneficial effects are also described. It should be noted that the described embodiments are only intended to facilitate the understanding of the present invention and do not have any limiting effect on it.
[0034] A Tibetan-Chinese neural machine translation method based on encrypted parallel corpus, comprising the following steps:
[0035] Step 1: Preprocess the Tibetan-Chinese parallel corpus to obtain the Tibetan-Chinese parallel corpus D after word segmentation f .
[0036] Step 1.1: Delete the Tibetan-Chinese sentence pairs whose source or target sentence length is greater than 150 characters or zero. The Tibetan-Chinese data after deletion is recorded as D = {(s1, t1), (s2, t2), …, (s i ,t i ),…,(s M ,t M )}, where (s i ,t i ) represents the i-th Tibetan-Chinese sentence pair, consisting of the Tibetan sentence s i and the corresponding Chinese sentence t i The subscript M represents the number of sentence pairs in the corpus.
[0037] Step 1.2: Use the word segmentation tool to segment the Tibetan-Chinese parallel corpus. The segmented words are recorded as in represents the i-th Tibetan sentence s i The result after word segmentation processing is Represents the i-th Chinese sentence t i The result after word segmentation processing.
[0038] Take a data entry from CCMT2023 Tibetan-Chinese parallel corpus as an example: "Literature and art are the torch of the national spirit and the clarion call for the people to forge ahead."). Chinese is segmented using the jieba tool, and Tibetan is segmented using the TIP-LAS tool. The segmentation results are "Literature and art are the torch of the national spirit and the clarion call for the people to forge ahead.")
[0039] Step 2: Use the Caesar cipher technique to segment the Tibetan-Chinese parallel corpus D f Encrypt and generate encrypted Tibetan-Chinese parallel corpus cipher (D f ).
[0040] Step 2.1: Create a Tibetan alphabet to encrypt Tibetan text. The Tibetan alphabet used is composed of 34 consonant letters. The specific content and order of the alphabet are as follows:
[0041] Step 2.2: Based on the Tibetan alphabet described in step 2.1, use the Caesar cipher technique to parse the Tibetan-Chinese parallel corpus D after word segmentation. f Tibetan sentences in Perform single letter replacement to generate a set of encrypted Tibetan sentences The encrypted Tibetan sentences and the corresponding Chinese sentences constitute the encrypted Tibetan-Chinese parallel corpus cipher (D f )={(cipher(S f ),T f )}, where S f Representation corpus D f The set of all Tibetan sentences in T f Representation corpus D f All Chinese sentences in the cipher(S f ) represents the corpus S f The encrypted result is Represents Tibetan sentences The encrypted result.
[0042] According to the Tibetan alphabet, the Caesar cipher technique is used to encrypt the data entry d f Encryption is performed, and the encryption result is "Literature and art are the torch of the national spirit and the clarion call for the people to forge ahead."). Each Tibetan letter in the plain text is replaced by the letter that is shifted back one step in the alphabet.
[0043] Step 3: For corpus D f and cipher(D f ) to perform BPE processing and obtain the corpus D after BPE processing bpe and cipher(D bpe ).
[0044] Step 3.1: Use the SentencePiece tool to learn the Tibetan-Chinese parallel corpus D f =(S f ,T f ) and the encrypted corpus cipher(D f )={(cipher(S f ),T f )} and perform Byte Pair Encoding. The encoded corpus is denoted as D bpe =(S bpe ,T bpe ) and cipher(D bpe )={(cipher(S bpe ),T bpe )}, where D bpe , S bpe , T bpe 、cipher(D bpe ) and cipher(S bpe ) represents the corpus D f , S f , T f 、cipher(D f ) and cipher(S f ) after BPE processing. and encrypted sentence pairs Recorded as and
[0045] Use the SentencePiece tool to learn a joint dictionary of size 35k, and then use the dictionary to perform BPE on the instance data strip d f and cipher(d f )The processing result is:
[0046]
[0047]
[0048] Step 4: Use the Tibetan-Chinese parallel corpus D processed by BPE bpe and encrypted parallel corpus cipher(D bpe ) jointly train the Tibetan-Chinese neural machine translation model.
[0049] Step 4.1: To use the plaintext parallel corpus D bpe and encrypted parallel corpus cipher(D bpe ) jointly train the Tibetan-Chinese translation model and define a plaintext Tibetan-Chinese sentence pair The loss function is as follows:
[0050]
[0051] Where α1, α2, and β are loss weight parameters and are set to 1, 1, and 5, respectively; Θ represents the model parameters to be learned; p Θ (t|s) represents the probability that the output of sentence s is sentence t under the condition of model parameter Θ; Represents a plaintext Tibetan-Chinese sentence pair Or encrypted sentence pairs The negative log-likelihood loss function of ; Represents the consistency loss, by calculating the model for Tibetan sentences and encrypted sentences The first two terms of formula (1) make the model Tibetan sentence and encrypted sentences Generate the corresponding Chinese sentences. The third term of formula (1) makes the Tibetan sentence and encrypted sentences We perform explicit interaction and urge the model to output consistent probability distributions for the two sentences. The third term of formula (1) is as follows:
[0052]
[0053] in represents the KL divergence function. In order to avoid excessive interference of formula (2) on the model prediction behavior, a temperature hyperparameter is used to soften the output distribution of formula (2). The softened output of a pair (s, t) is as follows:
[0054]
[0055] where z t represents the logit function of the output label t; τ represents the temperature hyperparameter, whose value is set to 1.
[0056] Step 4.2: The above formula (1) is the loss function of the Tibetan-Chinese translation model. The Tibetan-Chinese parallel corpus D after BPE processing is used. bpe and encrypted Tibetan-Chinese parallel corpus cipher(D bpe ) minimizes the loss function to jointly train the Tibetan-Chinese neural machine translation model.
[0057] Step 5: Use the Tibetan-Chinese neural machine translation model to translate the Tibetan sentences into Chinese sentences.
[0058] The Tibetan-Chinese neural machine translation model trained with Tibetan-Chinese parallel corpus and encrypted Tibetan-Chinese parallel corpus is used to translate the Tibetan test sentence into Chinese sentence. The following compares the translation performance of different methods by translating a Tibetan sentence:
[0059] Table 1. Comparison of translation performance of different methods
[0060]
[0061] As can be seen from Table 1, only our method can convert Tibetan It is accurately translated into "leadership position", while other methods cannot, thus proving that the Tibetan-Chinese neural machine translation model trained by our method has better translation performance.
[0062] The specific description above further illustrates the purpose, technical solutions and beneficial effects of the invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A Tibetan-Chinese neural machine translation method based on encrypted parallel corpus, Features: The following steps are included: Step 1: Preprocess the Tibetan-Chinese parallel corpus to obtain the Tibetan-Chinese parallel corpus D after word segmentation f ; Step 2: Use the Caesar cipher technique to segment the Tibetan-Chinese parallel corpus D f Encrypt and generate encrypted Tibetan-Chinese parallel corpus cipher (D f ); Step 3: For corpus D f and cipher(D f ) to perform BPE processing and obtain the corpus D after BPE processing bpe and cipher(D bpe ); Step 4: Use the Tibetan-Chinese parallel corpus D processed by BPE bpe and encrypted parallel corpus cipher(D bpe ) jointly train a Tibetan-Chinese neural machine translation model; Step 5: Use the Tibetan-Chinese neural machine translation model to translate the Tibetan sentences into Chinese sentences; So far, after steps 1 to 5, we first use 34 Tibetan consonant letters to create a Tibetan alphabet, and use Caesar encryption technology to replace single letters in Tibetan sentences in the Tibetan-Chinese parallel corpus according to the Tibetan alphabet, so as to obtain an encrypted parallel corpus consisting of encrypted Tibetan sentences and corresponding Chinese sentences; then, the Tibetan-Chinese parallel corpus and the encrypted parallel corpus are used to jointly train the translation model, so as to enhance the model performance from the perspective of inputting "multilingual" data; at the same time, in the model training stage, the symmetric KL divergence is also used to make the output distribution of Tibetan sentences and encrypted Tibetan sentences interact explicitly, so as to further improve the translation performance of the model; finally, the trained translation model is used to translate the Tibetan test sentences into Chinese sentences.
2. A Tibetan-Chinese neural machine translation method based on encrypted parallel corpus as claimed in claim 1, Features: The implementation method of step 1 is: Step 1.1: Delete the Tibetan-Chinese sentence pairs whose source or target sentence length is greater than 150 characters or zero. The Tibetan-Chinese data after deletion is recorded as D = {(s 1 ,t 1 ),(s 2 ,t 2 ),…,(s t ,t i ),…,(s M ,t M )}, where (s i ,t i ) represents the i-th Tibetan-Chinese sentence pair, consisting of the Tibetan sentence s i and the corresponding Chinese sentence t i Composition, the subscript M represents the number of sentence pairs in the corpus; Step 1.2: Use the word segmentation tool to segment the Tibetan-Chinese parallel corpus. The segmented words are recorded as in represents the i-th Tibetan sentence s i The result after word segmentation processing is Represents the i-th Chinese sentence t i The result after word segmentation processing.
3. A Tibetan-Chinese neural machine translation method based on encrypted parallel corpus as claimed in claim 2, Features: The implementation method of step 2 is: Step 2.1: Create a Tibetan alphabet to encrypt Tibetan text; the Tibetan alphabet used consists of 34 consonant letters. The specific content and order of the alphabet are as follows: Step 2.2: Based on the Tibetan alphabet described in step 2.1, use the Caesar cipher technique to parse the Tibetan-Chinese parallel corpus D after word segmentation. f Tibetan sentences in Perform single letter replacement to generate a set of encrypted Tibetan sentences The encrypted Tibetan sentences and the corresponding Chinese sentences constitute the encrypted Tibetan-Chinese parallel corpus cipher (D f )={(cipher(S f ),T f )}, where S f Representation corpus D f The set of all Tibetan sentences in T f Representation corpus D f All Chinese sentences in the cipher(S f ) represents the corpus S f The encrypted result is Represents Tibetan sentences The encrypted result.
4. A Tibetan-Chinese neural machine translation method based on encrypted parallel corpus as claimed in claim 3, Features: The implementation method of step 3 is: Step 3.1: Use the SentencePiece tool to learn the Tibetan-Chinese parallel corpus D f =(S f ,T f ) and the encrypted corpus cipher(D f )={(cipher(S f ),T f )} and perform Byte Pair Encoding. The encoded corpus is denoted as D bpe =(S bpe ,T bpe ) and cipher(D bpe )={(cipher(S bpe ),T bpe )}, where D bpe , S bpe , T bpe 、cipher(D bpe ) and cipher(S bpe ) represents the corpus D f , S f , T f 、cipher(D f ) and cipher(S f ) after BPE processing; Tibetan-Chinese sentence pairs after BPE processing and encrypted sentence pairs Recorded as and 5. A Tibetan-Chinese neural machine translation method based on encrypted parallel corpus as claimed in claim 4, Features: The implementation method of step 4 is: Step 4.1: To use the plaintext parallel corpus D bpe and encrypted parallel corpus cipher(D bpe ) jointly train the Tibetan-Chinese translation model and define a plaintext Tibetan-Chinese sentence pair The loss function is as follows: where α 1 , α 2 and β are loss weight parameters; Θ represents the model parameters to be learned; p Θ (t|s) represents the probability that the output of sentence s is sentence t under the condition of model parameter Θ; Represents a plaintext Tibetan-Chinese sentence pair Or encrypted sentence pairs The negative log-likelihood loss function of ; Represents the consistency loss, by calculating the model for Tibetan sentences and encrypted sentences The first two terms of formula (1) make the model Tibetan sentences respectively and encrypted sentences Generate the corresponding Chinese sentences; the third term of formula (1) makes the Tibetan sentence and encrypted sentences We perform explicit interaction and urge the model to output consistent probability distributions for the two sentences. The third term of formula (1) is as follows: in represents the KL divergence function. In order to avoid excessive interference of formula (2) on the model prediction behavior, a temperature hyperparameter is used to soften the output distribution of formula (2); the softened output of a pair (s, t) is as follows: where z t represents the logit function of the output label t, and τ represents the temperature hyperparameter; Step 4.2: The above formula (1) is the loss function of the Tibetan-Chinese translation model. The Tibetan-Chinese parallel corpus D after BPE processing is used. bpe and encrypted Tibetan-Chinese parallel corpus cipher(D bpe ) minimizes the loss function to jointly train the Tibetan-Chinese neural machine translation model.
