Network fairness repairing method based on key neuron positioning and reinforcement learning

By identifying significant compression layers and screening key neurons, combined with reinforcement learning to optimize the scaling factor, the efficiency and stability issues in fairness repair of neural networks are solved, and an efficient and stable fairness repair effect is achieved.

CN120597969APending Publication Date: 2025-09-05ANHUI UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510952746.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-10
Publication Date
2025-09-05

AI Technical Summary

Technical Problem

Existing neural network fairness repair technologies have shortcomings in efficiency, stability and repair effect. Especially in large and complex deep neural networks, the computational cost is high, the repair efficiency is low, the repair stability is poor, and it cannot effectively block the bias propagation chain within the model.

Method used

A random forest-based probe classifier is used to identify significantly compressed layers and screen out key neurons. Reinforcement learning is used to optimize the scaling factor of each key neuron to achieve fine-grained fairness repair of the neural network.

Benefits of technology

While controlling computational complexity, it significantly improves model fairness, reduces repair computational overhead, improves repair efficiency and stability, and maintains the model's predictive performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120597969A_ABST
    Figure CN120597969A_ABST
Patent Text Reader

Abstract

The invention relates to the field of artificial intelligence, in particular to a network fairness repairing method based on key neuron positioning and reinforcement learning. According to the method, a random forest is used as a probe classifier, after the probe classifier is inserted into each hidden layer in a neural network to be repaired by adopting a neural network instrumentation technology, the sensitive information amount of the hidden layers is estimated, then a significant compression layer of sensitive information is identified, local intervention is performed on the hidden layers before the layer, and the sensitive information is obtained. More efficient fairness improvement is realized under limited computing resources. Besides, key neurons playing a key role in spreading sensitive information in the to-be-repaired layer are further identified, and only the neurons are subjected to scaling adjustment, so that high calculation overhead and performance degradation caused by the fact that the neurons of all large-scale network layers need to be comprehensively repaired are overcome; the defects of efficiency, stability, repairing effect and the like of neural network fairness repairing are overcome.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence, and in particular to a network fairness repair method based on key neuron positioning and reinforcement learning, and a corresponding computer program product, storage medium, and computer device. Background Art

[0002] With the widespread application of neural networks in highly sensitive social fields such as financial credit assessment, disease diagnosis and prediction, and judicial sentencing assistance, the fairness of their decision-making outcomes has become an increasingly core issue in AI governance. Research has shown that when processing data containing sensitive attributes (such as gender, race, and age), neural network models often exhibit systematic biases against specific groups, leading to unfair predictions. This bias not only violates ethical and social principles but also may lead to legal risks and a crisis of public trust. Therefore, while ensuring model predictive performance, effectively remediating model unfairness has become a key challenge in achieving trustworthy AI deployment.

[0003] At present, the mainstream methods for neural network fairness repair can be divided into the following three categories: (1) Preprocessing methods, which attempt to weaken or eliminate the correlation of sensitive attributes in the data before model training by means of data resampling, feature anonymization, etc. Although this type of method can suppress explicit bias to a certain extent, it cannot prevent the model from implicitly capturing sensitive information through non-sensitive features (such as indirectly inferring race through zip codes), and excessive data "cleaning" often loses key semantics. In addition, in many real-world applications, developers cannot obtain complete original training data, which greatly reduces the practicality of this type of method. (2) Training phase optimization methods, which explicitly introduce fairness constraints during model training, such as adding differential regularization terms to the loss function, introducing adversarial networks and other mechanisms to limit the model's dependence on sensitive attributes. This type of method can improve the predictive fairness of the model group to a certain extent, but it also has the following problems: on the one hand, it is highly dependent on the training process and cannot be directly applied to trained or deployed models; on the other hand, it is sensitive to parameter selection and has weak transferability. The conflict between fairness and performance is significant, and it is difficult to obtain an ideal trade-off solution. (3) Post-processing methods mainly make adjustments at the model output stage, such as redistributing the model decision results through strategies such as threshold calibration and output distribution rebalancing. This type of method does not require access to training data or the training process and is flexible in application. However, it can only modify the surface results at the prediction level and cannot block the bias propagation chain from features to predictions within the model. Moreover, global intervention may lead to unstable overall model performance.

[0004] In recent years, inspired by research on "model repairability" in explainable artificial intelligence and software engineering, some scholars have proposed post-processing repairs through neuron-level intervention. For example, causal inference methods can be used to locate key neurons in the model that cause unfairness, and then their weights can be adjusted through search algorithms or randomized strategies can be used to find the optimal neuron dropout combination to weaken the bias propagation path. These methods can achieve refined repairs to a certain extent, but when faced with large and complex deep neural networks, they still generally face the problems of high computational cost, low repair efficiency, and poor repair stability. The main reason for this phenomenon is that they usually perform unified repairs on the entire model, resulting in huge computational overhead and the potential introduction of new errors, affecting predictive performance. Summary of the Invention

