LLM-based pre-training language model depolarization method and system, storage medium and terminal

Through the social common sense knowledge generated by large language model and structural causal model screening, the problem of semantic inconsistency and dependence on external corpus in the pre-trained language model when dealing with social bias is solved, and high-quality and coherent debias effect is achieved, reducing the problem of semantic inconsistency in pre-trained language models. Negative migration and noise effects.

CN119167092APending Publication Date: 2024-12-20UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411364076.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-28
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

Existing pre-trained language models have semantic inconsistencies, limitations in automation prompt generation, and limitations in dependence on external corpus when dealing with social bias, resulting in poor debias effect, high cost and easy to introduce noise.

Method used

Generate semantic coherent and balanced social common sense knowledge through large language models, estimate collision effects using structural causal models, filter out knowledge aligned with the pre-trained language model, and optimize it through bias evasion strategies, introducing specific loss functions to ensure that Deviating effect.

Benefits of technology

The generated data are demographically balanced and diverse, ensuring high quality and coherence of deviating tasks, reducing negative migration, improving the model's expression ability and deviating effect, and reducing the impact on model performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119167092A_ABST
    Figure CN119167092A_ABST
Patent Text Reader

Abstract

The invention discloses an LLM-based pre-training language model depolarization method and system, a storage medium and a terminal, and belongs to the field of language processing, and the method mainly comprises the steps: S1, generating social common sense knowledge through a large language model; s2, using a structural causal model to estimate the collision effect of the generated social common sense knowledge, and screening out the social common sense knowledge aligned with the hidden space of the pre-training language model; for the unaligned social common sense knowledge, a prejudice avoidance strategy is used for avoiding the unaligned social common sense knowledge; and S3, training and optimizing the pre-training language model based on a screening result. According to the method, the social common knowledge generated by the LLMs is introduced, so that the data quality problem existing in a traditional method is solved, and the social prejudice in the PLMs is effectively relieved. Meanwhile, by estimating the collision effect, aligned knowledge can be recognized and utilized to achieve positive migration, and the learning burden of PLMs on non-aligned knowledge is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of language processing, and in particular to a debiasing method, system, storage medium and terminal for a pre-trained language model based on LLM. Background Art

[0002] In recent years, pre-trained language models (PLMs) have made significant progress in the field of natural language processing (NLP) and have been widely used in various tasks. However, since these models are trained on datasets containing social biases, they often inadvertently reinforce these biases in practical applications, causing the models to behave unfairly when dealing with sensitive topics involving social biases. Therefore, how to debias pre-trained language models (PLMs) is particularly important.

[0003] In the debiasing task in pre-trained language models (PLMs), the goal is to find a suitable theoretical model to resample the training data, ensure the applicability of the data, and make full use of the generated data from different perspectives and different methods to fine-tune the model and improve the social fairness of PLMs. Traditional debiasing methods usually rely on identifying biases from external corpora and processing them, but these external corpora often have problems with quality, variety, and balance between groups, which limits the debiasing effect. The core challenge of the debiasing task is how to obtain consistent, balanced, and semantically rich training corpora and effectively apply them to the debiasing process of PLMs.

[0004] Although the existing debiasing methods have made considerable progress, there are still many problems. The challenges or defects are summarized as follows:

[0005] (1) Semantic coherence problem of balanced counterfactuals: Some methods try to achieve equivalence between different population groups through rigid balanced counterfactuals, but this may lead to semantic incoherence or errors when multiple entities are involved. For example, simple sentence replacement may introduce inconsistent or misleading semantic information when dealing with multiple entities.

[0006] (2) Limitations of automated prompt generation: Although some studies have attempted to replace external corpora by generating prompts, these methods rely on additional search spaces such as Wikipedia, and short prompts often fail to consider grammar or context, which may lead to missing information or semantic incoherence in semantic downstream tasks.

