A neural network training property verification method based on unified model detection

By verifying the training properties of neural networks using MSVL formal models and PPTL formulas, the limitations of activation function selection and the lack of verification of training properties in existing technologies are resolved, thus ensuring the safety and reliability of the neural network training process.

CN116911355BActive Publication Date: 2026-01-06XIDIAN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310685300.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-09
Publication Date
2026-01-06
Estimated Expiration
2043-06-09

AI Technical Summary

Technical Problem

Existing technologies have limitations in the selection of activation functions for neural networks and have failed to effectively verify the properties during the training process, thus failing to guarantee the safety and reliability of neural networks during training.

Method used

The training properties of the neural network are verified using the MSVL formal model and PPTL formula. By constructing a hierarchical and modular structure of the neural network, training-related properties are explored, and the UMC4M validator is used to perform an exhaustive search to determine whether there are problems such as gradient vanishing and neuron inactivation.

Benefits of technology

It can effectively identify and improve problems in neural network structures, enhance training results, ensure the security and reliability of neural networks, and provide more reliable verification methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116911355B_ABST
    Figure CN116911355B_ABST
Patent Text Reader

Abstract

The application discloses a neural network training property verification method based on unified model detection, and comprises the following steps: constructing an MSVL formal model of a neural network to be verified according to the principles of layering and modularization, wherein the MSVL formal model comprises structure construction and basic behavior construction; mining training related properties of the neural network and constructing the training related properties into PPTL formulas, wherein the training related properties include gradient disappearance, gradient explosion, a large number of neuron inactivation and network training convergence; and verifying the neural network in combination with the MSVL formal model and the PPTL formulas to determine whether the training related property problems exist in the neural network. The unified model detection method is executed by taking the MSVL model of the neural network and the PPTL formula as input to complete the verification, which can help to effectively find the problems existing in the neural network structure, improve the training effect of the neural network, and provide more reliable and safe guarantee for the training and application of the neural network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of neural network credibility verification technology, specifically relating to a method for verifying the training properties of neural networks based on unified model detection. Background Technology

[0002] With the application of neural networks in some key areas, people have placed higher demands on their safety. However, extensive research by scholars both domestically and internationally has shown that neural networks are likely to make incorrect predictions when faced with slight perturbations in the input, and such slight perturbations are highly probable in real-world applications. In March 2019, a Boeing aircraft crashed minutes after takeoff, killing all 157 people on board. The accident was caused by a software malfunction in the aircraft's anti-stall system, called MCAS, which prevented the pilots from properly controlling the aircraft's direction. In November 2022, on a foreign highway, a Tesla Model S in Autopilot mode suddenly braked, causing a chain-reaction collision involving eight other vehicles. Multiple ambulances rushed to the scene to assist the injured drivers.

[0003] Therefore, verifying the security properties of neural networks is crucial. Currently, most neural networks are tested for security. However, testing methods lack coverage; test cases cannot cover all possible scenarios, and even if a test is passed, the system's reliability cannot be guaranteed, thus failing to ensure the absence of defects. In contrast, formal verification is a method that ensures system security and reliability through rigorous logical deduction. It employs formal methods such as model checking and theorem proving to rigorously deduce whether the system meets expected properties, thus guaranteeing system security and reliability. Formal verification has advantages such as ensuring correct results, broad coverage, and high reliability, enabling the detection of system defects during the design phase and avoiding problems only being discovered during production deployment.

[0004] In recent years, the academic community has conducted research on the formal verification of neural network systems, resulting in some preliminary techniques. Among these, verification methods based on SMT (Satisfiability Modulo Theory) use linear approximations to approximate the properties of the neural network and employ logical formulas to examine whether each neuron satisfies operations such as ReLU. This tool can be used to find images that can still be correctly classified under specified perturbations. Such methods typically perform well when the properties of the neural network to be verified can be expressed as a logical composition of SMT constraints. Another approach based on abstract interpretation has been proposed. Its main idea is to use a set of conditional affine functions to model ReLU-based neural networks, which can characterize various structures in the neural network, such as fully connected, convolutional, and max-pooling layers. During the verification process, various abstract domains are used to analyze these affine functions, ultimately obtaining the range of values ​​for output layer variables or the constraint relationships between variables. A third approach is based on layer-by-layer refinement, analyzing from the input layer of the neural network down to its hidden layers and finally reaching the output layer. Specifically, for an input layer or a hidden layer, the finite region surrounding its input vector space can be exhaustively explored using single-path or multi-path search methods.

[0005] In existing formal verification methods for neural networks, many studies have limitations in the choice of activation functions, with most focusing only on relatively simple activation functions such as ReLU. Furthermore, current techniques concentrate on properties exhibited by neural network systems during prediction, such as robustness, and lack research on the properties exhibited by neural networks during training.

[0006] In summary, the problems and shortcomings of the existing technology are as follows:

[0007] (1) Most existing technologies have limitations in the selection of activation functions;

[0008] (2) Existing technologies are all geared towards the properties exhibited by neural networks when performing prediction functions, and do not support the characterization and verification of training-related properties. Summary of the Invention

[0009] To address the aforementioned problems in the existing technology, this invention provides a method for verifying the training properties of neural networks based on unified model detection. The technical problem to be solved by this invention is achieved through the following technical solution:

[0010] This invention provides a method for verifying the training properties of neural networks based on a unified model detection, comprising:

[0011] S1: Construct the MSVL formal model of the neural network to be verified according to the principles of hierarchy and modularity. The MSVL formal model includes structure construction and basic behavior construction.

[0012] S2: Mine the training-related properties of the neural network and construct the training-related properties into PPTL formulas. The training-related properties include gradient vanishing phenomenon, gradient exploding phenomenon, large number of neurons inactivation phenomenon, and network training convergence.

[0013] S3: Verify the neural network by combining the MSVL formal model and the PPTL formula to determine whether there are training-related property problems in the neural network.

[0014] In one embodiment of the present invention, the structure construction is used to design the structure of the neural network as a corresponding data structure, including a three-layer structure. The first layer is a basic operation logic unit, including three data structures: vector, matrix and tensor. The second layer is a hierarchical unit of the neural network, including predefined network parameters, dataset and related parameters, and a unified layer structure. The third layer is a network-level unit, including a convolutional neural network module and a fully connected neural network module.

[0015] In one embodiment of the present invention, the basic behavior construction is used to design various operations of the neural network on the data sample set as corresponding function methods, including a two-layer structure. The first layer consists of basic operation units alone, including basic matrix operations, weight initialization, loss function correlation, and activation function correlation. The second layer includes a network creation unit and a network operation unit. The network creation unit implements the functions needed to create the neural network, including network initialization and network access. The network operation unit implements the functions used by the neural network in the training and prediction processes, including forward propagation, backpropagation, testing and statistics, and optimization algorithms.

[0016] In one embodiment of the present invention, for the gradient vanishing phenomenon, constructing the PPTL formula includes:

[0017] Define floating-point type variables firstRatio and lastRatio to represent the gradient change rates of the first and last hidden layers of the neural network, respectively:

[0018]

[0019]

[0020] Where firstNablaMa represents the gradient matrix of the first hidden layer, firstWeightBiasMat represents the weight matrix of the first hidden layer, lastNablaMat represents the gradient matrix of the last hidden layer, lastWeightBiasMat represents the weight matrix of the last hidden layer, and ASum() means first calculating the sum of the absolute values ​​of all elements in the matrix, and then dividing the sum of the absolute values ​​by the number of elements in the matrix.

[0021] The vanishing gradient-free property is characterized by the PPTL formula P1:

[0022] P1 = alw(r→(p or q))

[0023]

[0024]

[0025]

[0026] Here, epochEnd indicates whether a complete training process has ended, with 1 indicating the end and 0 indicating the end.

[0027] In one embodiment of the present invention, for the phenomenon of large-scale neuron inactivation, the PPTL formula P2 is expressed as:

[0028] P2 = alw(q→p)

[0029]

[0030]

[0031] Wherein, dyingReLU represents the number of inactivated neurons in the last hidden layer, totalNeuron represents the total number of neurons in the last hidden layer, and epochEnd indicates whether a complete training process has ended, with 1 indicating end and 0 indicating not end.

[0032] In one embodiment of the present invention, S3 includes:

[0033] The UMC4M verifier is invoked to receive the MSVL formal model and the PPTL formula. It exhaustively searches the state space of the entire MSVL formal model, checks the property reduction of each state, and verifies whether the property requirements are met.

[0034] In one embodiment of the present invention, S3 includes:

[0035] The UMC4M verifier receives the MSVL formal model and the PPTL formula. For the program M of the MSVL formal model and the PPTL formula P of the property to be verified, the UMC4M verifier performs a negation operation on formula P and converts the negated property into an MSVL program. For program M and Perform a join operation to generate the MSVL program Mand.

[0036] The MSVL program M and are compiled and run by the modeling simulation verification language compiler. And perform a state space search process to complete the verification. If the MSVL program M and If the code can be compiled and executed correctly, then this property is not satisfied, and the output will be "Invalid"; otherwise, the output will be "Valid".

[0037] In one embodiment of the present invention, when it is determined that the neural network exhibits gradient vanishing, the activation function in the neural network is replaced or the number of hidden layers is reduced to obtain a new neural network model, and the model is verified again.

[0038] In one embodiment of the present invention, when it is determined that a large number of neurons in the neural network are inactive, the learning rate of the optimization algorithm in the neural network is reduced to obtain a new neural network model, and then the model is verified again.

[0039] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0040] 1. This invention provides a method for verifying neural network training-related properties using MSVL models and PPTL formulas, aiming to solve the problems that most existing technologies have limitations in the processing of activation functions and that existing technologies do not support the characterization and verification of neural network training-related properties.

[0041] 2. This invention verifies the training properties of neural networks. The verification results can help relevant researchers effectively discover problems in the network structure design, thereby helping to improve the training effect of neural networks and providing assurance for the security and reliability of neural network systems.

[0042] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0043] Figure 1 This is a flowchart of a neural network training property verification method based on unified model detection provided by an embodiment of the present invention;

[0044] Figure 2This is a schematic diagram of the structure of a fully connected neural network model FCNN-1 provided in an embodiment of the present invention;

[0045] Figure 3 This is a schematic diagram of a neural network modeling provided in an embodiment of the present invention;

[0046] Figure 4 This is a schematic diagram illustrating the verification of neural network training-related properties provided in an embodiment of the present invention;

[0047] Figure 5 This is a structural diagram of the CNN-1 convolutional neural network model provided in an embodiment of the present invention. Detailed Implementation

[0048] To further illustrate the technical means and effects adopted by the present invention to achieve the intended purpose, the following detailed description of the neural network training property verification method based on unified model detection proposed in accordance with the present invention is provided in conjunction with the accompanying drawings and specific embodiments.

[0049] The foregoing and other technical contents, features, and effects of the present invention will be clearly presented in the following detailed description of specific embodiments in conjunction with the accompanying drawings. Through the description of the specific embodiments, a more in-depth and concrete understanding can be gained of the technical means and effects adopted by the present invention to achieve its intended purpose. However, the accompanying drawings are for reference and illustration only and are not intended to limit the technical solutions of the present invention.

[0050] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations are intended to cover non-exclusive inclusion, such that an article or apparatus comprising a list of elements includes not only those elements but also other elements not expressly listed. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the article or apparatus that includes said element.

[0051] Example 1

[0052] Embodiment 1 of the present invention describes and verifies the properties of the gradient vanishing phenomenon in neural networks.

[0053] Please see Figure 1 , Figure 1 This is a flowchart of a method for verifying the training properties of a neural network based on a unified model detection, provided by an embodiment of the present invention. The verification method includes the following steps:

[0054] S1: Following the principles of hierarchy and modularity, MSVL (Modeling, Simulation and Verification Language) is used to construct the MSVL formal model of the neural network to be verified. Specifically, the data structures at each level in the neural network are constructed, and the network operation behavior is constructed based on these data structures.

[0055] The neural network task processed in this embodiment is handwritten digit recognition, a 10-class classification task that distinguishes handwritten digits. The data sample set selected in this embodiment consists of 70,000 handwritten digit images from 0 to 9, divided into 60,000 training samples and 10,000 prediction samples. These images are small square grayscale images of 28×28 pixels. In this embodiment, using this data sample set, a 5-layer fully connected neural network model FCNN-1 is constructed based on MSVL. The training parameters of network model FCNN-1 are shown in Table 1, and the structure of network model FCNN-1 is as follows. Figure 2 As shown, the activation function for all hidden layers is the Sigmoid function. It should be noted that in other embodiments, other suitable neural network models can be constructed; this is not a limitation.

[0056] Table 1 Training parameters of the fully connected neural network model FCNN-1

[0057] Number of hidden layers 3 Weight initialization method <![CDATA[He initialization, N(0, 1.5 2 )]]> Number of categories 10 loss function CrossEntropy Loss Optimization Algorithm ADAM, learning rate 0.001 Batch size 200 Training epochs 10

[0058] Please see Figure 3 , Figure 3 This is a schematic diagram of a neural network modeling method provided by an embodiment of the present invention. The neural network modeling in this embodiment consists of two parts: structure construction and basic behavior construction. Structure construction involves designing the neural network structure as a corresponding data structure, including a three-layer structure. The first layer is the basic operational logic unit, including three data structures: vectors, matrices, and tensors. Vectors and tensors can be considered special representations of matrices; therefore, the matrix is ​​the lowest and most crucial structure in this framework. The second layer is the hierarchical unit of the neural network, including predefined network parameters, datasets and related parameters, and a unified layer structure. Through unified design, fully connected layers, convolutional layers, deconvolutional layers, max pooling layers, and average pooling layers can all be represented by a unified layer structure. The third layer is the network-level unit, responsible for finally constructing the network-level structure, and is divided into two parts: a convolutional neural network module and a fully connected neural network module.

[0059] The basic behavior construction in this embodiment is designed to transform various operations of the neural network on the dataset into corresponding function methods. It includes a two-layer structure. The first layer consists of basic operation units, including basic matrix operations, weight initialization, loss function related functions, and activation function related functions. The second layer differs from the first layer, consisting of two units: a network creation unit, which mainly implements the functions needed to create the neural network, including network initialization and network access; and a network operation unit, which mainly implements the functions used by the neural network during training and prediction, including forward propagation, backpropagation, testing and statistics, and optimization algorithms.

[0060] The underlying structure method library of the MSVL formal model includes:

[0061] (I) Hierarchical Structure of Neural Networks:

[0062] (a) A matrix structure, which is used to represent a two-dimensional data set with rows and columns;

[0063] (b) A predefined parameter structure, which includes multiple attributes such as the total number of samples required by the user, the number of sample categories, and the number of hidden layers;

[0064] (c) Unified network layer structure, which is used to uniformly represent the five network layer structures of fully connected layers, convolutional layers, deconvolutional layers, max pooling layers and average pooling layers, including multiple attributes such as layer type flag, activation function selection flag, and weight matrix;

[0065] (d) Network-level structure, which stores the structure and related parameters of the entire network, including the height and width of the sample image, information of all layers in the network, and other attributes.

[0066] (II) Basic Behavior Methods of Neural Networks:

[0067] (a) Basic operation methods, which cover addition, subtraction, multiplication and division operations on vectors, matrices and tensors;

[0068] (b) Weight initialization method: In the creation stage of the neural network, an initial value is assigned to the weights of all layers, including random initialization, Xavier initialization, He initialization and other methods.

[0069] (c) Activation function method, which covers two behavioral operations: activation function and its derivative function. The activation functions that can be selected are Sigmoid activation function, Tanh activation function, ReLU activation function, etc.

[0070] (d) Forward propagation related methods, which cover the forward propagation process of five hierarchical structures, i.e. how the input is transformed into the final output in different types of network layers;

[0071] (e) Backpropagation related methods, which cover the backpropagation process of five hierarchical structures, namely, calculating the derivative of the loss function with respect to the neural network parameters in different types of network layers, thereby updating the weights and biases of the neural network.

[0072] Furthermore, the matrix structure is located in the basic operation logic unit, the predefined parameter structure and the unified network layer structure are located in the hierarchical unit, and the network-level structure is located in the network-level unit; the basic operation method, the weight initialization method and the activation function method are located in the basic operation unit, and the forward propagation correlation method and the back propagation correlation method are located in the network operation unit.

[0073] Based on the above construction method, this embodiment obtains the MSVL model of FCNN-1. The specific creation process mainly consists of the following steps.

[0074] (1) Create and initialize the predefined parameter structure;

[0075] (2) Set up the network structure, including one input layer, three fully connected layers and one output layer;

[0076] (3) Create the dataset structure;