[0005] In order to address the shortcomings of existing neural network fairness repair technologies in terms of efficiency, stability and repair effect, the present invention provides a network fairness repair method based on key neuron positioning and reinforcement learning, and its corresponding computer program product, storage medium and computer device.

[0006] The technical solutions provided by the present invention are as follows:

[0007] A network fairness restoration method based on key neuron positioning and reinforcement learning, which includes:

[0008] Obtaining in-painted datasets for unfair target neural network inference process.

[0009] A random forest-based probe classifier is inserted into each hidden layer of the target neural network; the probe classifier takes the output of each neuron in the hidden layer as input and predicts the corresponding sensitive attribute.

[0010] During the inference process of the target neural network on the repaired dataset, the hook function is used to extract the output of each neuron in each hidden layer, and the corresponding sensitive attribute labels are combined to complete the training of the probe classifier, thereby obtaining the balanced accuracy of each probe classifier and the feature importance value of each neuron in its corresponding hidden layer.

[0011] The balanced accuracy of each probe classification is used as an estimate of the amount of sensitive information in the corresponding layer. The compression ratio of each hidden layer relative to the previous layer is calculated, and the hidden layers before the significantly compressed layer with the highest compression ratio are selected as the layers to be repaired. In each layer to be repaired, neurons with feature importance values ​​above a preset importance threshold are selected as key neurons.

[0012] A scaling factor is assigned to each key neuron in the target neural network, and a reward function that considers both fairness and performance metrics is designed. The optimal scaling factor of each key neuron is iteratively optimized through a reinforcement learning strategy, thereby completing the fairness repair of the target neural network.

[0013] As a further improvement of the present invention, the target neural network is defined to consist of L layers, denoted as {l0,l1,…,l L-1}; where l0 is the input layer, l L-1 is the output layer, and the rest are hidden layers. Then the compression rate r of the sensitive information of the hidden layer l is l The calculation formula is as follows:

[0014]

[0015] In the above formula, BA l and BA l-1 They represent the balanced accuracy values ​​of hidden layer l and hidden layer l-1 respectively.

[0016] As a further improvement of the present invention, the following criterion is used to identify the significant compression layer l* from each hidden layer:

[0017]

[0018] As a further improvement of the present invention, the key neuron set N including all key neurons key Satisfy the following formula:

[0019]

[0020] In the above formula, (l,n) represents the nth neuron in the hidden layer l; represents the feature importance value of the nth neuron in the hidden layer l; E represents the set of layers to be repaired, E = {l1,l2,…,l*-1}.

[0021] As a further improvement of the present invention, the scaling factor of each key neuron is iteratively optimized using SARSA, DDPG, A2C, PPO, TRPO and GRPO algorithms based on a reinforcement learning strategy.

[0022] Defining the state space in reinforcement learning Each state s in is as follows:

[0023]

[0024] in, Represents the set of scaling factors of all key neurons in the network model; Fairness represents the fairness measure of the network model in the current state, and Performance represents the performance measure of the network model in the current state.

[0025] Action Space Each action a in is represented by a new scaling factor A combination of , used to replace the current scaling factors of each key neuron

[0026]

[0027] The policy network π directly outputs a new scaling factor value in each iteration.

[0028] Design a reward function that considers both fairness and performance for:

[0029]

[0030] In the above formula, Fairness represents the fairness metric of the model; Performance represents the performance metric of the model; and λ is the trade-off coefficient used to regulate the relative importance of fairness and performance.

[0031] As a further improvement of the present invention, in the iterative optimization process of the scaling factor of the key neurons based on reinforcement learning, SPD, AOD or EOD is used as an evaluation indicator of the fairness metric; and Accuracy or F1 is used as an evaluation indicator of the performance metric.

[0032] As a further improvement of the present invention, after repair, the output of any key neuron (l,n) is updated to

[0033]

[0034] In the above formula, represents the original output of the key neuron (l,n) before repair; represents the optimal scaling factor of the key neuron (l,n) after iterative optimization by reinforcement learning.

[0035] The present invention also includes a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the steps of the network fairness repair method based on key neuron positioning and reinforcement learning as described above, thereby locating the key neurons in the unfair neural network model and updating the output of each key neuron using the optimal scaling factor to achieve fairness repair of the target neural network.

[0036] The present invention also includes a storage medium storing a computer program. When the computer program is executed by a processor, the steps of the aforementioned network fairness repair method based on key neuron positioning and reinforcement learning are implemented, thereby locating the key neurons in the unfair neural network model and updating the output of each key neuron using the optimal scaling factor to achieve fairness repair of the target neural network.