[0007] (3) Limitations of reliance on external corpora: Most existing debiasing methods rely on extracting sentences from external corpora to identify and mitigate bias. The quality, quantity, and diversity of these corpora have a significant impact on the debiasing effect. However, collecting high-quality corpora is usually costly and prone to introducing noise. Indiscriminate use of all data may lead to negative transfer during training, resulting in insufficient bias mitigation. Summary of the invention

[0008] The purpose of the present invention is to overcome at least one technical problem existing in the prior art, and provide a debiasing method, system, storage medium and terminal for a pre-trained language model based on LLM, so as to generate semantically coherent and balanced social common sense knowledge (CK) with the help of a large language model (LLM); at the same time, the negative transfer caused by LLM is overcome by estimating the collision effect.

[0009] The objective of the present invention is achieved through the following technical solutions:

[0010] In a first aspect, a method for debiasing a pre-trained language model based on LLM is provided, comprising the following steps:

[0011] S1. Generate social common sense knowledge using large language models;

[0012] S2. Use the structural causal model (SCM) to estimate the collision effect of the generated social common sense knowledge, and screen out the social common sense knowledge that is aligned with the latent space of the pre-trained language model; for the misaligned social common sense knowledge, use the bias avoidance strategy to avoid it;

[0013] S3. Train and optimize the pre-trained language model based on the screening result of step S2.

[0014] In some embodiments, the generating social common sense knowledge using a large language model includes:

[0015] The system prompt words are used to guide the large language model to automatically generate pairs of common sense knowledge sentences;

[0016] Perform replacement operations on the initially generated common sense knowledge sentences and establish a knowledge graph.

[0017] In some embodiments, the generating social common sense knowledge using a large language model further includes:

[0018] Perform toxicity detection on generated common sense knowledge sentences.

[0019] In some embodiments, the collision effect of the social common sense knowledge generated by estimating the social common sense knowledge using the structural causal model includes:

[0020] Calculate the semantic consistency between each social common sense knowledge sample and its K nearest neighbors;

[0021] Social common sense knowledge samples with high consistency are used as alignment samples for the forward transfer of the model.

[0022] In some embodiments, the bias avoidance strategy comprises:

[0023] The most biased cue words in the unaligned social commonsense knowledge are identified to train the pre-trained language model, the distribution difference between the cue words and the target words is calculated, and debiasing is achieved by minimizing the distribution difference.

[0024] In some embodiments, by sorting and selecting the most biased cue words.

[0025] In some embodiments, the training and optimizing the pre-trained language model includes:

[0026] Pre-train the language model based on the forward transfer loss, bias aversion loss, and auxiliary representation loss respectively;

[0027] The forward transfer loss, bias avoidance loss, and auxiliary representation loss function are weighted and added to obtain the final training loss function of the model.

[0028] In a second aspect, a debiasing system for a pre-trained language model based on LLM is provided, comprising:

[0029] A knowledge generation module configured to generate social common sense knowledge using a large language model;

[0030] The knowledge screening module is configured to use the structural causal model to estimate the collision effect of the generated social common sense knowledge, and screen out the social common sense knowledge that is aligned with the latent space of the pre-trained language model; for the misaligned social common sense knowledge, a bias avoidance strategy is used to avoid it;

[0031] The model training module is configured to train and optimize the pre-trained language model based on the screening results of the knowledge screening module.

[0032] In a third aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any one of the debiasing methods for the pre-trained language model based on LLM is implemented.

[0033] In a fourth aspect, a terminal is provided, comprising a memory and a processor, wherein the memory stores computer instructions executable on the processor, and when the processor executes the computer instructions, any one of the debiasing methods for the LLM-based pre-trained language model is executed.

[0034] It should be further explained that the technical features corresponding to the above options can be combined or replaced with each other to form a new technical solution if there is no conflict.

[0035] Compared with the prior art, the present invention has the following beneficial effects:

[0036] (1) On the one hand, the present invention can accurately generate common sense knowledge related to the debiasing task according to certain rules with the help of the large language model LLM. The generated data has a balanced data distribution in demographics and is sufficiently diverse, which can ensure that the generated data has high quality and consistency in the debiasing task. On the other hand, the structured causal model (SCM) is adopted to point out the limitations of traditional debiasing methods, and to solve the problem of how to effectively use LLM to generate knowledge through improved causal graphs. By estimating the collision effect, we can identify and utilize aligned knowledge to achieve positive transfer and reduce the learning burden of PLMs on non-aligned knowledge. A standardized framework is provided through a scientific theoretical model to verify the applicability of the generated social common sense knowledge, thereby ensuring that this knowledge can be effectively used for the purpose of PLMs debiasing.

[0037] (2) The present invention performs toxicity detection on the generated common sense knowledge sentences to ensure that the generated social common sense knowledge does not introduce harmful content.

[0038] (3) By introducing a specific loss function, the stability of the model’s expressiveness is maintained during the debiasing process to reduce the impact of debiasing on model performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A flow chart of a debiasing method for a pre-trained language model based on LLM according to an embodiment of the present invention;

[0040] Figure 2 A two-stage prompt diagram for generating social common sense knowledge shown in an embodiment of the present invention;

[0041] Figure 3 A diagram showing the knowledge graph construction of debiased domain data shown in an embodiment of the present invention;

[0042] Figure 4 A schematic diagram of sentence toxicity detection shown in an embodiment of the present invention;

[0043] Figure 5 A comparison diagram of the structured causal model of the present invention and the causal diagram of the traditional method is shown in the embodiment of the present invention;

[0044] Figure 6 This is the main diagram of the CK-Debias method shown in an embodiment of the present invention. DETAILED DESCRIPTION

[0045] The technical solution of the present invention is clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. The components of the embodiments of the present application described and shown in the accompanying drawings can be arranged and designed in various configurations. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0046] It should be noted that the defects existing in the solutions in the above-mentioned prior art are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above-mentioned problems and the solutions proposed in the embodiments of the present application for the above-mentioned problems below should all be the contributions made by the inventor to the present application in the process of invention and creation, and should not be understood as technical contents known to technical personnel in this field.

[0047] In view of the technical problems pointed out in the background technology, the embodiments provided by the present invention are as follows:

[0048] Example 1

[0049] Reference Figure 1 In an exemplary embodiment, a method for debiasing a pre-trained language model based on LLM is provided, comprising the following steps:

[0050] S1. Generate social common sense knowledge using large language models;

[0051] S2. Use the structural causal model (SCM) to estimate the collision effect of the generated social common sense knowledge, and screen out the social common sense knowledge that is aligned with the latent space of the pre-trained language model; for the misaligned social common sense knowledge, use the bias avoidance strategy to avoid it;

[0052] S3. Train and optimize the pre-trained language model based on the screening result of step S2.

[0053] Specifically, in step S1, in order to overcome the semantic coherence problem caused by the currently commonly used counterfactual processing data, a large language model LLM such as ChatGPT or LLaMa is used to generate semantically coherent and balanced social common sense knowledge (CK). By generating common sense knowledge that is sufficiently diverse and evenly distributed in demographics, it is possible to ensure that the generated data has high quality and coherence in the debiasing task. This includes:

[0054] 1. Use two concise and clear system prompts P1 and P2 to automatically generate pairs of common sense knowledge sentences. The specific prompts are as follows: Figure 2 shown.

[0055] 2. After generating the initial sentence in the first step, perform a replacement operation to ensure semantic consistency when multiple entities are involved. For example, the initial sentence is The cashier, impressed by the airwoman's dedication to her country, discreetly paid for her coffee at the café next door as a gesture of gratitude. The replaced sentence is The cashier, impressed by the airman's dedication to his country, discreetly paid for his coffee at the café next door as a gesture of gratitude. There are two main changes. If the gender attribute word in the sentence changes (airwoman-->airman), then the pronoun for the attribute word in the sentence should also change (she-->he).

