Model Bias Response Removal Method, Device, Computer Equipment, and Storage Medium

By introducing update vectors and white box model evaluation in the question-and-answer model, the problem of low control accuracy of traditional large language models is solved, and more accurate and controllable response results are achieved, reducing the impact of bias.

CN119067100BActive Publication Date: 2025-07-25ELECTRIC POWER RES INST CHINA SOUTHERN POWER GRID CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411433302.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-14
Publication Date
2025-07-25
Estimated Expiration
2044-10-14

AI Technical Summary

Technical Problem

Traditional large language models have the problem of low control accuracy in natural language processing, especially in closed-source models, which may generate biased or inaccurate content, affecting the effectiveness of the model.

Method used

The question-and-answer model is used for processing, and through cascading network levels, linear update, segmented update or projected update, the intermediate reply results are adjusted according to the target update vector, bias is removed, and the white box model is used to evaluate and correct the output of the closed source model.

Benefits of technology

The controllability and accuracy of the question-and-answer model for the target response results is improved, ensuring the fairness and reliability of the generated content, and reducing the impact of bias.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119067100B_ABST
    Figure CN119067100B_ABST
Patent Text Reader

Abstract

The present application relates to a method, apparatus, computer device, and storage medium for removing model bias in responses. The method includes: inputting the data of the question to be answered into a question-and-answer model; the question-and-answer model includes at least one cascaded network layer; for each network layer in the question-and-answer model, determining an intermediate response result corresponding to the input data of the network layer; wherein, the input data of the first network layer is the data of the question to be answered; updating the intermediate response result according to the target update vector and update method corresponding to the network layer; the update method includes any one of linear update, segmented update, and projection update; determining the target response result of the data of the question to be answered according to the intermediate response result corresponding to the tail network layer in the question-and-answer model. By using this method to introduce an update vector, the fine control of the question-and-answer model over the target response result is strengthened, and the controllability and accuracy of the target response result are further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of natural language processing, and particularly to a method, apparatus, computer device, and storage medium for removing model bias responses. Background Art

[0002] With the rapid development of natural language processing technology, large language models have been widely applied in the field of natural language processing.

[0003] In traditional technologies, large language models are usually used for natural language processing. However, the wide application of large language models has brought a series of problems such as content generation bias and uncontrollable output, which are particularly obvious in the use of closed-source large models. Due to the non-transparency of their internal mechanisms and training data, these closed-source models pose significant trust risks to users. In specific scenarios, the model may generate biased or inaccurate content, or even be induced externally to produce malicious output. These problems weaken the effectiveness of the model.

[0004] Therefore, the closed-source models in traditional technologies usually have the problem of low control accuracy. Summary of the Invention

[0005] Based on this, it is necessary to provide a method, apparatus, computer device, and storage medium for removing model bias responses that can improve control accuracy for the above technical problems.

[0006] In a first aspect, this application provides a method for removing model bias responses, including:

[0007] Inputting the data of the question to be answered into a question-and-answer model; the question-and-answer model includes at least one cascaded network layer;

[0008] For each network layer in the question-and-answer model, determining an intermediate response result corresponding to the input data of the network layer; wherein, the input data of the first network layer is the data of the question to be answered;

[0009] Updating the intermediate response result according to the target update vector and update method corresponding to the network layer; the update method includes any one of linear update, segmented update, and projection update; the target update vector is used to remove the biased response content in the intermediate response result;

[0010] Determining the target response result of the data of the question to be answered according to the intermediate response result corresponding to the last network layer in the question-and-answer model.

[0011] In one embodiment, if the update method is linear update, then updating the intermediate response result according to the update method corresponding to the target update vector in the network layer, updating the intermediate response result includes:

[0012] Update the intermediate response result according to the sum value between the intermediate response result and the target update vector; or update the intermediate response result according to the difference between the intermediate response result and the target update vector.

[0013] In one embodiment, if the update method is segmented update, update the intermediate response result according to the update method corresponding to the target update vector in the network hierarchy. Updating the intermediate response result includes:

[0014] Adjust the vector direction of the target update vector according to the transposed result of the intermediate response result and the target update vector;

[0015] Update the intermediate response result according to the sum value between the intermediate response result and the target update vector.

[0016] In one embodiment, if the update method is projection update, update the intermediate response result according to the update method corresponding to the target update vector in the network hierarchy. Updating the intermediate response result includes:

[0017] Adjust the vector direction of the target update vector according to the transposed result of the intermediate response result, the target update vector, and the norm of the target update vector;

[0018] Update the intermediate response result according to the difference between the intermediate response result and the target update vector.

[0019] In one embodiment, a training method for a question-answering model includes:

[0020] Input sample question data into a pre-trained question-answering model to obtain a first response result;

[0021] Input the first response result into a pre-trained response update model to obtain a second response result;

[0022] Perform model training on the question-answering model according to the first response result and the second response result.

[0023] In one embodiment, performing model training on the question-answering model according to the first response result and the second response result includes:

[0024] Determine the loss value of the question-answering model according to the first response result and the second response result;

[0025] Determine the intermediate update vector in the question-answering model according to the difference between the first response result and the second response result;

[0026] Perform model training on the question-answering model according to the loss value and the intermediate update vector.

[0027] In a second aspect, the present application also provides a model bias response removal device, including:

[0028] A data input module for inputting data of a question to be answered into a question - answering model; the question - answering model includes at least one cascaded network layer;

[0029] A reply determination module for determining an intermediate reply result corresponding to the input data of each network layer in the question - answering model; wherein, the input data of the first network layer is the data of the question to be answered;

[0030] A reply update module for updating the intermediate reply result according to a target update vector and an update method corresponding to the network layer; the update method includes any one of linear update, segmented update, and projection update;

[0031] A target determination module for determining a target reply result of the data of the question to be answered according to the intermediate reply result corresponding to the last network layer in the question - answering model.

[0032] In a third aspect, the present application further provides a computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0033] Input the data of the question to be answered into the question - answering model; the question - answering model includes at least one cascaded network layer;

[0034] For each network layer in the question - answering model, determine an intermediate reply result corresponding to the input data of the network layer; wherein, the input data of the first network layer is the data of the question to be answered;

[0035] Update the intermediate reply result according to a target update vector and an update method corresponding to the network layer; the update method includes any one of linear update, segmented update, and projection update;

[0036] Determine a target reply result of the data of the question to be answered according to the intermediate reply result corresponding to the last network layer in the question - answering model.

[0037] In a fourth aspect, the present application further provides a computer - readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0038] Input the data of the question to be answered into the question - answering model; the question - answering model includes at least one cascaded network layer;

[0039] For each network layer in the question - answering model, determine an intermediate reply result corresponding to the input data of the network layer; wherein, the input data of the first network layer is the data of the question to be answered;

[0040] Update the intermediate response result according to the target update vector and update method corresponding to the network level; the update method includes any one of linear update, segmented update, and projection update;

[0041] Determine the target response result of the question data to be answered according to the intermediate response result corresponding to the tail network level in the question and answer model.

[0042] In a fifth aspect, the present application also provides a computer program product, including a computer program, which when executed by a processor implements the following steps:

[0043] Input the question data to be answered into the question and answer model; the question and answer model includes at least one cascaded network level;

[0044] For each network level in the question and answer model, determine the intermediate response result corresponding to the input data of the network level; wherein, the input data of the first network level is the question data to be answered;

[0045] Update the intermediate response result according to the target update vector and update method corresponding to the network level; the update method includes any one of linear update, segmented update, and projection update;

[0046] Determine the target response result of the question data to be answered according to the intermediate response result corresponding to the tail network level in the question and answer model.

[0047] For the above model bias response removal method, device, computer device, and storage medium, input the question data to be answered into the question and answer model; the question and answer model includes at least one cascaded network level; for each network level in the question and answer model, determine the intermediate response result corresponding to the input data of the network level; wherein, the input data of the first network level is the question data to be answered; update the intermediate response result according to the target update vector and update method corresponding to the network level; the update method includes any one of linear update, segmented update, and projection update; determine the target response result of the question data to be answered according to the intermediate response result corresponding to the tail network level in the question and answer model. The present application introduces an update vector, which strengthens the fine control of the question and answer model over the target response result, and further improves the controllability and accuracy of the target response result. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0049] Figure 1An application environment diagram of a method for removing model bias responses provided in this embodiment;

[0050] Figure 2 A flowchart of the first method for removing model bias responses provided in this embodiment;

[0051] Figure 3 A flowchart of a method for training a question - answering model provided in this embodiment;

[0052] Figure 4 A flowchart of a method for determining a loss value provided in this embodiment;

[0053] Figure 5 A flowchart of a method for determining an update vector provided in this embodiment;