[0037] The present invention also includes a computer device, which includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the computer program is executed by the processor, it implements the steps of the network fairness repair method based on key neuron positioning and reinforcement learning as described above, thereby locating the key neurons in the unfair neural network model and updating the output of each key neuron using the optimal scaling factor to achieve fairness repair of the target neural network.

[0038] The present invention has the following beneficial effects:

[0039] The present invention provides a network fairness repair method based on key neuron positioning and reinforcement learning. The method first uses a probe classifier based on random forest to identify the significant compression layer with the highest compression rate for sensitive information in the hidden layer of the neural network, and identifies the layer as the critical layer that changes the way sensitive information is propagated in the network. Then, each hidden layer before the significant compression layer that can realize the explicit propagation of sensitive information is used as a layer to be repaired, so as to improve the repair efficiency of the invention scheme. Then, the probe classifier is further used in the layer to be repaired to screen out the key neurons that play a key role in the propagation of sensitive information, thereby narrowing the scope of the operation objects of the repair process. Finally, the present invention assigns a scaling factor to each key neuron, and optimizes the optimal scaling factor of each key neuron through reinforcement learning, so as to use the optimal scaling factor to achieve a more refined fairness repair of the output of the neural network.

[0040] The solution of the present invention can accurately identify the key layers where sensitive information is significantly compressed by performing hierarchical analysis on the amount of sensitive information, and then focus on the front layers with strong propagation for local intervention; and further locate key neurons and implement minimization adjustments; thereby effectively improving the fairness of the model while controlling the computational complexity. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 This is a flowchart of the steps of the network fairness repair method based on key neuron positioning and reinforcement learning provided in Example 1 of the present invention.

[0042] Figure 2 4 is a flowchart of the steps of the method for identifying a significantly compressed layer in Example 1 of the present invention. DETAILED DESCRIPTION

[0043] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0044] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this invention pertains. The terms used herein in the specification of the present invention are for the purpose of describing specific embodiments only and are not intended to limit the present invention. The term "or / and" as used herein includes any and all combinations of one or more of the associated listed items.

[0045] Example 1

[0046] Essentially, a key source of unfairness in neural networks lies in the propagation of sensitive attribute information within the network. When processing data, models often unconsciously prioritize sensitive attributes, gradually amplifying and encoding this information through layers of neurons, ultimately influencing decision-making outcomes. If left unchecked, this can easily lead to systematic discrimination against certain groups. Based on this, and inspired by the information bottleneck theory, researchers working in this embodiment discovered that different layers in a network model have varying abilities to propagate sensitive information, manifesting as differences in the amount of sensitive information carried by each layer. This means that different layers compress sensitive information to varying degrees during network propagation, with significant compression often occurring at certain layers, effectively blocking the explicit propagation of sensitive information. After this, sensitive information is often propagated implicitly, fused with information related to the target task. Therefore, addressing model fairness starting with the significantly compressed layers is often costly and ineffective, and may even severely impact model performance.

[0047] In response to this discovery, this embodiment proposes a network fairness repair method based on key neuron location and reinforcement learning. Unlike traditional solutions, the method provided by this embodiment focuses on intervening in the network portion before the layer where sensitive information is significantly compressed, thereby achieving more efficient fairness improvements with limited computing resources. In addition, after completing the identification of the significantly compressed layer in the network model, this embodiment further selects key neurons that play a key role in the propagation of sensitive information from each network layer that needs to be repaired, and only scales and adjusts these neurons, thereby overcoming the high cost and performance degradation caused by the need to comprehensively repair neurons in all large-scale network layers.

[0048] Specifically, if Figure 1 As shown, the network fairness repair method based on key neuron positioning and reinforcement learning provided in this embodiment includes the following process:

[0049] (i) Locate the significant compression layer in the network model that can highly compress sensitive information.

[0050] In the process of quantifying the amount of sensitive information, this embodiment defines a neural network as a decision function f from input space X to output space Y, f: X→Y; where Y represents the C categories output by the network model, Y={1,2,…,C}. The network model consists of L layers, denoted as {l0,l1,…,l L-1}; where l0 is the input layer, l L-1 is the output layer, and the rest are hidden layers. In the network model of the neural network, the input of each layer is the output of the previous layer, and each layer also contains a series of neurons.

[0051] Assume that given an input sample x, x∈X, use Z l (x) represents the internal features extracted in layer l, that is, the output values ​​of all neurons in that layer. In data processing involving sensitive attributes, the input features may include sensitive attributes S (such as gender, age, and race). Inspired by the information bottleneck theory, this theory states that during the learning process, neural networks tend to compress redundant information in the input data X that is not relevant to the task and retain feature information that is highly relevant to the target variable Y. Its objective function form is:

[0052]

