Language discrimination adversarial training method based on large-scale language model

By introducing an adversarial training mechanism into the language discrimination system, and using large-scale language models to generate and process adversarial samples, the problems of language confusion and noise interference are solved, and the accuracy and robustness of language discrimination are improved.

CN119692340APending Publication Date: 2025-03-25CHINA SOUTHERN POWER GRID ARTIFICIAL INTELLIGENCE TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411792165.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

In practical applications, existing language identification methods are susceptible to language confusion and noise interference, affecting system performance.

Method used

The language discrimination adversarial training method based on large-scale language models is adopted. By building a large-scale language model, adversarial samples are generated and mixed with real samples for training to improve the robustness of the model.

Benefits of technology

Through adversarial training, the accuracy and robustness of large-scale language models are improved, the recognition ability of noise and interference is enhanced, and the accuracy and generalization ability of language discrimination are improved.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The invention provides a language discrimination adversarial training method based on a large-scale language model, and belongs to the technical field of natural language processing. The invention discloses a language discrimination adversarial training method based on a large-scale language model. Comprising the following steps: constructing a large-scale language model, generating an adversarial sample, mixing the adversarial sample and a real sample, inputting the adversarial sample and the real sample into the large-scale language model for training, adjusting parameters of the large-scale language model according to a training result, and deploying the trained large-scale language model into an image recognition system. A safe and reliable image recognition function is provided; through adversarial training, the large-scale language model can learn the characteristics of adversarial samples, so that the large-scale language model can better cope with the problems of language confusion, noise interference and the like, the accuracy and generalization ability of the model are improved, the robustness to noise and interference is improved, and meanwhile, the distinguishing accuracy of real samples can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of natural language processing, and more specifically, to a language discrimination adversarial training method based on a large-scale language model. Background Art

[0002] At present, with the development of globalization, multilingual information processing has become increasingly important. Research on cross-language unified semantic representation pre-training technology, and design a self-supervised word alignment method based on the attention mechanism by analyzing the grammatical word formation and other characteristics of the source language and the target language, so as to form a multilingual representation with richer information and stronger robustness. Based on the encoder and decoder of the neural machine translation model, a word alignment attention layer is added to obtain a high-quality word alignment matrix between the source language and the target language, and provide word alignment information for context modeling training to strengthen word-level semantic alignment between different languages; language identification is one of the basic tasks of multilingual information processing, and its purpose is to determine the language to which the text belongs. Traditional language identification methods are usually based on manual features or shallow models; In recent years, deep learning technology has made significant progress in the field of natural language processing. Models based on deep learning can automatically learn the feature representation of text, thereby improving the accuracy and robustness of language identification; The above-mentioned existing technical solutions have the following defects: in practical applications, language identification faces the problems of language confusion and noise interference, which seriously affects the performance of the language identification system. Summary of the invention

[0003] In order to make up for the above shortcomings, the present application provides a language identification adversarial training method based on a large-scale language model, aiming to improve the problems of language confusion and noise interference faced by language identification.

[0004] The present application embodiment provides a language discrimination adversarial training method based on a large-scale language model, comprising the following steps: S1. Build a large-scale language model: Create a model that can process and generate natural language. This may require the use of deep learning techniques such as neural networks and training with large amounts of text data.

[0005] S2. Generate adversarial samples. Adversarial samples are created by making slight modifications or adding noise to the original samples, aiming to deceive the model and lead to wrong predictions. S3. Mix adversarial samples with real samples and input them into a large-scale language model for training. In this way, the model will learn how to distinguish between real samples and adversarial samples and improve its robustness against adversarial attacks.

[0006] S4. Adjust the parameters of the large-scale language model based on the training results; adjust the parameters of the large-scale language model based on the performance and error rate of the model during training. This can be achieved by using backpropagation algorithms or other optimization algorithms to improve the accuracy and robustness of the model; improve the accuracy and robustness of the large-scale language model through adversarial training.

[0007] S5. Deploy the trained large-scale language model to the image recognition system so that it can demonstrate good robustness in practical applications and provide safe and reliable image recognition functions.

[0008] In a preferred embodiment of the present invention, an adversarial network is added, and the parameters of the adversarial network are adjusted according to the training results; the hyperparameters of the adversarial training, such as the learning rate and the number of iterations, are reasonably adjusted to obtain the best performance. The large-scale language model is a language recognition model or a pre-trained language model; the language recognition model is used to classify the language of the input text.