[0077] (4) Create and initialize the optimization algorithm parameter structure;

[0078] (5) Set the number of epochs and train the network.

[0079] The core construction code in its main method is shown below:

[0080]

[0081]

[0082]

[0083] S2: Mine the training-related properties of the neural network and characterize the training-related properties as corresponding PPTL (Propositional Projection Temporal Logic) formulas. The training-related properties include gradient vanishing phenomenon, gradient exploding phenomenon, large number of neuron inactivation phenomenon, and network training convergence.

[0084] This embodiment takes the vanishing gradient phenomenon as an example. Please refer to Table 2. Table 2 is the auxiliary variable related to the vanishing gradient phenomenon defined in this embodiment, in order to explore the properties and laws reflected by this phenomenon.

[0085] Table 2. Auxiliary variables related to the vanishing gradient phenomenon.

[0086]

[0087] In this embodiment, the weights, gradients, and other variables within the neural network are stored in the form of a matrix data structure. Since a matrix is ​​a two-dimensional structure, it is difficult to directly compare the magnitudes of related variables such as weights. Therefore, the ASum function is defined. This function first calculates the sum of the absolute values ​​of all elements in the matrix, and then divides this sum by the number of elements in the matrix, thereby converting the two-dimensional matrix into a one-dimensional floating-point number.

[0088] The ASum function allows for a more intuitive observation of the changing trends of various matrix-type variables in a neural network, facilitating the discovery of the causes and patterns of related phenomena. Floating-point type variables firstRatio and lastRatio are defined to represent the gradient change rates of the first and last hidden layers of the neural network under test, respectively, as shown below:

[0089]

[0090]

[0091] If gradient vanishing occurs in a neural network, the value of `firstRatio` will become very small at the end of a training iteration (epoch), and the difference between `firstRatio` and `lastRatio` will be large. This is used to characterize the PPTL formula for no gradient vanishing. Proposition `p` indicates that the value of `firstRatio` is not a small value, i.e., the value of `firstRatio` is greater than a preset threshold, which is represented by 0.01 here; Proposition `q` indicates that the ratio of `lastRatio` to `firstRatio` does not exceed a preset critical value, which is chosen as 8 here; Proposition `r` indicates that the current epoch has ended. Therefore, the no-gradient-vanishing property can be characterized by the PPTL formula P1, as shown below:

[0092] P1 = alw(r→(p or q))

[0093]

[0094]

[0095]

[0096] S3: Verify the neural network by combining the MSVL formal model and PPTL formula to determine whether there are training-related property problems in the neural network.

[0097] This step executes the unified model checking method, calling the verification tool UMC4M to receive the aforementioned MSVL formal model and PPTL formula, and then exhaustively searches the state space of the entire MSVL formal model. Specifically, it starts with the initial state of the neural network system and adds it to the set of states to be processed. This set of states stores the state at each time step during the operation of the neural network. Then, it selects a state from the set of states to be processed and generates a successor state according to the system's state transition rules, adding the newly generated state to the set of states to be processed. Each state is then checked for property reduction to verify whether it meets the property requirements. If a state violates the property reduction, the search stops and an error is reported. If the set of states to be processed is empty, it means that all possible states of the system have been exhausted, and the verification process ends. If no state violates the property reduction at this point, it means that the system meets the property requirements.

[0098] The specific principle of the UMC4M verifier is as follows: For the MSVL formal model's program M and the PPTL formula P of the property to be verified, the UMC4M verifier performs a negation operation on formula P and converts the negated property into an MSVL program. Then for M and Perform a join operation to generate a new MSVL program M and The program is compiled and run by a modeling simulation verification language compiler, and the aforementioned state space search process is executed to complete the verification. This method transforms the verification process of the model and its properties into the execution process of an MSVL program. Program execution is typically more time-efficient than the verification process, thus this conversion leads to higher efficiency. Finally, if the program M and If the program can be compiled and executed correctly, it means there is a counterexample and the program does not satisfy the property, so output "Invalid". Otherwise, it means the program satisfies the property, so output "Valid".