[0053] Among them, I(X; Z l ) represents the l-th layer feature Z l The mutual information with the input data X needs to be minimized to achieve compression; and I(Y; Z l ) represents Z l The mutual information with the label Y needs to be maximized to retain task-related information; β is the trade-off coefficient between the two.

[0054] In deep neural networks, this goal is gradually approached by layer-by-layer feature transformation. As the layers deepen, the network model continues to compress non-task related information in the input (including sensitive attributes ), while retaining the discriminative features for label prediction. When the network is optimized to a certain critical layer (denoted as l*), the task-driven learning process will significantly suppress the feature dimensions that are not related to Y, resulting in a significant compression of sensitive information at this layer, which is manifested as Compared with the previous layer The rate of change decreases significantly. The ability to carry sensitive information in the layer is significantly weakened, and this layer "blocks" the display and dissemination of sensitive information. After this layer, sensitive information has almost no longer any carrying or display capability, but is instead fused with information related to the target task. Repairing this layer is less effective and can easily impact performance. This embodiment identifies this layer as a significantly compressed layer, focusing the fairness repair task of the network model before this layer.

[0055] In order to accurately identify the significant compression layers in the network model that can highly compress sensitive information, this embodiment first needs to quantify the amount of sensitive information in each hidden layer of the neural network to be repaired. Most existing solutions calculate the mutual information between the sensitive attributes of each layer and the output value of the layer, that is, I(S; Z l ) to quantify the amount of sensitive information. However, the technicians of this embodiment have taken into account that in actual applications, the output dimensions of each network layer in the network model to be repaired are mostly high, and the traditional mutual information estimation method (such as KSG) has heavy computational tasks and has no practical value; the estimation method based on neural network (such as MINE), although accurate, also has the problem of high computational cost, which is difficult to meet the efficiency requirements of this embodiment. Therefore, this embodiment proposes an alternative estimation method based on a probe classifier, which can significantly reduce the amount of computation on the basis of accurately evaluating the amount of sensitive information of different network layers.

[0056] Specifically, if Figure 2 As shown, the method of using a probe classifier to estimate the amount of sensitive information of each layer of the network and then identifying the significant compression layer in this embodiment includes the following steps:

[0057] (1) Obtain an unfair repair dataset for the target neural network inference process.

[0058] In the real-world scenario of network model fairness repair, a neural network that can be used in practice has usually been obtained through pre-training. Next, after using this neural network to infer a certain data set, it will be found that the prediction results output by the neural network, as shown by the measured fairness metric, are obviously unfair. Therefore, this embodiment needs to repair the fairness of this neural network (hereinafter referred to as the target neural network) on this data while maintaining the prediction performance of the network model. In this process, this embodiment uses this data as a repair data set, which contains feature information corresponding to the original input and output of the neural network, as well as feature information corresponding to the sensitive attributes of the neural network.

[0059] (2) A random forest-based probe classifier is inserted into each hidden layer of the target neural network; the probe classifier takes the output of each neuron in the hidden layer as input and predicts the corresponding sensitive attribute.

[0060] In this embodiment, a neural network plugging technique is used to insert a lightweight probe classifier at the output end of each hidden layer of the target neural network. The probe classifier is based on the output Z of the layer. l The input is the sensitive attribute S, and the label is obtained through training. This helps this embodiment accurately measure the relative value of the sensitive information contained in each hidden layer. In practical applications, the selection of a probe classifier must meet the following requirements: a. Nonlinear modeling capabilities (to capture nonlinear correlations); b. Efficient training; c. Resistance to overfitting and good interpretability (to facilitate subsequent key neuron location). After comprehensive consideration, this embodiment uses random forest as the probe classifier.

[0061] (3) During the inference process of the target neural network on the repaired dataset, the hook function is used to extract the output of each neuron in each hidden layer, and the corresponding sensitive attribute labels are combined to complete the training of the probe classifier, thereby obtaining the balanced accuracy of each probe classifier and the feature importance value of each neuron in the corresponding hidden layer.

[0062] In this embodiment, as a post-processing repair method, a hook function can be used to extract the output feature Z of each hidden layer of the neural network in the forward propagation of the inference task on the repair dataset. l , and combined with the corresponding sensitive attribute S, complete the training of the probe classifiers of each layer. After training, the random forest-based probe classifier will obtain a balanced accuracy (BA).

[0063] In addition, after the random forest training is completed, each input feature Each of these features will correspond to a feature importance value. Indicates its contribution in the prediction of sensitive attributes.

[0064] (4) The balanced accuracy of each probe classification is used as an estimate of the amount of sensitive information in the corresponding layer. The compression ratio of the sensitive information of each hidden layer relative to the previous layer is calculated, and the hidden layer with the highest compression ratio is identified as the significantly compressed layer.

