Abstraction neural network method for accelerating neural network verification

Through hierarchical clustering and neuron merging technology, the number of clusters is dynamically adjusted to solve the time-consuming problem of neural network verification, achieve an efficient and robust verification process, and enhance the interpretability of the network.

CN118780320APending Publication Date: 2024-10-15HEBEI UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410989798.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

In the existing technology, the verification of neural networks takes a long time, especially with high-dimensional data, which leads to prone to timeout problems during formal verification.

Method used

Use the hierarchical clustering method to dynamically adjust the number of clusters, generate a similarity matrix by calculating the cosine similarity between neurons, perform agglomerative hierarchical clustering and merging of neurons, and generate an abstracted neural network to reduce redundant calculations and improve Verify efficiency.

Benefits of technology

Significantly improves the speed of neural network verification, maintains the accuracy and robustness of the network, simplifies the network structure, enhances interpretability, and reduces computational complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure BDA0004958541610000075
    Figure BDA0004958541610000075
  • Figure BDA0004958541610000081
    Figure BDA0004958541610000081
  • Figure BDA0004958541610000086
    Figure BDA0004958541610000086
Patent Text Reader

Abstract

The invention discloses an abstract neural network method for accelerating neural network verification, which comprises the following steps of: S1, inputting pictures in a data set into a neural network to be abstracted, calculating an activation value of each picture output by each neuron in a hidden layer of the neural network to be abstracted, and generating an activation value matrix corresponding to each hidden layer; s2, calculating cosine similarity by using the activation value, and generating a similarity matrix corresponding to each hidden layer; s3, performing agglomeration hierarchical clustering on the neurons according to the similarity matrix to generate a clustering result, the clustering result comprising a single-neuron cluster and a multi-neuron cluster; s4, combining the neurons according to a clustering result to generate an abstracted neural network, and combining the weights of the neurons; and S5, inputting the verification set into the abstracted neural network for verification. According to the method, the low-score neurons are merged into the high-score neurons, so that the accuracy of the neural network is not influenced, and the verification time of the neural network is shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a method for optimizing a neural network, in particular to an abstract neural network method for accelerating neural network verification. Background Art

[0002] In the field of deep learning, neural networks have been widely used in image recognition, natural language processing and other fields. However, neural networks themselves are relatively fragile and can easily exhibit dangerous behaviors when attacked. For example, a small perturbation to the input of a neural network can significantly affect the output of the neural network, causing the neural network to make wrong decisions. Therefore, how to ensure the credibility of the behavior and output of a neural network is also a challenging problem worth exploring.

[0003] As a rigorous mathematical method, formal verification can solve these problems to a certain extent, ensuring that the behavior of the neural network is as expected and that the verified neural network will be more robust. However, the high dimensionality of the neural network data makes the use of verification technology more time-consuming. Formal verification of some networks with only a few hundred neurons sometimes results in serious timeouts and cannot be verified. Summary of the invention

[0004] The purpose of the present invention is to provide an abstract neural network method for accelerating neural network verification, so as to solve the problem that the verification of neural networks by existing methods takes a long time.

[0005] The object of the invention is achieved in this way:

[0006] An abstract neural network method for accelerating neural network verification includes the following steps:

[0007] S1. Input the pictures in the data set into the neural network to be abstracted, calculate the activation value of each picture output by each neuron in the hidden layer of the neural network to be abstracted, and generate an activation value matrix corresponding to each hidden layer; the neural network to be abstracted is a fully connected network, the number of rows of the activation value matrix is ​​the number of neurons in each hidden layer, and the number of columns of the activation value matrix is ​​the number of pictures input into the neural network;

[0008] S2. Calculate the cosine similarity between every two neurons using the activation value matrix to generate a similarity matrix corresponding to each hidden layer;

[0009] S3. performing agglomerative hierarchical clustering on the neurons in each hidden layer according to the similarity matrix corresponding to each hidden layer to generate a clustering result, wherein the clustering result includes a single neuron cluster and a multi-neuron cluster;

[0010] S4. According to the clustering results, neurons are merged to generate an abstracted neural network, wherein the merging is to merge the output weights of the neurons;

[0011] S5. Input the validation set into the abstracted neural network for validation.

[0012] The present invention uses a hierarchical clustering method to dynamically adjust the number of clusters, effectively identify and cluster similar neurons, and improve the flexibility and efficiency of the abstraction process. It can better adapt to different data and network structures, especially when dealing with complex network structures.

[0013] Furthermore, the specific method of merging neurons according to the clustering results in step S4 is:

[0014] S4-1. Merge the output weights of neurons in multiple neuron clusters to generate a new single neuron cluster;

[0015] S4-2. Merge the output weights of neurons in all single neuron clusters to generate an abstracted neural network.

[0016] Furthermore, the specific method of merging the output weights of neurons in the multi-neuron cluster in step S4-1 is:

[0017] S4-1-1. Calculate the score of each neuron in each multi-neuron cluster according to the output weight of the neuron;

[0018] S4-1-2. In each multi-neuron cluster, the output weights of the neurons with small scores are merged into the output weights of the neurons with large scores, and the neurons with small scores and their input weights are deleted until only one neuron is merged into the multi-neuron cluster.

[0019] Furthermore, in step S4-2, the specific method of merging the output weights of neurons in all single neuron clusters is:

[0020] S4-2-1. Traverse each neuron in the hidden layer and calculate the KNN value of each neuron based on the activation value of the neuron;

[0021] S4-2-2. Find the target neuron corresponding to the neuron with a KNN value greater than 1 based on the similarity matrix;

[0022] S4-2-3. Merge the output weights of neurons with KNN values ​​greater than 1 into the output weights of the corresponding target neurons, delete the neurons with KNN values ​​greater than 1 and their input weights, generate a new neural network, and record the parameters of the new neural network;

[0023] S4-2-4. Test the accuracy of the new neural network. If the merging causes the error of the new neural network to exceed the threshold α, cancel the merging operation; continue to merge the output weights of other neurons whose KNN values ​​are greater than 1, until the last neuron whose KNN value is greater than 1 is merged, and test the accuracy of the neural network.

[0024] The present invention uses the scoring criteria and KNN values ​​to determine the merging order of neurons, reduces the complexity of the network, and at the same time maintains the network performance as much as possible, improves the effectiveness of abstract operations, and reduces the calculation amount of the neural network.

[0025] The present invention tests the accuracy of the new neural network after each merging operation, and monitors the error in real time through the error control method to ensure that each merging operation is performed within an acceptable error range, thereby avoiding performance degradation caused by excessive abstraction.

[0026] The present invention improves the verification speed of the network, reduces redundant calculations in the network by clustering and abstracting multiple neurons and single neurons in the neural network. In particular, in multi-neuron clustering, similar neurons are effectively merged through hierarchical clustering and scoring criteria, simplifying the network structure and thus accelerating the verification of the network.

[0027] The present invention maintains the accuracy and robustness of the network. When merging neurons, a rigorous scoring standard and merging strategy are used to ensure that the merging operation will not significantly affect the performance of the network. By calculating and comparing the scores of neurons, it is ensured that high-scoring neurons are retained and low-scoring neurons are merged into high-scoring neurons, thereby maintaining the accuracy and robustness of the network to the maximum extent. In single neuron clustering, by using KNN density judgment and similarity matrix, it is ensured that the merging of neurons will not lead to significant performance degradation. At the same time, theoretical support for error analysis and error range is provided to ensure the robustness of the network after abstraction.

[0028] The present invention enhances the interpretability of the network. By abstracting the neural network, the internal structure and working mechanism of the network can be more clearly understood. By clustering and scoring neurons, it is possible to identify which neurons play a key role in the network, which helps to improve the interpretability of the network.

[0029] In summary, the present invention aims to provide an efficient, robust and automated neural network abstraction method, which reduces the size of the network by abstracting the neural network and accelerates the verification process, thereby solving the problems of high computational complexity, insufficient robustness and much manual intervention in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1(a) is the original neural network, and (b) is the abstracted neural network.

[0031] Figure 2 It is the number of remaining neurons in each hidden layer after the five neural networks are abstracted using the present invention.

[0032] Figure 3 This is a comparison of the verification time required for the neural network before and after abstraction.

[0033] Figure 4 It is a comparison chart of the total time of verifying the neural network by the present invention and the verification tool. DETAILED DESCRIPTION

[0034] The present invention is further described below.

[0035] The abstract neural network method for accelerating neural network verification provided by the present invention specifically includes the following steps:

[0036] S1. Input the images in the data set into the neural network to be abstracted, calculate the activation value of each image output by each neuron in the hidden layer of the neural network to be abstracted, and generate the activation value matrix corresponding to each hidden layer.