[0009] The method of generating the adversarial sample includes generating the adversarial sample using an adversarial network or generating the adversarial sample using a language recognition model.

[0010] In a preferred embodiment of the present invention, the adversarial sample generation method includes at least one of the following: Generate adversarial samples similar to real samples based on the generative ability of language models; Make slight perturbations or transformations to real samples to generate adversarial samples.

[0011] In a preferred embodiment of the present invention, the language identification model adopts a deep learning model, such as a convolutional neural network or a recurrent neural network.

[0012] In a preferred embodiment of the present invention, the adversarial network includes a generator and a discriminator, wherein the generator is used to generate adversarial samples and the discriminator is used to determine the authenticity of the samples. The generator attempts to generate text similar to the target language, while the language discriminator attempts to distinguish the generated text from the real target language text. Through this adversarial training, the model gradually learns to ignore language features and pay more attention to semantic information, thereby improving the knowledge transfer performance on the target language; the generator generates adversarial samples based on the confusion and interference of language features to increase the robustness of the language discrimination model.

[0013] In a preferred embodiment of the present invention, the generator and the discriminator are optimized through adversarial training, so that the adversarial samples generated by the generator can deceive the discriminator, and the discriminator can accurately judge the authenticity of the samples. The language discrimination model simultaneously learns the features of real samples and adversarial samples to improve the recognition ability of language confusion and noise interference.

[0014] In a preferred embodiment of the present invention, the generation of the adversarial samples is based on confusion and interference of language features to increase the robustness of the language discrimination model.

[0015] In a preferred embodiment of the present invention, the training process uses a stochastic gradient descent optimization algorithm to adjust parameters. By continuously adjusting parameters, the language recognition model and the adversarial network can better cooperate and improve the performance of the language recognition system.

[0016] In a preferred embodiment of the present invention, it also includes Training the language discriminator: The language discriminator is trained by minimizing its error rate in judging the generated text. With the powerful representation capability of large-scale language models, it can better capture semantic information and improve the performance of the model. By weakening language features and strengthening semantic features, the model can better transfer knowledge from the source language to the target language and improve its performance in target language tasks.

[0017] Alternating training: Alternately train the generator and language discriminator to achieve a balanced and optimized effect; Model fine-tuning: Based on adversarial training, a small amount of labeled data in the target language is used to fine-tune the model to further improve the performance of the model in the target language. Only a small amount of labeled data in the target language is needed for fine-tuning, which reduces the cost and workload of data annotation; adversarial training makes the model more adaptable to texts in different languages ​​and enhances the generalization ability of the model.

[0018] Beneficial effects: The present application provides a language discrimination adversarial training method based on a large-scale language model. By introducing an adversarial training mechanism, the large-scale language model can learn the characteristics of adversarial samples through adversarial training, so that the large-scale language model can better cope with problems such as language confusion and noise interference, thereby improving the accuracy and generalization ability of the model, thereby improving the robustness to noise and interference, and also improving the accuracy of distinguishing real samples; By integrating the cross-language pre-trained model fine-tuning technology of the generative adversarial network, an adversarial network with a large-scale language model as the generator is designed. Through adversarial training between the generator and the language discriminator, the model weakens the language features and strengthens the semantic features, thereby improving the knowledge transfer performance on the target language. DETAILED DESCRIPTION

[0019] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be directly connected or indirectly connected through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0020] In the present invention, unless otherwise clearly specified and limited, a first feature being "above" or "below" a second feature may include that the first and second features are in direct contact, or may include that the first and second features are not in direct contact but are in contact through another feature between them. Moreover, a first feature being "above", "above" and "above" a second feature includes that the first feature is directly above and obliquely above the second feature, or simply indicates that the first feature is higher in level than the second feature. A first feature being "below", "below" and "below" a second feature includes that the first feature is directly below and obliquely below the second feature, or simply indicates that the first feature is lower in level than the second feature.

[0021] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0022] The present invention provides a language discrimination adversarial training method based on a large-scale language model, comprising the following steps: S1. Build a large-scale language model: Create a model that can process and generate natural language. This may require the use of deep learning techniques such as neural networks and training with large amounts of text data.