[0099] Please see Figure 4 , Figure 4This is a schematic diagram illustrating the verification of neural network training-related properties according to an embodiment of the present invention. First, the neural network, having received the input dataset, is formally constructed to obtain its MSVL model. Second, propositional projection temporal logic is used to characterize the training-related properties to be verified, yielding the corresponding PPTL formula. Finally, using the aforementioned MSVL model and PPTL formula as input, a unified model detection method is executed to exhaustively search the entire model, detecting whether a path violates the property to be verified, thereby providing a valid or invalid verification result.

[0100] Combining the MSVL model of FCNN-1 with PPTL formula P1 which has no vanishing gradient property, execute Figure 4 The validation scheme was implemented, and the validation results are shown in Table 3. The validation program automatically terminated after the 8th epoch and gave an "Invalid" validation result, indicating that the training process of FCNN-1 did not satisfy the property of no gradient vanishing, that is, gradient vanishing occurred, so there was no need to continue executing subsequent epochs. At this point, it can also be seen from the accuracy of the test dataset that the training effect of the model is indeed poor, with an accuracy of only 48% after the 8th epoch.

[0101] Table 3. FCNN-1 Validation Results

[0102] epoch count accuracy Loss value Verification results 1 25.96% 2.514895 — 2 30.75% 2.394481 — … … … … 7 45.67% 1.954268 — 8 48.26% 1.895271 Invalid

[0103] It should be noted that the appearance of vanishing gradients indicates that the design of the neural network structure is not reasonable and can be further improved. Vanishing gradients are caused by the chain reaction of derivatives in the backpropagation process. Improvements can be made by increasing the derivative of the activation function in the formula or reducing the length of the entire derivative chain. This can be achieved by changing the activation function or reducing the number of hidden layers. In this embodiment, the activation function in FCNN-1 is replaced with ReLU, resulting in a new network model FCNN-1m (modified). The model is then validated again, and the results are shown in Table 4. The validation result is Valid, indicating that the vanishing gradient phenomenon no longer occurs during the training process of FCNN-1m. At this point, the accuracy of the test dataset reaches 96% after the 10th epoch.

[0104] Table 4. Validation results of FCNN-1m

[0105] epoch count accuracy Loss value Verification results 1 90.41% 0.374143 — 2 91.75% 0.316641 — … … … … 8 95.76% 0.169574 — 9 96.01% 0.161549 — 10 96.23% 0.154977 Valid

[0106] Example 2

[0107] This embodiment characterizes and verifies the phenomenon of large-scale neuron inactivation in neural networks. The task of the neural network being processed remains handwritten digit recognition. In this embodiment, the MNIST dataset is used as input samples to construct a 5-layer convolutional neural network model CNN-1. The training parameters of the network are shown in Table 5, and the network structure is as follows. Figure 5 As shown, the ReLU activation function is chosen for the convolutional layers, and the Sigmoid activation function is chosen for the fully connected layers. It should be noted that other suitable neural network models can be constructed in other embodiments; this is not a limitation.

[0108] Table 5 Training parameters of CNN-1

[0109] Number of hidden layers 3 Weight initialization method <![CDATA[He initialization, N(0, 1.2 2 )]]> Number of categories 10 loss function CrossEntropy Loss Optimization Algorithm MBGD, learning rate 0.3 Batch size 100 Training epochs 10

[0110] based on Figure 3 The construction method shown in this embodiment yields the MSVL model of CNN-1. The construction process mainly consists of the following steps:

[0111] (1) Create and initialize the predefined parameter structure;

[0112] (2) Set up the network structure: 1 input layer, 1 convolutional layer, 1 max pooling layer, 1 fully connected layer, and 1 output layer;

[0113] (3) Create the dataset structure;

[0114] (4) Create and initialize the optimization algorithm parameter structure;

[0115] (5) Set the number of epochs and train the network.

[0116] Furthermore, the core construction code in its main method is shown below.

[0117]

[0118]

[0119]

[0120] Further, please refer to Table 6, which lists auxiliary variables related to the large-scale neuron inactivation phenomenon defined in this embodiment, in order to explore the underlying properties and patterns of this phenomenon. In this embodiment, the inactivation of a single neuron is defined as follows: the proportion of negative values ​​in a certain column of the weight matrix corresponding to the neuron exceeds 60%, and the output value of the neuron after the activation function is 0. Furthermore, since weight updates in a neural network are performed from back to front, the analysis only needs to focus on the number of inactivated neurons in the last hidden layer.