[0056] 3. Use the CK generated by the large language model to build a large social knowledge graph, see Figure 3 , ensuring that it is semantically rich and balanced across different groups.

[0057] The training dataset of LLM covers a wide range of fields and topics, and it has learned powerful knowledge, including social common sense knowledge. It is undoubted that LLM has more extensive knowledge than lightweight PLMs. Extracting high-quality knowledge from them to alleviate the bias of PLM not only saves time, but also has high quality, which is conducive to the location of bias and subsequent debiasing tasks. By limiting the attribute words in the generated sentences, we limit the context of the extracted knowledge to the field related to bias, and by Figure 2 Intuitively represent. A single small knowledge sub-graph describes each group of CK sentences generated, and then they can be linked into a large graph through the same entity nodes. At the same time, we hope that through the form of pictures and texts, readers can intuitively feel why we call it common sense knowledge.

[0058] Furthermore, in order to ensure that the generated social common sense knowledge does not introduce harmful content, the experiment conducted toxicity testing on the generated content, such as Figure 4As shown, the horizontal axis represents the toxicity score of the sentence, and the vertical axis represents the order of magnitude of the sentence. The figure contains three bar graphs, which correspond to the corpus generated by our method on three dimensions containing bias-sensitive topics, and are compared with the toxicity distribution of the corpus used by the three debiasing methods MABEL, ADEPT and Auto-Debias. It can be clearly seen that the sentences we extracted from the large language model (LLM) are more concentrated in the low toxicity score range. Compared with other debiasing methods, the toxicity distribution is significantly biased towards the lower toxicity quantile segment, which shows that our method effectively reduces the generation of toxic content when generating corpus. The present invention uses the ComprehendAPI of Amazon Web Services (AWS) to detect the toxicity of generated sentences. Experimental results show that the content generated by CK-Debias is significantly less toxic than other methods in terms of containing bias.

[0059] Furthermore, not all CKs generated by large language models are directly suitable for debiasing, because the pre-training data of LLMs and PLMs vary greatly, resulting in significant differences in the latent space. Therefore, the knowledge extracted from LLMs may contain incomprehensible content, which may lead to negative transfer if used indiscriminately for debiasing. Therefore, in step S2, we estimate the collision effect to derive aligned knowledge suitable for debiasing PLMs. Specifically, knowledge with significant collision effects is considered to be aligned knowledge to achieve positive transfer, reduce the learning burden of PLMs on non-aligned knowledge, and prevent its degradation. For the remaining non-aligned knowledge, we introduce a strategy to optimize the debiasing ability of PLMs and the use of generated CKs by identifying the most biased prompts. Specifically, it includes:

[0060] 1. First, we use structural causal modeling (SCM) to analyze the collision effect of knowledge in the external corpus and find those knowledge that are aligned with the PLM latent space in order to achieve positive transfer.

[0061] 2. For misaligned knowledge, identify the most biased prompts, optimize their debiasing capabilities, and prevent negative transfer.

[0062] 3. By introducing a specific loss function, the stability of the model's expressiveness is maintained during the debiasing process to reduce the impact of debiasing on model performance.

[0063] Traditional debiasing methods mainly rely on static corpora or fixed debiasing strategies, which cannot flexibly deal with diverse and dynamically changing bias problems, and use the collected external data indiscriminately. We use structured causal models (SCMs) to point out the limitations of traditional debiasing methods, and solve the problem of how to effectively use LLM to generate knowledge through improved causal graphs. The causal graphs of our invention and traditional methods are compared. Figure 5As shown. By estimating the collision effect, we are able to identify and utilize aligned knowledge to achieve positive transfer, reducing the learning burden of PLMs on non-aligned knowledge. A standardized framework is provided through a scientific theoretical model to verify the applicability of the generated social common sense knowledge, thereby ensuring that this knowledge can be effectively used for PLMs debiasing purposes.