[0037] Among them, the neural network to be abstracted is a fully connected network, the number of rows of the activation value matrix is ​​the number of neurons in each hidden layer, and the number of columns of the activation value matrix is ​​the number of images input into the neural network.

[0038] The present invention uses the first two hundred images of the MNIST data set as the input data of the neural network. These data are processed by each neuron of the neural network, and each neuron generates an activation value for each image, thereby generating an activation value matrix corresponding to the hidden layer.

[0039] S2. Use the activation value matrix to calculate the cosine similarity between every two neurons and generate the similarity matrix corresponding to each hidden layer.

[0040] The number of rows and columns in the similarity matrix are the number of neurons, and the value in the similarity matrix is ​​the cosine similarity between two neurons.

[0041] S3. Perform agglomerative hierarchical clustering on the neurons in each hidden layer according to the similarity matrix corresponding to each hidden layer to generate a clustering result.

[0042] Among them, the clustering results include single neuron clusters and multi-neuron clusters.

[0043] Single neuron clusters and multi-neuron clusters are generated by hierarchical clustering. The single neuron cluster contains one neuron, and the multi-neuron cluster contains at least two neuron clusters.

[0044] The present invention adopts a hierarchical clustering method to abstract neurons, rather than the traditional method of presetting the number of clusters. Hierarchical clustering is based on the cosine similarity of neuron activation values, and the number of clusters can be adjusted dynamically. This dynamic adjustment capability makes the abstraction process more flexible and can better adapt to different data and network structures. By calculating the similarity between each neuron, it is possible to more accurately determine which neurons can be merged, thereby reducing unnecessary redundancy.

[0045] S4. According to the clustering results, neurons are merged to generate an abstracted neural network, and the merging is to merge the output weights of the neurons.

[0046] The specific method of merging neurons according to the clustering results in step S4 is:

[0047] S4-1. Merge the output weights of neurons in multiple neuron clusters to generate a new single neuron cluster.

[0048] like Figure 1 As shown, Figure 1 (a) is an original network with three layers. Each neuron has a corresponding number. Neurons 1 and 2 are input layer neurons, 3, 4, 5, and 6 are hidden layer neurons, and 7 and 8 correspond to output layer neurons. The input weight and output weight of each neuron have been calculated according to W. i,j , where i represents the neurons in the i-th layer and j represents the neurons in the i+1-th layer.

[0049] According to the method of the present invention, neuron 6 is merged onto neuron 5. Figure 1 (b) shows how the merge operation is used, specifically by removing the input weight of neuron 6, adding the output weight of neuron 6 to the output weight of neuron 5, and then setting the output weight of neuron 5 to the sum of the merged weights.

[0050] The output weight of a neuron is the weight between the neuron and the neurons in the next layer. When merging weights, the weight between the neuron and the neurons in the next layer is merged into the weight between another neuron and the same neuron in the next layer, that is, the weight between neuron 6 and neuron 7 is added to the weight between neuron 5 and neuron 7.

[0051] The specific method of merging neurons in multiple neuron clusters in step S4-1 is:

[0052] S4-1-1. Calculate the score of each neuron in each multi-neuron cluster based on the output weight of the neuron.

[0053] The score of each neuron is the sum of the weights between the neuron and the neurons in the next layer to which it is fully connected.

[0054] For example, two multi-neuron clusters Cluster1 (n i,1 ,n i,2 ) and Cluster2(n i+1,4 ,n i+1,5 ), Cluster1 is located in the i-th layer, Cluster2 is located in the next layer i+1, and neuron n i,1 and n i,2 Respectively with n i+1,4 and n i+1,5 It is fully connected.

[0055] Then neuron n i,1 and n i,2 The score is:

[0056] Score(n i,1 )=W(n i,1 ,n i+1,4 )+W(n i,1 ,n i+1,5 )

[0057] Among them, W(n i,1 ,n i+1,4 ) is neuron n i,1 and neuron n i+1,4 The weight between them, W(n i,1 ,n i+1,5 ) is neuron n i,1 and neuron n i+1,5 The weight between .

[0058] Score(n i,2 )=W(n i,2 ,n i+1,4 )+W(n i,2 ,n i+1,5 )

[0059] Among them, W(n i,2 ,n i+1,4 ) is neuron n i,2 and neuron n i+1,4 The weight between them, W(n i,2 ,n i+1,5 ) is neuron n i,2 and neuron n i+1,5 The weight between .