[0054] Figure 6 A structural block diagram of a device for removing model bias responses provided in this embodiment;

[0055] Figure 7 An internal structure diagram of a computer device provided in this embodiment. Detailed implementation manners

[0056] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0057] The method for removing model bias responses provided in the embodiments of the present application can be applied to, for example Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or placed on the cloud or other network servers. The computer device inputs the data of the question to be answered into the question-and-answer model; the question-and-answer model includes at least one cascaded network layer; for each network layer in the question-and-answer model, determine the intermediate answer result corresponding to the input data of the network layer; among them, the input data of the first network layer is the data of the question to be answered; according to the target update vector and update method corresponding to the network layer, update the intermediate answer result; the update method includes any one of linear update, segmented update, and projection update; according to the intermediate answer result corresponding to the tail network layer in the question-and-answer model, determine the target answer result of the data of the question to be answered. Among them, the computer device can be a terminal or a server. The terminal 102 can be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers, Internet of Things devices, and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. The portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented by an independent server or a server cluster composed of multiple servers.

[0058] In an exemplary embodiment, as Figure 2 shown, a method for removing model bias answers is provided. Taking the computer device in Figure 1 as an example, the following steps 201 to step 204 are included. Among them:

[0059] Step 201, input the data of the question to be answered into the question-and-answer model.

[0060] Among them, the data of the question to be answered can include preset scenario data and preset question data. The question-and-answer model can be a model that can answer the data content of the question to be answered. The question-and-answer model includes at least one cascaded network layer.

[0061] Specifically, obtain the data of the question to be answered, and use the data of the question to be answered as the input data of the question-and-answer model, and input it into the question-and-answer model.

[0062] Step 202, for each network layer in the question-and-answer model, determine the intermediate answer result corresponding to the input data of the network layer.

[0063] Among them, the input data of the first network layer is the data of the question to be answered. The intermediate answer result can be the answer result corresponding to the data of the question to be answered output by the network layer, and this answer result may have a deviation answer result.

[0064] Specifically, for each network layer in the question-and-answer model, the input data is input into the current network layer to obtain the intermediate response result corresponding to this network layer.

[0065] Step 203: Update the intermediate response result according to the target update vector and update method corresponding to the network layer.

[0066] Among them, the target update vector can be a vector for optimizing and updating the intermediate response result. Optionally, the target update vector can be an activation vector, and the activation vector can be constructed by designing stimuli and tasks from the dataset, collecting the neural activities of the model, and through the internal differences of the model. Specifically, a pair of input contrast prompts that run the same in the question-and-answer model are used to generate two different feature representations (i.e., response results). The difference between these feature representations (i.e., response results) forms an activation vector, which acts as a stimulus-dependent controller. The target update vector is used to remove the biased response content in the intermediate response result.

[0067] Among them, the update method includes any one of linear update, piecewise update, and projection update.

[0068] Exemplarily, determine the target update vector corresponding to the network layer and the update method corresponding to this network layer; through this update method, update the intermediate response result according to the target update vector.

[0069] In one embodiment, if the update method is linear update, then update the intermediate response result according to the update method corresponding to the target update vector in the network layer. Updating the intermediate response result includes: updating the intermediate response result according to the sum value between the intermediate response result and the target update vector; or, updating the intermediate response result according to the difference between the intermediate response result and the target update vector. Specifically, in this embodiment, according to the intermediate response result and the target update vector, the intermediate response result is updated through the following formula (1-1) to achieve the effect of generating something similar to stimulating or inhibiting a certain concept.

[0070] (1-1)

[0071] Among them, R' is the updated intermediate response result, R is the unupdated intermediate response result, and v is the update vector.

[0072] In one embodiment, if the update method is segmented update, the intermediate response result is updated according to the update method corresponding to the target update vector in the network hierarchy. Updating the intermediate response result includes: adjusting the vector direction of the target update vector according to the transposed result of the intermediate response result and the target update vector; updating the intermediate response result according to the sum value between the intermediate response result and the target update vector. Specifically, according to the product value between the transposed result of the intermediate response result and the target update vector, the intermediate response result is updated through the following formula (1-2) to amplify the neural activity along the direction of the control element.

[0073] (1-2)

[0074] Wherein, R' is the updated intermediate response result, R is the unupdated intermediate response result, v is the update vector, R T is the transposed result of the intermediate response result, and sign is the sign function.