[0064] Example 2

[0065] In an exemplary embodiment, based on Example 1, a specific debiasing method for a pre-trained language model based on LLM is given. Since we promote the fairness of pre-trained language models (PLMs) by absorbing coherent, balanced and semantically rich common sense knowledge (Commonsense Knowledge), we call our proposed model CK-Debias. Figure 6 This is the main figure of the CK-Debias method, combined with Figure 6 The debiasing process is described. It includes the following contents:

[0066] 1. Generation of social common sense knowledge:

[0067] a. Prompt design: The study first guides large language models (LLMs) to generate social common sense knowledge through carefully designed system prompts. The attribute words (such as gender) and target words (such as occupation) in the prompts are paired to form the basis for generating sentences.

[0068] b. Sentence generation: These generated sentences are processed and organized into a knowledge graph, which is mainly used to debias pre-trained language models (PLMs).

[0069] c. Detailed implementation: When generating sentences, the model is prompted to generate a series of diverse and semantically rich sentences, controlling the number of words in the sentences to around 20 while ensuring the consistency of grammatical logic.

[0070] 2. Collision effect estimation and knowledge screening:

[0071] a. Estimation of collision effect: After generating knowledge, the collision effect is estimated through causal inference to screen which knowledge is aligned with the latent space of PLMs. The specific implementation includes calculating the semantic consistency between each knowledge sample and its K nearest neighbor (KNN). Three pre-trained language models (PLMs) are mainly used as the basic models: BERT, ALBERT and RoBERTa. The implementation of these models depends on the Huggingface Transformers library.

[0072] b. Selection of aligned knowledge: If the semantic consistency between a knowledge sample and its K nearest neighbors is high, then the knowledge is considered to be aligned and can be used for the forward migration of the model. The K nearest neighbor (KNN) method is used to calculate the similarity of each generated sample, and K is set to 5.

[0073] c. Calculation method: KNN samples are used to calculate the collision effect, which is obtained by estimating the similarity between the sample and its neighbors, and then identifying which knowledge can achieve positive transfer and reduce the model's learning burden on misaligned knowledge.

[0074] d. Training data: Social common sense knowledge is generated through GPT-3.5-turboAPI. This data is generated based on a human-created vocabulary, covering sensitive areas that contain social biases. The training data contains a certain amount of debiased samples, and the most suitable samples are screened by calculating semantic similarity, and toxic text fragments are removed. Finally, the 60% of data with the lowest toxicity was selected.

[0075] 3. Bias avoidance strategies:

[0076] a. Identifying the most biased cues: For misaligned knowledge, a strategy is proposed to train PLMs by identifying the most biased cues in this knowledge. The specific approach is to calculate the distribution difference between the cues and the target words and achieve debiasing by minimizing this difference.

[0077] b. Optimize the use of cues: By sorting and selecting the most biased cues, find the knowledge that needs to be avoided to prevent the model from introducing more bias during the learning process.

[0078] 4. Training objectives and optimization:

[0079] a. Forward migration loss D1(x (n) ): The forward transfer loss is estimated based on the collision effect and is calculated using the JSD distribution function. It is used to maximize the transfer effect of aligned knowledge and ensure that PLMs learn the correct social common sense knowledge.

[0080]

[0081] Among them, x (n) represents the nth sample sentence; i, j represent the index of pairs of attribute words or group labels (such as population attributes); d represents the total number of attribute words; It represents the distance measure between the sentence containing the attribute word and the sentence containing all the target words (target word set), calculated using the Euclidean distance Distance. is the representation of the target word in the embedding space, where e x It is a sentence Or the target word x vi Representation in embedding space.

[0082] b. Biased loss aversion D2(x (n) ): Bias aversion loss is used to prevent the model from learning misaligned knowledge. By masking the attribute word [MASK], calculating the distribution difference between the generated bias hint and the target word, the semantic difference between the generated [MASK] tokens is minimized.

[0083]