[0065] After obtaining the balanced accuracy of the probe classifier in each hidden layer in the previous step, the higher the balanced accuracy, the stronger the predictive power of the hidden layer for the sensitive attribute; this also means that the hidden layer contains a larger amount of sensitive information. Therefore, in this embodiment, the balanced accuracy (BA) corresponding to each probe classifier is used as an estimate of the amount of sensitive information in the hidden layer.

[0066] After obtaining the estimated value of the amount of sensitive information in each hidden layer (i.e., the balanced accuracy, BA), this embodiment further calculates the rate of change of the estimated value of the amount of sensitive information in each hidden layer relative to the previous hidden layer (i.e., the compression rate of the amount of sensitive information r l ), if a hidden layer has the largest compression rate for the amount of sensitive information, it means that the hidden layer has the most significant compression for the sensitive information, and this embodiment identifies it as a significant compression layer.

[0067] Specifically, in the solution of this embodiment, the compression rate r of the sensitive information of the hidden layer l is l The calculation formula is as follows:

[0068]

[0069] In the above formula, BA l and BA l-1 They represent the balanced accuracy values ​​of hidden layer l and hidden layer l-1 respectively.

[0070] Finally, this embodiment uses the following criteria to identify the significant compression layer l* from each hidden layer:

[0071]

[0072] (2) Identify key neurons in the network model that are related to the propagation of key sensitive information.

[0073] Each hidden layer before the significantly compressed layer with the highest compression rate is selected as the layer to be repaired. The neurons in each layer to be repaired whose feature importance value is higher than the preset importance threshold are selected as key neurons.

[0074] As discussed above, this example demonstrates that the significant compression layer can block the explicit propagation of sensitive information. Sensitive information in the hidden layers following the significant compression layer is often implicitly propagated by fusing it with information related to the target task. Therefore, to improve the effectiveness of neural network fairness repair, this example selects the hidden layers preceding the significant compression layer with the highest compression ratio as the layers to be repaired.

[0075] On this basis, compared with the existing solutions, this embodiment has positioned the operation objects of fairness repair of the neural network to several hidden layers with fewer and higher efficiency, thereby significantly reducing the repair calculation overhead. However, considering that in complex deep neural networks, each hidden layer often still contains a large number of neurons, if all neurons in these layers to be repaired are fully repaired, it will still bring an extremely high computational burden. To address this problem, this embodiment chooses to further screen out some neurons that play a key role in the propagation of sensitive information from each layer to be repaired, and only repairs these key neurons. Specifically, the method of screening out key neurons from the layer to be repaired in this embodiment is as follows:

[0076] In the process of locating the significant compression layer, this embodiment has trained an interpretable probe classifier for each hidden layer of the target neural network. The input feature of the probe classifier is the output value of all neurons in the layer, that is, the intermediate representation Z of the layer. l In addition to estimating the relative value of the sensitive information amount of each hidden layer, the probe classifier designed in this embodiment can also be used to identify some neurons in the probe model that contribute more to the prediction of sensitive attributes.

[0077] On the one hand, some neurons in the layer to be repaired significantly affect the prediction of sensitive attributes, so they play a key role in the propagation of sensitive information. On the other hand, the random forest-based probe classifier designed in this embodiment has good interpretability. After training, it can obtain the same information as each input feature. (i.e., the output of the nth neuron in the lth layer) corresponding to the feature importance value It can represent its contribution in the prediction of sensitive attributes. Therefore, for the nth neuron (l,n) in any hidden layer l, if its corresponding feature importance value is The higher the value, the greater the contribution of the neuron to the prediction of the sensitive attributes of the network model, that is, the more important the neuron is in the propagation of sensitive information. In this embodiment, it should be regarded as a key neuron in the layer to be repaired.

[0078] On this basis, in order to screen out neurons that play a key role in the propagation of sensitive information, this embodiment introduces an importance threshold, and screens out neurons with a value higher than the preset importance threshold according to the characteristic importance value of each neuron, and uses them as key neurons, thereby obtaining a key neuron set N. key Specifically, the key neuron set N contains all key neurons key Satisfy the following formula:

[0079]

[0080] In the above formula, (l,n) represents the nth neuron in the hidden layer l; represents the feature importance value of the nth neuron in the hidden layer l; E represents the set of layers to be repaired, E = {l1,l2,…,l*-1}.

[0081] (3) Scaling and adjusting the output of key neurons to weaken the impact of sensitive information on the final decision of the network model output.

[0082] A scaling factor is assigned to each key neuron in the target neural network, and a reward function that considers both fairness and performance metrics is designed. The optimal scaling factor of each key neuron is iteratively optimized through a reinforcement learning strategy, thereby completing the fairness repair of the target neural network.