[0075] In one embodiment, if the update method is projection update, the intermediate response result is updated according to the update method corresponding to the target update vector in the network hierarchy. Updating the intermediate response result includes: adjusting the vector direction of the target update vector according to the transposed result of the intermediate response result, the target update vector, and the norm of the target update vector; updating the intermediate response result according to the difference between the intermediate response result and the target update vector.

[0076] Specifically, the vector direction of the target update vector is adjusted according to the transposed result of the intermediate response result, the target update vector, and the norm of the target update vector; according to the difference between the intermediate response result and the target update vector, the intermediate response result is updated through the following formula (1-3) to eliminate the component aligned with the intermediate response result and the update vector.

[0077] (1-3)

[0078] Wherein, R' is the updated intermediate response result, R is the unupdated intermediate response result, v is the update vector, R T is the transposed result of the intermediate response result, and ||v|| is the norm of the target update vector.

[0079] Step 204: Determine the target response result of the question data to be answered according to the intermediate response result corresponding to the tail network hierarchy in the question and answer model.

[0080] Wherein, the target response result may be the result of answering the data content of the question data to be answered.

[0081] Specifically, in this embodiment, the intermediate response result corresponding to the tail network layer in the Q&A model can be used as the target response result of the question data to be answered. Alternatively, the intermediate response result corresponding to the tail network layer in the Q&A model can be decoded to obtain a decoded result, and the decoded result can be used as the target response result of the question data to be answered.

[0082] The above model bias response removal method inputs the question data to be answered into the Q&A model; the Q&A model includes at least one cascaded network layer; for each network layer in the Q&A model, the intermediate response result corresponding to the input data of the network layer is determined; wherein, the input data of the first network layer is the question data to be answered; the intermediate response result is updated according to the target update vector and update method corresponding to the network layer; the update method includes any one of linear update, segmented update, and projection update; according to the intermediate response result corresponding to the tail network layer in the Q&A model, the target response result of the question data to be answered is determined. The present application introduces an update vector, which strengthens the fine control of the Q&A model over the target response result, and further improves the controllability and accuracy of the target response result.

[0083] In an exemplary embodiment, as Figure 3 shown in a schematic flowchart of a process for training a Q&A model, taking the method applied to Figure 1 the computer device therein as an example for illustration, includes the following steps 301 to step 303. Wherein:

[0084] Step 301: Input the sample question data into the pre-trained Q&A model to obtain a first response result.

[0085] Among them, the sample question data can be the question data as a sample.

[0086] Specifically, the sample question data is used as the input data of the pre-trained Q&A model and input into the pre-trained Q&A model to obtain a first response result.

[0087] It should be noted that the Q&A model can be a closed-source model. Due to its opacity and the complexity of its internal mechanism, the closed-source model may introduce biases or inaccurate response results when generating the first response result, thus affecting the user experience and the actual application value of the model.

[0088] Step 302: Input the first response result into the pre-trained response update model to obtain a second response result.

[0089] Among them, the reply update model can be a model used to evaluate and update and optimize the first reply result. The reply update model can be a white-box model. The white-box model can comprehensively evaluate the authenticity and fairness of the generated content, and at the same time effectively identify and correct potential biased replies. In addition, the monitoring framework of the white-box model not only supervises the quality of the model output, but also ensures the consistency and reliability of the output through preset evaluation criteria. In this way, the monitoring mechanism of the white-box model can timely discover and correct those potentially misleading output results, ensuring the objectivity and credibility of the generated content. Among them, the role of the white-box model is crucial. Its task is to deeply analyze a pair of sample question data and the first reply result provided by the closed-source large model (i.e., the pre-trained question-and-answer model), and generate a more fair and unbiased second reply result. This improvement process not only requires the white-box model to supplement and perfect the information of the original output, but also requires it to be able to identify and correct any potential biases or inaccuracies.

[0090] Specifically, take the first reply result as the input data of the pre-trained reply update model and input it into the reply update model. The reply update model optimizes and updates the first reply result to obtain the second reply result.

[0091] Step 303, perform model training on the question-and-answer model according to the first reply result and the second reply result.

[0092] One optional implementation method can be to determine the loss value according to the first reply result and the second reply result, and adjust the model parameters of the question-and-answer model according to the loss value.

[0093] Another optional implementation method can be to determine the loss value of the question-and-answer model according to the first reply result and the second reply result; determine the intermediate update vector in the question-and-answer model according to the difference between the first reply result and the second reply result; perform model training on the question-and-answer model according to the loss value and the intermediate update vector.

