CN113361709A - Deep neural network model repairing method based on variation - Google Patents

Deep neural network model repairing method based on variation Download PDF

Info

Publication number
CN113361709A
CN113361709A CN202110639424.2A CN202110639424A CN113361709A CN 113361709 A CN113361709 A CN 113361709A CN 202110639424 A CN202110639424 A CN 202110639424A CN 113361709 A CN113361709 A CN 113361709A
Authority
CN
China
Prior art keywords
weight
neural network
variation
deep neural
repairing
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.)
Pending
Application number
CN202110639424.2A
Other languages
Chinese (zh)
Inventor
吴欢欢
崔展齐
郑丽伟
刘建宾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Information Science and Technology University
Original Assignee
Beijing Information Science and Technology University
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Information Science and Technology University filed Critical Beijing Information Science and Technology University
Priority to CN202110639424.2A priority Critical patent/CN113361709A/en
Publication of CN113361709A publication Critical patent/CN113361709A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/082Learning methods modifying the architecture, e.g. adding, deleting or silencing nodes or connections
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3676Test management for coverage analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/12Computing arrangements based on biological models using genetic models
    • G06N3/126Evolutionary algorithms, e.g. genetic algorithms or genetic programming

Abstract

The invention discloses a deep neural network model repairing method based on variation, which relates to the technical field of deep neural network model repairing and comprises the following steps: positioning the position of the defect weight, and obtaining a suspicious weight sequence by positioning the weight corresponding to the neuron of the layer where the deep neural network model to be repaired is positioned; optimizing weights of the deep neural network, and carrying out variation on each weight in the suspicious weight sequence in sequence; and (3) based on the iterative optimization of the weights of the genetic thought, adjusting each weight to generate different variants, and selecting the individuals with high fitness to continue the next iteration until the repair stopping condition is reached. According to the method, the importance influence of the weight of each neuron in the deep learning model on the test result is sequenced through a reverse calculation method, and the neuron is subjected to variation iteration based on a genetic algorithm, so that the accuracy of the deep learning model is improved, and the repairing effect is achieved.

Description