[0083] Different from traditional methods that mostly achieve fairness restoration by dynamically adjusting the weights of neurons, this embodiment chooses to directly adjust the output values ​​of these neurons to weaken their influence on the propagation of sensitive information. Specifically, for the key neuron set N obtained in the previous step, key For any key neuron in this embodiment, a scaling factor is introduced This scaling factor directly affects the output of the neuron. The neuron output after the scaling factor is applied can be expressed as:

[0084]

[0085] In the above formula, represents the original input of neuron (l,n) before repair; Represents the output of neuron (l,n) after fairness repair.

[0086] To improve the fairness of the neural network while maintaining the model's predictive accuracy and other performance as much as possible, this embodiment needs to find the optimal scaling factor for each key neuron. This is a multi-objective optimization problem. To solve this problem, this embodiment designs a reward function that considers both fairness and performance metrics. It then iteratively optimizes the optimal scaling factor for each key neuron through a reinforcement learning strategy.

[0087] In practical applications, this embodiment can use algorithms such as SARSA, DDPG, A2C, PPO, TRPO, and GRPO to iteratively optimize the scaling factor of each key neuron based on a reinforcement learning framework. In the reinforcement learning framework corresponding to the technical problem of this embodiment, the design of the state space, action space, and reward function is as follows:

[0088] State Space

[0089] Define the state space Each state s in is as follows:

[0090]

[0091] in, Represents the set of scaling factors for all key neurons in the network model; Fairness represents the fairness metric of the network model in its current state, and Performance represents the performance metric of the network model in its current state. In practical applications, SPD, AOD, or EOD can be used as evaluation metrics for fairness metrics, and Accuracy or F1 can be used as evaluation metrics for performance metrics.

[0092] The calculation formula for EOD is as follows:

[0093]

[0094] In the above formula, h(X) represents the predicted value of the input data X, A represents the sensitive attribute value, and Y represents the label value.

[0095] The calculation formula for SPD is as follows:

[0096]

[0097] In the above formula, It represents the predicted value, which is equivalent to h(X) above, and Z represents the sensitive attribute value, which is equivalent to A above.

[0098] The calculation formula for AOD is as follows:

[0099]

[0100] Action Space

[0101] Define each action a to represent each new scaling factor A combination of , used to replace the current scaling factors of each key neuron

[0102]

[0103] Reward Function

[0104] In order to take into account both the fairness and performance of the neural network, this embodiment designs a reward function that considers both the fairness metric and the performance metric. for:

[0105]

[0106] In the above formula, Fairness represents the fairness metric of the model; Performance represents the performance metric of the model; and λ is the trade-off coefficient used to regulate the relative importance of fairness and performance.

[0107] In this embodiment's reinforcement learning framework, the policy network π directly outputs a new scaling factor value in each iteration. The action network then determines the new state s based on the updated action a and calculates the reward corresponding to action a. Within this framework, this embodiment continuously updates the optimal fairness metric and corresponding scaling factor that can be achieved while meeting the performance threshold in each iteration until the corrected iteration number meets the user-specified constraint.

[0108] When the iterative optimization is completed, the optimal scaling factor corresponding to each key neuron can be obtained Then in the fairness-repaired neural network of this embodiment, the output of any key neuron (l,n) is updated to

[0109]

[0110] In the above formula, represents the original output of the key neuron (l,n) before repair; represents the optimal scaling factor of the key neuron (l,n) after iterative optimization by reinforcement learning.

[0111] Example 2

[0112] In order to better apply the network fairness repair method based on key neuron positioning and reinforcement learning provided in Example 1. This embodiment further provides a computer program product, a storage medium, and a corresponding computer device that can implement the above method. Specifically, this embodiment provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the steps of the network fairness repair method based on key neuron positioning and reinforcement learning as described above, and then locates the key neurons in the unfair neural network model, and uses the optimal scaling factor to update the output of each key neuron to achieve fairness repair of the target neural network.

[0113] This embodiment also provides a storage medium storing a computer program. When the computer program is executed by a processor, the steps of the aforementioned network fairness repair method based on key neuron positioning and reinforcement learning are implemented, thereby locating the key neurons in the unfair neural network model and updating the output of each key neuron using the optimal scaling factor to achieve fairness repair of the target neural network.

[0114] This embodiment also provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the computer program is executed by the processor, the steps of the network fairness repair method based on key neuron positioning and reinforcement learning are implemented as described above, thereby locating the key neurons in the unfair neural network model and updating the output of each key neuron using the optimal scaling factor to achieve fairness repair of the target neural network.

[0115] In actual applications, the computer device can be an embedded device and deployed in various terminal devices to support data processing and interaction. It can also be used as an independent computer device to support data processing needs in certain scenarios. This non-embedded computer device can be a laptop, tablet computer, desktop computer, or a medium or large computer device such as a rack server, blade server, tower server, or cabinet server (including a standalone server or a server cluster consisting of multiple servers) that can execute computer programs.

