Model prejudice reply removal method and device, computer equipment and storage medium
By using the method of using cascading network hierarchy and target update vectors in the question-and-answer model, the problem of bias and uncontrollable outputs of large language models is solved, and the control accuracy and trust of natural language processing is improved.
Patent Information
- Application Number
- CN202411433302.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2044-10-14
AI Technical Summary
Large language models have problems such as content generation bias and uncontrollable output in natural language processing, especially in the use of closed-source models, resulting in low trust risk and control accuracy.
By introducing cascading network hierarchy and target update vectors in the question-and-answer model, the biased reply content is removed by using linear update, segmented update or projected update methods to improve the controllability and accuracy of target reply results.
Effectively remove model bias, improve the controllability and accuracy of the response results, reduce trust risks, and enhance the effectiveness of the model.
Smart Images

Figure CN119067100A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural language processing, and in particular to a method, apparatus, computer device and storage medium for removing biased responses from models. Background Art
[0002] With the rapid development of natural language processing technology, large language models have been widely used in the field of natural language processing.
[0003] In traditional technologies, large language models are usually used for natural language processing. However, the widespread use of large language models has brought about a series of problems such as biased content generation and uncontrollable output, which is especially evident in the use of closed-source large models. These closed-source models pose significant trust risks to users due to the non-transparency of their internal mechanisms and training data. In certain scenarios, the models may generate biased or inaccurate content, or even be induced externally to produce malicious output. These problems weaken the effectiveness of the models.
[0004] Therefore, closed-source models in traditional technologies usually suffer from low control accuracy. Summary of the invention
[0005] Based on this, it is necessary to provide a method, device, computer equipment and storage medium for removing model bias responses that can improve control accuracy in response to the above-mentioned technical problems.
[0006] In a first aspect, the present application provides a method for removing biased responses from a model, comprising:
[0007] Inputting the question data to be answered into the question answering model; the question answering model includes at least one cascaded network layer;
[0008] For each network level in the question-answering model, determine the intermediate answer 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;
[0009] 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; the target update vector is used to remove the biased response content in the intermediate response result;
[0010] According to the intermediate response results corresponding to the tail network layer in the question-answering model, the target response results of the question data to be answered are determined.
[0011] In one embodiment, if the update method is a linear update, the intermediate reply result is updated according to the update method corresponding to the target update vector in the network layer, and the updating of the intermediate reply result includes:
[0012] The intermediate reply result is updated according to the sum of the intermediate reply result and the target update vector; or, the intermediate reply result is updated according to the difference between the intermediate reply result and the target update vector.
[0013] In one embodiment, if the update method is a segmented update, the intermediate reply result is updated according to the update method corresponding to the target update vector in the network layer, and the updating of the intermediate reply result includes:
[0014] According to the transposed result of the intermediate response result and the target update vector, the vector direction of the target update vector is adjusted;
[0015] Update the intermediate reply result based on the sum of the intermediate reply result and the target update vector.
[0016] In one embodiment, if the update method is a projection update, the intermediate reply result is updated according to the update method corresponding to the target update vector in the network layer, and the updating of the intermediate reply result includes:
[0017] 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 modulus of the target update vector;
[0018] Update the intermediate response result based on the difference between the intermediate response result and the target update vector.
[0019] In one embodiment, a method for training a question-answering model includes:
[0020] Input the sample question data into the pre-trained question-answering model to obtain the first answer result;
[0021] Input the first reply result into a pre-trained reply update model to obtain a second reply result;
[0022] The question-answering model is trained based on the first answer result and the second answer result.
[0023] In one embodiment, the question-answering model is trained according to the first answer result and the second answer result, including:
[0024] Determine the loss value of the question-answering model according to the first answer result and the second answer result;
[0025] Determine an intermediate update vector in the question-answering model according to the difference between the first answer result and the second answer result;
[0026] The question-answering model is trained based on the loss value and the intermediate update vector.
[0027] In a second aspect, the present application also provides a model bias response removal device, comprising:
[0028] A data input module, used for inputting the question data to be answered into the question-answering model; the question-answering model comprises at least one cascaded network layer;
[0029] A reply determination module is used to determine, for each network level in the question-answering model, an intermediate reply 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;
[0030] A reply update module, used to update the intermediate reply result according to the target update vector and update method corresponding to the network layer; the update method includes any one of linear update, segment update and projection update;
[0031] The target determination module is used to determine the target response result of the question data to be answered based on the intermediate response result corresponding to the tail 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, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0033] Inputting the question data to be answered into the question answering model; the question answering model includes at least one cascaded network layer;
[0034] For each network level in the question-answering model, determine the intermediate answer 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;
[0035] 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, segment update and projection update;
[0036] According to the intermediate response results corresponding to the tail network layer in the question-answering model, the target response results of the question data to be answered are determined.
[0037] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0038] Inputting the question data to be answered into the question answering model; the question answering model includes at least one cascaded network layer;
[0039] For each network level in the question-answering model, determine the intermediate answer 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;
[0040] 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, segment update and projection update;
[0041] According to the intermediate response results corresponding to the tail network layer in the question-answering model, the target response results of the question data to be answered are determined.
[0042] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0043] Inputting the question data to be answered into the question answering model; the question answering model includes at least one cascaded network layer;
[0044] For each network level in the question-answering model, determine the intermediate answer 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 layer; the update method includes any one of linear update, segment update and projection update;
[0046] According to the intermediate response results corresponding to the tail network layer in the question-answering model, the target response results of the question data to be answered are determined.
[0047] The above-mentioned model bias answer removal method, device, computer equipment and storage medium input the question data to be answered into the question-answering model; the question-answering model includes at least one cascaded network layer; for each network layer in the question-answering model, determine the intermediate answer result corresponding to the input data of the network layer; wherein, the input data of the first network layer is the question data 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-answering model, determine the target answer result of the question data to be answered. This application introduces update vectors, which strengthens the fine control of the question-answering model over the target answer result, and further improves the controllability and accuracy of the target answer result. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0049] FIG1 is a diagram showing an application environment of a method for removing biased model responses provided by this embodiment;
[0050] FIG2 is a schematic diagram of a flow chart of a first method for removing biased model responses provided in this embodiment;
[0051] FIG3 is a schematic diagram of a flow chart of a training question-answering model provided in this embodiment;
[0052] FIG4 is a schematic diagram of a process for determining a loss value provided by this embodiment;
[0053] FIG5 is a schematic diagram of a flow chart of determining an update vector provided by this embodiment;
[0054] FIG6 is a structural block diagram of a device for removing model biased responses provided by this embodiment;
[0055] FIG. 7 is a diagram showing the internal structure of a computer device provided in this embodiment. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0057] The model bias reply removal method provided in the embodiment of the present application can be applied in the application environment shown in FIG1. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The computer device inputs the question data to be answered into the question-answering model; the question-answering model includes at least one cascaded network layer; for each network layer in the question-answering model, the intermediate reply 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; according to the target update vector and update method corresponding to the network layer, the intermediate reply result is updated; the update method includes any one of linear update, segmented update and projection update; according to the intermediate reply result corresponding to the tail network layer in the question-answering model, the target reply result of the question data to be answered is determined. 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, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices, and the Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. The portable wearable device may be a smart watch, a smart bracelet, a head-mounted device, etc. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.
[0058] In an exemplary embodiment, as shown in FIG2 , a method for removing model biased responses is provided, which is described by taking the method applied to the computer device in FIG1 as an example, and includes the following steps 201 to 204. Among them:
[0059] Step 201, input the question data to be answered into the question-answering model.
[0060] The question data to be answered may include preset scenario data and preset question data. The question-answering model may be a model for answering the data content of the question data to be answered. The question-answering model includes at least one cascaded network layer.
[0061] Specifically, the data of questions to be answered are obtained, and the data of questions to be answered are used as input data of the question-answering model and input into the question-answering model.
[0062] Step 202, for each network level in the question-answering model, determine the intermediate answer result corresponding to the input data of the network level.
[0063] The input data of the first network layer is the data of the question to be answered. The intermediate answer result may be the answer result corresponding to the data of the question to be answered output by the network layer, and the answer result may be a deviation answer result.
[0064] Specifically, for each network level in the question-answering model, the input data is input into the current network level to obtain the intermediate response result corresponding to the network level.
[0065] Step 203, updating 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 reply result. Optionally, the target update vector can be an activation vector, which can be designed from the stimulus and task in the data set, collect the neural activity of the model, and construct through the internal difference of the model. Specifically, a pair of input contrast prompts that run the same in the question-answering model are used to produce two different feature representations (i.e., reply results). The difference between these feature representations (i.e., reply results) forms an activation vector, which acts as a stimulus-dependent controller. The target update vector is used to remove biased reply content in the intermediate reply result.
[0067] The updating method includes any one of linear updating, segmented updating and projection updating.
[0068] Exemplarily, a target update vector corresponding to a network level and an update method corresponding to the network level are determined; through the update method, an intermediate response result is updated according to the target update vector.
[0069] In one embodiment, if the update method is a linear update, the intermediate reply result is updated according to the update method corresponding to the target update vector in the network layer, and the intermediate reply result is updated, including: updating the intermediate reply result according to the sum of the intermediate reply result and the target update vector; or, updating the intermediate reply result according to the difference between the intermediate reply result and the target update vector. Specifically, this embodiment updates the intermediate reply result according to the intermediate reply result and the target update vector through the following formula (1-1), so as to achieve an effect similar to stimulating or inhibiting a 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 a segmented update, the intermediate reply result is updated according to the update method corresponding to the target update vector in the network layer, and the intermediate reply result is updated, including: adjusting the vector direction of the target update vector according to the transposed result of the intermediate reply result and the target update vector; updating the intermediate reply result according to the sum of the intermediate reply result and the target update vector. Specifically, according to the product value between the transposed result of the intermediate reply result and the target update vector, the intermediate reply result is updated through the following formula (1-2) to achieve amplification of the neural activity along the direction of the control element.
[0073] (1-2)
[0074] Among them, 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 reply result, and sign is the sign function.
[0075] In one embodiment, if the update method is projection update, the intermediate reply result is updated according to the update method corresponding to the target update vector in the network layer, and the intermediate reply result is updated, including: adjusting the vector direction of the target update vector according to the transposition result of the intermediate reply result, the target update vector and the modulus of the target update vector; updating the intermediate reply result according to the difference between the intermediate reply 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 reply result, the target update vector and the modulus of the target update vector; according to the difference between the intermediate reply result and the target update vector, the intermediate reply result is updated by the following formula (1-3) to eliminate the components aligned with the intermediate reply result and the update vector.
[0077] (1-3)
[0078] Among them, 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 reply result, and ||v|| is the modulus of the target update vector.
[0079] Step 204, determining the target answer result of the question data to be answered based on the intermediate answer result corresponding to the tail network layer in the question-answering model.
[0080] Among them, the target reply result can be the result of replying to the data content of the question data to be replied.
[0081] Specifically, this embodiment can use the intermediate answer result corresponding to the tail network layer in the question-answering model as the target answer result of the question data to be answered. It is also possible to decode the intermediate answer result corresponding to the tail network layer in the question-answering model to obtain a decoding result, and use the decoding result as the target answer result of the question data to be answered.
[0082] The above-mentioned model biased reply removal method inputs the question data to be answered into the question-answering model; the question-answering model includes at least one cascaded network layer; for each network layer in the question-answering model, the intermediate reply 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; according to the target update vector and update method corresponding to the network layer, the intermediate reply result is updated; the update method includes any one of linear update, segmented update and projection update; according to the intermediate reply result corresponding to the tail network layer in the question-answering model, the target reply result of the question data to be answered is determined. This application introduces the update vector, which strengthens the fine control of the question-answering model over the target reply result, and further improves the controllability and accuracy of the target reply result.
[0083] In an exemplary embodiment, as shown in FIG3 , a flowchart of a training question-answering model is illustrated, taking the method applied to the computer device in FIG1 as an example, including the following steps 301 to 303. Among them:
[0084] Step 301, input the sample question data into the pre-trained question-answering model to obtain the first answer result.
[0085] The sample question data may be question data used as a sample.
[0086] Specifically, the sample question data is used as input data of the pre-trained question-answering model, and is input into the pre-trained question-answering model to obtain a first answer result.
[0087] It should be noted that the question-answering model can be a closed source model. Due to its opacity and complexity of internal mechanisms, the closed source model may introduce bias or inaccurate response results when generating the first response results, thereby affecting the user experience and the actual application value of the model.
[0088] Step 302, input the first reply result into a pre-trained reply update model to obtain a second reply result.
[0089] Among them, the reply update model can be a model for evaluating and updating 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 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 output results that may be misleading, and ensure the objectivity and reliability of the generated content. Among them, the role of the white-box model is crucial. Its task is to conduct an in-depth analysis of a pair of sample question data and the first reply result provided by the closed-source large model (i.e., the pre-trained question-answering model), and generate a more fair and unbiased second reply result. This improvement process requires not only the white-box model to supplement and improve the information of the original output, but also to be able to identify and correct any potential bias or inaccuracy.
[0090] Specifically, the first reply result is used as input data of a pre-trained reply update model and input into the reply update model. The reply update model optimizes and updates the first reply result to obtain a second reply result.
[0091] Step 303: Perform model training on the question-answering model according to the first reply result and the second reply result.
[0092] One optional implementation method may be to determine a loss value based on the first reply result and the second reply result, and adjust the model parameters of the question-answering model based on the loss value.
[0093] Another optional implementation method may be to determine the loss value of the question-answering model based on the first reply result and the second reply result; determine the intermediate update vector in the question-answering model based on the difference between the first reply result and the second reply result; and perform model training on the question-answering model based on the loss value and the intermediate update vector.
[0094] Specifically, according to the first reply result and the second reply result, the cross entropy loss value of the question-answering model is determined by the following formula (1-4), and the weight coefficient in the question-answering model is adjusted; the difference between the first reply result and the second reply result is determined, and the difference is used as the intermediate update vector of each network layer in the question-answering model in the next iteration process.
[0095] (1-4)
[0096] Among them, y target Indicates the second answer result, y student Indicates the first reply result, L distill represents the loss value, α is the weight coefficient, L CE is the cross entropy function.
[0097] Exemplary, a flowchart for determining the loss value is shown in FIG4 . 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 knowledge distillation to dynamically adjust the weight coefficient α in the loss function to balance the alignment 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, a flowchart of determining the update vector is shown in Figure 5. The data set in the figure is sample question data; based on the unbiased questions and biased questions in the same scenario determined by the sample question data, the activation vector is determined through feature engineering to achieve multi-level optimization of the model output, so that the generated results are more accurate and meet 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, the embodiment of the present application also provides a model biased reply removal device for implementing the above-mentioned model biased reply removal method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in one or more embodiments of the model biased reply removal device provided below can refer to the limitations of the model biased reply removal method above, and will not be repeated here.
[0102] In an exemplary embodiment, as shown in FIG6 , a model bias answer removal device is provided, comprising: a data input module 10, an answer determination module 11, an answer update module 12 and a target determination module 13, wherein:
[0103] A data input module 10, for inputting the question data to be answered into the question-answering model; the question-answering model comprises at least one cascaded network layer;
[0104] The answer determination module 11 is used to determine the intermediate answer result corresponding to the input data of the network layer for each network layer in the question-answering model; wherein the input data of the first network layer is the question data to be answered;
[0105] A reply update module 12, used to update the intermediate reply result according to the target update vector and update method corresponding to the network layer; the update method includes any one of linear update, segment update and projection update;
[0106] The target determination module 13 is used to determine the target answer result of the question data to be answered based on the intermediate answer result corresponding to the tail network layer in the question-answering model.
[0107] In one embodiment, the reply update module 12 in Figure 6 is also used to update the intermediate reply result based on the sum of the intermediate reply result and the target update vector; or, to update the intermediate reply result based on the difference between the intermediate reply result and the target update vector.
[0108] In one embodiment, the reply update module 12 in Figure 6 is also used to adjust the vector direction of the target update vector based on the transposed result of the intermediate reply result and the target update vector; and update the intermediate reply result based on the sum of the intermediate reply result and the target update vector.
[0109] In one embodiment, the reply update module 12 in Figure 6 is also used to adjust the vector direction of the target update vector based on the transposed result of the intermediate reply result, the target update vector and the modulus of the target update vector; and update the intermediate reply result based on the difference between the intermediate reply result and the target update vector.
[0110] In one embodiment, the model bias response removal device in FIG6 further includes:
[0111] The model training module is used to input sample question data into a pre-trained question-answering model to obtain a first answer result; input the first answer result into a pre-trained answer update model to obtain a second answer result; and perform model training on the question-answering model based on the first answer result and the second answer result.
[0112] In one embodiment, the model training module in Figure 6 is also used to determine the loss value of the question and answer model based on the first reply result and the second reply result; determine the intermediate update vector in the question and answer model based on the difference between the first reply result and the second reply result; and perform model training on the question and answer model based on the loss value and the intermediate update vector.
[0113] Each module in the above-mentioned model bias answer removal device can be implemented in whole or in part by software, hardware and their combination. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the corresponding operations of each of the above modules.
[0114] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG7. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. 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 an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for removing model bias responses is implemented.
[0115] Those skilled in the art will understand that the structure shown in FIG. 7 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0116] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0117] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0118] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0119] It should be noted that the data involved in this application (including but not limited to data used for analysis, stored data, displayed data, etc.) are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0120] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0121] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0122] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for removing model biased responses, characterized in that: The method comprises: Inputting the question data to be answered into the question-answering model; the question-answering model comprises at least one cascaded network layer; For each network level in the question-answering model, determine the intermediate answer 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; According to the target update vector and update method corresponding to the network level, the intermediate response result is updated; the update method includes any one of linear update, segmented update and projection update; the target update vector is used to remove biased response content in the intermediate response result; The target answer result of the question data to be answered is determined according to the intermediate answer result corresponding to the tail network layer in the question-answering model.
2. The method according to claim 1, characterized in that If the update mode is a linear update, updating the intermediate reply result according to the update mode corresponding to the target update vector in the network layer, and updating the intermediate reply result includes: The intermediate reply result is updated according to the sum of the intermediate reply result and the target update vector; or, the intermediate reply result is updated according to the difference between the intermediate reply result and the target update vector.
3. The method according to claim 1, characterized in that If the update mode is a segmented update, updating the intermediate reply result according to the update mode corresponding to the target update vector in the network layer, and updating the intermediate reply 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; The intermediate reply result is updated according to the sum value between the intermediate reply result and the target update vector.
4. The method according to claim 1, characterized in that: If the update mode is projection update, updating the intermediate reply result according to the update mode corresponding to the target update vector in the network layer, and updating the intermediate reply 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 modulus of the target update vector; The intermediate response result is updated according to the difference between the intermediate response result and the target update vector.
5. The method according to claim 1, characterized in that The training method of the question-answering model comprises: Input the sample question data into the pre-trained question-answering model to obtain the first answer result; Input the first reply result into a pre-trained reply update model to obtain a second reply result; The question-answering model is trained according to the first reply result and the second reply result.
6. The method according to claim 5, characterized in that The step of performing model training on the question-answering model according to the first answer result and the second answer result includes: Determining a loss value of the question-answering model according to the first answer result and the second answer result; Determining an intermediate update vector in the question-answering model according to the difference between the first answer result and the second answer result; The question-answering model is trained according to the loss value and the intermediate update vector.
7. A model bias response removal device, characterized in that: The device comprises: A data input module, used for inputting the question data to be answered into the question-answering model; the question-answering model comprises at least one cascaded network layer; A reply determination module, for determining, for each network level in the question-answering model, an intermediate reply 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; A reply update module, used to update the intermediate reply 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 determination module is used to determine the target answer result of the question data to be answered based on the intermediate answer result corresponding to the tail network layer in the question-answering model.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Question answering method and device based on artificial intelligence, electronic equipment and storage medium
CN117725188A
Question and answer model training method, question and answer method and question and answer method under subject question and answer scene
CN118312784A
Apparatus and method for distributed neural networks
WO2022228645A1
Generative model training method and apparatus and data conversion method and apparatus
WO2024109910A1