[0094] Specifically, according to the first reply result and the second reply result, through the following formula (1-4), determine the cross-entropy loss value of the question-and-answer model, and adjust the weight coefficient in the question-and-answer model; determine the difference between the first reply result and the second reply result, and use this difference as the intermediate update vector of each network layer in the question-and-answer model in the next iteration process.

[0095] (1-4)

[0096] Among them, y target represents the second reply result, y student represents the first reply result, L distill represents the loss value, α is the weight coefficient, and L CE is the cross-entropy function.

[0097] For example, Figure 4 The flowchart for determining the loss value is shown. In the figure, the scenario question and answer is the sample question data, the open source white box model is the pre-trained question and answer model, the reasons and answers are the first reply results, the closed source large model is the reply update model, and the better reasons and answers are the second reply results. The sample question data is input into the pre-trained question and answer model to obtain the first reply result, and then the first reply result is input into the reply update model to obtain the second reply result, and then the second reply result and the sample question data are re-input into the pre-trained question and answer model to train the question and answer model. This embodiment uses the knowledge distillation method to dynamically adjust the weight coefficient α in the loss function to balance the alignment degree of the question and answer model to the optimized answer (second reply result), thereby improving the performance of the question and answer model under complex tasks.

[0098] For example, Figure 5 The flowchart of determining the update vector is shown in FIG. The data set in the figure is sample problem data; based on the unbiased and biased questions in the same scenario determined by the sample problem data, the activation vector is determined through feature engineering to achieve multi-level optimization of the model output, making the generated results more accurate and in line with the expected requirements.

[0099] In this embodiment, the sample question data is input into the pre-trained question-answering model to obtain the first answer result; the first answer result is input into the pre-trained answer update model to obtain the second answer result; the question-answering model is trained based on the first answer result and the second answer result. By using the knowledge distillation method, the question-answering model can effectively learn the advanced knowledge of the answer update model and show excellent ability in identifying and correcting bias. At the same time, by dynamically adjusting the weight coefficient in the loss function, it is ensured that the question-answering model can accurately align and optimize the answer when processing complex tasks, thereby improving its performance in various application scenarios.

[0100] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0101] Based on the same inventive concept, an embodiment of the present application further provides a model bias response removal device for implementing the above-mentioned model bias response removal method. The solution provided by this device for solving the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the model bias response removal device provided below can refer to the limitations on the model bias response removal method in the above text, and will not be repeated here.

[0102] In an exemplary embodiment, as Figure 6 shown, a model bias response removal device is provided, including: a data input module 10, a response determination module 11, a response update module 12, and a target determination module 13, where:

[0103] The data input module 10 is configured to input the data of the question to be answered into the question-and-answer model; the question-and-answer model includes at least one cascaded network layer;

[0104] The response determination module 11 is configured to determine the intermediate response result corresponding to the input data of each network layer in the question-and-answer model; among them, the input data of the first network layer is the data of the question to be answered;

[0105] The response update module 12 is configured to update the intermediate response result according to the target update vector and update method corresponding to the network layer; the update method includes any one of linear update, segmented update, and projection update;

[0106] The target determination module 13 is configured to determine the target response result of the data of the question to be answered according to the intermediate response result corresponding to the tail network layer in the question-and-answer model.

[0107] In one embodiment, Figure 6 the response update module 12 in

[0108] is further configured to update the intermediate response result according to the sum value between the intermediate response result and the target update vector; or update the intermediate response result according to the difference value between the intermediate response result and the target update vector. Figure 6 In one embodiment,

[0109] the response update module 12 in Figure 6 is further configured to adjust the vector direction of the target update vector according to the transposed result of the intermediate response result and the target update vector; update the intermediate response result according to the sum value between the intermediate response result and the target update vector.

[0110] In one embodiment, Figure 6 the model bias response removal device in

[0111] The model training module is configured to input sample question data into a pre-trained question-answering model to obtain a first response result; input the first response result into a pre-trained response update model to obtain a second response result; and perform model training on the question-answering model according to the first response result and the second response result.

[0112] In one embodiment, Figure 6 The model training module in

[0113] is further configured to determine a loss value of the question-answering model according to the first response result and the second response result; determine an intermediate update vector in the question-answering model according to the difference between the first response result and the second response result; and perform model training on the question-answering model according to the loss value and the intermediate update vector.

[0114] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as Figure 7 shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with an external terminal through a network connection. The computer program, when executed by the processor, implements a model bias response removal method.