[0060] S4-1-2. In each multi-neuron cluster, merge the output weights of the neurons with smaller scores into the output weights of the neurons with larger scores, delete the neurons with smaller scores and their input weights, until only one neuron is merged into the multi-neuron cluster.

[0061] When Score(ni,1 )>Score(n i,2 ), in this case, neuron n i,2 The output weights of neuron n will be incorporated into i,1 The output weights of neurons with smaller scores are merged into the output weights of neurons with larger scores, and neuron n is deleted. i,2 and its input weights.

[0062] The pre-activation value for the next layer is:

[0063] p i+1,4 =v i,1 ×W(n i,1 ,n i+1,4 )+v i,2 ×W(n i,2 ,n i+1,4 )

[0064] p i+1,5 =v i,1 ×W(n i,1 ,n i+1,5 )+v i,2 ×W(n i,2 ,n i+1,5 )

[0065] Among them, p i+1,4 For neuron n i+1,4 The pre-activation value, v i,1 For neuron n i,1 The activation value, v i,2 For neuron n i,2 The activation value, p i+1,5 For neuron n i+1,5 The pre-activation value.

[0066] Merging the output weights of neurons with small scores into the output weights of neurons with large scores has little impact on the neurons in the next layer.

[0067] When there are at least three neurons in a neuron cluster, for example, in the i+2th hidden layer, the multi-neuron cluster includes neurons n i+2,1 、n i+2,2 ,…,n i+2,n-1 、n i+2,n , where the scores are arranged as follows: Score(n i+2,1 )>Score(n i+2,2 )>…>Score(n i+2,n-1 )>Score(n i+2,n ), then when merging, the neuron n i+2,n The output weights are merged into neuron n i+2,n-1 In the output weight of the merged neuron ni+2,n-1 The output weights are merged into neuron n i+2,n-2 The output weights of , continue to merge in the order of fraction size until they are merged into neuron n i+2,1 Among the output weights, a neuron is finally generated, and the neurons with small scores and their input weights are deleted.

[0068] The present invention uses a scoring standard to evaluate the importance of each neuron, so that neurons with low importance can be merged and neurons with high importance are retained.

[0069] S4-2. Merge the output weights of neurons in all single neuron clusters to generate an abstracted neural network.

[0070] The specific method of merging the output weights of neurons in all single neuron clusters in step S4-2 is:

[0071] S4-2-1. Traverse each neuron in the hidden layer and calculate the KNN value of each neuron based on the activation value of the neuron.

[0072] After merging the neurons in the multi-neuron clusters in step S4-1, the remaining ones are single neuron clusters, which need to be merged again. The KNN value of each neuron is calculated by the activation value of each neuron.

[0073] S4-2-2. Find the target neuron corresponding to the neuron with a KNN value greater than 1 based on the similarity matrix.

[0074] When the KNN value of a neuron is greater than 1, it means that there are other neurons around the neuron.

[0075] When the KNN value of a neuron is greater than 1, the neuron corresponding to the cosine similarity of the neuron greater than 0.5 is searched in the similarity matrix, and the neuron corresponding to the cosine similarity with the largest value is used as the target neuron. For example, neuron 1 corresponds to a cosine similarity greater than 0.5, and there is only a cosine similarity of 0.6 between neuron 1 and neuron 5, so neuron 5 is the target neuron of neuron 1; neuron 2 corresponds to a cosine similarity greater than 0.5, and there is a cosine similarity of 0.6 between neuron 2 and neuron 6, and a cosine similarity of 0.8 between neuron 2 and neuron 7. Since the cosine similarity between neuron 2 and neuron 7 is the highest, neuron 7 is the target neuron of neuron 2.

[0076] The KNN value is used to identify neurons with high similarity to further optimize the merging order.

[0077] S4-2-3. Merge the output weights of neurons with KNN values ​​greater than 1 into the output weights of the corresponding target neurons, delete the neurons with KNN values ​​greater than 1 and their input weights, generate a new neural network, and record the parameters of the new neural network.

[0078] When neurons are merged, the parameters of the original neural network also change, so the parameters of the new neural network need to be recorded.

[0079] S4-2-4. Test the accuracy of the new neural network. If the merging causes the error of the new neural network to exceed the threshold α, cancel the merging operation; continue to merge the output weights of other neurons whose KNN values ​​are greater than 1, until the last neuron whose KNN value is greater than 1 is merged, and test the accuracy of the new neural network to determine whether the merging operation needs to be canceled.