Deep neural network model repairing method based on variation
Technical Field
The invention relates to the technical field of deep neural network model repair, in particular to a deep neural network model repair method based on variation.
Background
Nowadays, with the vigorous development of networks, deep learning has been deeply conducted into various research fields of people, such as automatic driving, computer vision, natural language processing, and the like. The deep neural network is a typical deep learning model and comprises a feedforward neural network, a deep neural network and a convolution neural network. Due to the computational cost, training a neural network may require a lot of overhead, which is also an important reason for the low accuracy of the neural network. At present, a deep learning model is widely applied to problems of medical diagnosis, unmanned driving and even privacy protection, and if the accuracy of a trained deep learning model does not meet the requirement, disastrous unpredictable results can be brought when a great decision is made. Therefore, improving the accuracy of the deep learning model to ensure that accurate judgment can be made more probably is an important research problem in the field of intelligent software quality assurance at present.
In order to improve the quality of the deep learning model, the repairing technology is one of effective methods. Similar to the traditional software, the maintenance process of the traditional software with defects is a project which consumes cost and time, the intelligent software of the deep learning model also needs to be maintained and repaired, and the effect of achieving twice the result with half the effort can be achieved by optimizing the deep learning model by using a good software automatic repairing technology. At present, many researchers have made researches on testing and repairing technologies of deep learning models, if the MODE technology is used, namely two types of over-fitting problems and under-fitting problems in the training process are solved by using state differential analysis, the problems are solved by identifying error features (or neurons) causing error classification in the models, and the importance degree of the feature is constructed by combining heat maps so as to retrain the defective neurons by using new input sample selection, thereby achieving a certain repairing effect and improving the accuracy of the deep learning models; another method for automatically repairing a deep learning model is proposed, which uses three strategies to adjust the weights to achieve higher test accuracy by using the difference comparison between the original model and the simplified sets of models. In summary, the existing research aims to continuously update the iterative optimization weights in a way of amplifying the training data set, so that the iterative optimization weights are more accurate in prediction. However, on one hand, the amplification data set will make the cost of repair higher, and on the other hand, the re-amplified training data set may have a larger difference from the natural input, and it is difficult to achieve the goal of repair.
Therefore, how to provide a repairing method capable of repairing the defects of the neural network model and improving the accuracy of the deep learning model is a problem that needs to be solved by those skilled in the art.
Disclosure of Invention
In view of this, the invention provides a deep neural network model repairing method based on variation, which can repair the defects of the neural network model and improve the accuracy of the deep learning model.
In order to achieve the above purpose, the invention provides the following technical scheme:
a deep neural network model repairing method based on variation comprises the following steps:
step 1): positioning the position of the defect weight, and obtaining a suspicious weight sequence by positioning the weight corresponding to the neuron of the layer where the deep neural network model to be repaired is positioned;
step 2): optimizing weights of the deep neural network, and carrying out variation on each weight in the suspicious weight sequence in sequence;
step 3): and (3) based on the iterative optimization of the weights of the genetic thought, adjusting each weight to generate different variants, and selecting the individuals with high fitness to continue the next iteration until the repair stopping condition is reached.
The technical scheme discloses basic operation steps of the deep neural network model based on variation, firstly, suspicious weights in the neural network are determined, and then, the suspicious weights are modified in a targeted manner by using a variation strategy and iteration based on a genetic algorithm, so that the neural network is repaired, and higher test precision is achieved.
Further, the step 1) comprises the following steps:
step 11): extracting all weight elements from a deep neural network to be repaired, testing the deep neural network by using a test set, and collecting execution information of each weight;
step 12): substituting the execution information of each weight into a suspicion degree calculation formula, carrying out normalization processing on the suspicion degrees corresponding to the weights of different layers, limiting the suspicion degrees of the weights within (0,1), carrying out sequencing, and determining the possibility of weight errors according to the sequencing sequence.
The technical scheme discloses a specific method for positioning the defect weight position in the step 1), and the defect weight is found by using a test case test neural network and observing and calculating the relation with expected output based on a frequency spectrum-based defect positioning method.
Further, the suspicion degree calculation formula in the step 12) is as follows:
Figure BDA0003106601550000031
wherein n isep(x) And nef(x) The number of successful case coverage and the number of failed case coverage of x in the test set are respectively, and e is a positive real number close to 0.
The above technical scheme discloses a suspicion degree calculation formula when n isef(x) When the value is negative, x is considered to play a positive role in the failed case and is substituted into a formula as a successful case; when n isep(x) And when the negative value is negative, substituting the negative value into the formula as a failure case, so that the problem of the negative value in the formula is solved.
Further, the weight is optimized based on the probability range of the gaussian distribution in the step 2), and the weight is calculated according to the gaussian distribution N (w, σ)2) Changing a given weight value w, removing all weights corresponding to the neuron from the current suspicious weight, and averaging
Figure BDA0003106601550000034
Adding on the basis of suspicious weights
Figure BDA0003106601550000032
Random number between, obtain the weight value W after variationi=wi+ R, wherein: a is>0,
Figure BDA0003106601550000033
wi=(w1,w2,...,wm) Is a suspect weight sequence.
The technical scheme discloses that when the weights are directly optimized, if the weights are randomly and blindly changed, the repair efficiency is reduced, the probability range optimization weights based on Gaussian distribution are selected, the probability range optimization weights provide approximate distribution of the sum of independent and uniformly distributed random variables, and normal distribution can be adopted for approximation without considering the distribution obeyed by the random variables in the sum formula as long as the number of addition terms in the sum formula is sufficiently large.
Further, the step 2) comprises the following steps:
step 21): selecting the first weight w in the suspicious weight sequence1N times of mutation to obtain a mutation weight of w11,w12,...,w1n
Step 22): testing the variation weight of the step 21), and recording the obtained precision as p11,...,p1nAnd make the following judgments:
only when p is1iAnd when p is larger than epsilon, considering that the testing precision of the corresponding variant is improved after the weight is changed, sequencing according to the improved testing precision, and reserving the first l variants.
Further, the step 3) comprises the following steps:
step 31): assigning variation opportunities to the l variants reserved in the step 22), wherein the higher the test precision is, the greater the assignment opportunities are to enter the next round to continue the operation in the step 21); when the improvement of the variation testing precision of the continuous m rounds is not more than epsilon, the improvement is not considered, the variation of the current weight is stopped, and the step 32) is carried out;
step 32): selecting the next weight in the suspicious weight sequence to carry out the operation in the step 21); and when the testing precision of the continuous k weights is not improved, stopping the experiment, and taking the highest testing precision corresponding to the mutated current weight as the final repairing result.
The above technical solution discloses an iterative optimization process for performing weight variation and based on genetic thought, wherein epsilon is a minimum value for determining the improvement of test precision, which can be changed as required, only if p is1iWhen p is larger than epsilon, the test precision after the weight is changed is considered to be improved, the defect model is repaired for many times, the accuracy of the deep learning model is improved, and a better repairing effect is achieved.
According to the technical scheme, compared with the prior art, the invention discloses a deep neural network model repairing method based on variation, and the method has the following beneficial effects:
(1) the method for repairing the deep neural network model based on the variation realizes the positioning on the weight granularity in the neural network of the deep learning model to be repaired, the positioned granularity is accurate to the weight, the repairing efficiency can be improved, the repairing is more targeted, the ranking is carried out according to the suspicious degree of the weight, and the larger the suspicious degree is, the larger the influence of the weight on the decision making error of the neural network is;
(2) the deep neural network model repairing method based on the variation provides a weight variation strategy based on a genetic algorithm, so that the weight approaches to the direction of improving the testing precision of the model until the testing precision is not obviously improved, the accuracy of the deep learning model is improved, and a better repairing effect is achieved.
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, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a general overview of the method for repairing a deep neural network model based on variation according to the present invention.
Fig. 2 is a schematic diagram of the process of locating suspicious weight sequences according to the present invention.
FIG. 3 is a flowchart of weight variation and iterative optimization based on genetic thought in the present invention.
Detailed Description
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 only a part of the embodiments of the present invention, and not all of the embodiments. 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.
Fig. 1 is a general overview of the method for repairing a deep neural network model based on variation according to the present invention, which is characterized by comprising the following steps:
step 1): positioning the position of the defect weight, and obtaining a suspicious weight sequence by positioning the weight corresponding to the neuron of the layer where the deep neural network model to be repaired is positioned;
step 2): optimizing weights of the deep neural network, and carrying out variation on each weight in the suspicious weight sequence in sequence;
step 3): and (3) based on the iterative optimization of the weights of the genetic thought, adjusting each weight to generate different variants, and selecting the individuals with high fitness to continue the next iteration until the repair stopping condition is reached.
In a specific embodiment, for a given neural network model, in order to make the repairing effect more obvious, a defect is implanted first, the weights corresponding to a certain neuron can be exchanged, so that the testing precision of the original model is reduced, then the defect is repaired by using the method of the present invention, and the effectiveness of the method can be verified by comparing the precision of the model implanted with the precision after repair.
Firstly, positioning is needed in the first step, in order to accurately position the position of the implanted defect and enable repair to be faster, weights corresponding to neurons positioned to the layer where the defect model is located are used, and the sequence of suspicious weights is obtained by a positioning result, namely the sequence of the influence degree of the weights on the decision errors of the deep learning model is sequenced; meanwhile, the granularity of positioning is accurate to the weight, so that the repairing efficiency can be improved, and the repairing becomes more targeted. Fig. 2 is a schematic diagram illustrating a process of locating suspicious weight sequences in this embodiment. Firstly, a prepared data set is operated, test cases which are successfully operated and test cases which are failed to operate are obtained, the successful test cases, namely the input of the successful test cases are in accordance with the expected output (namely in accordance with the corresponding output label), the failed test cases, namely the input of the failed test cases are not in accordance with the expected output (namely in accordance with the corresponding output label), for one test case, success coverage and failure coverage exist, and then the success case coverage number and the failure case coverage number are brought into the following doubtful degree formula,
Figure BDA0003106601550000061
wherein n isep(x) And nef(x) E is close to 0, which is the number of successful case coverage and the number of failed case coverage of x in the test set respectively. And finally, sorting according to the suspicion degree, wherein the higher the suspicion degree is, the higher the sorting is, namely the probability of the defect weight is higher.
The second step is to mutate the weights, and as shown in fig. 3, the flowchart of the iterative optimization based on the weight variation and the genetic thought in the deep neural network model repairing method based on the mutation in the embodiment of the present invention is shown. Based on the suspicious weight sequence obtained in the first step, selecting a first weight to mutate the suspicious weight sequence, and setting the suspicious weight sequence to mutate the suspicious weight sequence n times, for example, taking n as 5, so as to obtain corresponding 5 variants, respectively testing the precision of each variant, then judging whether epsilon is a number close to 0, and judging whether the testing precision is promoted, for example, epsilon is 0.00001, namely judging whether the promotion of the testing precision after the weight mutation is greater than epsilon, only when the testing precision is greater than epsilon, considering that the testing precision after the mutation is promoted, and keeping the testing precision, considering that the variants which do not reach the condition are not promoted, and eliminating the variants, and only keeping l better variants in each round, for example, l as 20. And for the variant with the test precision improved more than epsilon, continuously carrying out mutation on the weight of the variant until the test precision of all the variants in m successive rounds is not improved, for example, m is 20, then carrying out n-time mutation on the next weight in the positioned suspicious weight sequence respectively, similarly to the previous weight mutation, thus sequentially selecting the weights from the weight sequence, if the test precision of the variant is not improved by selecting k successive weights, for example, k is 10, stopping the current mutation, and taking the test precision at the moment as the final repairing effect.
At present, many tests for deep learning models exist, but only the test work of the neural network is focused on, the reliability, the robustness against the attack and the interpretability of the neural network are tested, and the reinforcement of the neural network is only performed on the aspects of the attack training, the model compression and the backdoor elimination. In contrast, the method for repairing the deep neural network model based on the variation repairs not an original deep learning model but a deep learning model with defects; secondly, the repairing method of the invention does not additionally increase a training set, and does not modify the weight by retraining; finally, we focus on the accuracy of the deep learning model to repair known defects.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (6)