[0023] S2. Generate adversarial samples. Adversarial samples are created by making slight modifications or adding noise to the original samples, aiming to deceive the model and lead to wrong predictions. S3. Mix adversarial samples with real samples and input them into a large-scale language model for training. In this way, the model will learn how to distinguish between real samples and adversarial samples and improve its robustness against adversarial attacks.

[0024] S4. Adjust the parameters of the large-scale language model based on the training results; adjust the parameters of the large-scale language model based on the performance and error rate of the model during training. This can be achieved by using backpropagation algorithms or other optimization algorithms to improve the accuracy and robustness of the model; improve the accuracy and robustness of the large-scale language model through adversarial training.

[0025] S5. Deploy the trained large-scale language model to the image recognition system so that it can demonstrate good robustness in practical applications and provide safe and reliable image recognition functions.

[0026] In a specific embodiment of the present invention, an adversarial network is added, and the parameters of the adversarial network are adjusted according to the training results; the hyperparameters of the adversarial training, such as the learning rate and the number of iterations, are reasonably adjusted to obtain the best performance. The large-scale language model is a language discrimination model or a pre-trained language model; the language discrimination model is used to classify the language of the input text.

[0027] The method of generating the adversarial sample includes generating the adversarial sample using an adversarial network or generating the adversarial sample using a language recognition model.

[0028] In a specific embodiment of the present invention, the adversarial sample generation method includes at least one of the following: Generate adversarial samples similar to real samples based on the generative ability of language models; Make slight perturbations or transformations to real samples to generate adversarial samples.

[0029] In a specific embodiment of the present invention, the language identification model adopts a deep learning model, such as a convolutional neural network or a recurrent neural network.

[0030] In a specific embodiment of the present invention, the adversarial network includes a generator and a discriminator, wherein the generator is used to generate adversarial samples and the discriminator is used to determine the authenticity of the samples. The generator attempts to generate text similar to the target language, while the language discriminator attempts to distinguish the generated text from the real target language text. Through this adversarial training, the model gradually learns to ignore language features and pay more attention to semantic information, thereby improving the knowledge transfer performance on the target language; the generator generates adversarial samples based on the confusion and interference of language features to increase the robustness of the language discrimination model.

[0031] In a specific embodiment of the present invention, the generator and the discriminator are optimized through adversarial training, so that the adversarial samples generated by the generator can deceive the discriminator, and the discriminator can accurately determine the authenticity of the samples. The language discrimination model simultaneously learns the features of real samples and adversarial samples to improve the recognition ability of language confusion and noise interference.

[0032] In a specific embodiment of the present invention, the generation of the adversarial samples is based on the confusion and interference of language features to increase the robustness of the language discrimination model.

[0033] In a specific embodiment of the present invention, the training process uses a stochastic gradient descent optimization algorithm to adjust parameters. By continuously adjusting parameters, the language recognition model and the adversarial network can better cooperate and improve the performance of the language recognition system.

[0034] In a specific embodiment of the present invention, it also includes Training the language discriminator: The language discriminator is trained by minimizing its error rate in judging the generated text. With the powerful representation capability of large-scale language models, it can better capture semantic information and improve the performance of the model. By weakening language features and strengthening semantic features, the model can better transfer knowledge from the source language to the target language and improve its performance in target language tasks.

[0035] Alternating training: Alternately train the generator and language discriminator to achieve a balanced and optimized effect; Model fine-tuning: Based on adversarial training, a small amount of labeled data in the target language is used to fine-tune the model to further improve the performance of the model in the target language. Only a small amount of labeled data in the target language is needed for fine-tuning, which reduces the cost and workload of data annotation; adversarial training makes the model more adaptable to texts in different languages ​​and enhances the generalization ability of the model.

[0036] The present application provides a language discrimination adversarial training method based on a large-scale language model. By introducing an adversarial training mechanism, the large-scale language model can learn the characteristics of adversarial samples through adversarial training, so that the large-scale language model can better cope with problems such as language confusion and noise interference, improve the accuracy and generalization ability of the model, thereby improving the robustness to noise and interference, and also improving the accuracy of distinguishing real samples; By integrating the cross-language pre-trained model fine-tuning technology of the generative adversarial network, an adversarial network with a large-scale language model as the generator is designed. Through adversarial training between the generator and the language discriminator, the model weakens the language features and strengthens the semantic features, thereby improving the knowledge transfer performance on the target language.