[0080] The value of the threshold α can be set by a technician.

[0081] When clustering and merging neurons, errors will occur. Let n l represents the number of neurons in layer l, represents the activation vector of layer l, represents the weight from node i in layer l to node j in layer l+1, represents the pre-activation vector of layer l, Represents the column vector of bias values ​​for the lth layer.

[0082] Single step error:

[0083] If the activation vector z of layer l (l) The perturbation Δz at layer l is (l) , and φ is subadditive, then the perturbation Δz of the activation value of the next layer l+1 is (l+1) The range is:

[0084] Δz (l+1) ≤φ(W (l) Δz (l) )

[0085] Proof of single-step error:

[0086] Assume z (l) Subject to a disturbance Δz (l) , thus obtaining the new activation vector of the lth layer For the next layer l+1, the pre-activation vector will be the perturbed activation vector of the previous layer, so the perturbed pre-activation vector h of the l+1th layer is (l+1) for:

[0087]

[0088] Among them, b (l+1) Represents the column vector of bias values ​​for the l+1th layer.

[0089] Next, find the original h (l+1) and h after disturbance (l+1) The difference between:

[0090]

[0091] This error can be propagated to the neurons in the l+1th layer:

[0092]

[0093] If φ is subadditive, then we have:

[0094]

[0095] therefore,

[0096] Δz (l+1) ≤φ(W (l) Δz (l) )

[0097] Layer error caused by clustering:

[0098] Assume that all layers have been clustered to the l+1th layer so far, and obviously the The accumulated error of the layer, err (l) , among which The error of the layer is in Represents the activation value after completing the l+1th layer of clustering. represents the activation value when the clustering of all the first l+1 layers is completed but the clustering of this layer is not completed, and z (l+1) represents the original activation value. It can be deduced that:

[0099]

[0100] The single-step error shows how the error propagates between layers, so the error of the next layer is:

[0101]

[0102] Considering the error of the l+1th layer due to clustering, the error of the l+1th layer can be expressed as:

[0103]

[0104] Among them, ∈ (l+1) Represents the distance between the merged neuron and the target neuron.

[0105] therefore:

[0106] |err (l+1) |≤|φ(W (l) err (l) )|+∈ (l+1)

[0107] Since the activation functions in the neural network used in the present invention are all ReLU functions, this result can be simplified by |φ(x)|≤|x|, so:

[0108] |err (l+1) |≤|W (l) err (l) |+∈ (l+1)

[0109] Proof of overall error:

[0110] Calculate the total error err total :

[0111]

[0112] Among them, x is the original input, that is, the input without perturbation, is the perturbed input, D(x) is the output of the original input after passing through the neural network to be abstracted, is the output of the neural network after the original input is abstracted. It is the output of the neural network after the perturbed input is abstracted.

[0113] According to the single-step error, we can get:

[0114]

[0115] in, The weights of node i in layer l to node j in layer l+1 of the abstracted neural network, δ is the perturbation range.

[0116] Assume that the activation function φ satisfies φ(x)≤x, which is true for the ReLU function. Based on the layer error, we can deduce:

[0117]

[0118] Among them, err (L) is the sum of the errors in each layer.

[0119] From the above analysis of the error, it can be seen that the error mainly comes from the merging of neurons. Therefore, after each merging operation, the accuracy of the generated new neural network is tested. The specific method of the accuracy test is to input the data set into the new neural network and pay attention to whether the error of the new neural network recognition accuracy exceeds α compared with the original neural network. If it exceeds, the merging operation is canceled.

[0120] The present invention introduces a detailed error analysis and control method, through theoretical analysis and practical testing, to ensure that the abstraction operation does not significantly reduce the accuracy of the network. Error control parameters (such as KNN values ​​and scoring criteria) are used to accurately control the errors in the abstraction process.

[0121] S5. Input the validation set into the abstracted neural network for validation.

[0122] After the abstracted neural network is abstracted, the number of neurons in the neural network is reduced, and the time for verifying the verification set in the abstracted neural network is reduced, thereby improving the verification speed of the neural network.

[0123] S6. Method evaluation.