1. A deep neural network model repairing method based on variation is characterized by comprising the following steps:
step 1): positioning the position of the defect weight, and obtaining a suspicious weight sequence by positioning the weight corresponding to the neuron of the layer where the deep neural network model to be repaired is positioned;
step 2): optimizing weights of the deep neural network, and carrying out variation on each weight in the suspicious weight sequence in sequence;
step 3): and (3) based on the iterative optimization of the weights of the genetic thought, adjusting each weight to generate different variants, and selecting the individuals with high fitness to continue the next iteration until the repair stopping condition is reached.
2. The method for repairing a deep neural network model based on variation according to claim 1, wherein the step 1) comprises the following steps:
step 11): extracting all weight elements from a deep neural network to be repaired, testing the deep neural network by using a test set, and collecting execution information of each weight;
step 12): substituting the execution information of each weight into a suspicion degree calculation formula, carrying out normalization processing on the suspicion degrees corresponding to the weights of different layers, limiting the suspicion degrees of the weights within (0,1), carrying out sequencing, and determining the possibility of weight errors according to the sequencing sequence.
3. The method for repairing a deep neural network model based on variation according to claim 2, wherein the suspicion degree calculation formula in the step 12) is as follows:
Figure FDA0003106601540000011
wherein n isep(x) And nef(x) The number of successful case coverage and the number of failed case coverage of x in the test set are respectively, and e is a positive real number close to 0.
4. The method for repairing a deep neural network model based on variation as claimed in claim 1, wherein the weight is optimized based on the probability range of Gaussian distribution in step 2), and the weight is optimized based on the Gaussian distribution N (w, σ)2) Changing a given weight value w, removing all weights corresponding to the neuron from the current suspicious weight, and averaging
Figure FDA0003106601540000023
Adding on the basis of suspicious weights
Figure FDA0003106601540000021
Random number between, obtain the weight value W after variationi=wi+ R, wherein: a is>0,
Figure FDA0003106601540000022
wi=(w1,w2,...,wm) Is a suspect weight sequence.
5. The method for repairing a deep neural network model based on variation according to claim 1, wherein the step 2) comprises the following steps:
step 21): selecting the first weight w in the suspicious weight sequence1N times of mutation to obtain a mutation weight of w11,w12,...,w1n
Step 22): testing the variation weight of the step 21), and recording the obtained precision as p11,...,p1nAnd make the following decisions:
only when p is1iAnd when p is larger than epsilon, considering that the testing precision of the corresponding variant is improved after the weight is changed, sequencing according to the improved testing precision, and reserving the first l variants.
6. The method for repairing a deep neural network model based on variation according to claim 5, wherein the step 3) comprises the following steps:
step 31): assigning variation opportunities to the l variants reserved in the step 22), wherein the higher the test precision is, the greater the assignment opportunities are to enter the next round to continue the operation in the step 21); when the improvement of the variation testing precision of the continuous m rounds is not more than epsilon, the improvement is not considered, the variation of the current weight is stopped, and the step 32) is carried out;
step 32): selecting the next weight in the suspicious weight sequence to carry out the operation in the step 21); and when the testing precision of the continuous k weights is not improved, stopping the experiment, and taking the highest testing precision corresponding to the mutated current weight as the final repairing result.
CN202110639424.2A 2021-06-08 2021-06-08 Deep neural network model repairing method based on variation Pending CN113361709A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110639424.2A CN113361709A (en) 2021-06-08 2021-06-08 Deep neural network model repairing method based on variation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110639424.2A CN113361709A (en) 2021-06-08 2021-06-08 Deep neural network model repairing method based on variation