[0121] Table 6. Auxiliary variables related to the phenomenon of massive neuronal inactivation.

[0122]

[0123] If a large number of neurons in a neural network become inactive, the proportion of dyingReLU to total neurons should be relatively high at the end of a given epoch. This leads to the PPTL formula for a neural network without a large number of inactive neurons. Proposition p indicates that the proportion of dyingReLU to total neurons does not exceed a certain threshold; here, 0.3 is chosen as the threshold value. Proposition q indicates that the current epoch has ended. Furthermore, the absence of a large number of inactive neurons can be described by the PPTL formula P2, as shown below:

[0124] P2 = alw(q→p)

[0125]

[0126]

[0127] Combining the MSVL model of CNN-1 with PPTL formula P2 (which does not contain a large number of inactive neurons), a unified model detection was performed. The verification process is similar to S3 in Example 1 and will not be repeated here. The verification results are shown in Table 7. The verification program automatically terminated after the 6th epoch and gave an "Invalid" verification result, indicating that the training process of CNN-1 did not satisfy the property of not containing a large number of inactive neurons, that is, many neurons were inactive, so it was unnecessary to execute subsequent epochs. At this point, the accuracy of the test dataset also showed that the training effect of the model was indeed poor, with an accuracy of only 43% after the 6th epoch.

[0128] Table 7 CNN-1 Validation Results

[0129] epoch count accuracy Loss value Verification results 1 28.06% 2.701238 — ... ... ... ... 5 43.51% 1.704423 — 6 43.47% 1.748345 Invalid

[0130] To illustrate how the verification method of this invention helps improve the training effect of neural networks, further improvements are made to address the problems discovered in the verification. Neuron inactivation is caused by weights becoming negative during weight updates. Therefore, the most direct improvement is to reduce the value of each update, which can be achieved by lowering the learning rate of the optimization algorithm. The learning rate of MBGD (Mini-Batch Gradient Descent) in CNN-1 was changed to 0.1, resulting in a new model CNN-1m. Verification was performed again, and the results are shown in Table 8. The verification result is Valid, indicating that a large number of neurons did not inactivate during the training of CNN-1m. At this point, the accuracy of the test dataset also reached 97% after the 10th epoch.

[0131] Table 8 CNN-1m Validation Results

[0132]

[0133]

[0134] In summary, this invention provides a method for verifying neural network training-related properties using the MSVL model and PPTL formula. This aims to address the limitations of existing technologies in selecting activation functions and their lack of support for characterizing and verifying neural network training-related properties. The verification results of this invention can help researchers effectively identify problems in neural network structure design, thereby improving the training effect of neural networks and ensuring the security and reliability of neural network systems.

[0135] In the several embodiments provided by this invention, it should be understood that the apparatus and methods disclosed in this invention can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of modules is merely a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0136] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated module can be implemented in hardware or in the form of hardware plus software functional modules.

[0137] Another embodiment of the present invention provides a storage medium storing a computer program for executing the steps of the neural network training property verification method based on unified model detection described in the above embodiments. A further aspect of the present invention provides an electronic device including a memory and a processor. The memory stores a computer program, and the processor, when calling the computer program in the memory, implements the steps of the neural network training property verification method based on unified model detection as described in the above embodiments. Specifically, the integrated modules implemented as software functional modules can be stored in a computer-readable storage medium. The software functional modules stored in a storage medium include several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0138] The above description, in conjunction with specific preferred embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of the present invention, and all such modifications and substitutions should be considered within the scope of protection of the present invention.

Claims