[0084] in, Represents a given sentence The predicted probability distribution of the mask in under model M; Represents the prompt part of the sentence (excluding attribute words and target words), usually used to predict the target word of the sentence; v t Represents the target word set W t A word in (i.e. the word that the model needs to predict).

[0085] c. Total bias loss L Bias

[0086]

[0087] Among them, X C is a sample using the first bias distance; X BP is a sample using the second bias distance; S n,k is the similarity function S H (x (n) ,x (n,k) ), which is used to represent the nth sample x (n) and its kth nearest neighbor sample x (n ,k) The similarity between them is selected using the K nearest neighbor (KNN) method.

[0088] c. Auxiliary representation loss L Re :In order to maintain the model M H The article introduces a loss function L Re , which aims to minimize the impact of the debiasing process on the inherent capabilities of PLMs. This loss is obtained by combining the original model and the debiased model M′ H It is calculated by the mean squared error (MSE) between the hidden states of .

[0089]

[0090] d. Comprehensive training goal: The final training loss function is L Bias and LRe The weighted sum of

[0091]

[0092] Among them, the training time varies according to different bias types.

[0093] Example 3

[0094] Based on the same inventive concept as that of Example 1, a debiasing system for a pre-trained language model based on LLM is provided, comprising:

[0095] A knowledge generation module configured to generate social common sense knowledge using a large language model;

[0096] The knowledge screening module is configured to use the structural causal model to estimate the collision effect of the generated social common sense knowledge, and screen out the social common sense knowledge that is aligned with the latent space of the pre-trained language model; for the misaligned social common sense knowledge, a bias avoidance strategy is used to avoid it;

[0097] The model training module is configured to train and optimize the pre-trained language model based on the screening results of the knowledge screening module.

[0098] It should be noted that each module in the system implements functions corresponding to each step in the method, which will not be described in detail here.

[0099] Example 4

[0100] Based on the same inventive concept as Example 1, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the debiasing method of the pre-trained language model based on LLM provided in the embodiment of the present invention is implemented. Based on such an understanding, the technical solution of this embodiment is essentially or partly contributed to the prior art or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0101] Example 5

[0102] Based on the same inventive concept as Example 1, a terminal is provided, including a memory and a processor, wherein the memory stores computer instructions that can be executed on the processor, and when the processor executes the computer instructions, the debiasing method of the pre-trained language model based on LLM provided in the embodiment of the present invention is executed.

[0103] The processor may be a single-core or multi-core central processing unit or a specific integrated circuit, or one or more integrated circuits configured to implement the present invention.

[0104] Embodiments of the subject matter and functional operations described in this specification may be implemented in: tangibly embodied computer software or firmware, computer hardware including the structures disclosed in this specification and their structural equivalents, or a combination of one or more of them. Embodiments of the subject matter described in this specification may be implemented as one or more computer programs, i.e., one or more modules of computer program instructions encoded on a tangible, non-transitory program carrier to be executed by a data processing device or to control the operation of the data processing device. Alternatively or additionally, the program instructions may be encoded on an artificially generated propagated signal, such as a machine-generated electrical, optical, or electromagnetic signal, which is generated to encode and transmit information to a suitable receiver device for execution by the data processing device.

[0105] The processes and logic flows described in this specification can be performed by one or more programmable computers executing one or more computer programs to perform corresponding functions by operating on input data and generating output. The processes and logic flows can also be performed by special purpose logic circuits, such as FPGAs (field programmable gate arrays) or ASICs (application-specific integrated circuits), and the apparatus can also be implemented as special purpose logic circuits.