[0037] It should be noted that the following system modules are also included: Adversarial sample generation module, used to generate adversarial samples using large-scale language models; The training module is used to mix adversarial samples with real samples and input them into the language recognition model for training; Evaluation module, used to evaluate the accuracy and robustness of the language identification model.

[0038] A language model-based generation unit, which is used to generate adversarial samples similar to real samples based on the generation ability of the language model; The perturbation unit is used to perform slight perturbations or transformations on real samples to generate adversarial samples.

[0039] The above modules work together to implement the language discrimination adversarial training method.

[0040] Using the generative capabilities of large-scale language models, adversarial samples similar to real samples are generated. These adversarial samples can be obtained by making slight perturbations or transformations to real samples, or they can be generated by generation algorithms based on language models.

[0041] The generated adversarial samples are mixed with real samples and input into the language recognition model for training. During the training process, the language recognition model needs to learn the features of adversarial samples and real samples at the same time to improve the robustness to noise and interference, while also improving the recognition accuracy of real samples.

[0042] During the training process, by adjusting the parameters of the language identification model, it can better learn the characteristics of adversarial samples, thereby improving its robustness to noise and interference, and at the same time improving the accuracy of identifying real samples.

[0043] The language discrimination adversarial training system based on a large-scale language model of the present invention comprises an adversarial sample generation module, a training module and an evaluation module. The adversarial sample generation module is used to generate adversarial samples using a large-scale language model; the training module is used to mix adversarial samples with real samples and input them into the language discrimination model for training; the evaluation module is used to evaluate the accuracy and robustness of the language discrimination model.

[0044] The above description is only an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.

Claims

1. A language discrimination adversarial training method based on a large-scale language model, characterized in that: The following steps are involved: S1. Build a large-scale language model; S2, generate adversarial samples; S3, mixing adversarial samples with real samples and inputting them into a large-scale language model for training; S4. Adjust the parameters of the large-scale language model according to the training results; S5. Deploy the trained large-scale language model to the image recognition system so that it can demonstrate good robustness in practical applications and provide safe and reliable image recognition functions.

2. According to the method of claim 1, the language discrimination adversarial training method based on a large-scale language model is characterized in that: An adversarial network is added, and the parameters of the adversarial network are adjusted according to the training results; the large-scale language model is a language recognition model or a pre-trained language model; The method of generating the adversarial sample includes generating the adversarial sample using an adversarial network or generating the adversarial sample using a language recognition model.

3. According to the method for language discrimination adversarial training based on a large-scale language model in claim 1, it is characterized in that: The adversarial sample generation method includes at least one of the following: Generate adversarial samples similar to real samples based on the generative ability of language models; Make slight perturbations or transformations to real samples to generate adversarial samples.

4. According to claim 2, a language discrimination adversarial training method based on a large-scale language model is characterized in that: The language identification model adopts a deep learning model, such as a convolutional neural network or a recurrent neural network.

5. The method for language discrimination adversarial training based on a large-scale language model according to claim 2, characterized in that: The adversarial network includes a generator and a discriminator, the generator is used to generate adversarial samples, and the discriminator is used to judge the authenticity of the samples.

6. The language discrimination adversarial training method based on a large-scale language model according to claim 5, characterized in that: The generator and discriminator are optimized through adversarial training so that the adversarial samples generated by the generator can deceive the discriminator, and the discriminator can accurately determine the authenticity of the samples.

7. The method for language discrimination adversarial training based on a large-scale language model according to claim 1, characterized in that: The generation of the adversarial samples is based on the confusion and interference of language features to increase the robustness of the language discrimination model.

8. The language discrimination adversarial training method based on a large-scale language model according to claim 1, characterized in that: The training process adopts stochastic gradient descent and optimization algorithm to adjust parameters.

9. The method for language discrimination adversarial training based on a large-scale language model according to claim 1, characterized in that: Also includes Training the language discriminator: Train the language discriminator by minimizing its error rate in judging the generated text. Alternating training: Alternately train the generator and language discriminator to achieve a balanced and optimized effect; Model fine-tuning: Based on adversarial training, a small amount of labeled data in the target language is used to fine-tune the model to further improve the performance of the model in the target language.