Publications (1)

Publication Number Publication Date
CN113361709A true CN113361709A (en) 2021-09-07

Family

ID=77533264

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110639424.2A Pending CN113361709A (en) 2021-06-08 2021-06-08 Deep neural network model repairing method based on variation

Country Status (1)

Country Link
CN (1) CN113361709A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114565051A (en) * 2022-03-03 2022-05-31 余姚市亿盛金属制品有限公司 Test method of product classification model based on neuron influence degree

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114565051A (en) * 2022-03-03 2022-05-31 余姚市亿盛金属制品有限公司 Test method of product classification model based on neuron influence degree

Similar Documents

Publication Publication Date Title
CN108596212B (en) Transformer fault diagnosis method based on improved cuckoo search optimization neural network
CN111310915B (en) Data anomaly detection defense method oriented to reinforcement learning
CN106874581B (en) Building air conditioner energy consumption prediction method based on BP neural network model
US11816183B2 (en) Methods and systems for mining minority-class data samples for training a neural network
CN109800875A (en) Chemical industry fault detection method based on particle group optimizing and noise reduction sparse coding machine
CN112465040B (en) Software defect prediction method based on class unbalance learning algorithm
CN111582542B (en) Power load prediction method and system based on anomaly repair
CN110263934B (en) Artificial intelligence data labeling method and device
CN112685504B (en) Production process-oriented distributed migration chart learning method
CN111310722A (en) Power equipment image fault identification method based on improved neural network
CN111860971B (en) Method and device for predicting residual life of turnout switch machine
CN114049305A (en) Distribution line pin defect detection method based on improved ALI and fast-RCNN
CN113361709A (en) Deep neural network model repairing method based on variation
CN114513367B (en) Cellular network anomaly detection method based on graph neural network
CN111192158A (en) Transformer substation daily load curve similarity matching method based on deep learning
CN113343123A (en) Training method and detection method for generating confrontation multiple relation graph network
CN116542382A (en) Sewage treatment dissolved oxygen concentration prediction method based on mixed optimization algorithm
CN116167438A (en) Transformer fault diagnosis method based on improved quantum genetic algorithm optimized SVM
CN115781136A (en) Intelligent identification and optimized feedback method for welding heat input abnormity
CN114565051A (en) Test method of product classification model based on neuron influence degree
CN113807005A (en) Bearing residual life prediction method based on improved FPA-DBN
Wu et al. Genmunn: A mutation-based approach to repair deep neural network models
CN113837443A (en) Transformer substation line load prediction method based on depth BilSTM
CN113610229A (en) Active learning method based on norm uncertainty index
CN112699229A (en) Self-adaptive question-pushing method based on deep learning model

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