CN115017290B - File question-answering system optimization method and device based on cooperative confrontation training - Google Patents
File question-answering system optimization method and device based on cooperative confrontation training Download PDFInfo
- Publication number
- CN115017290B CN115017290B CN202210828777.1A CN202210828777A CN115017290B CN 115017290 B CN115017290 B CN 115017290B CN 202210828777 A CN202210828777 A CN 202210828777A CN 115017290 B CN115017290 B CN 115017290B
- Authority
- CN
- China
- Prior art keywords
- archive
- question
- sample
- answering system
- bias
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000012549 training Methods 0.000 title claims abstract description 96
- 238000000034 method Methods 0.000 title claims abstract description 55
- 238000005457 optimization Methods 0.000 title claims description 23
- 239000013598 vector Substances 0.000 claims abstract description 36
- 230000000694 effects Effects 0.000 claims abstract description 10
- 238000012360 testing method Methods 0.000 claims description 29
- 230000028161 membrane depolarization Effects 0.000 claims description 9
- 230000035945 sensitivity Effects 0.000 claims description 9
- 238000005516 engineering process Methods 0.000 claims description 7
- 238000004590 computer program Methods 0.000 claims description 6
- 238000011156 evaluation Methods 0.000 claims description 6
- 235000013399 edible fruits Nutrition 0.000 claims 1
- 238000004891 communication Methods 0.000 description 7
- 238000013135 deep learning Methods 0.000 description 6
- 230000008569 process Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 5
- 230000006870 function Effects 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 238000012163 sequencing technique Methods 0.000 description 3
- 238000013136 deep learning model Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000007115 recruitment Effects 0.000 description 2
- 230000004913 activation Effects 0.000 description 1
- 150000001875 compounds Chemical class 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000001186 cumulative effect Effects 0.000 description 1
- 230000008034 disappearance Effects 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 238000004880 explosion Methods 0.000 description 1
- 239000000203 mixture Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 210000005036 nerve Anatomy 0.000 description 1
- 230000001537 neural effect Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000005192 partition Methods 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/332—Query formulation
- G06F16/3329—Natural language query formulation or dialogue systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Mathematical Physics (AREA)
- General Engineering & Computer Science (AREA)
- Artificial Intelligence (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Biomedical Technology (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Evolutionary Computation (AREA)
- Biophysics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Human Computer Interaction (AREA)
- Databases & Information Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention provides a method and a device for optimizing a file question-answering system based on cooperative confrontation training, which relate to the technical field of computers and comprise the following steps: generating an equivalent archive question-answering system according to the pre-acquired archive data set and the archive feature vector; generating a G-type bias archive sample and an O-type bias archive sample for an equivalent archive question-answering system; constructing a plurality of G-type-O type bias archive sample pairs according to the similarity of the samples to obtain a plurality of bias archive sample pair sets for collaborative confrontation training; and performing cooperative confrontation training on the set by using the prejudice file sample to eliminate the prejudice of the original file question-answering system so as to obtain a fair file question-answering system. The method solves the problems that the existing file question-answering system is easily influenced by bias factors, low in stability and not fair enough in decision result, achieves the technical effects of eliminating the bias of the original file question-answering system and improving the accuracy of the returned result of the question-answering system.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for optimizing a file question-answering system based on cooperative confrontation training.
Background
With the rapid development of deep learning technology, deep learning models are widely applied to various fields, including crime prediction, criminal arrest, enterprise recruitment, salary assessment, vehicle search and the like. The file question-answering system based on deep learning can meet the information query requirement of managers on personnel with key attributes and relevant skills, can assist a public security system to quickly locate relevant suspicious personnel and target vehicles, and can help users who lose vehicles to quickly find the vehicles and the like. However, in the application process, the return result of the file questioning and answering system often has problems such as bias and discrimination, for example, in the traffic file questioning and answering system, the prediction result of the target vehicle may be affected by factors such as vehicle texture, vehicle color and vehicle shape.
That is to say, the existing file question-answering system based on deep learning is susceptible to bias factors, and has the problems of low stability and unfair decision results.
Disclosure of Invention
The invention aims to provide a method and a device for optimizing an archive question-answering system based on cooperative confrontation training, so as to solve the technical problems that the prior art is easily influenced by bias factors, low in stability and not fair in decision result.
In order to achieve the above purpose, the embodiment of the present invention adopts the following technical solutions:
in a first aspect, an embodiment of the present invention provides a method for optimizing an archive question-answering system based on collaborative confrontation training, including:
generating an equivalent archive question-answering system according to an archive data set and an archive feature vector which are acquired in advance;
generating a G-type bias archive sample and an O-type bias archive sample aiming at the equivalent archive question-answering system;
constructing a plurality of G-O type bias archive sample pairs according to the similarity of the G type bias archive sample and the O type bias archive sample to obtain a plurality of bias archive sample pair sets for collaborative countermeasure training;
and performing cooperative confrontation training on the set by using the bias archive sample to eliminate the bias of the original archive question-answering system and obtain a fair archive question-answering system.
In some possible embodiments, before generating the equivalent archive question answering system according to the archive data set and the archive feature vector acquired in advance, the method includes:
acquiring an archive data set; the archival data set includes a training set and a test set; converting archive sample data in a text form into archive feature vectors by using a feature embedding technology word2vec algorithm; determining an original archive question-answering system according to an archive question-answering system model; the archival question-answering system model includes a long-short term memory model LSTM.
In some possible embodiments, the generating an equivalent archive question-and-answer system from the pre-acquired archive data set and the archive feature vectors comprises: inputting the file feature vectors into the original file question-answering system to generate an output confidence coefficient of each file feature vector; and training the original archive question-answering system by using the archive feature vectors and the output confidence coefficient to generate an equivalent archive question-answering system.
In some possible embodiments, generating G-type bias profile samples and O-type bias profile samples for the equivalent profile question-answering system comprises:
generating a G-type bias archive sample aiming at the equivalent archive question-answering system based on gradient attack; generating an O-type bias archive sample aiming at the equivalent archive question-answering system based on optimization attack; respectively establishing corresponding bias archive sample training data sets based on the G-type bias archive sample and the O-type bias archive sample; wherein the gradient attack comprises: adding a first perturbation to the sample to increase the loss of the equivalence profile question-answering system; the optimization attack comprises the following steps: a second perturbation is added to the sample to cause the equivalent archive question-answering system to give an error label.
In some possible embodiments, constructing a plurality of G-O type bias profile sample pairs according to the similarity of the samples to obtain a plurality of bias profile sample pair sets for collaborative confrontation training, includes:
constructing a plurality of G-type-O type prejudice archive sample pairs according to the similarity of the samples;
calculating the fairness contribution value of each G-O type prejudice archive sample to the equivalent archive question-answering system;
and performing descending arrangement on the G-type-O-type bias archive samples according to the fairness contribution value to generate a plurality of bias archive sample pair sets for collaborative countermeasure training.
In some possible embodiments, the collaborative confrontation training of the set using the bias profile sample includes: and taking the plurality of G-type-O type bias archive sample pairs as training samples, and inputting the training samples into the equivalent archive question-answering system for training.
In some possible embodiments, the method further comprises:
testing the fair file question-answering system by using a test set;
when the test result meets the equal opportunity of the fairness evaluation index, the model is considered to be fair after being trained; the formula for the chance equality is:
wherein,representing model predictions, A is a sensitive attribute, Y represents a tag in the dataset, Y represents a target tag and Y represents a target tagY {0,1}; and when the results of the left side and the right side of the above formula are equal, the model is considered to achieve the depolarization effect.
In a second aspect, an embodiment of the present invention provides an archive question-answering system optimization device based on collaborative confrontation training, including:
the system comprises a question-answering system generating module, a file characteristic vector generating module and a file data set generating module, wherein the question-answering system generating module is used for generating an equivalent file question-answering system according to a file data set and a file characteristic vector which are acquired in advance;
the data set establishing module is used for generating a G-type bias archive sample and an O-type bias archive sample aiming at the equivalent archive question-answering system;
the sample pair set generation module is used for constructing a plurality of G-O type bias archive sample pairs according to the similarity of the G type bias archive samples and the O type bias archive samples to obtain a plurality of bias archive sample pair sets used for collaborative confrontation training;
and the training module is used for performing collaborative confrontation training on the set by utilizing the bias archive sample so as to eliminate the bias of the original archive question-answering system and obtain a fair archive question-answering system.
In some possible embodiments, the method further comprises: the test module is used for testing the fair file question-answering system by using a test set; when the test result meets the equal probability of the fairness evaluation index, the model is considered to be fair after training; the formula for the chance equality is:
wherein,representing model predictions, A is a sensitive attribute, Y represents a tag in the dataset, Y represents a target tag and Y represents a target tagY {0,1}; when the results of the left side and the right side of the above formula are equal, the model is considered to achieve the depolarization effect.
In a third aspect, an embodiment of the present invention provides an electronic device, including a memory and a processor, where the memory stores a computer program operable on the processor, and the processor implements the steps of the method according to any one of the first aspect when executing the computer program.
In a fourth aspect, embodiments of the present invention provide a computer-readable storage medium storing machine executable instructions that, when invoked and executed by a processor, cause the processor to perform the method of any of the first aspects.
The invention provides a method and a device for optimizing a file question-answering system based on cooperative confrontation training, which comprises the following steps: generating an equivalent archive question-answering system according to the pre-acquired archive data set and the archive feature vector; generating a G-type bias archive sample and an O-type bias archive sample aiming at the equivalent archive question-answering system; constructing a plurality of G-type-O type bias archive sample pairs according to the similarity of the samples to obtain a plurality of bias archive sample pair sets for collaborative countermeasure training; and performing cooperative confrontation training on the set by using the prejudice file sample to eliminate the prejudice of the original file question-answering system so as to obtain a fair file question-answering system. The method solves the problems that the existing file question-answering system is easily influenced by bias factors, has low stability and impartial decision results, and achieves the technical effects of eliminating the bias of the original file question-answering system and improving the accuracy of the returned results of the question-answering system.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic flow diagram of an archive question-answering system optimization method based on collaborative confrontation training according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an archival question-answering system model based on collaborative confrontation training according to an embodiment of the present invention;
FIG. 3 is a schematic flow chart of a method for optimizing a document question-answering system based on collaborative confrontation training;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, as presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Some embodiments of the invention are described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
With the rapid development of deep learning technology, deep learning models are widely applied to various fields, including crime prediction, criminal arrest, enterprise recruitment, salary assessment, vehicle search and the like. The archive question-answering system based on deep learning can meet the information query requirements of managers on persons with key attributes and relevant skills, can assist the public security system to quickly locate relevant suspicious persons and target vehicles, and can help users who lose vehicles to quickly find the vehicles and the like. However, in the application process, the return result of the file questioning and answering system often has problems such as bias and discrimination, for example, in the traffic file questioning and answering system, the prediction result of the target vehicle may be affected by factors such as vehicle texture, vehicle color and vehicle shape. That is to say, the existing archive question-answering system based on deep learning is susceptible to bias factors, and has the problems of low stability and impartial decision result.
Based on the above, the embodiment of the invention provides a method and a device for optimizing a file questioning and answering system based on collaborative confrontation training, so as to solve the problems that the existing file questioning and answering system is easily influenced by biased factors, low in stability and not fair in decision result.
To facilitate understanding of the present embodiment, first, a detailed description is given to an archive question-answering system optimization method based on collaborative confrontation training disclosed in the embodiment of the present invention, referring to a flowchart of an archive question-answering system optimization method based on collaborative confrontation training shown in fig. 1, where the method may be executed by an electronic device and mainly includes the following steps S110 to S140:
s110: generating an equivalent archive question-answering system according to an archive data set and an archive feature vector which are acquired in advance;
the archive data set is a data set formed by aiming at existing archive data, and contains all sample information of an existing archive, for example, sample attributes of each individual in the traffic archive data set include a brand, a model, a vehicle texture, a vehicle color, a vehicle shape and the like, the sample attributes also include sensitive attributes, and any one or more of the attributes can be used as the sensitive attributes according to actual application scenes, for example, the vehicle texture is the sensitive attributes.
S120: generating a G-type bias archive sample and an O-type bias archive sample aiming at the equivalent archive question-answering system;
s130: constructing a plurality of G-O type bias archive sample pairs according to the similarity of the G type bias archive sample and the O type bias archive sample to obtain a plurality of bias archive sample pair sets for collaborative countermeasure training;
s140: and performing cooperative confrontation training on the set by using the prejudice file sample to eliminate the prejudice of the original file question-answering system so as to obtain a fair file question-answering system.
As an embodiment, before the step S110 of generating the equivalent archive question answering system, the method further includes:
(1) Acquiring an archive data set; the archive data set comprises a training set and a test set;
(2) Converting file sample data in a text form into a file feature vector by using a feature embedding technology word2vec algorithm;
(3) Determining an original archive question-answering system according to an archive question-answering system model; the archival question-and-answer system model includes a long-short term memory model LSTM.
Wherein, according to the archives data set and archives eigenvector generation equivalent archives inquiry-answering system that acquire in advance, include: firstly, inputting the file feature vectors into an original file question-answering system to generate an output confidence coefficient of each file feature vector; and then training the original file question-answering system by using the file characteristic vector and the output confidence coefficient to generate an equivalent file question-answering system.
As a specific example, generating G-type bias profile samples and O-type bias profile samples for an equivalent profile question-answering system includes:
1) Generating a G-type bias archive sample aiming at an equivalent archive question-answering system based on gradient attack;
2) Generating an O-shaped bias archive sample aiming at an equivalent archive question-answering system based on optimization attack;
3) Respectively establishing corresponding bias archive sample training data sets based on the G-type bias archive sample and the O-type bias archive sample;
wherein the gradient attack comprises: adding a first perturbation to the sample to increase the loss of the equivalent archive question-answering system; optimizing the attack includes: adding a second perturbation to the sample to make the equivalent archive question-answering system give an error label, wherein the second perturbation is generally an imperceptible perturbation added to the sample, and can make the model give an error label with high confidence. Specifically, the disturbance is usually adjusted according to different demand scenarios corresponding to the corresponding threshold range. For example: when the first disturbance magnitude is from the threshold value A to the threshold value B, the loss of the model can be increased; and when the second disturbance is smaller than the threshold value C, the second disturbance is an imperceptible disturbance added to the sample.
In an embodiment, the constructing a plurality of G-O type bias profile sample pairs according to the similarity of the samples in the step S130 to obtain a plurality of bias profile sample pair sets for collaborative countermeasure training includes:
(1) Constructing a plurality of G-type-O type prejudice archive sample pairs according to the similarity of the samples;
sample pair definition: hypothesis sampleStructure ofWherein the third dimension is a sensitive attribute, that is, x and x' are identical except for the sensitive attribute, and the attributes are considered similar.
Wherein the sensitive attribute may be vehicle texture, vehicle color, vehicle shape, and the like.
(2) Calculating the fairness contribution value of each G-O type prejudice archive sample to the equivalent archive question-answering system;
the fairness contribution value can be calculated according to the following method, specifically including: and sequencing the sample pairs from large to small according to the similarity sequencing, calculating an accumulated value of probability differences (A =0, Y = 0) - (A =1, Y = 1) | of each sample pair, and dividing the accumulated value by the total number of samples to obtain a fairness contribution value of each sample pair. Where (a =0, y = 0) is the probability that the value of the dimension-sensitive attribute is 0 while the label is 0, and (a =1, y = 1) is the probability that the value of the dimension-sensitive attribute is 1 while the label is 1.
Where a =0, i.e., the sensitivity value is 0, and a =1, i.e., the sensitivity value is 1.Y =0, i.e. the label is 0 corresponding to the marked negative example in the archive data set; y =1, i.e. a label of 1, corresponds to a marked positive sample in the archival data set.
(3) And performing descending order on the G-type-O-type bias archive sample pairs according to the fairness contribution value to generate a plurality of bias archive sample pair sets for collaborative countermeasure training.
That is, the indexes of the sample pairs with the cumulative percentage of more than 80% in the above all sample pair fairness contribution values are determined, and the first 80% is the descending order of the required G-O type bias profile sample pairs from large to small.
In one embodiment, the collaborative countermeasure training for the set using the biased profile samples in step S140 includes: and taking a plurality of G-type-O type bias archive sample pairs as training samples, and inputting the training samples into an equivalent archive question-answering system for training.
In an embodiment, the above method for optimizing a dossier question-answering system based on collaborative confrontation training may further include:
testing a fair file question-answering system by using a test set;
when the test result meets the equal opportunity of the fairness evaluation index, the model is considered to be fair after being trained; the chance equality formula is:
wherein,representing model predictions, A is a sensitivity attribute, Y represents a label in the dataset, Y represents a target label and Y represents a target labelY {0,1}; and when the results of the left side and the right side of the above formula are equal, the model is considered to achieve the depolarization effect.
As a specific example, with reference to the schematic structural diagram of the archival question-and-answer system model based on the collaborative countermeasure training shown in fig. 2, a archival question-and-answer system optimization method based on the collaborative countermeasure training shown in fig. 3 is introduced, and a specific flow of the archival question-and-answer system optimization method based on the collaborative countermeasure training is as follows:
1) Data pre-processing
1.1 Training the data set with the archival data set:
and adopting the archive data set as a training data set of an archive question-answering system optimization method based on cooperative confrontation training. The archive data set is a data set formed by aiming at the existing archive data, and contains all sample information of the existing archive, for example, the sample attribute of each individual in the traffic archive data set comprises the existing brand, model, vehicle texture, vehicle color, vehicle shape and the like, and the sample attribute also comprises a sensitive attribute, for example, the vehicle texture is a sensitive attribute.
However, research studies have found that the sensitive property of vehicle texture is often biased in the archival data set.
1.2 Partition data set:
the archive data set is composed of 10000 samples, and the invention takes 5: a ratio of 1 divides the training set and the test set.
1.3 Obtain the archive feature vector:
aiming at the existing archive data set, converting archive sample data in a text form into archive feature vectors by using a feature embedding technology word2vec algorithm; the model structure of word2vec consists of an input, an intermediate layer and an output. The input is a One-Hot vector; the middle layer is a hidden layer without an activation function; the dimensionality of the output layer is the same as that of the input layer, and Softmax regression is adopted. The Loss function is generally cross entropy, and a gradient descent algorithm is adopted to update the weight.
2) Model construction
2.1 Select archive question-answering system model
The LSTM is used as a file question-answer system model, and Long-short-term memory (LSTM) is a special RNN and mainly aims to solve the problems of gradient disappearance and gradient explosion in the Long sequence training process. In short, LSTM can perform better in longer sequences than normal RNNs.
2.2 Question-answering system for constructing equivalent archives
Aiming at the existing archive data set, converting archive sample data in a text form into archive feature vectors by using a feature embedding technology word2vec algorithm; then inputting the file feature vectors into an original file question-answering system to obtain the output confidence of each file feature vector; then, training a new archive question-answering system by using the archive feature vectors and the output confidence coefficient, wherein the new archive question-answering system is an equivalent archive question-answering system; the equivalent archive question-answering system and the original archive question-answering system have the same network structure, but the used training data labels are different, and the weight parameters in the network are also different.
3) Model depolarization
3.1 Create G-type bias archive samples
And generating a bias archive sample aiming at the equivalent archive question-answering system based on the gradient attack, and establishing a G-type bias archive sample training data set. Modifying the vehicle texture information in the existing archive sample data set, and converting the modified archive sample data into archive feature vectors by using a word2vec algorithm; inputting the characteristic vectors into an equivalent archive question-answering system, deriving a system input layer by a system output layer to obtain gradient information, and calculating disturbance by using the gradient information to obtain a bias sample archive; and repeating the operation to calculate the bias sample file corresponding to each original file, and establishing a bias sample file training data set named as a G-type bias sample file training data set.
3.2 Create a sample of O-bias files
And generating a bias sample file aiming at the equivalent file question-answering system based on optimization attack, and establishing an O-shaped bias sample file training data set. Modifying the vehicle texture information in the existing archive data set, and converting the modified archive text data into a feature vector by using a word2vec function; inputting the characteristic vectors into an equivalent archive question-answering system, and calculating disturbance by using random noise optimization to obtain a bias sample archive, wherein an optimization object is a confidence value of an output layer of the equivalent archive question-answering system; and repeating the operation to calculate the bias sample file corresponding to each original file, and establishing a bias sample file training data set named as an O-shaped bias sample file training data set.
3.2 ) depolarization operation
And establishing an ordered sample pair set for collaborative confrontation training according to the G-type bias sample archive training data set and the O-type bias sample archive training data set. Establishing G-type-O type sample pairs according to the similarity of the samples, and calculating the fairness contribution value of each pair of G-type-O type sample pairs to an equivalent archive question-answering system; and performing descending sequencing on the G-O type sample pairs according to the contribution values to obtain an ordered sample pair set for the cooperative countermeasure training.
And performing G-type and O-type cooperative confrontation training by utilizing the ordered sample pair set to eliminate the prejudice of the original file question-answering system, thereby obtaining a fair file question-answering system. The cooperative confrontation training process is to input the mixture of the G-type bias sample file, the O-type bias sample file and the original sample file into the model for training.
4) Test model
Inputting the test set divided in step 1.2) into the model shown in FIG. 2When the test result of the test set meets the fairness assessment index chance equality, the model is considered to be fair after training.
Wherein, the formula of chance equality is:
in the above-mentioned formula, the compound has the following structure,representing model prediction, wherein A is a sensitive attribute, Y represents a label in a data set, Y represents a target label and Y belongs to Y {0,1}; and when the results of the left side and the right side of the above formula are equal, the model is considered to achieve the depolarization effect.
According to the optimization method of the archive question-answering system based on the confrontation samples, the G-type and O-type cooperative confrontation training is carried out by utilizing the ordered sample pair set to eliminate the prejudice of the original archive question-answering system, so that the fair archive question-answering system is obtained.
Firstly, finding the prejudice and discrimination existing in a file question-answering system based on a confrontation sample according to known sensitivity attributes, and positioning a corresponding prejudice nerve layer; and then, the confrontation sample and the normal sample are mixed to retrain the bias neural layer in the file question-answering system, so that bias factors in the file question-answering system are eliminated quickly and lightly, and a set of file question-answering system capable of making fair decision is obtained.
In addition, the embodiment of the present invention further provides an archive question-answering system optimization device based on collaborative confrontation training, including:
the system comprises a question-answering system generating module, a file characteristic vector generating module and a file data set generating module, wherein the question-answering system generating module is used for generating an equivalent file question-answering system according to a file data set and a file characteristic vector which are acquired in advance;
the data set establishing module is used for generating a G-type bias archive sample and an O-type bias archive sample aiming at the equivalent archive question-answering system and establishing a corresponding bias archive sample training data set;
the sample pair set generation module is used for constructing a plurality of G-O type bias archive sample pairs according to the similarity of the G type bias archive samples and the O type bias archive samples to obtain a plurality of bias archive sample pair sets used for collaborative confrontation training;
and the training module is used for performing collaborative confrontation training on the set by utilizing the bias archive samples so as to eliminate the bias of the original archive question-answering system and obtain a fair archive question-answering system.
In one embodiment, the apparatus may further include: the test module is used for testing the fair file question-answering system by using a test set; when the test result meets the equal probability of the fairness evaluation index, the model is considered to be fair after training; the chance equality formula is:
wherein,representing model prediction, wherein A is a sensitive attribute, Y represents a label in a data set, Y represents a target label and Y belongs to Y {0,1}; and when the results of the left side and the right side of the above formula are equal, the model is considered to achieve the depolarization effect.
The archive question-answering system optimization device based on collaborative confrontation training provided by the embodiment of the application can be specific hardware on equipment or software or firmware installed on the equipment and the like. The device provided by the embodiment of the present application has the same implementation principle and technical effect as the foregoing method embodiments, and for the sake of brief description, reference may be made to the corresponding contents in the foregoing method embodiments where no part of the device embodiments is mentioned. It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the foregoing systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. The device for optimizing the file questioning and answering system based on the cooperative countermeasure training provided by the embodiment of the application has the same technical characteristics as the method for optimizing the file questioning and answering system based on the cooperative countermeasure training provided by the embodiment, so that the same technical problems can be solved, and the same technical effect can be achieved.
The embodiment of the application further provides an electronic device, and specifically, the electronic device comprises a processor and a storage device; the storage means has stored thereon a computer program which, when executed by the processor, performs the method of any of the above described embodiments.
Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application, where the electronic device 400 includes: a processor 40, a memory 41, a bus 42 and a communication interface 43, wherein the processor 40, the communication interface 43 and the memory 41 are connected through the bus 42; the processor 40 is arranged to execute executable modules, such as computer programs, stored in the memory 41.
The Memory 41 may include a high-speed Random Access Memory (RAM) and may also include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The communication connection between the network element of the system and at least one other network element is realized through at least one communication interface 43 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, etc. may be used.
The bus 42 may be an ISA bus, a PCI bus, an EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 4, but this does not indicate only one bus or one type of bus.
The memory 41 is used for storing a program, and the processor 40 executes the program after receiving an execution instruction, and the method performed by the apparatus defined by the flow program disclosed in any of the foregoing embodiments of the present invention may be applied to the processor 40, or implemented by the processor 40.
The processor 40 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 40. The Processor 40 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory 41, and the processor 40 reads the information in the memory 41 and completes the steps of the method in combination with the hardware thereof.
Corresponding to the method, the embodiment of the application also provides a computer readable storage medium, wherein the computer readable storage medium stores machine executable instructions, and when the computer executable instructions are called and executed by a processor, the computer executable instructions cause the processor to execute the steps of the method.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments provided in the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, an electronic device, or a network device) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk, and various media capable of storing program codes.
It should be noted that: like reference numbers and letters indicate like items in the figures, and thus once an item is defined in a figure, it need not be further defined or explained in subsequent figures, and moreover, the terms "first," "second," "third," etc. are used merely to distinguish one description from another and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and these modifications or substitutions do not depart from the spirit of the corresponding technical solutions of the embodiments of the present invention.
Claims (7)
1. A method for optimizing a file question-answering system based on collaborative confrontation training is characterized by comprising the following steps:
generating an equivalent archive question-answering system according to the pre-acquired archive data set and the archive feature vector; wherein the archive data set contains sample attributes of an existing archive, the sample attributes including sensitivity attributes;
generating a G-type bias archive sample aiming at the equivalent archive question-answering system based on gradient attack; generating an O-shaped bias archive sample aiming at the equivalent archive question-answering system based on optimization attack;
respectively establishing corresponding bias archive sample training data sets based on the G-type bias archive sample and the O-type bias archive sample;
wherein the gradient attack comprises: adding a first perturbation to the sample to increase the loss of the equivalence profile question-answering system; the optimization attack comprises the following steps: adding a second perturbation to the sample to enable the equivalent archive question-answering system to give an error label; constructing a plurality of G-O type bias archive sample pairs according to the similarity of the G type bias archive samples and the O type bias archive samples;
calculating the fairness contribution value of each G-O type prejudice archive sample to the equivalent archive question-answering system;
the method for calculating the fairness contribution value comprises the following steps: sorting the sample pairs from large to small according to similarity sorting, calculating an accumulated value of probability difference (A =0, Y = 0) - (A =1, Y = 1) | of each sample pair, and dividing the accumulated value by the total number of samples to obtain a fairness contribution value of each sample pair; wherein (a =0, y = 0) is the probability that the value of the sensitive attribute is 0 while the label is 0; (a =1, y = 1) is the probability that the value of the sensitive attribute is 1 while the label is 1; a =0, i.e. the value of the sensitive attribute is 0, a =1, i.e. the value of the sensitive attribute is 1; y =0, i.e. the label is 0 corresponding to the marked negative example in the archive data set; y =1, i.e. the label is 1 corresponding to the marked positive sample in the archive data set;
performing descending order on the G-type-O type bias archive samples according to the fairness contribution values to generate a plurality of bias archive sample pair sets for collaborative confrontation training;
performing collaborative confrontation training on the set by using the bias archive sample to eliminate the bias of the original archive question-answering system and obtain a fair archive question-answering system;
testing the fair file question-answering system by using a test set;
when the test result meets the equal probability of the fairness evaluation index, the model is considered to be fair after training; the formula for the chance equality is:
wherein,representing model predictions, A is a sensitive attribute, Y represents a tag in the dataset, Y represents a target tag and Y represents a target tagY {0,1}; when the results of the left side and the right side of the above formula are equal, the model is considered to reach the depolarization effectAnd (5) fruit.
2. The method of claim 1, wherein before generating the equivalent archive question answering system from the pre-acquired archive data sets and archive eigenvectors, comprising:
acquiring an archive data set; the archival data set includes a training set and a test set;
converting archive sample data in a text form into archive feature vectors by using a feature embedding technology word2vec algorithm;
determining an original archive question-answering system according to an archive question-answering system model; the archival question-answering system model includes a long-short term memory model LSTM.
3. The method of claim 2, wherein generating an equivalent archive question-and-answer system based on the pre-acquired archive dataset and archive eigenvector comprises:
inputting the file feature vectors into the original file question-answering system to generate an output confidence coefficient of each file feature vector;
and training the original archive question-answering system by using the archive feature vectors and the output confidence coefficient to generate an equivalent archive question-answering system.
4. The method of claim 1, wherein utilizing the bias profile sample for collaborative countermeasure training of a set comprises:
and taking the plurality of G-type-O type bias archive sample pairs as training samples, and inputting the training samples into the equivalent archive question-answering system for training.
5. An archive question-answering system optimization device based on cooperative confrontation training is characterized by comprising:
the system comprises a question-answering system generating module, a file characteristic vector generating module and a file data set generating module, wherein the question-answering system generating module is used for generating an equivalent file question-answering system according to a file data set and a file characteristic vector which are acquired in advance; the archive data set comprises sample attributes of the existing archive, wherein the sample attributes comprise sensitivity attributes;
the data set establishing module is used for generating a G-type bias archive sample aiming at the equivalent archive question-answering system based on gradient attack; generating an O-shaped bias archive sample aiming at the equivalent archive question-answering system based on optimization attack; respectively establishing corresponding bias archive sample training data sets based on the G-type bias archive sample and the O-type bias archive sample;
wherein the gradient attack comprises: adding a first perturbation to the sample to increase the loss of the equivalence profile question-answering system; the optimization attack comprises the following steps: adding a second perturbation to the sample to enable the equivalent archive question-answering system to give an error label;
a sample pair set generation module for constructing a plurality of G-O type bias archive sample pairs according to the similarity between the G type bias archive samples and the O type bias archive samples; calculating the fairness contribution value of each G-O type prejudice archive sample to the equivalent archive question-answering system; the method for calculating the fairness contribution value comprises the following steps: sorting the sample pairs from large to small according to similarity sorting, calculating an accumulated value of probability difference (A =0, Y = 0) - (A =1, Y = 1) | of each sample pair, and dividing the accumulated value by the total number of samples to obtain a fairness contribution value of each sample pair; where (a =0, y = 0) is the probability that the value of the sensitive attribute is 0 while the label is 0; (a =1, y = 1) is the probability that the value of the sensitive attribute is 1 while the label is 1; a =0, i.e. the value of the sensitivity attribute is 0, a =1, i.e. the value of the sensitivity attribute is 1; y =0, i.e. the label is 0 corresponding to the marked negative example in the archive data set; y =1, i.e. the label is 1 corresponding to the marked positive sample in the archive data set; performing descending order on the G-type-O type bias archive samples according to the fairness contribution values to generate a plurality of bias archive sample pair sets for collaborative confrontation training;
the training module is used for performing collaborative confrontation training on the set by utilizing the bias archive sample so as to eliminate the bias of an original archive question-answering system and obtain a fair archive question-answering system;
the test module is used for testing the fair file question-answering system by using a test set; when the test result meets the equal probability of the fairness evaluation index, the model is considered to be fair after training; the formula for the chance equality is:
wherein,representing model predictions, A is a sensitivity attribute, Y represents a label in the dataset, Y represents a target label and Y represents a target labelY {0,1}; and when the results of the left side and the right side of the above formula are equal, the model is considered to achieve the depolarization effect.
6. An electronic device comprising a memory and a processor, wherein the memory stores a computer program operable on the processor, and wherein the processor implements the steps of the method of any of claims 1 to 4 when executing the computer program.
7. A computer readable storage medium having stored thereon machine executable instructions which, when invoked and executed by a processor, cause the processor to execute the method of any of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210828777.1A CN115017290B (en) | 2022-07-15 | 2022-07-15 | File question-answering system optimization method and device based on cooperative confrontation training |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210828777.1A CN115017290B (en) | 2022-07-15 | 2022-07-15 | File question-answering system optimization method and device based on cooperative confrontation training |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115017290A CN115017290A (en) | 2022-09-06 |
CN115017290B true CN115017290B (en) | 2022-11-08 |
Family
ID=83081180
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210828777.1A Active CN115017290B (en) | 2022-07-15 | 2022-07-15 | File question-answering system optimization method and device based on cooperative confrontation training |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115017290B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111898731A (en) * | 2020-06-24 | 2020-11-06 | 北京航空航天大学 | Bias-based universal countermeasure patch generation method and device |
CN114419379A (en) * | 2022-03-30 | 2022-04-29 | 浙江大学 | System and method for improving fairness of deep learning model based on antagonistic disturbance |
CN114462466A (en) * | 2021-12-06 | 2022-05-10 | 浙江工业大学 | Deep learning-oriented data depolarization method |
CN114626507A (en) * | 2022-03-15 | 2022-06-14 | 西安交通大学 | Method, system, device and storage medium for generating confrontation network fairness analysis |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11934969B2 (en) * | 2019-10-01 | 2024-03-19 | International Business Machines Corporation | Bias identification in cognitive computing systems |
EP3910479A1 (en) * | 2020-05-15 | 2021-11-17 | Deutsche Telekom AG | A method and a system for testing machine learning and deep learning models for robustness, and durability against adversarial bias and privacy attacks |
CN112115963B (en) * | 2020-07-30 | 2024-02-20 | 浙江工业大学 | Method for generating unbiased deep learning model based on transfer learning |
CN114492830A (en) * | 2021-12-16 | 2022-05-13 | 浙江工业大学 | Deep learning model depolarization method and device based on individual discrimination example pair generation |
-
2022
- 2022-07-15 CN CN202210828777.1A patent/CN115017290B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111898731A (en) * | 2020-06-24 | 2020-11-06 | 北京航空航天大学 | Bias-based universal countermeasure patch generation method and device |
CN114462466A (en) * | 2021-12-06 | 2022-05-10 | 浙江工业大学 | Deep learning-oriented data depolarization method |
CN114626507A (en) * | 2022-03-15 | 2022-06-14 | 西安交通大学 | Method, system, device and storage medium for generating confrontation network fairness analysis |
CN114419379A (en) * | 2022-03-30 | 2022-04-29 | 浙江大学 | System and method for improving fairness of deep learning model based on antagonistic disturbance |
Non-Patent Citations (1)
Title |
---|
"Siasmese-ELECTRA网络结合对抗训练的FAQ问答模型研究";王仲林 等;《软件导刊》;20210831;第20卷(第8期);58-64页 * |
Also Published As
Publication number | Publication date |
---|---|
CN115017290A (en) | 2022-09-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111783875A (en) | Abnormal user detection method, device, equipment and medium based on cluster analysis | |
Gong et al. | Loss decomposition and centroid estimation for positive and unlabeled learning | |
CN109657947B (en) | Enterprise industry classification-oriented anomaly detection method | |
CN110852881B (en) | Risk account identification method and device, electronic equipment and medium | |
CN111783505A (en) | Method and device for identifying forged faces and computer-readable storage medium | |
US10546106B2 (en) | Biometric verification | |
EP3591545A1 (en) | Method for co-clustering senders and receivers based on text or image data files | |
CN111340144A (en) | Risk sample detection method and device, electronic equipment and storage medium | |
CN113434684B (en) | Rumor detection method, system, equipment and storage medium for self-supervision learning | |
CN115473726B (en) | Domain name identification method and device | |
CN115222443A (en) | Client group division method, device, equipment and storage medium | |
CN115034315A (en) | Business processing method and device based on artificial intelligence, computer equipment and medium | |
CN111786999B (en) | Intrusion behavior detection method, device, equipment and storage medium | |
CN113837836A (en) | Model recommendation method, device, equipment and storage medium | |
CN115017290B (en) | File question-answering system optimization method and device based on cooperative confrontation training | |
CN110427496B (en) | Knowledge graph expansion method and device for text processing | |
CN113591892A (en) | Training data processing method and device | |
US20170053024A1 (en) | Term chain clustering | |
CN114528908A (en) | Network request data classification model training method, classification method and storage medium | |
CN113705692A (en) | Emotion classification method and device based on artificial intelligence, electronic equipment and medium | |
CN113469033A (en) | Image recognition method and device, electronic equipment and storage medium | |
CN112507912A (en) | Method and device for identifying illegal picture | |
CN112463964A (en) | Text classification and model training method, device, equipment and storage medium | |
CN111461199A (en) | Security attribute selection method based on distributed junk mail classified data | |
CN110348189A (en) | A kind of identity spoofing detection method and its system, device, storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |