Debiasing method and device for deep transfer learning

By introducing attention mechanisms and orthogonal operations in transfer learning, the problem that teacher model bias in transfer learning affects the fairness of students' models is solved, improving the interpretability of the model and achieving fairness verification.

CN113298254BActive Publication Date: 2024-11-26ZHEJIANG UNIV OF TECH
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202110649889.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-10
Publication Date
2024-11-26
Estimated Expiration
2041-06-10

AI Technical Summary

Technical Problem

The pre-trained teacher models in transfer learning may be biased, affecting the fairness of downstream student models, especially in prediction tasks involving sensitive attributes, resulting in unfair bias in certain groups or individuals.

Method used

By introducing attention mechanisms and orthogonal operations, we obtain source and target domain data sets, extract category labels and sensitive attribute labels, build a fully connected neural network as a teacher model, fix parameter optimization feature extractor, and add it in the student model The attention mechanism layer performs orthogonal operations of sensitive attribute eigenvectors and other eigenvectors to remove bias.

Benefits of technology

Improve the interpretability of the model and validate it through test sets, the fairness of the migration model is achieved, ensuring equal opportunities for sensitive attributes in the predicted results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113298254B_ABST
    Figure CN113298254B_ABST
Patent Text Reader

Abstract

The present invention discloses a debiasing method and device for deep transfer learning, comprising: obtaining a source domain data set and a target domain data set, extracting category labels and sensitive attribute labels; constructing a fully connected neural network as a teacher model of a transfer model, and optimizing the network parameters of the teacher model using the source domain data set; fixing the network parameters of the first n fully connected layers of the teacher model with optimized parameters as a feature extractor, and adding m fully connected layers to the last layer of the teacher model to form a student model of the transfer model, and optimizing the network parameters of the student model using the target domain data set; adding an attention mechanism layer to the output of the feature extractor of the parameter-optimized student model, for extracting sensitive attributes from the output features in the feature extractor and determining the weights of the sensitive attributes; performing orthogonal operations on the feature vectors corresponding to the sensitive attributes and other feature vectors to remove the bias caused by the sensitive attributes of deep transfer learning, so as to achieve fairness in prediction results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of fairness of deep learning, and specifically relates to a debiasing method and a device thereof for deep transfer learning. Background Art

[0002] To achieve higher performance, deep learning models are becoming more and more complex. However, training these complex models from scratch requires a large amount of training data and computing resources. Typically, individual researchers and small companies cannot afford such resources.

[0003] To solve this problem, researchers proposed transfer learning. The general idea is for leading companies to collect large amounts of data from users and use large amounts of computing resources to pre-train complex deep learning models; then, the pre-trained models are released to downstream applications. At that point, individual researchers and small companies no longer need to train their complex deep learning models from scratch. Instead, they can use pre-trained models as a starting point and customize their own applications using local datasets. Generally speaking, in transfer learning, the pre-trained model is called a teacher model, and the downstream model is called a student model.

[0004] However, the pre-trained teacher model in transfer learning may be biased and pass on this bias to downstream student models. For example, in online advertising, the so-called prediction vendors make profits by selling their predictions to advertisers (e.g., person X may be interested in product Y), while data owners make profits by selling prediction-useful datasets to prediction vendors. Because the prediction vendor seeks to maximize the accuracy of its predictions, it may (intentionally or unintentionally) make predictions unfairly biased towards certain groups or individuals.

[0005] In view of the limitations of existing transfer model debiasing methods and the objectivity of transfer learning bias, a debiasing method for transfer learning is studied. Summary of the invention

[0006] The purpose of the present invention is to provide a debiasing method for transfer learning. The model is debiased by introducing an attention mechanism and an orthogonalization operation, thereby achieving fairness in the model prediction results.

[0007] The technical solutions adopted by the present invention to achieve the above-mentioned invention objects are as follows:

[0008] In a first aspect, a debiasing method for deep transfer learning comprises the following steps:

[0009] Obtain source domain datasets and target domain datasets, and extract category labels and sensitive attribute labels;

[0010] Construct a fully connected neural network as the teacher model of the transfer model, and use the source domain dataset to optimize the network parameters of the teacher model;

[0011] The network parameters of the first n fully connected layers of the teacher model with fixed parameter optimization remain unchanged as the feature extractor, and m fully connected layers are added to the last layer of the teacher model to form the student model of the transfer model. The network parameters of the student model are optimized using the target domain dataset.

[0012] Add an attention mechanism layer to the output of the feature extractor of the parameter-optimized student model to extract sensitive attributes from the output features in the feature extractor and determine the weights of the sensitive attributes;

[0013] The feature vectors corresponding to the sensitive attributes are orthogonalized with other feature vectors to remove the bias caused by the sensitive attributes of deep transfer learning.

[0014] The source domain dataset is the Credit dataset, the target domain dataset is the Census dataset, and the sensitive attribute is the gender attribute.

[0015] Preferably, the category label is encoded using one-hot encoding.

[0016] Preferably, the teacher model adopts a fully connected neural network consisting of 5 fully connected layers, n is 3, and m is 2.

[0017] Preferably, the teacher model uses SoftMax as an activation function to classify and identify data, and the loss function of the training process uses a cross entropy loss function.

[0018] Preferably, the student model uses SoftMax as an activation function to classify and identify data, and the loss function of the training process uses a cross entropy loss function.

[0019] Preferably, after the migration model training is completed, the fairness of the migration model is tested using the test set, and the formula for equal opportunity is:

[0020]

[0021] in It represents the predicted classification result of the migration model, Y and y are the real classification labels, and A is the sensitive attribute. When the results on both sides of the above formula are equal or similar, it is considered that the model has achieved the debiasing effect.

[0022] In a second aspect, a debiasing device for deep transfer learning comprises a computer memory, a computer processor, and a computer program stored in the computer memory and executable on the computer processor, wherein the computer processor implements the above-mentioned debiasing method for deep transfer learning when executing the computer program.

[0023] The beneficial effects of the present invention are mainly manifested in: by introducing an attention mechanism into the migration model to determine the weights of sensitive attributes, the interpretability of the model is improved; and an orthogonalization operation is introduced to debias the migration model. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0025] Figure 1 is a schematic diagram of the structure of a migration model provided by an embodiment;

[0026] Figure 2 This is a flowchart of a debiasing method for deep transfer learning provided by an embodiment. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific implementation methods described herein are only used to explain the present invention and do not limit the protection scope of the present invention.

[0028] Reference Figure 1-2 , a debiasing method for transfer learning provided in the embodiment, the steps are as follows:

[0029] Step 1: Data preprocessing.

[0030] In the embodiment, the Credit dataset is used as the source domain dataset for the debiasing method of transfer learning. The Credit dataset is a credit dataset in the UCI database, and its prediction task is to classify people described by a set of attributes as good or bad credit risks. The Credit dataset contains sample information of 1,000 people. The sample attributes of each individual include existing checking accounts, credit records, savings accounts / bonds, and houses, etc. The sample attributes also include sensitive attributes, for example, attribute 9 is gender. The Credit dataset uses 20 features to describe each individual, thereby predicting whether the individual's credit risk is good or bad. However, after investigation and research, it was found that there is a bias against the sensitive attribute of gender in the Credit dataset, where men are more likely to be classified as good credit risks than women.

[0031] The Census dataset is used as the target domain dataset for the debiasing method for transfer learning. The Census dataset is a census dataset in the UCI database. It was conducted by Barry Becker from the 1994 census database. The prediction task is to determine whether a person's annual income exceeds 50K. The Census dataset contains sample information of 48,842 people. The sample attributes of each individual include current age, job category, education level, etc. The sample attributes also include sensitive attributes. For example, attribute 10 is gender. The Census dataset uses 14 features to describe each individual, so as to predict whether a person's annual income exceeds 50K. However, after investigation and research, it was found that there is a bias in the sensitive attribute of gender in the Census dataset, where men are more likely to be classified as "high-income" people than women.

[0032] The present invention is a debiasing method for transfer learning. Therefore, in the data set preprocessing, the data sets in the source domain and the target domain need to be aligned, that is, the dimensions of the data sets in the source domain and the target domain need to be consistent before the migration operation can be performed. The dimension of the source domain data set Credit is 20, and the dimension of the target domain data set Census is 14. Therefore, 6 columns of all 0 are inserted into the target domain data set Census, so that both the source domain and the target domain data sets are 20-dimensional, so as to perform the migration operation.

[0033] After the alignment operation is completed, the data set is divided, specifically including: the Census data set consists of more than 40,000 samples, and the present invention divides the training set and the test set in a ratio of 5:1.

[0034] The preprocessing process also needs to extract category labels and sensitive attribute labels. Each sample in the Credit dataset has 20 category attributes, among which attribute 9 gender is a sensitive attribute. The category of the data is one-hot encoded to obtain the corresponding category label sequence. In the present invention, gender is used as a sensitive attribute. Men and women in the Credit dataset are divided into: men (divorced / separated), women (divorced / separated / married), men (single), men (married / widowed) and women (single). We consider the attribute "male" or "female" to be sensitive and perform binary processing on it. The sensitive attribute "male" is encoded as 1, and the sensitive attribute "female" is encoded as 0.

[0035] Each sample in the Census dataset has 14 category attributes, of which attribute 10 (gender) is a sensitive attribute, encoding "male" as 1 and "female" as 0.

[0036] Therefore, the source domain dataset of the migration model uses the Credit dataset, and the target domain dataset uses the Census dataset, where "gender" is used as a sensitive attribute in both the source domain and the target domain.

[0037] Step 2: Build and train the migration model.

[0038] Transfer learning is an effective way to transfer "knowledge" from a pre-trained model (teacher model) to a new model (student model). There are two ways to transfer from teacher model to student model. One is the feature extractor, which freezes the first K layers of the teacher model and trains the output layer of the student model. The other is fine-tuning, which uses the parameters of the teacher model as initialization and then fine-tunes the model using the dataset of the student model.

[0039] The migration model in this invention adopts the first method: feature extractor. The student model freezes the first K layers of the teacher model, where K≤N-1, and uses it as a feature extractor. Then, the student model uses back propagation to update the parameters of other layers using their local datasets.

[0040] Specifically, a fully connected neural network is constructed to train the source domain dataset Credit. The fully connected neural network has 5 layers, and the number of neurons in each layer is 64, 32, 16, 8, and 2 respectively. The fully connected layer uses SoftMax as the activation function to classify and identify the data. The loss function of the training process uses the cross entropy loss function (categorical_crossentropy), and the optimizer uses Adam. After this training, the teacher model Amodel is obtained.

[0041] Then freeze the first three layers of the obtained Amodel, add two more layers of network after Amodel to train the target domain dataset Census, use SoftMax as the activation function for the fully connected layer to classify and identify the data, use the cross entropy loss function (categorical_crossentropy) for the loss function of the training process, and use Adam as the optimizer. After this training, the student model Bmodel is obtained.

[0042] Step 3: Debiasing of the migration model.

[0043] An attention mechanism, that is, an Attention layer, is added after the feature layer of the Bmodel. The Attention mechanism is an attention mechanism. The present invention introduces an attention mechanism in the migration model, which can extract feature information from the input data and find sensitive attributes that have a greater impact on the output results. The introduction of the Attention mechanism can not only significantly improve the performance of the migration model, but also observe how the information in the input data affects the final output, which helps to better understand the internal operating mechanism of the model and improve the interpretability of the model.

[0044] Then, the samples with larger weights of sensitive attributes obtained in the Attention layer are debiased, that is, the feature vectors of sensitive attributes are orthogonalized with other attributes, so as to obtain a migration model and eliminate the influence of sensitive attributes, thereby achieving the debiasing effect.

[0045] Step 4: Test the fairness of the migration model.

[0046] In the embodiment, the divided test set is input into the migration model for testing. When the test result of the test set satisfies the fairness evaluation indicator of equal opportunity, it is considered that the migration model has achieved fairness after training.

[0047] The formula for equal opportunity is:

[0048]

[0049] in represents the model prediction, A is the sensitive attribute, and when the results on both sides of the above formula are equal or similar, it is considered that the model has achieved the debiasing effect.

[0050] The embodiment further provides a debiasing device for deep transfer learning, comprising a computer memory, a computer processor, and a computer program stored in the computer memory and executable on the computer processor. When the computer processor executes the computer program, the debiasing method for deep transfer learning is implemented, specifically comprising:

[0051] Step 1, data preprocessing;

[0052] Step 2: Build and train the migration model;

[0053] Step 3: Debiasing of the migration model;

[0054] Step 4: Test the fairness of the migration model.

[0055] The specific implementation methods described above provide a detailed description of the technical solutions and beneficial effects of the present invention. It should be understood that the above is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, supplements and equivalent substitutions made within the scope of the principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A debiasing method for deep transfer learning, It is characterized in that The following steps are involved: The prediction task is to take a credit dataset that classifies people described by a set of attributes as good or bad credit risks as the source domain dataset and a census dataset as the target domain dataset, extract category labels and sensitive attribute labels, where the sensitive attribute is the gender attribute; Construct a fully connected neural network as the teacher model of the transfer model, and use the source domain dataset to optimize the network parameters of the teacher model; The network parameters of the first n fully connected layers of the teacher model with fixed parameter optimization remain unchanged as the feature extractor, and m fully connected layers are added to the last layer of the teacher model to form the student model of the transfer model. The network parameters of the student model are optimized using the target domain dataset. Add an attention mechanism layer to the output of the feature extractor of the parameter-optimized student model to extract sensitive attributes from the output features in the feature extractor and determine the weights of the sensitive attributes; The feature vectors corresponding to the sensitive attributes are orthogonalized with other feature vectors to remove the bias caused by the sensitive attributes of deep transfer learning.

2. The debiasing method for deep transfer learning as claimed in claim 1, It is characterized in that The category labels are encoded using one-hot encoding.

3. The debiasing method for deep transfer learning according to claim 1, It is characterized in that The teacher model adopts a fully connected neural network consisting of 5 fully connected layers, where n is 3 and m is 2.

4. The debiasing method for deep transfer learning according to claim 1, It is characterized in that The teacher model uses SoftMax as the activation function to classify and identify the data, and the loss function of the training process uses the cross entropy loss function.

5. The debiasing method for deep transfer learning according to claim 1, It is characterized in that The student model uses SoftMax as the activation function to classify and identify data, and the loss function of the training process uses the cross entropy loss function.

6. The debiasing method for deep transfer learning according to claim 1, It is characterized in that After the migration model training is completed, the fairness of the migration model is tested using the test set. The formula for equal opportunity is: in It represents the predicted classification result of the migration model, Y and y are the real classification labels, A is the sensitive attribute, and when the results on both sides of the above formula are equal, it is considered that the model has achieved the debiasing effect.

7. A debiasing device for deep transfer learning, comprising a computer memory, a computer processor, and a computer program stored in the computer memory and executable on the computer processor, It is characterized in that When the computer processor executes the computer program, the debiasing method for deep transfer learning according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Adversarial learning-based gender prejudice removing image recognition model and application

    CN111753918A

  • Method for generating unbiased deep learning model based on transfer learning

    CN112115963A

  • Transfer learning and domain adaptation using distributable data models

    US20180197111A1