Method and apparatus for removing bias in model responses, computer device, and storage medium
By introducing update vectors into the question-answering model, fine-grained control is achieved for each network layer, which solves the bias and uncontrollable output problems of large language models and realizes more reliable and accurate response results.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- ELECTRIC POWER RES INST CHINA SOUTHERN POWER GRID CO LTD
- Filing Date
- 2024-10-29
- Publication Date
- 2026-04-23
AI Technical Summary
Large language models suffer from content generation bias and uncontrollable output in natural language processing, especially in closed-source models where trust risks are high and control precision is low.
By inputting the data of questions to be answered into a cascaded question-answering model, intermediate answer results are determined for each network layer, and biased answer content is removed based on the target update vector using linear update, segmented update, or projection update methods, to finally determine the target answer result.
It improves the controllability and accuracy of the question-answering model's response to the target, enhances the reliability and fairness of the model's output, and reduces the impact of bias.
Smart Images

Figure CN2024128134_23042026_PF_FP_ABST
Abstract
Description
Methods, apparatus, computer equipment, and storage media for removing biased responses from models Technical Field
[0001] This application relates to the field of natural language processing technology, and in particular to a method, apparatus, computer device, and storage medium for removing model bias responses. Background Technology
[0002] With the rapid development of natural language processing technology, large-scale language models have been widely used in the field of natural language processing.
[0003] Traditional technologies for natural language processing typically employ large language models. However, the widespread use of large language models has brought a series of problems, such as content generation bias and uncontrollable output, especially with closed-source large models. Due to the opacity 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 influenced by external factors to produce malicious output. These problems weaken the model's effectiveness.
[0004] Therefore, closed-source models in traditional technologies often suffer from low control accuracy.
[0005] Summary of the Invention
[0006] Therefore, it is necessary to provide a model bias response removal method, apparatus, computer equipment, and storage medium that can improve control accuracy in response to the above-mentioned technical problems.
[0007] Firstly, this application provides a method for removing model-biased responses, including:
[0008] Input the question data to be answered into the question-answering model; the question-answering model includes at least one cascaded network layer;
[0009] For each network layer in the question-answering model, determine the intermediate response result corresponding to the input data of the network layer; where the input data of the first network layer is the question data to be answered;
[0010] The intermediate response results are updated according to the target update vector and update method corresponding to the network layer; the update method includes any one of linear update, piecewise update and projection update; the target update vector is used to remove biased response content from the intermediate response results.
[0011] Based on the intermediate response results corresponding to the tail network layers in the question-answering model, the target response result for the question data to be answered is determined.
[0012] In one embodiment, if the update method is linear update, the intermediate response result is updated according to the update method corresponding to the target update vector in the network layer. Updating the intermediate response result includes:
[0013] Update the intermediate response result based on the sum of the intermediate response result and the target update vector; or, update the intermediate response result based on the difference between the intermediate response result and the target update vector.
[0014] 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 layer. Updating the intermediate response result includes:
[0015] Adjust the direction of the target update vector based on the transpose of the intermediate response and the target update vector.
[0016] Update the intermediate response result based on the sum of the intermediate response result and the target update vector.
[0017] 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 layer. Updating the intermediate response result includes:
[0018] Adjust the direction of the target update vector based on the transpose of the intermediate response, the target update vector, and the magnitude of the target update vector.
[0019] Update the intermediate response result based on the difference between the intermediate response result and the target update vector.
[0020] In one embodiment, the training method for the question-answering model includes:
[0021] The sample question data is input into the pre-trained question-answering model to obtain the first response result;
[0022] The first response result is input into the pre-trained response update model to obtain the second response result;
[0023] The question-answering model is trained based on the results of the first and second responses.
[0024] In one embodiment, the question-answering model is trained based on the first response result and the second response result, including:
[0025] Based on the results of the first and second responses, determine the loss value of the question-answering model;
[0026] Based on the difference between the first and second responses, determine the intermediate update vector in the question-answering model;
[0027] The question-answering model is trained based on the loss value and intermediate update vector.
[0028] Secondly, this application also provides a model bias response removal device, comprising:
[0029] The data input module is used to input the question data to be answered into the question-answering model; the question-answering model includes at least one cascaded network layer;
[0030] The response determination module is used to determine the intermediate response result corresponding to the input data of each network layer in the question-answering model; the input data of the first network layer is the question data to be answered.
[0031] The response update module is used to update the intermediate response results according to the target update vector and update method corresponding to the network layer; the update method includes any one of linear update, piecewise update and projection update;
[0032] The target determination module is used to determine the target response result for the question data to be answered based on the intermediate response results corresponding to the tail network layers in the question-answering model.
[0033] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0034] Input the question data to be answered into the question-answering model; the question-answering model includes at least one cascaded network layer;
[0035] For each network layer in the question-answering model, determine the intermediate response result corresponding to the input data of the network layer; where the input data of the first network layer is the question data to be answered;
[0036] Update the intermediate response results according to the target update vector and update method corresponding to the network layer; the update method includes any one of linear update, piecewise update and projection update.
[0037] Based on the intermediate response results corresponding to the tail network layers in the question-answering model, the target response result for the question data to be answered is determined.
[0038] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0039] Input the question data to be answered into the question-answering model; the question-answering model includes at least one cascaded network layer;
[0040] For each network layer in the question-answering model, determine the intermediate response result corresponding to the input data of the network layer; where the input data of the first network layer is the question data to be answered;
[0041] Update the intermediate response results according to the target update vector and update method corresponding to the network layer; the update method includes any one of linear update, piecewise update and projection update.
[0042] Based on the intermediate response results corresponding to the tail network layers in the question-answering model, the target response result for the question data to be answered is determined.
[0043] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0044] Input the question data to be answered into the question-answering model; the question-answering model includes at least one cascaded network layer;
[0045] For each network layer in the question-answering model, determine the intermediate response result corresponding to the input data of the network layer; where the input data of the first network layer is the question data to be answered;
[0046] Update the intermediate response results according to the target update vector and update method corresponding to the network layer; the update method includes any one of linear update, piecewise update and projection update.
[0047] Based on the intermediate response results corresponding to the tail network layers in the question-answering model, the target response result for the question data to be answered is determined.
[0048] The aforementioned biased response removal method, apparatus, computer equipment, and storage medium input the question-to-answer data into a question-answering model. The question-answering model includes at least one cascaded network layer. For each network layer in the question-answering model, an intermediate response result corresponding to the input data of that network layer is determined. The input data of the first network layer is the question-to-answer data. The intermediate response results are updated according to the target update vector and update method corresponding to the network layer. The update method includes any one of linear update, piecewise update, and projective update. The target response result for the question-to-answer data is determined based on the intermediate response results corresponding to the tail network layers in the question-answering model. This application introduces an update vector, which strengthens the fine-grained control of the target response result by the question-answering model, further improving the controllability and accuracy of the target response result. Attached Figure Description
[0049] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0050] Figure 1 shows the application environment of a model bias response removal method provided in this embodiment.
[0051] Figure 2 is a flowchart illustrating the first model bias response removal method provided in this embodiment;
[0052] Figure 3 is a flowchart illustrating a question-answering model training method provided in this embodiment;
[0053] Figure 4 is a schematic diagram of a process for determining the loss value provided in this embodiment;
[0054] Figure 5 is a schematic diagram of a process for determining an update vector provided in this embodiment;
[0055] Figure 6 is a structural block diagram of a model bias response removal device provided in this embodiment;
[0056] Figure 7 is an internal structure diagram of a computer device provided in this embodiment. Detailed Implementation
[0057] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0058] The model bias response removal method provided in this application embodiment can be applied to the application environment shown in Figure 1. The terminal 102 communicates with the server 104 via a network. A 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 a cloud or other network server. 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 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, piecewise update, and projection update; the target response result of the question data to be answered is determined according to the intermediate response result corresponding to the tail network layer in the question-answering model. The computer device can be a terminal or a server. The terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices; IoT devices can be smart speakers, smart TVs, smart air conditioners, smart vehicle devices, etc. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.
[0059] In an exemplary embodiment, as shown in FIG2, a method for removing model bias responses is provided. Taking the application of this method to the computer device in FIG1 as an example, the method includes the following steps 201 to 204. Wherein:
[0060] Step 201: Input the data of the questions to be answered into the question-answering model.
[0061] The data to be answered may include preset scenario data and preset question data. The question-answering model is a model that responds to the data content of the question to be answered. The question-answering model includes at least one cascaded network layer.
[0062] Specifically, the data of questions to be answered is obtained and used as input data for the question-answering model.
[0063] Step 202: For each network layer in the question-answering model, determine the intermediate response result corresponding to the input data of the network layer.
[0064] The input data for the first network layer consists of questions to be answered. Intermediate responses can be the responses to the questions output by the network layers, and these responses may contain biases.
[0065] Specifically, for each network layer in the question-answering model, the input data is fed into the current network layer to obtain the intermediate response result corresponding to that network layer.
[0066] Step 203: Update the intermediate response results according to the target update vector and update method corresponding to the network layer.
[0067] The target update vector can be a vector used to optimize and update intermediate response results. Optionally, the target update vector can be an activation vector, which can be constructed from stimuli and tasks designed from the dataset, neural activity collected from the model, and internal differences within the model. Specifically, using a pair of contrasting inputs running in the question-answering model, two different feature representations (i.e., response results) are generated. The difference between these feature representations (i.e., response results) forms an activation vector that acts as a stimulus-dependent controller. This target update vector is used to remove biased response content from the intermediate response results.
[0068] The update method includes any one of linear update, piecewise update, and projection update.
[0069] For example, the target update vector corresponding to the network layer and the update method corresponding to the network layer are determined; the intermediate response results are updated according to the target update vector using the update method.
[0070] In one embodiment, if the update method is linear, the intermediate response result is updated 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 based on the sum of the intermediate response result and the target update vector; or, updating the intermediate response result based on the difference between the intermediate response result and the target update vector. Specifically, in this embodiment, the intermediate response result is updated according to the intermediate response result and the target update vector using the following formula (1-1), achieving an effect similar to stimulating or inhibiting a certain concept. R′=R±v (1-1)
[0071] Where 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 layer. Updating the intermediate response result includes: adjusting the vector direction of the target update vector based on the transpose of the intermediate response result and the target update vector; and updating the intermediate response result based on the sum of the intermediate response result and the target update vector. Specifically, based on the product of the transpose of the intermediate response result and the target update vector, the intermediate response result is updated using the following formula (1-2) to amplify neural activity along the direction of the control element. R′=R+sign(R T v)v (1-2)
[0073] Where R' is the updated intermediate response result, R is the unupdated intermediate response result, v is the update vector, and R T This is the transpose of the intermediate response, and sign is the sign function.
[0074] 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 layer. Updating the intermediate response result includes: adjusting the vector direction of the target update vector according to the transpose of the intermediate response result, the target update vector, and the magnitude of the target update vector; and updating the intermediate response result according to the difference between the intermediate response result and the target update vector.
[0075] Specifically, the vector direction of the target update vector is adjusted based on the transpose of the intermediate response result, the target update vector, and the magnitude of the target update vector; the intermediate response result is updated based on the difference between the intermediate response result and the target update vector using the following formula (1-3) to eliminate the components aligned between the intermediate response result and the update vector.
[0076] Where R' is the updated intermediate response result, R is the unupdated intermediate response result, v is the update vector, and R T Let ||v|| be the transpose of the intermediate response, and ||v|| be the modulus of the target update vector.
[0077] Step 204: Determine the target response result for the question data to be answered based on the intermediate response results corresponding to the tail network layer in the question-answering model.
[0078] The target response result can be the result of responding to the data content of the question to be answered.
[0079] Specifically, in this embodiment, the intermediate response results corresponding to the tail network layers in the question-answering model can be used as the target response results for the question data to be answered. Alternatively, the intermediate response results corresponding to the tail network layers in the question-answering model can be decoded to obtain the decoded results, which can then be used as the target response results for the question data to be answered.
[0080] The aforementioned biased response removal method inputs the question-and-answer model with data to be answered into the question-and-answer model. The model includes at least one cascaded network layer. For each network layer, the intermediate response result corresponding to the input data is determined. The input data for the first network layer is the question-and-answer data. 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, piecewise update, and projective update. The target response result for the question-and-answer data is determined based on the intermediate response results corresponding to the tail network layers in the question-and-answer model. This application introduces an update vector, enhancing the fine-grained control of the target response result by the question-and-answer model, further improving the controllability and accuracy of the target response result.
[0081] In an exemplary embodiment, as shown in Figure 3, a flowchart of training a question-answering model is illustrated. Taking the application of this method to the computer device in Figure 1 as an example, the method includes the following steps 301 to 303. Wherein:
[0082] Step 301: Input the sample question data into the pre-trained question-answering model to obtain the first response result.
[0083] Among them, sample problem data can be problem data used as samples.
[0084] Specifically, the sample question data is used as input data for the pre-trained question-answering model to obtain the first response result.
[0085] It should be noted that this question-answering model can be a closed-source model. Due to its opacity and the complexity of its internal mechanisms, closed-source models may introduce bias or inaccurate response results when generating the first response, thereby affecting the user experience and the practical application value of the model.
[0086] Step 302: Input the first response result into the pre-trained response update model to obtain the second response result.
[0087] The response update model can be a model used to evaluate and optimize the first response result. This model can be a white-box model. A white-box model can comprehensively evaluate the authenticity and fairness of the generated content, while effectively identifying and correcting potentially biased responses. Furthermore, 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 pre-defined evaluation criteria. In this way, the monitoring mechanism of the white-box model can promptly detect and correct potentially misleading output results, ensuring the objectivity and reliability of the generated content. The role of the white-box model is crucial. Its task is to conduct in-depth analysis of a pair of sample question data and the first response result provided by the closed-source large model (i.e., the pre-trained question-answering model) and generate a fairer and more unbiased second response result. This improvement process not only requires the white-box model to supplement and improve the information in the original output but also requires it to identify and correct any potential biases or inaccuracies.
[0088] Specifically, the first response result is used as the input data for a pre-trained response update model. The response update model optimizes and updates the first response result to obtain the second response result.
[0089] Step 303: Train the question-answering model based on the first and second response results.
[0090] One possible implementation is to determine the loss value based on the first and second response results, and then adjust the model parameters of the question-answering model based on the loss value.
[0091] Another possible implementation is to determine the loss value of the question-answering model based on the first and second response results; determine the intermediate update vector in the question-answering model based on the difference between the first and second response results; and train the question-answering model based on the loss value and the intermediate update vector.
[0092] Specifically, based on the first and second response results, the cross-entropy loss value of the question-answering model is determined using the following formula (1-4), and the weight coefficients in the question-answering model are adjusted; the difference between the first and second response results is determined, and this difference is used as the intermediate update vector for each network layer in the question-answering model during the next iteration. distill =αL CE (y target ,y student (1-4)
[0093] Among them, y target Indicates the result of the second response, y student Indicates the first response result, L distillThis represents the loss value, α is the weighting coefficient, and L... CE This is the cross-entropy function.
[0094] An exemplary flowchart for determining the loss value is shown in Figure 4. In the figure, the scenario-based question-and-answer session represents the sample question data, the open-source white-box model is the pre-trained question-and-answer model, the reasons and answers represent the first response result, the closed-source large model is the response update model, and the better reasons and answers represent the second response result. The sample question data is input into the pre-trained question-and-answer model to obtain the first response result. This first response result is then input into the response update model to obtain the second response result. Finally, the second response result and the sample question data are re-input into the pre-trained question-and-answer model to train it. 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 with the optimized answer (the second response result), thereby improving the performance of the question-and-answer model under complex tasks.
[0095] For example, Figure 5 illustrates the flowchart for determining the update vector. The dataset in the figure represents sample question data. Based on the unbiased and biased questions identified from the sample question data, feature engineering is used to determine the activation vector, thereby optimizing the model output at multiple levels, resulting in more accurate and expected results.
[0096] In this embodiment, sample question data is input into a pre-trained question-answering model to obtain a first response result; the first response result is then input into a pre-trained response update model to obtain a second response result; based on the first and second response results, the question-answering model is trained. Utilizing knowledge distillation, the question-answering model can effectively learn high-level knowledge from the response update model, demonstrating superior ability to identify and correct biases. Simultaneously, by dynamically adjusting the weight coefficients in the loss function, it is ensured that the question-answering model can accurately align and optimize answers when handling complex tasks, thereby improving its performance in various application scenarios.
[0097] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0098] Based on the same inventive concept, this application also provides a model bias response removal apparatus for implementing the model bias response removal method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more embodiments of the model bias response removal apparatus provided below can be found in the limitations of the model bias response removal method described above, and will not be repeated here.
[0099] In an exemplary embodiment, as shown in FIG6, a model bias response removal device is provided, comprising: a data input module 10, a response determination module 11, a response update module 12, and a target determination module 13, wherein:
[0100] Data input module 10 is used to input the question data to be answered into the question answering model; the question answering model includes at least one cascaded network layer;
[0101] The response determination module 11 is used to determine the intermediate response 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 question data to be answered;
[0102] The response update module 12 is used to update the intermediate response results according to the target update vector and update method corresponding to the network layer; the update method includes any one of linear update, piecewise update and projection update;
[0103] The target determination module 13 is used to determine the target response result of the question data to be answered based on the intermediate response results corresponding to the tail network layer in the question answering model.
[0104] In one embodiment, the response update module 12 in FIG6 is further configured to update the intermediate response result based on the sum between the intermediate response result and the target update vector; or, to update the intermediate response result based on the difference between the intermediate response result and the target update vector.
[0105] In one embodiment, the response update module 12 in FIG6 is further configured to adjust the vector direction of the target update vector according to the transpose of the intermediate response result and the target update vector; and update the intermediate response result according to the sum between the intermediate response result and the target update vector.
[0106] In one embodiment, the response update module 12 in FIG6 is further configured to adjust the vector direction of the target update vector according to the transpose of the intermediate response result, the target update vector, and the modulus of the target update vector; and update the intermediate response result according to the difference between the intermediate response result and the target update vector.
[0107] In one embodiment, the model bias response removal device in Figure 6 further includes:
[0108] The model training module is used 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 train the question-answering model based on the first and second response results.
[0109] In one embodiment, the model training module in Figure 6 is further configured to determine the loss value of the question-answering model based on the first response result and the second response result; determine the intermediate update vector in the question-answering model based on the difference between the first response result and the second response result; and train the question-answering model based on the loss value and the intermediate update vector.
[0110] The modules in the aforementioned bias response removal device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can invoke and execute the operations corresponding to each module.
[0111] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram is shown in Figure 7. The computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is connected to the system bus via the I / O interfaces. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes non-volatile storage media and internal memory. The non-volatile storage media stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used to store data. The I / O interfaces of the computer device are used for exchanging information between the processor and external devices. The communication interface of the computer device is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a model bias response removal method.
[0112] Those skilled in the art will understand that the structure shown in Figure 7 is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0113] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0114] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0115] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0116] It should be noted that the data involved in this application (including but not limited to data used for analysis, data stored, data displayed, etc.) are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0117] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media 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), magnetic 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 take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0118] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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.
[0119] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A model bias reply removal method, characterized by, The method comprises: inputting to-be-answered question data into a question and answer model; the question and answer model comprises at least one cascaded network level; for each network level in the question and answer model, determining an intermediate answer result corresponding to input data of the network level; wherein the input data of the first network level is the to-be-answered question data; updating the intermediate answer result according to a target update vector corresponding to the network level and an update mode; the update mode comprises any one of linear update, segmented update and projection update; the target update vector is used to remove biased answer content in the intermediate answer result; determining a target answer result of the to-be-answered question data according to the intermediate answer result corresponding to the tail network level in the question and answer model.
2. The method of claim 1, wherein, If the update mode is linear update, updating the intermediate answer result according to the update mode corresponding to the target update vector in the network level, updating the intermediate answer result, comprises: 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 of claim 1, wherein, If the update mode is segmented update, updating the intermediate answer result according to the update mode corresponding to the target update vector in the network level, updating the intermediate answer result, comprises: 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 of claim 1, wherein, If the update mode is projection update, updating the intermediate answer result according to the update mode corresponding to the target update vector in the network level, updating the intermediate answer result, comprises: 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 modulus 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. The method of claim 1, wherein, The training method of the question and answer model comprises: inputting 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; model training of the question and answer model according to the first answer result and the second answer result.
6. The method of claim 5, wherein, The model training of the question and answer model according to the first answer result and the second answer result comprises: determining a 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; model training of the question and answer model according to the loss value and the intermediate update vector.
7. A model bias reply removal apparatus characterized by comprising: The device comprises: a data input module for inputting to-be-answered question data into a question and answer model; the question and answer model comprises at least one cascaded network level; The response determination module is used to determine the intermediate response 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 question data to be answered; The response update module is used 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, piecewise update and projection update; The target determination module is used to determine the target response result of the question data to be answered based on the intermediate response results corresponding to the tail network layer in the question-answering model.
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, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Data processing method and device based on artificial intelligence and electronic equipment
CN111813961A
Question answering method and device based on artificial intelligence, electronic equipment and storage medium
CN117725188A
Knowledge processing method and device based on large model, knowledge question and answer method and device based on large model, and medium
CN117743558A
Editing method and device for pre-training language model
CN117851613A
Method for question-answering based on asr
KR102552401B1