CN114706764A - Defect code block positioning method based on model structure evolution - Google Patents

Defect code block positioning method based on model structure evolution Download PDF

Info

Publication number
CN114706764A
CN114706764A CN202210279322.9A CN202210279322A CN114706764A CN 114706764 A CN114706764 A CN 114706764A CN 202210279322 A CN202210279322 A CN 202210279322A CN 114706764 A CN114706764 A CN 114706764A
Authority
CN
China
Prior art keywords
defect
library
code block
model
framework
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
CN202210279322.9A
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.)
Zhejiang University of Technology ZJUT
Original Assignee
Zhejiang University of Technology ZJUT
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 Zhejiang University of Technology ZJUT filed Critical Zhejiang University of Technology ZJUT
Priority to CN202210279322.9A priority Critical patent/CN114706764A/en
Publication of CN114706764A publication Critical patent/CN114706764A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/366Software debugging using diagnostics
    • 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/08Learning methods

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Biomedical Technology (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a defect code block positioning method based on model structure evolution, which comprises the steps of firstly, calculating a frame library based on a plurality of deep learning, summarizing an object library and a safety problem of the frame library, and constructing a calculation frame object library; then a computing frame security defect library and a code security defect library are formed; then constructing a neural network model, carrying out variation on the neural network model to obtain a variation model set, carrying out output difference extraction on the variation model set to obtain a characteristic difference vector, calculating a prediction matching rate, and judging whether the neural network model has a defect code block or not according to the characteristic difference vector; and finally, verifying and tracing the defect codes of the neural network model by a statement operation method, and comparing the defect codes with a computing framework security defect library and a code security defect library to realize defect code block positioning. The method of the invention reduces the calculation cost, has wider deployment and application scenes and improves the defect positioning precision of the code block.

Description

Defect code block positioning method based on model structure evolution
Technical Field
The invention belongs to the field of defect positioning facing deep learning, and particularly relates to a defect code block positioning method based on model structure evolution.
Background
The intelligent computing is widely applied in daily life, and the safety problem is particularly critical. For example, DARPA in the united states finds that, in a complex environment with uncertain high-countermeasure, a normally-operating intelligent voice recognition system has serious performance degradation, and the security of the system is extremely vulnerable to data pollution caused by countermeasure voice commands, poisoning voices and the like, so that great potential safety hazards exist. According to different service objects, the intelligent calculation is composed of a calculation framework, a model algorithm and a data sample. The safety of intelligent calculation means that a user builds a reliable model algorithm by using a safe calculation framework, trains by using pollution-free data samples to obtain a robust intelligent model, and makes a credible decision.
Thus, bottom-up intelligent computing security includes: computing framework security, model algorithm security, data sample security. The safety of model algorithms and data samples is researched more, the research on the safety problem of an intelligent computing framework serving as the basis of artificial intelligence construction is still in the starting stage, but the safety threat to intelligent computing is far higher than the safety threat of the intelligent computing framework and the data samples. For example, the security threat of the data sample may be that the data of the current batch is polluted, and the data of the current batch is changed; the safety of the model algorithm may be caused by unreasonable structural design or improper super-parameter setting, and only a code is replaced; the threat scope of the two is limited to a few intelligent models, and the risk scope is limited. However, the safety of the computing framework is taken as an example of the most common precision error of the library operator, and all under the computing framework, the model of the library operator is used, so that potential safety hazards are left, the risk range is extremely large and quite hidden.
Specifically, the security problem of the intelligent computing framework can be divided into a framework library level, a framework code level and a model system level according to different error defect subjects. Firstly, a framework library layer comprises security problems such as execution inconsistency, declaration function definition error, service denial and the like; then, a framework code level is formed, and the problems of model parameter and structure statement, tensor with unmatched dimensionality, API function abuse and the like are included; and finally, a model system level comprises the problems of performance error, precision error, operator calculation error and the like. The existing testing technology carries out systematic testing on an intelligent computing framework, codes thereof and API functions in the aspects of inconsistency, precision errors and performance errors, and carries out effect verification on a common computing framework, thereby solving part of security threats, but the prior art still has the following challenges:
(1) the prior knowledge has strong dependence: most test methods rely on prior knowledge or model information to trigger errors, or require expert knowledge to specify acceptable false decision thresholds. This increases computational costs to some extent and hinders its deployment and application in real scenarios.
(2) The test method has poor universality: the testing method depends on some particularity of the framework, such as packaging attributes, class attributes, member attributes and the like, cannot be applied to all current intelligent computing frameworks, and an effective universal testing method is still lacked for domestic technical platforms MindSpore and propellers.
(3) The defect positioning precision is low: errors and inconsistencies in the framework may be caused by input samples, execution errors, slight differences in precision, completely different algorithm couplings, the latter two being not considered errors but causing safety concerns. In addition, the influence of the real class mark and the input value on the result is difficult to eliminate in the testing process of the framework, and the deviation is easy to occur when the positioning is wrong.
The existing computing frame defect testing technology still cannot position codes where defects are located, and therefore authenticity of the found defects cannot be determined directly.
Disclosure of Invention
Aiming at the defects of the prior art and ensuring the certainty and the safety of a calculation framework in intelligent calculation, the invention provides a defect code block positioning method based on model structure evolution.
In order to realize the purpose of the invention, the technical scheme of the invention is as follows:
the first aspect of the embodiment of the invention provides a method for positioning a defect code block based on model structure evolution, which comprises the following steps:
(1) summarizing an object library and safety problems of the deep learning calculation frame library based on a plurality of deep learning calculation frame libraries, and constructing a calculation frame object library;
(2) integrating the security problems of the target computing frame in the computing frame object library to form a computing frame security defect library; integrating common code errors of a computing framework in a computing framework object library to form a code security defect library;
(3) constructing a neural network model, carrying out variation on the neural network model to obtain a variation model set, carrying out output difference extraction on the variation model set to obtain a characteristic difference vector, calculating a prediction matching rate, and judging whether a defect code block exists in the neural network model or not according to the characteristic difference vector;
(4) and verifying and tracing the defect codes of the neural network model by a statement operation method, and comparing the defect codes with a computing framework security defect library and a code security defect library to realize defect code block positioning.
Preferably, the deep learning computation framework library comprises MindSpore, Paddle, TensorFlow, PyTorch, and Keras.
Preferably, the step (2) specifically comprises the following sub-steps:
(2.1) constructing a computing framework security defect library by integrating security problems of a computing framework object library target computing framework, including output difference before and after a framework library, precision error of library operators and output error of an API function;
and (2.2) constructing a code security defect library by integrating common code errors of the calculation framework including numerical errors, model parameter declaration errors and tensor dimension inconsistency errors in the calculation framework object library.
Preferably, the step (3) specifically comprises the following sub-steps:
(3.1) initializing a neural network model;
(3.2) carrying out variation operation on the neural network model constructed in the step (3.1) based on a Shapril value framework so as to construct a variation model set;
and (3.3) carrying out output difference extraction on the variation model set to obtain a characteristic difference vector, calculating a prediction matching rate, and judging whether the neural network model has a defect code block or not.
Preferably, the mutation operation comprises: an identity operation, a projection operation, a selection operation, a join operation, or a reverse join operation.
Preferably, the sentence operation method comprises sentence deletion, sentence switching, sentence copying or sentence addition.
A second aspect of the embodiments of the present invention provides an electronic device, including a memory and a processor, wherein the memory is coupled to the processor; the memory is used for storing program data, and the processor is used for executing the program data to realize the defect code block positioning method based on model structure evolution.
A third aspect of the embodiments of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the program, when executed by a processor, implements the above-mentioned method for locating a defect code block based on model structure evolution.
The invention has the beneficial effects that: the invention detects the defect code detection under different frames by calculating the output difference of models under different frames, and realizes the positioning of the defect code by utilizing a series of code operation commands. The method overcomes the defects of strong prior knowledge dependence, reduces the calculation cost and has wider deployment and application scenes. The method constructs the calculation frame object library through fusion of various deep learning calculation frame libraries, so that the test positioning method provided by the invention is stronger and wider in universality and is suitable for more domestic technical platforms. The method of the invention improves the defect positioning precision of the code block by comparing the structural variation of the target model and the defect library, and assists in improving the accuracy of finding the authenticity of the defect.
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 some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a flowchart of a method for locating a defect code block based on model structure evolution according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a defect code block locating apparatus based on model structure evolution in an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in this specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
The following describes the defect code block positioning method based on model structure evolution in detail with reference to the accompanying drawings. The features of the following examples and embodiments may be combined with each other without conflict.
As shown in FIG. 1, the method firstly establishes a test object library facing a computing framework and a defect library existing in codes, then guides a model structure to be fuzzy, finally measures potential computing framework defects by outputting differences, and realizes the inspection and positioning of defect codes by statement replacement so as to test the potential defects of the intelligent algorithm computing framework. The method comprises the following specific steps:
(1) constructing a calculation framework object library:
according to the invention, the object library and the safety problem of the famous deep learning calculation framework library such as MindSpore, Paddle, TensorFlow, PyTorch and Keras are summarized, and the five calculation frameworks are summarized to complete the construction of the calculation framework object library.
The MindSpore depth learning calculation frame library is a new generation of all-scene AI calculation frame developed by Huawei. The framework architecture has the characteristics of friendly development state, high efficiency of operation state, flexible deployment state and the like, can meet the requirements of terminals, edge computing and cloud full scene, and can better protect data privacy.
The PaddlePaddle deep learning calculation framework library is proposed by Baidu corporation and is a nationwide product in a mainstream deep learning framework. Compared with other deep learning frames, the flight propeller has the advantages of developing a convenient deep learning frame, a super-large-scale deep learning model training technology, a multi-end multi-platform deployed high-performance inference engine, an industrial-level open-source model library and the like.
The TensorFlow deep learning computation framework library is developed and maintained by Google brain and has a plurality of projects including TensorFlow Hub, TensorFlow Lite and TensorFlow Research Cloud and various application program interfaces.
The TensorFlow deep learning calculation framework library is a symbolic mathematical system based on data flow programming, and has the characteristics of convenience and quickness in calculation, easiness in operation and rich code library.
The Keras deep learning calculation framework library is a deep learning framework based on Theano, is also an advanced neural network API written by Python, and can operate by taking TensorFlow, CNTK or Theano as a back end. Keras has the following important properties: the same code can be seamlessly switched to run on the CPU or the GPU; the method has user-friendly API, and is convenient for rapidly developing prototypes of deep learning models; built-in support convolutional networks (for computer vision), cyclic networks (for sequence processing), and any combination of the two; support for any network architecture: multiple input or multiple output models, layer sharing, model sharing, etc.
The PyTorch is introduced by Facebook artificial intelligence research institute (FAIR), is an open-source Python machine learning library, has powerful GPU-accelerated tensor computation (such as NumPy) based on Torch, and includes a deep neural network of an automatic derivation system. The PyTorch achieves rapid, flexible experiments and efficient production through a hybrid front end, distributed training and tool and library ecosystem. Unlike the static computational graph of TensorFlow (which is pre-defined and then used), PyTorch employs a dynamic graph mechanism (runtime dynamic definition).
The embodiment of the invention researches 5 calculation frames which cover the whole world. The domestic framework has a good user maintenance management system, the method tries to mine potential defects of the computing framework, and has good guiding significance for future ecological construction of the computing platform; the foreign framework is a computing framework mainly applied to the current intelligent algorithm, has good applicability to tasks such as images, voice and texts, is applied to a plurality of safety critical fields such as automatic driving, and is of great importance in safety testing of the computing framework.
(2) Integrating the security problems of the target computing frame in the computing frame object library to form a computing frame security defect library; integrating common code errors of a computing framework in a computing framework object library to form a code security defect library; the method specifically comprises the following substeps:
(2.1) calculating a framework library security defect library: the computing framework library includes a library operator and an API (Application Programming Interface), and the security problem may also be divided into a difference between before and after the output of the framework library, a precision error of the library operator, and an output error of the API. And completing the construction of a security defect library by integrating the security problems of the object computing framework of the object computing library of the computing framework created in the step 1).
The frame library pre-post output differences tend to reveal hidden errors. Due to the variety of models, deep learning tasks, and data sets, it is difficult to know how much difference indicates that there is an inconsistency representing a mistake. The output difference is measured by two indexes, D _ CLASS and D _ MAD, wherein the D _ CLASS represents the distance based on the CLASS, and the classification between different frames is calculatedScore σC,YThe absolute value of the difference of (a); d _ MAD is the difference delta between two output vectors and the true vectorO,GThe average absolute distance of (a), which is described in detail below:
Figure BDA0003556376760000061
D_CLASSC,Y,Y'=|σC,YC,Y'|
Figure BDA0003556376760000062
Figure BDA0003556376760000063
wherein C represents the true label, Y represents the output vector of the classification model, Y' represents the output vector of the classification model under another frame, rankC,YRepresents the ranking of the true label C in the classification model Y, k represents the classification ranking threshold, σC,YRepresenting the classification score between different frames. oi,giRepresenting the original model before the i-th input mutation and the mutation model after the i-th input mutation, m representing the number of the mutation models, deltaO,GRepresents the average value of the differences between the m variation models and the original model,
d _ CLASS calculates the score for each predictor by examining the true token ranking in the predictor, and then calculates the difference between the two scores. It considers the ranking beyond the top k meaningless, i.e. sets the score to 0. The D _ MAD considers all the elements in each output vector to calculate its distance from the real class object. Given the ground truth vector denoted G ═ G (G1, G2, … …, gm), the predicted output vector OiAnd Ok. An inconsistency is detected when the value of D _ CLASS or D _ MAD is greater than a predetermined threshold, the value of D _ CLASS or D _ MAD indicating the degree of inconsistency of the markings.
The DL operator (library operator) is a basic building block consisting of various DL algorithms and their interfaces. The DL framework library is constructed on the basis of DL operators, so that errors of the DL operators can directly influence the stability and safety of the framework library. The security problem of the DL operator is mainly the presence of precision errors, which represent the difference between the output produced and the expected value. The accuracy error measures whether the disturbance in the algorithm output is within an acceptable range for a particular input, i.e. the error can be bounded. The accuracy error is defined as follows:
|P(i)-Oi|<ε
where P represents the algorithm, i represents the input, OiRepresenting the desired output for input i, and epsilon represents an acceptable interval.
The output error of the API function means that the API function crashes or the output is invalid. This is often caused by incorrect API documentation, inconsistencies between documentation and code, or invalid input outside of boundary values.
(2.2) code security defect library construction: errors at the code level mainly comprise numerical errors, model parameter declaration errors and tensor dimension inconsistency errors. Completing the construction of a code security defect library by integrating the common code errors of the computing framework in the computing framework object library in the step 1).
The numerical error is one of the most prominent defects in the deep learning algorithm. Numerical errors can result in outliers such as NaN (Not-a-Number) and INF (Infinite). Specifically, numerical errors include Division (y, x) (x ═ 0) denominator of zero, exp (x) (x >88) exceeding the upper computational limit, log (x) (x ≦ 0), sqrt (x) (x < 0). They are typically caused by violations of mathematical property or floating point number representation errors. Once a digital error is triggered in the calculation, it will continue to propagate and eventually result in an invalid output.
Incorrect model parameters or structures in the code can lead to abnormal behavior in the execution phase. These errors typically come from inappropriate model parameters (e.g., learning rates) or incorrect model structures (e.g., missing nodes or layers). This tends to result in inefficient model operation, such as low accuracy and large losses.
The tensor dimensions are not uniform, i.e., misaligned tensors, which may result in a code run error. When the shape of the input tensor does not match the expectation, the error found in the computational graph construction stage is called a misaligned tensor error. Because the tensors in the TensorFlow are allowed to have dynamic shapes, the API function that checks the input tensor can perform errors from one iteration to another, with traditional errors such as array size mismatches.
(3) Positioning the defect codes, constructing a neural network model, and carrying out variation to obtain a variation model set; the method specifically comprises the following substeps:
(3.1) initializing a neural network model, the neural network model being composed of a plurality of layers including at least one convolutional layer and a feature extraction layer, each layer containing a plurality of neurons.
And (3.2) carrying out mutation operation on the neural network model constructed in the step (3.1) based on a Shapril value framework so as to construct a mutation model set. The mutation operation comprises the following steps: identity operation, projection operation, selection operation, connection operation, and reverse connection operation.
The identity operation specifically comprises the following steps: identity operator representation base interpretation
Figure BDA0003556376760000071
It generates a given input x relative to DNN f and a baseline input
Figure BDA0003556376760000072
(e.g., all zero vectors). Conceptually, the identity operator computes the expected contribution of each feature of x to the prediction f (x). Within the frame of the values of salpril, x is used as a d-dimensional vector (x is equal to R)d) And IkAs a subset of k-size of I ═ 1, 2.... multidata, d }, a d-dimensional vector is defined
Figure BDA0003556376760000073
Its ith dimension is defined as:
Figure BDA0003556376760000074
in a visual sense, it is possible to say that,
Figure BDA0003556376760000075
along IkIs replaced by x
Figure BDA0003556376760000076
Then the saliency map is calculated as follows:
Figure BDA0003556376760000081
the projection operation is specifically as follows: intuitively, global importance approximates decision boundaries in high-dimensional space, while local importance focuses on low-dimensional space, so that local boundaries can be more accurately described. For input x and a selected window w, Πw(x) A local significance interpretation of x is generated. By using the frame of the Sapril value, the area of x outside the window w can be completely covered. The projection operation can be expressed as:
Figure BDA0003556376760000082
the selection operation specifically comprises: the selection operation selects the target network layer that needs interpretation. Intuitively, this dynamic significance interpretation captures the "attention" shift of the DNN at different stages, which helps the user to analyze the reasoning process in depth. Assuming that the neural network has n layers of the network f[1:n]Then the selection operator can interpret the selected ith layer. This may be done by connecting the ith layer to the output layer and then retraining the last fully connected layer. We note the retrained network as flThen the selection operator is defined as:
Figure BDA0003556376760000083
the connection operation specifically comprises: the join operation compares the most useful common features of two samples of the same class, denoted x1><x2. Operating in connection with sandThe pri values can be achieved in the framework of:
Figure BDA0003556376760000084
the reverse connection operation specifically comprises the following steps: in contrast to the join operation, the inverse join operation compares the common features of the optimal distinctiveness of the two different classes of samples, denoted as x1<>x2. The reverse ligation operation can be achieved in the frame of the value of salpril as follows:
Figure BDA0003556376760000085
(3.3) carrying out output difference extraction on the variation model set to obtain a characteristic difference vector, calculating a prediction matching rate, and judging whether the neural network model has a defect code block or not according to the characteristic difference vector, wherein the specific steps are as follows:
assume that c mutation models are constructed in total, and the output layer is the softmax layer. Definition { g }1,g2,...,gcIs the output of the variation model constructed in step (3.1), wherein gi(x) Representing the confidence that sample x is classified as i. Definition of { Z1,Z2,...,ZcThe second layer of the variance model reciprocal set, i.e., the logits layer. The extracted feature disparity vector can be expressed as:
D_class=|Zi-Zj|,i≠j,i,j∈c
n difference values are obtained by predicting the difference output. Assume that the m difference outputs have the same label predicted by the variant and original models. And defining m/n as the predicted matching rate. And if the matching rate is greater than or equal to the threshold value delta, defining that the initially constructed neural network model has defects, and thus mining and tracing the defects.
(4) And verifying and tracing the defect codes of the neural network model by a statement operation method, and comparing the defect codes with a computing frame security defect library and a code security defect library to realize defect code block positioning. The method specifically comprises the following steps:
for the found defect codes, in the embodiment of the invention, the defect verification and the source tracing are tried to be realized through statement operation methods such as statement deletion, statement switching, statement copying, statement addition and the like.
The statement deletion specifically includes: a statement is removed from the model building code that conforms to the input shape and the output shape.
The statement switch specifically comprises: the switch segment constructs a sentence code, both having the same input shape and output shape.
The statement replication specifically comprises: a model build code having an input shape that is identical to the output shape is copied, and then the copied build code is inserted to concatenate the original code.
The statement addition specifically comprises: a build statement is selected from the set of generic build statements that conforms to the input shape and the output shape, and then inserted into a compatible location in the model build code.
Finally, by the sentence operations of deleting, switching, copying, adding and the like, the defect position searched and guided by the variation model is verified, and the comprehensive comparison is carried out with the calculation framework security defect library and the code security defect library established in the step (2.1) and the step (2.2), so that the misjudgment rate caused by uncertain influences is eliminated, and the defect code is repaired.
Corresponding to the embodiment of the method for positioning the defect code block based on the model structure evolution, the invention also provides an embodiment of a device for positioning the defect code block based on the model structure evolution.
Referring to fig. 2, the defect code block positioning apparatus based on model structure evolution provided in the embodiment of the present invention includes one or more processors, and is configured to implement the defect code block positioning apparatus based on model structure evolution in the foregoing embodiment.
The embodiment of the apparatus for locating a defect code block based on model structure evolution of the present invention can be applied to any device with data processing capability, such as a computer or other devices or apparatuses. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. The software implementation is taken as an example, and as a logical device, the device is formed by reading corresponding computer program instructions in the nonvolatile memory into the memory for running through the processor of any device with data processing capability. In terms of hardware, as shown in fig. 2, a hardware structure diagram of any device with data processing capability where the apparatus for positioning a defective code block based on model structure evolution of the present invention is located is shown, except for the processor, the memory, the network interface, and the nonvolatile memory shown in fig. 2, in the embodiment, any device with data processing capability where the apparatus is located may also include other hardware according to the actual function of the any device with data processing capability, which is not described again.
The specific details of the implementation process of the functions and actions of each unit in the above device are the implementation processes of the corresponding steps in the above method, and are not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the invention. One of ordinary skill in the art can understand and implement it without inventive effort.
An embodiment of the present invention further provides a computer-readable storage medium, on which a program is stored, where the program, when executed by a processor, implements the method for a defect code block locating device based on model structure evolution in the foregoing embodiments.
The computer readable storage medium may be an internal storage unit, such as a hard disk or a memory, of any data processing capability device described in any of the foregoing embodiments. The computer readable storage medium can be any device with data processing capability, such as a plug-in hard disk, a Smart Media Card (SMC), an SD Card, a Flash memory Card (Flash Card), etc. provided on the device. Further, the computer readable storage medium may include both an internal storage unit and an external storage device of any data processing capable device. The computer-readable storage medium is used for storing the computer program and other programs and data required by the arbitrary data processing-capable device, and may also be used for temporarily storing data that has been output or is to be output.
The above embodiments are only used for illustrating the design idea and features of the present invention, and the purpose of the present invention is to enable those skilled in the art to understand the content of the present invention and implement the present invention accordingly, and the protection scope of the present invention is not limited to the above embodiments. Therefore, all equivalent changes and modifications made in accordance with the principles and concepts disclosed herein are intended to be included within the scope of the present invention.

Claims (8)

1. A defect code block positioning method based on model structure evolution is characterized by comprising the following steps:
(1) summarizing an object library and safety problems of the deep learning calculation frame library based on a plurality of deep learning calculation frame libraries, and constructing a calculation frame object library;
(2) integrating the security problems of the target computing frame in the computing frame object library to form a computing frame security defect library; integrating common code errors of a computing framework in a computing framework object library to form a code security defect library;
(3) constructing a neural network model, carrying out variation on the neural network model to obtain a variation model set, carrying out output difference extraction on the variation model set to obtain a characteristic difference vector, calculating a predicted matching rate, and judging whether a defective code block exists in the neural network model or not according to the characteristic difference vector;
(4) and verifying and tracing the defect codes of the neural network model by a statement operation method, and comparing the defect codes with a computing framework security defect library and a code security defect library to realize defect code block positioning.
2. The model structure evolution based defect code block localization method of claim 1, wherein the deep learning computation framework library comprises MindSpore, Paddle, TensorFlow, PyTorch and Keras.
3. The method for locating a defect code block based on model structure evolution as claimed in claim 1, wherein the step (2) comprises the following sub-steps:
(2.1) constructing a computing framework security defect library by integrating security problems of a computing framework object library target computing framework, including output difference before and after a framework library, precision error of a library operator and output error of an API function;
and (2.2) constructing a code security defect library by integrating common code errors of the calculation framework including numerical errors, model parameter declaration errors and tensor dimension inconsistency errors in the calculation framework object library.
4. The method for locating a defect code block based on model structure evolution as claimed in claim 1, wherein the step (3) comprises the following sub-steps:
(3.1) initializing a neural network model;
(3.2) carrying out variation operation on the neural network model constructed in the step (3.1) based on a Shapril value framework so as to construct a variation model set;
and (3.3) carrying out output difference extraction on the variation model set to obtain a characteristic difference vector, calculating a prediction matching rate, and judging whether the neural network model has a defect code block or not.
5. The method of claim 1, wherein the mutation operation comprises: an identity operation, a projection operation, a selection operation, a join operation, or a reverse join operation.
6. The method for locating a defect code block based on model structure evolution of claim 1, wherein the sentence operation method comprises sentence deletion, sentence switching, sentence copying or sentence addition.
7. An electronic device comprising a memory and a processor, wherein the memory is coupled with the processor; wherein the memory is configured to store program data, and the processor is configured to execute the program data to implement the method for locating a defect code block based on model structure evolution as claimed in any one of claims 1 to 6.
8. A computer readable storage medium having stored thereon a computer program, wherein said program when executed by a processor implements the method for model structure evolution based defect code block localization as claimed in any one of claims 1-6.
CN202210279322.9A 2022-03-21 2022-03-21 Defect code block positioning method based on model structure evolution Pending CN114706764A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210279322.9A CN114706764A (en) 2022-03-21 2022-03-21 Defect code block positioning method based on model structure evolution

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210279322.9A CN114706764A (en) 2022-03-21 2022-03-21 Defect code block positioning method based on model structure evolution

Publications (1)

Publication Number Publication Date
CN114706764A true CN114706764A (en) 2022-07-05

Family

ID=82169710

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210279322.9A Pending CN114706764A (en) 2022-03-21 2022-03-21 Defect code block positioning method based on model structure evolution

Country Status (1)

Country Link
CN (1) CN114706764A (en)

Similar Documents

Publication Publication Date Title
Zhang et al. Sequential optimization for efficient high-quality object proposal generation
CN115357904B (en) Multi-class vulnerability detection method based on program slicing and graph neural network
Wu et al. Sharing deep neural network models with interpretation
Huang et al. A survey of safety and trustworthiness of deep neural networks
CN116432184A (en) Malicious software detection method based on semantic analysis and bidirectional coding characterization
Wu et al. SDLV: Verification of steering angle safety for self-driving cars
Alon et al. Using graph neural networks for program termination
Huang et al. Machine learning safety
Yahmed et al. DiverGet: A search-based software testing approach for deep neural network quantization assessment
Chen et al. ActGraph: prioritization of test cases based on deep neural network activation graph
Abonyi et al. Event‐Tree Based Sequence Mining Using LSTM Deep‐Learning Model
CN116208399A (en) Network malicious behavior detection method and device based on metagraph
CN114706764A (en) Defect code block positioning method based on model structure evolution
CN115858388A (en) Test case priority ordering method and device based on variation model mapping chart
CN114579761A (en) Information security knowledge entity relation connection prediction method, system and medium
CN112906824A (en) Vehicle clustering method, system, device and storage medium
Diwan Representation Learning for Vulnerability Detection on Assembly Code
Song et al. Loop closure detection of visual SLAM based on variational autoencoder
CN117556425B (en) Intelligent contract vulnerability detection method, system and equipment based on graph neural network
Balouchi et al. Graph Representation Learning In A Contrastive Framework For Community Detection
Kasturi et al. Object Detection in Heritage Archives Using a Human-in-Loop Concept
Chouraqui et al. A geometric method for improved uncertainty estimation in real-time
US11423252B1 (en) Object dataset creation or modification using labeled action-object videos
Jiang et al. Graph matching
Wu Robustness evaluation of deep neural networks with provable guarantees

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