1. A method for verifying properties of neural network training based on uniform model checking, characterized in that, The method comprises the following steps: S1: constructing an MSVL formal model of a neural network to be verified according to the principles of layering and modularization, wherein the MSVL formal model comprises structure construction and basic behavior construction, the task of the neural network is handwritten digit recognition, and a selected data sample set is a digital picture; S2: mining training-related properties of the neural network and constructing the training-related properties into PPTL formulas, wherein the training-related properties comprise gradient disappearance, gradient explosion, a large number of neuron inactivation, and network training convergence; S3: verifying the neural network in combination with the MSVL formal model and the PPTL formulas to determine whether there is a training-related property problem in the neural network; For the gradient disappearance, the construction of the PPTL formulas comprises: Defining a floating point number type variable firstRatio and lastRatio respectively represent a gradient change rate of a first hidden layer and a last hidden layer of the neural network. wherein, firstNablaMa represents a gradient matrix of the first layer hidden layer, firstWeightBiasMat represents a weight matrix of the first layer hidden layer, lastNablaMat represents a gradient matrix of the last layer hidden layer, lastWeightBiasMat represents a weight matrix of the last layer hidden layer, ASum () represents that the sum of absolute values of all elements in a matrix is first calculated, and then the sum of absolute values is divided by the number of elements in the matrix; The vanishing of gradient-free property is characterized as PPTL formula : , wherein, epochEnd denotes whether a complete training process is finished, 1 denotes finished, and 0 denotes not finished; For the large number of neuron inactivation phenomenon, the PPTL formula is expressed as: wherein, dyingReLU represents the number of deactivated neurons in the last hidden layer, totalNeuron represents the total number of neurons in the last hidden layer, epochEnd represents whether a complete training process is finished, 1 means finished, 0 means not finished; The S3 comprises: The UMC4M verifier is invoked to receive the MSVL formal model and the PPTL formula, and the program for the MSVL formal model is executed. M PPTL formula for properties to be verified P The UMC4M verifier verifies the formula P Perform a NOT operation and convert the NOT property into an MSVL program. For the program M and Perform a join operation to generate an MSVL program. ; compiling and running the MSVL program by a modeling simulation verification language compiler and performing a state space search procedure, thereby completing the verification, if the MSVL program cannot be correctly compiled and executed, outputting Invalid, otherwise outputting Valid.

2. The unified model checking based neural network training property verification method according to claim 1, characterized in that, The structure construction is used to design the structure of the neural network into a corresponding data structure, comprising three layers, the first layer is a basic operation logic unit, comprising three data structures of a vector, a matrix and a tensor; the second layer is a hierarchical unit of the neural network, comprising pre-defined network parameters, a data set and related parameters, and a unified layer structure; and the third layer is a network level unit, comprising a convolutional neural network module and a fully connected neural network module.

3. The unified model checking based neural network training property verification method of claim 1, wherein, The basic behavior construction is used to design various operations of the neural network on a data sample set into corresponding function methods, comprising two layers, the first layer is independently composed of a basic operation unit, containing basic operations of a matrix, weight initialization, loss function correlation and activation function correlation; and the second layer comprises a network creation unit and a network operation unit, wherein the network creation unit is a function used to create a neural network, containing network initialization and network access, and the network operation unit is a function used in a training process and a prediction process of the neural network, containing forward propagation, backward propagation, testing and statistics, and an optimization algorithm.

4. The unified model checking based neural network training property verification method of claim 1, wherein, The S3 comprises: The UMC4M verifier is called to receive the MSVL formal model and the PPTL formulas, exhaustively search a state space of the entire MSVL formal model, perform property reduction checking on each state, and verify whether the property requirements are met.

5. The unified model checking based neural network training property verification method according to claim 4, characterized in that, The S3 comprises: calling a UMC4M verifier to receive the MSVL formal model and the PPTL formula, for the program of the MSVL formal model M and the PPTL formula of the property to be verified P , the UMC4M verifier performs a NOT operation on the formula P and converts the property after the NOT operation into an MSVL program , performs a conjunction operation on the program M and , and generates an MSVL program ; compiling and running the MSVL program by a modeling simulation verification language compiler and performing a state space search procedure, thereby completing the verification, if the MSVL program is correctly compiled and executed, then the property is not satisfied and Invalid is output, otherwise Valid is output.

6. The unified model checking based neural network training property verification method according to claim 5, characterized in that, When it is determined that the neural network has the gradient disappearance, the activation function in the neural network is replaced or the number of hidden layers is reduced to obtain a new neural network model, and verification is performed again.

7. The unified model checking based neural network training property verification method according to claim 6, characterized in that, When it is determined that the neural network has a large number of neuron inactivation, the learning rate of the optimization algorithm in the neural network is reduced to obtain a new neural network model, and verification is performed again.

Citation Information

Patent Citations

  • Modeling and verification method of neural network system based on MSVL

    CN110443348A

  • MSVL-based BP neural network construction and training method, and MSVL-based BP neural network construction and training system

    CN113240075A