[0116] Specifically, the computer device of this embodiment includes at least, but is not limited to, a memory and a processor that can be interconnected via a system bus. In this embodiment, the memory (i.e., a readable storage medium) includes flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, a magnetic disk, an optical disk, etc. In some embodiments, the memory can be an internal storage unit of the computer device, such as the hard disk or internal memory of the computer device. In other embodiments, the memory can also be an external storage device of the computer device, such as a plug-in hard disk equipped with the computer device, a smart memory card (SMC), a secure digital (SD) card, a flash memory card, etc. Of course, the memory can also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the memory is generally used to store the operating system and various application software installed on the computer device. In addition, the memory can also be used to temporarily store various types of data that have been output or are about to be output.

[0117] In some embodiments, the processor may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor is generally used to control the overall operation of a computer device.

[0118] Performance Testing

[0119] In order to verify the performance of the solution of the present invention, the technical staff developed an experimental plan and conducted simulation tests on the relevant solutions. The experimental environment was as follows:

[0120] Ubuntu 22.04.3, LTS with an Intel(R)Core(TM)i7-10700 CPU@2.90GHzprocessor, 15GB RAM, and a 1TB HDD.

[0121] 1. Dataset and neural network model training

[0122] This experiment used four extensive datasets, Adult Income dataset, Bank Marketing dataset, Medical Survey 2016 dataset, and Default Credit dataset, to train four neural networks with different model structures. Among them, the Adult Income dataset contains demographic and financial information about individuals extracted from the 1994 census data of a certain area, which is used to predict whether a person's annual income exceeds US$50,000. The Bank Marketing dataset contains financial information about customers of banking institutions in a certain area, which is used to predict whether customers subscribe to fixed deposits. The Medical Survey 2016 dataset contains data that measures how users in a certain area use and pay for healthcare, health insurance, and out-of-pocket expenses, and is used to analyze individual healthcare utilization. The Default Credit dataset contains anonymous credit card customer data in a certain area, including demographic profiles, payment history, and creditization patterns. It is often used to predict whether a customer will default on the next credit card payment. The data characteristics of the above four datasets are as follows:

[0123] Table 1: Data characteristics of the four datasets

[0124]

[0125] The model structures of the four neural networks trained based on the above four data sets are shown in the following table:

[0126] Table 2: Structures of different network models

[0127]

[0128] In the table above, the numbers in parentheses correspond to the number of neurons in each hidden layer. For example, the network model trained on the AdultIncome dataset has 8 hidden layers; the network model trained on the Bank Marketing dataset has 7 hidden layers, each with 128 neurons; the network model trained on the MedicalSurvey 2016 dataset has 3 hidden layers, and the network model trained on the Default Credit dataset has 5 hidden layers. It should be noted that the first two model structures were independently designed by the experimenters, while the latter two models adopt model structures widely used in fairness restoration tasks.

[0129] 2. Fairness repair of neural network models

[0130] In this experiment, technicians set the fairness metric to be repaired as EOD (smaller values ​​indicate greater fairness) and the performance metric to be maintained as the F1 score, with a maximum permissible performance degradation of 2%. To verify the effectiveness of the method, this experiment used an existing repair method (NeuFair) as a control group for comparison with this case (denoted as EarlyFair). The two repair methods were compared on the four neural networks trained previously. For the network model trained on the Adult Income dataset, this experiment targeted two sensitive attributes, gender and race, for repair.

[0131] In this experiment, each repair was limited to 5 minutes. To minimize the impact of randomness, 10 neural network models were trained for each dataset using different random seeds. All metrics reported were the mean of these 10 models and their 95% confidence intervals. The final results of the repair experiment are shown in the following table:

[0132] Table 3: Repair results of the present invention and the control group on different neural networks

[0133]

[0134] In the table above, NeuFair is the indicator for the control solution after repair, and EarlyFair is the indicator for the solution of the present invention after repair. Comparing the experimental data of the present invention and the control solution before and after repair, it can be found that: within the same repair time budget, the method of the present invention has the greatest improvement in fairness. At the same time, the method of the present invention also maintains performance the best (even improving performance on some data sets), and the method of the present invention also has the best repair stability.

[0135] The above-described embodiment merely represents one embodiment of the present invention. While the description is relatively specific and detailed, it should not be construed as limiting the scope of the invention. It should be noted that a person skilled in the art would be able to make various modifications and improvements without departing from the spirit of the present invention, and these modifications and improvements fall within the scope of the present invention. Therefore, the scope of the present invention shall be determined by the appended claims.

Claims