[0106] Processors suitable for executing computer programs include, for example, general and / or special microprocessors, or any other type of central processing unit. Typically, the central processing unit will receive instructions and data from a read-only memory and / or a random access memory. The basic components of a computer include a central processing unit for implementing or executing instructions and one or more memory devices for storing instructions and data. Typically, the computer will also include one or more large-capacity storage devices for storing data, such as magnetic disks, magneto-optical disks, or optical disks, or the computer will be operably coupled to this large-capacity storage device to receive data from it or to transmit data to it, or both. However, the computer does not necessarily have such a device. In addition, the computer can be embedded in another device, such as a mobile phone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a global positioning system (GPS) receiver, or a portable storage device such as a universal serial bus (USB) flash drive, just to name a few.

[0107] It should be understood that each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0108] The above specific implementation methods are detailed descriptions of the present invention. It cannot be determined that the specific implementation methods of the present invention are limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions and substitutions can be made without departing from the concept of the present invention, which should be regarded as belonging to the protection scope of the present invention.

Claims

1. A debiasing method for a pre-trained language model based on LLM, characterized in that: The following steps are involved: S1. Generate social common sense knowledge using large language models; S2. Use the structural causal model to estimate the collision effect of the generated social common sense knowledge, and screen out the social common sense knowledge that is aligned with the latent space of the pre-trained language model; for the misaligned social common sense knowledge, use the bias avoidance strategy to avoid it; S3. Train and optimize the pre-trained language model based on the screening result of step S2.

2. The method for debiasing a pre-trained language model based on LLM according to claim 1, characterized in that: The method of using a large language model to generate social common sense knowledge includes: The system prompt words are used to guide the large language model to automatically generate pairs of common sense knowledge sentences; Perform replacement operations on the initially generated common sense knowledge sentences and establish a knowledge graph.

3. The debiasing method of a pre-trained language model based on LLM according to claim 2, characterized in that: The method of generating social common sense knowledge using a large language model further includes: Perform toxicity detection on generated common sense knowledge sentences.

4. The method for debiasing a pre-trained language model based on LLM according to claim 1, characterized in that: The collision effect of the generated social common sense knowledge estimated using the structural causal model includes: Calculate the semantic consistency between each social common sense knowledge sample and its K nearest neighbors; Social common sense knowledge samples with high consistency are used as alignment samples for the forward transfer of the model.

5. The method for debiasing a pre-trained language model based on LLM according to claim 1, characterized in that: The bias avoidance strategies include: The most biased cue words in the unaligned social commonsense knowledge are identified to train the pre-trained language model, the distribution difference between the cue words and the target words is calculated, and debiasing is achieved by minimizing the distribution difference.

6. The method for debiasing a pre-trained language model based on LLM according to claim 5, characterized in that: By sorting and selecting the most biased cue words.

7. The method for debiasing a pre-trained language model based on LLM according to claim 1, characterized in that: The training and optimization of the pre-trained language model includes: Pre-train the language model based on the forward transfer loss, bias aversion loss, and auxiliary representation loss respectively; The forward transfer loss, bias avoidance loss, and auxiliary representation loss function are weighted and added to obtain the final training loss function of the model.

8. A debiasing system for a pre-trained language model based on LLM, characterized in that: include: A knowledge generation module configured to generate social common sense knowledge using a large language model; A knowledge screening module, configured to use a structural causal model to estimate the collision effect of the generated social common sense knowledge, and screen out the social common sense knowledge that is aligned with the latent space of the pre-trained language model; Use bias avoidance strategies to avoid misaligned social common sense knowledge; The model training module is configured to train and optimize the pre-trained language model based on the screening results of the knowledge screening module.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the debiasing method of the pre-trained language model based on LLM described in any one of claims 1 to 7 is implemented.

10. A terminal comprising a memory and a processor, wherein the memory stores computer instructions that can be executed on the processor, characterized in that: When the processor runs the computer instructions, it executes the debiasing method of the pre-trained language model based on LLM as described in any one of claims 1-7.

Citation Information

Cited By

  • Picture generation model depolarization method and system based on enhanced cue word learning

    CN119963675A

  • Method and device for measuring spatial gender prejudice of large language model

    CN121413608A

  • Artificial consciousness credible interaction control method based on semantic space

    CN121615796A