[0124] like Figure 2 As shown, Figure 2 6*200 means there are 6 hidden layers, each with 200 neurons; 6*300 means there are 6 hidden layers, each with 300 neurons; 6*500 means there are 6 hidden layers, each with 500 neurons; 6*700 means there are 6 hidden layers, each with 700 neurons; 6*800 means there are 6 hidden layers, each with 800 neurons. Figure 2 As can be seen from the figure, neurons near the output layer are abstracted more, while neurons near the input layer are abstracted less. This may be because neurons in the first few layers need to process relatively raw data, and when the data passes through each layer, it gradually approaches the final decision data. Therefore, neurons in the latter layers will process more similar data, resulting in stronger correlation between neurons in the latter layers, thereby abstracting more neurons.

[0125] like Figure 3 As shown in the figure, the dark columns represent the network verification time after abstraction, and the light columns represent the network verification time before abstraction. The results show that as the network width increases, the verification time of the abstracted network decreases faster, which may be due to the higher similarity of neurons close to the output layer. As the network width increases, the number of similar neurons also increases, so the abstraction speed of neurons is accelerated.

[0126] like Figure 4As shown in Figure 1, the total time of abstraction and verification is always lower than the time required to verify the original network alone. In addition, as the network size increases, the verification time of the original network increases significantly, while the verification time of the abstract network increases relatively little. In other words, the increase in network size has a greater impact on the verification time of the original network, while it has a smaller impact on the verification time of the abstract network.

[0127] In addition, it can be found that the number of neurons is not the decisive factor affecting the final decision. From the experimental results, it can be found that in the neural network, the neurons close to the input layer may be more important than the neurons close to the output layer. Therefore, when designing the neural network structure, more attention should be paid to the first few layers.

Claims

1. An abstract neural network method for accelerating neural network verification, characterized in that: The steps include: S1. Input the pictures in the data set into the neural network to be abstracted, calculate the activation value of each picture output by each neuron in the hidden layer of the neural network to be abstracted, and generate the activation value matrix corresponding to each hidden layer; The neural network to be abstracted is a fully connected network, the number of rows of the activation value matrix is ​​the number of neurons in each hidden layer, and the number of columns of the activation value matrix is ​​the number of images input into the neural network; S2. Calculate the cosine similarity between every two neurons using the activation value matrix to generate a similarity matrix corresponding to each hidden layer; S3. performing agglomerative hierarchical clustering on the neurons in each hidden layer according to the similarity matrix corresponding to each hidden layer to generate a clustering result, wherein the clustering result includes a single neuron cluster and a multi-neuron cluster; S4. According to the clustering results, neurons are merged to generate an abstracted neural network, wherein the merging is to merge the output weights of the neurons; S5. Input the validation set into the abstracted neural network for validation.

2. The abstract neural network method for accelerating neural network verification according to claim 1, characterized in that: The specific method of merging neurons according to the clustering results in step S4 is: S4-1. Merge the output weights of neurons in multiple neuron clusters to generate a new single neuron cluster; S4-2. Merge the output weights of neurons in all single neuron clusters to generate an abstracted neural network.

3. The abstract neural network method for accelerating neural network verification according to claim 2, characterized in that: The specific method of merging the output weights of neurons in the multi-neuron cluster in step S4-1 is: S4-1-1. Calculate the score of each neuron in each multi-neuron cluster according to the output weight of the neuron; S4-1-2. In each multi-neuron cluster, the output weights of the neurons with small scores are merged into the output weights of the neurons with large scores, and the neurons with small scores and their input weights are deleted until only one neuron is merged into the multi-neuron cluster.

4. The abstract neural network method for accelerating neural network verification according to claim 2, characterized in that: The specific method of merging the output weights of neurons in all single neuron clusters in step S4-2 is: S4-2-1. Traverse each neuron in the hidden layer and calculate the KNN value of each neuron based on the activation value of the neuron; S4-2-2. Find the target neuron corresponding to the neuron with a KNN value greater than 1 based on the similarity matrix; S4-2-3. Merge the output weights of neurons with KNN values ​​greater than 1 into the output weights of the corresponding target neurons, delete the neurons with KNN values ​​greater than 1 and their input weights, generate a new neural network, and record the parameters of the new neural network; S4-2-4. Test the accuracy of the new neural network. If the merging causes the error of the new neural network to exceed the threshold α, cancel the merging operation; continue to merge the output weights of other neurons whose KNN values ​​are greater than 1, until the last neuron whose KNN value is greater than 1 is merged, and test the accuracy of the neural network.