1. A network fairness repair method based on key neuron positioning and reinforcement learning, characterized in that: It includes: Obtaining a repaired dataset for unfair target neural network inference process; A random forest-based probe classifier is inserted after each hidden layer in the target neural network. The probe classifier uses the output of each neuron in the hidden layer as input and predicts the corresponding sensitive attribute. During the inference process of the target neural network on the repaired dataset, the hook function is used to extract the output of each neuron in each hidden layer, and the probe classifier is trained in combination with the corresponding sensitive attribute labels. The balanced accuracy of each probe classifier and the feature importance value of each neuron in the corresponding hidden layer are then obtained. The balanced accuracy of each probe classifier is used as an estimate of the amount of sensitive information in the corresponding layer. The compression ratio of each hidden layer relative to the previous layer is calculated, and the hidden layers before the significantly compressed layer with the highest compression ratio are selected as the layers to be repaired. The neurons in each layer to be repaired whose feature importance value is higher than the preset importance threshold are regarded as key neurons; A scaling factor is assigned to each key neuron in the target neural network, and a reward function that considers both fairness and performance metrics is designed. The optimal scaling factor of each key neuron is iteratively optimized through a reinforcement learning strategy, thereby completing the fairness repair of the target neural network.

2. The network fairness restoration method based on key neuron positioning and reinforcement learning according to claim 1 is characterized by: The target neural network is defined to consist of L layers, denoted as {l0,l1,…,l L-1 }, where l0 is the input layer, l L-1 is the output layer, and the rest are hidden layers; then the compression rate of the sensitive information of the hidden layer l is r l The calculation formula is as follows: In the above formula, BA l and BA l-1 They represent the balanced accuracy values ​​of hidden layer l and hidden layer l-1 respectively.

3. The network fairness repair method based on key neuron positioning and reinforcement learning according to claim 2 is characterized in that: The following criterion is used to identify the significant compression layer l* from each hidden layer:

4. The network fairness repair method based on key neuron positioning and reinforcement learning according to claim 3 is characterized in that: The key neuron set N contains all key neurons key Satisfy the following formula: In the above formula, (l,n) represents the nth neuron in the hidden layer l; represents the feature importance value of the nth neuron in the hidden layer l; E represents the set of layers to be repaired, E = {l1,l2,…,l*-1}.

5. The network fairness restoration method based on key neuron positioning and reinforcement learning according to claim 1 is characterized in that: SARSA, DDPG, A2C, PPO, TRPO, and GRPO are used to iteratively optimize the scaling factor of each key neuron based on reinforcement learning strategies; Defining the state space in reinforcement learning Each state s in is as follows: in, Represents the set of scaling factors of all key neurons in the network model; Fairness represents the fairness measurement value of the network model in the current state, and Performance represents the performance measurement value of the network model in the current state; Action Space Each action a in is represented by a new scaling factor A combination of , used to replace the current scaling factors of each key neuron The policy network π directly outputs the new scaling factor value in each iteration; Design a reward function that considers both fairness and performance for: In the above formula, Fairness represents the fairness metric of the model; Performance represents the performance metric of the model; and λ is the trade-off coefficient used to regulate the relative importance of fairness and performance.

6. The network fairness restoration method based on key neuron positioning and reinforcement learning according to claim 1 is characterized by: In the iterative optimization process of the scaling factors of key neurons based on reinforcement learning, SPD, AOD or EOD is used as the evaluation indicator of the fairness metric; and Accuracy or F1 is used as the evaluation indicator of the performance metric.

7. The network fairness repair method based on key neuron positioning and reinforcement learning according to claim 1 is characterized in that: After repair, the output of any key neuron (l,n) is updated to In the above formula, represents the original output of the key neuron (l,n) before repair; represents the optimal scaling factor of the key neuron (l,n) after iterative optimization by reinforcement learning.

8. A computer program product comprising a computer program, characterized in that: When the computer program is executed by a processor, the steps of the network fairness repair method based on key neuron positioning and reinforcement learning as described in any one of claims 1 to 7 are implemented, thereby locating the key neurons in the unfair neural network model and updating the output of each key neuron using the optimal scaling factor to achieve fairness repair of the target neural network.

9. A storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the network fairness repair method based on key neuron positioning and reinforcement learning as described in any one of claims 1 to 7 are implemented, thereby locating the key neurons in the unfair neural network model and updating the output of each key neuron using the optimal scaling factor to achieve fairness repair of the target neural network.

10. A computer device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the computer program is executed by a processor, the steps of the network fairness repair method based on key neuron positioning and reinforcement learning as described in any one of claims 1 to 7 are implemented, thereby locating the key neurons in the unfair neural network model and updating the output of each key neuron using the optimal scaling factor to achieve fairness repair of the target neural network.

Citation Information

Patent Citations

  • Depolarization method based on sensitive neuron suppression

    CN115271066A

  • Federal system prejudice poisoning defense method and device based on reinforcement learning

    CN116361780A

  • Systems and methods for model fairness

    US20200302524A1