[0115] Those skilled in the art can understand that Figure 7The structure shown is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.

[0116] In one embodiment, a computer device is also provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the above method embodiments are implemented.

[0117] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0118] In one embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0119] It should be noted that the data involved in this application (including but not limited to data for analysis, stored data, displayed data, etc.) are all information and data authorized by users or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.

[0120] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.

[0121] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.

[0122] The above-described embodiments merely represent several implementation manners of the present application. Their descriptions are relatively specific and detailed, but they should not be construed as limiting the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims

1. A method for removing model bias responses, characterized in that, The method includes: Inputting the data of the question to be answered into a question-and-answer model; the question-and-answer model includes at least one cascaded network layer; For each network layer in the question-and-answer model, determining an intermediate answer result corresponding to the input data of the network layer; wherein, the input data of the first network layer is the data of the question to be answered; Updating the intermediate answer result according to the target update vector and update method corresponding to the network layer; the update method includes any one of linear update, segmented update, and projection update; the target update vector is used to remove the biased answer content in the intermediate answer result; Determining the target answer result of the data of the question to be answered according to the intermediate answer result corresponding to the tail network layer in the question-and-answer model; Wherein, the training method of the question-and-answer model includes: inputting the sample question data into a pre-trained question-and-answer model to obtain a first answer result; inputting the first answer result into a pre-trained answer update model to obtain a second answer result; determining the loss value of the question-and-answer model according to the first answer result and the second answer result; determining an intermediate update vector in the question-and-answer model according to the difference between the first answer result and the second answer result; and training the question-and-answer model according to the loss value and the intermediate update vector.

2. The method according to claim 1, characterized in that If the update method is linear update, updating the intermediate answer result according to the update method corresponding to the target update vector in the network layer includes: Updating the intermediate answer result according to the sum value between the intermediate answer result and the target update vector; or, updating the intermediate answer result according to the difference value between the intermediate answer result and the target update vector.

3. The method according to claim 1, wherein If the update method is segmented update, updating the intermediate answer result according to the update method corresponding to the target update vector in the network layer includes: Adjusting the vector direction of the target update vector according to the transposed result of the intermediate answer result and the target update vector; Updating the intermediate answer result according to the sum value between the intermediate answer result and the target update vector.

4. The method according to claim 1, wherein If the update method is projection update, updating the intermediate answer result according to the update method corresponding to the target update vector in the network layer includes: Adjusting the vector direction of the target update vector according to the transposed result of the intermediate answer result, the target update vector, and the norm of the target update vector; Updating the intermediate answer result according to the difference value between the intermediate answer result and the target update vector.

5. A model bias response removal device, characterized in that, The device includes: A data input module, configured to input the data of the question to be answered into a question-and-answer model; the question-and-answer model includes at least one cascaded network layer; An answer determination module, configured to determine, for each network layer in the question-and-answer model, an intermediate answer result corresponding to the input data of the network layer; wherein, the input data of the first network layer is the data of the question to be answered; A reply update module, configured to update the intermediate reply result according to the target update vector and update method corresponding to the network level; the update method includes any one of linear update, segmented update, and projection update; A target determination module, configured to determine the target reply result of the question data to be replied according to the intermediate reply result corresponding to the tail network level in the question and answer model; Among them, the training method of the question and answer model includes: inputting sample question data into a pre-trained question and answer model to obtain a first reply result; inputting the first reply result into a pre-trained reply update model to obtain a second reply result; determining the loss value of the question and answer model according to the first reply result and the second reply result; determining an intermediate update vector in the question and answer model according to the difference between the first reply result and the second reply result; training the question and answer model according to the loss value and the intermediate update vector.

6. The device according to claim 5, characterized in that The reply update module is further configured to update the intermediate reply result according to the sum value between the intermediate reply result and the target update vector; or update the intermediate reply result according to the difference value between the intermediate reply result and the target update vector.

7. The device according to claim 5, characterized in that, The reply update module is further configured to adjust the vector direction of the target update vector according to the transposed result of the intermediate reply result and the target update vector; update the intermediate reply result according to the sum value between the intermediate reply result and the target update vector.

8. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method described in any one of claims 1 to 4 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps of the method described in any one of claims 1 to 4 are implemented.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, the steps of the method described in any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Question answering method and device based on artificial intelligence, electronic equipment and storage medium

    CN117725188A

  • Apparatus and method for distributed neural networks

    WO2022228645A1