Intelligent contract vulnerability detection method fusing code structure and semantic information
By combining GraphCodeBERT and graph neural network, efficient and accurate detection of smart contract vulnerability detection is achieved, and the problem of insufficient accuracy and efficiency in the existing technology is solved, the risk of attacks of smart contracts is reduced and the security of blockchain applications is improved. sex.
Patent Information
- Application Number
- CN202411212718.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-12-10
AI Technical Summary
The existing smart contract vulnerability detection methods are insufficient in terms of accuracy and efficiency, and it is difficult to fully cover the complex logic and potential risks of smart contracts, especially in the case of a surge in the number of smart contracts.
The pre-trained model GraphCodeBERT is used to extract the semantic information of the code, and analyze the code structure in combination with the graph neural network. The efficient and accurate detection of smart contract vulnerabilities is achieved through graph convolution and classifier.
It significantly improves the efficiency and accuracy of smart contract vulnerability detection, realizes accurate identification of potential vulnerabilities, reduces the risk of contract being attacked, and increases the trust of blockchain applications.
Smart Images

Figure CN119106435A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer security technology, and in particular to a smart contract vulnerability detection method that integrates code structure and semantic information. Background Art
[0002] With the widespread application of blockchain technology, smart contracts, as one of its core functions, bear the heavy responsibility of automating the execution of transactions and business logic. The security of smart contracts is directly related to asset security, user trust, and the stability of the entire blockchain ecosystem, and has always been the focus of attention in the industry. However, the complexity of smart contract programming and the particularity of the operating environment make the potential vulnerabilities in its code a major security risk. Since smart contracts cannot be changed once deployed on the blockchain, any vulnerabilities in the contract may lead to serious security risks, including loss of funds, malicious exploitation of contract logic by attackers, etc. Therefore, the security of smart contracts is directly related to the stability of the entire blockchain ecosystem and user trust.
[0003] In order to ensure the security and stability of the blockchain ecosystem, it is necessary to detect vulnerabilities in smart contracts. Although the writing and auditing of smart contracts have received more and more attention, the existing vulnerability detection methods still have limitations due to the complexity of smart contracts and the particularity of the blockchain environment. Traditional software testing methods such as static code analysis and formal verification can identify certain security issues to a certain extent, but they are often limited by the fixedness of the rules and the depth of the analysis, and it is difficult to fully cover the complex logic and potential risks of smart contracts. In addition, with the surge in the number of smart contracts, traditional detection methods are also facing challenges in efficiency and accuracy. Summary of the invention
[0004] In order to solve the technical problem of poor accuracy in vulnerability detection of smart contracts, the present invention proposes a smart contract vulnerability detection method that integrates code structure and semantic information.
[0005] The present invention provides a smart contract vulnerability detection method that integrates code structure and semantic information. The pre-trained model GraphCodeBERT is used to extract the semantic information of the code, and then combined with the analysis ability of the graph neural network on the code structure, the two technologies are integrated with the code structure features and semantic information to achieve efficient and accurate detection of smart contract vulnerabilities, specifically including:
[0006] Step S1, based on the pre-acquired smart contract source code, use the compiler tree-sitter-solidity to generate the corresponding abstract syntax tree, extract the key tree nodes in the abstract syntax tree, construct a contract graph that reflects the contract code structure, and sort the nodes in the order of visiting the nodes during the depth-first traversal to obtain an ordered node sequence;
[0007] Step S2, input the word id sequence, mask and node sequence generated by the conversion of the smart contract source code into the pre-trained model GraphCodeBERT, convert the source code into a feature matrix containing semantic information through the pre-trained model GraphCodeBERT, and use the corresponding relationship between the feature vectors in the feature matrix and the graph nodes as the semantic information of the node in the contract graph;
[0008] Step S3, the complete contract graph containing semantic information and structural features is used as input and sent to the graph neural network for processing. By performing graph convolution operations, the graph neural network can realize information transmission and aggregation on the contract graph;
[0009] In step S4, the contract graph after graph convolution optimization is input into a classifier composed of a linear layer and a sofmax function. The security of the smart contract is comprehensively evaluated through the classifier, and the output result is normalized through the softmax function. Based on the set threshold, it is determined whether the smart contract may have security vulnerabilities.
[0010] Optionally, generating a corresponding abstract syntax tree using a compiler tree-sitter-solidity according to the pre-acquired smart contract source code includes:
[0011] Obtain a smart contract source code in advance, and use the compiler tree-sitter-solidity to convert the smart contract source code into an abstract syntax tree. The abstract syntax tree obtained after conversion is a tree structure containing nodes, node attributes, codes corresponding to nodes, and direct edges between nodes.
[0012] Optionally, extracting key tree nodes in the abstract syntax tree to construct a contract graph reflecting the contract code structure includes:
[0013] The abstract syntax tree completely parses the source code. It contains key information in the contract, such as variable declarations, function calls, and control flow statements. It also contains brackets and semicolons, which are useless for vulnerability detection. The nodes and directed edges related to these key information in the abstract syntax tree are extracted as contract graph nodes to obtain the node set V = {v1, v2, ..., v k}, according to node v i To node v j The directed edge e of the obtained directed edge set E = {e1, e2, ..., e h}, the node set V = {v1, v2, ..., v k} and the directed edge set E = {e1, e2, ..., e h} constitutes a complete contract graph G(SC), denoted as G(SC)=(V,E).
[0014] Optionally, the nodes are sorted according to the order in which the nodes are visited during the depth-first traversal to obtain an ordered node sequence, including:
[0015] The root node is the starting point of the entire smart contract source code. A depth-first traversal is performed from the root node, and the order in which the nodes are accessed during the traversal is recorded. An ordered node sequence is constructed in this order.
[0016] Optionally, the step of inputting the word id sequence, mask and node sequence generated by converting the smart contract source code into the pre-trained model GraphCodeBERT includes:
[0017] The source code is segmented by the tokenizer of the pre-trained model GraphCodeBERT, which is decomposed into a series of smaller vocabulary units to obtain tokens. The tokens are then converted into word id sequences according to the vocabulary of the pre-trained model GraphCodeBERT, and the positions of the nodes and tokens are marked in the mask. The word id sequence, mask, and node arrangement are input into the pre-trained model GraphCodeBERT, where the pre-trained model GraphCodeBERT can aggregate word embeddings into node embeddings before performing pre-training tasks.
[0018] Optionally, according to the correspondence between the feature vectors in the feature matrix and the graph nodes, taking the feature vector corresponding to the node as the semantic information of the node in the contract graph includes:
[0019] According to the feature matrix output by the pre-trained model GraphCodeBERT and the position of the node in the node sequence, the part corresponding to the node is screened out in the feature matrix to obtain the node feature vector containing semantic information, and the node feature vector is used as the semantic information of the corresponding node in the contract graph.
[0020] Optionally, by performing graph convolution operations, the graph neural network can realize information transmission and aggregation on the contract graph, including:
[0021] Perform multi-layer graph convolution on the input contract graph G(SC) = (V, E) to integrate the information between nodes. The corresponding calculation formula is:
[0022]
[0023] Among them, H (l) represents the node feature matrix of the lth layer of the graph neural network, σ is the activation function, represents the degree matrix of the graph, Represents the adjacency matrix of the graph, W (l)is the learnable weight matrix at layer l.
[0024] Optionally, the security of the smart contract is comprehensively evaluated by a classifier, the output result is normalized by a softmax function, and whether the smart contract may have a security vulnerability is determined based on a set threshold, including:
[0025] Classification is performed according to the feature matrix learned by the graph neural network, where the classifier consists of a linear layer and a softmax function. The formula corresponding to the classification process is:
[0026] Y=f(W·X+b)
[0027] Among them, Y is the output of the classifier, X is the input feature matrix, W is the weight matrix, b is the bias vector, and f is the activation function softmax;
[0028] The predicted value is obtained based on the classifier output result and the set threshold.
[0029] Optionally, during the model training phase, a set of smart contract source codes are given to generate prediction values, with the cross entropy loss function minimized as the training objective. The loss function is calculated as:
[0030]
[0031] Among them, loss is the loss function value, N represents the total number of samples in the batch, C represents the category, and q xc represents the true vulnerability label of sample x, p x Represents the predicted value of sample x.
[0032] The present invention has the following beneficial effects:
[0033] The present invention discloses a smart contract vulnerability detection method that integrates code structure and semantic information, which significantly improves the efficiency and accuracy of the detection process by automating the entire process from source code to vulnerability detection. By using the pre-trained model GraphCodeBERT to extract node feature vectors containing semantic information, and combining the learning of code grammatical structure information by the graph neural network, the present invention can accurately identify potential vulnerabilities in smart contracts. The real-time and scalability of the present invention make it suitable for rapid detection of large-scale smart contracts. The self-learning ability of the graph neural network and the pre-trained model GraphCodeBERT ensures that the model can continuously optimize detection performance. By detecting potential vulnerabilities before the smart contract deployment stage, the present invention helps to reduce the risk of contract attacks, while enhancing users' trust in blockchain applications, providing a more reliable guarantee for the security of smart contracts. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0035] Figure 1 A flowchart of a smart contract vulnerability detection method that integrates code structure and semantic information of the present invention;
[0036] Figure 2 This is an example diagram of converting smart contract source code into an abstract syntax tree of the present invention;
[0037] Figure 3 It is the overall framework diagram of the present invention. DETAILED DESCRIPTION
[0038] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the specific implementation methods, structures, features and effects of the technical solutions proposed by the present invention are described in detail below in conjunction with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0039] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0040] refer to Figure 1 , shows the process of some embodiments of a smart contract vulnerability detection method that integrates code structure and semantic information according to the present invention. The smart contract vulnerability detection method that integrates code structure and semantic information includes the following steps:
[0041] Step S1, based on the pre-acquired smart contract source code, use the compiler tree-sitter-solidity to generate the corresponding abstract syntax tree, and construct a contract graph that reflects the contract code structure by extracting the key tree nodes in the abstract syntax tree. Then, sort the nodes in the order in which they are visited during depth-first traversal to obtain an ordered node sequence.
[0042] In some embodiments, for any given smart contract source code, the embodiment of the present invention uses the compiler tree-sitter-solidity to generate a corresponding abstract syntax tree. By extracting the key tree nodes in the abstract syntax tree, a contract graph that can accurately reflect the contract code structure is constructed. At the same time, the nodes are sorted according to the order in which the nodes are visited during the depth-first traversal to obtain an ordered node sequence.
[0043] As an example, this step may include the following steps:
[0044] The first step is to obtain a smart contract source code in advance and use the compiler tree-sitter-solidity to convert the smart contract source code into a highly structured representation, namely the abstract syntax tree.
[0045] The abstract syntax tree obtained after the conversion is a tree structure that includes nodes, node attributes, codes corresponding to nodes, and direct edges between nodes, which reflects code structure information.
[0046] For example, given a smart contract source code, the compiler tree-sitter-solidity is used to convert the smart contract source code into a highly structured representation - an abstract syntax tree. The abstract syntax tree obtained after the conversion is a tree structure that contains nodes, node attributes, code corresponding to nodes, direct edges between nodes, and other information reflecting the code structure. The tree structure can be as follows: Figure 2 shown.
[0047] The second step is to extract code structure information based on the abstract syntax tree to construct a contract graph. Specifically, the abstract syntax tree can fully parse the source code. In addition to key information in the contract such as variable declarations, function calls, and control flow statements, it also contains information such as brackets and semicolons that are useless for vulnerability detection. Nodes and directed edges related to these key information in the abstract syntax tree are extracted as contract graph nodes, and the node set V = {v1, v2, ..., v k}, according to node v i To node v j The directed edge e of the obtained directed edge set E = {e1, e2, ..., e h}, the node set V = {v1, v2, ..., v k} and the directed edge set E = {e1, e2, ..., e h} constitutes a complete contract graph G(SC), denoted as G(SC)=(V,E).
[0048] The third step is to sort the nodes according to the order in which they are visited during depth-first traversal to obtain an ordered node sequence. Specifically, the root node is the starting point of the entire smart contract source code. A depth-first traversal is performed from the root node, and the order in which the nodes are visited during the traversal is recorded. An ordered node sequence is constructed in this order, and this arrangement is used as the node sequence labeling part in the subsequent process to input the pre-trained model GraphCodeBERT.
[0049] Step S2, input the word id sequence, mask and node sequence generated by the transformation of the smart contract source code into the pre-trained model GraphCodeBERT, convert the source code into a feature matrix containing semantic information through the pre-trained model GraphCodeBERT, and use the corresponding relationship between the feature vectors in the feature matrix and the graph nodes to use the feature vector corresponding to the node as the semantic information of the node in the contract graph.
[0050] In some embodiments, the word id sequence, mask and node sequence generated by the conversion of a given smart contract source code are input into the pre-trained model GraphCodeBERT. The model can efficiently convert the source code into a feature matrix containing semantic information. According to the correspondence between the feature vectors and graph nodes in the feature matrix, the feature vector corresponding to the node is used as the semantic information of the node in the contract graph.
[0051] As an example, this step may include the following steps:
[0052] In the first step, the word id sequence, mask and node arrangement generated by the transformation of the given smart contract source code are input into the pre-trained model GraphCodeBERT. Specifically, the source code is segmented carefully using the word segmenter of the pre-trained model GraphCodeBERT, decomposing it into a series of smaller vocabulary units, namely, word segments. The word segments are then converted into word id sequences according to the vocabulary of the pre-trained model GraphCodeBERT. The mask contains the position marks of nodes and word segments, which are used to guide the attention calculation of the pre-trained model. The word id sequence, mask and node arrangement are input into the pre-trained model GraphCodeBERT, where the pre-trained model GraphCodeBERT can aggregate word embeddings into node embeddings before performing pre-training tasks.
[0053] In the second step, according to the correspondence between the feature vectors in the feature matrix and the graph nodes, the feature vector corresponding to the node is used as the semantic information of the node in the contract graph. Specifically, according to the feature matrix output by the pre-trained model GraphCodeBERT and the position of the node in the node sequence, the corresponding part of the node can be found in the feature matrix, thereby obtaining the node feature vector containing semantic information, and the node feature vector is used as the semantic information of the corresponding node in the contract graph.
[0054] In step S3, the complete contract graph containing semantic information and structural features is taken as input and sent to the graph neural network for processing. By performing graph convolution operations, the graph neural network can realize information transmission and aggregation on the contract graph.
[0055] In some embodiments, a complete contract graph containing semantic information and structural features is used as input and fed into a graph neural network for processing. By performing graph convolution operations, the model can achieve effective transmission and aggregation of information on the contract graph, thereby further refining and enhancing the understanding and expression of high-level features of the contract code.
[0056] As an example, by performing graph convolution operations, the graph neural network can achieve effective information transmission and aggregation on the contract graph, including:
[0057] Perform multi-layer graph convolution on the input contract graph G(SC) = (V, E) to fully integrate the information between nodes and obtain the final contract graph feature matrix. The graph convolution calculation formula is:
[0058]
[0059] Among them, H (l) represents the node feature matrix of the lth layer of the graph neural network (GCN), σ is the activation function, represents the degree matrix of the graph, Represents the adjacency matrix of the graph, W (l) is the learnable weight matrix at layer l.
[0060] In step S4, the contract graph after graph convolution optimization is input into a classifier composed of a linear layer and a sofmax function. The security of the smart contract is comprehensively evaluated through the classifier, and the output result is normalized through the softmax function. Based on the set threshold, it is determined whether the smart contract may have security vulnerabilities.
[0061] In some embodiments, the contract graph after graph convolution optimization is input into a classifier composed of a linear layer and a sofmax function. This classifier comprehensively evaluates the security of the smart contract based on the learned feature representation. The output result is normalized by applying the softmax function, and then the smart contract is judged based on the set threshold whether there may be a security vulnerability.
[0062] As an example, the classifier evaluates the security of the smart contract based on the learned feature representation. Normalization is performed through the softmax function, and then the prediction result is obtained according to the set threshold. The following steps can be included:
[0063] In the first step, the contract graph optimized by graph convolution is input into a classifier consisting of a linear layer and a sofmax function. This classifier comprehensively evaluates the security of the smart contract based on the learned feature representation.
[0064] It should be noted that the core component of the classifier can include a linear layer and an activation function softmax. The contract graph feature matrix is first input into the linear layer, and then normalized by the softmax function. It converts the output of the linear combination into a probability distribution to ensure that the sum of the output probabilities of vulnerability is 1, and each probability value is in the interval (0, 1). The activation function softmax is also called the softmax function.
[0065] For example, classification is performed based on the feature matrix learned by the graph neural network, where the classifier consists of a linear layer and a softmax function. The formula corresponding to the classification process is:
[0066] Y=f(W·X+b)
[0067] Among them, Y is the output of the classifier, X is the input feature matrix, W is the weight matrix, b is the bias vector, and f is the activation function softmax.
[0068] In the second step, the prediction result is obtained based on the classifier output result and the set threshold.
[0069] It should be noted that after the classifier generates the output probability distribution, it can be judged according to the set threshold. When the output result Y is greater than the threshold, the prediction value is set to 1, indicating that there is a vulnerability. On the contrary, when it is less than or equal to the threshold, the prediction value is set to 0, indicating that there is no vulnerability.
[0070] For example, in the model training phase, given a set of smart contract source codes to generate prediction values, the training objective is to minimize its cross entropy loss function. The loss function is calculated as:
[0071]
[0072] Among them, loss is the loss function value, N represents the total number of samples in the batch, C represents the category, and q xc represents the true vulnerability label of sample x, p x Represents the predicted value of sample x.
[0073] The overall framework diagram can be Figure 3 shown.
[0074] The present invention provides a smart contract vulnerability detection method that integrates code structure and semantic information. The method solves the problem that the existing smart contract vulnerability detection method cannot fully combine the semantic information and structure information of the code at the same time, which helps to improve the accuracy of smart contract vulnerability detection and reduce the risk of smart contracts being attacked.
[0075] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A smart contract vulnerability detection method that integrates code structure and semantic information, It is characterized in that The following steps are involved: Step S1, based on the pre-acquired smart contract source code, use the compiler tree-sitter-solidity to generate the corresponding abstract syntax tree, extract the key tree nodes in the abstract syntax tree, construct a contract graph that reflects the contract code structure, and sort the nodes in the order of visiting the nodes during the depth-first traversal to obtain an ordered node sequence; Step S2, input the word id sequence, mask and node sequence generated by the conversion of the smart contract source code into the pre-trained model GraphCodeBERT, convert the source code into a feature matrix containing semantic information through the pre-trained model GraphCodeBERT, and use the corresponding relationship between the feature vectors in the feature matrix and the graph nodes as the semantic information of the node in the contract graph; Step S3, the complete contract graph containing semantic information and structural features is used as input and sent to the graph neural network for processing. By performing graph convolution operations, the graph neural network can realize information transmission and aggregation on the contract graph; In step S4, the contract graph after graph convolution optimization is input into a classifier composed of a linear layer and a sofmax function. The security of the smart contract is comprehensively evaluated through the classifier, and the output result is normalized through the softmax function. Based on the set threshold, it is determined whether the smart contract may have security vulnerabilities.
2. According to claim 1, a smart contract vulnerability detection method integrating code structure and semantic information, It is characterized in that The method generates a corresponding abstract syntax tree using the compiler tree-sitter-solidity according to the pre-acquired smart contract source code, including: Obtain a smart contract source code in advance, and use the compiler tree-sitter-solidity to convert the smart contract source code into an abstract syntax tree. The abstract syntax tree obtained after conversion is a tree structure containing nodes, node attributes, codes corresponding to nodes, and direct edges between nodes.
3. According to claim 1, a smart contract vulnerability detection method integrating code structure and semantic information, It is characterized in that The method extracts key tree nodes from the abstract syntax tree to construct a contract graph that reflects the contract code structure, including: The abstract syntax tree completely parses the source code. It contains key information in the contract, such as variable declarations, function calls, and control flow statements. It also contains brackets and semicolons, which are useless for vulnerability detection. The nodes and directed edges related to these key information in the abstract syntax tree are extracted as contract graph nodes to obtain the node set V = {v 1 , v 2 , …, v k }, according to node v i To node v j The directed edge e of the obtained directed edge set E = {e 1 , e 2 ,…,e h }, the node set V = {v 1 , v 2 , …, v k } and the directed edge set E = {e 1 , e 2 ,…,e h } constitutes a complete contract graph G(SC), denoted as G(SC)=(V,E).
4. According to claim 1, a smart contract vulnerability detection method integrating code structure and semantic information, It is characterized in that The nodes are sorted in the order of visiting the nodes during the depth-first traversal to obtain an ordered node sequence, including: The root node is the starting point of the entire smart contract source code. A depth-first traversal is performed from the root node, and the order in which the nodes are accessed during the traversal is recorded. An ordered node sequence is constructed in this order.
5. According to claim 1, a smart contract vulnerability detection method integrating code structure and semantic information, It is characterized in that The step of converting the smart contract source code to generate a word id sequence, a mask, and a node sequence and inputting them into the pre-trained model GraphCodeBERT includes: The source code is segmented by the tokenizer of the pre-trained model GraphCodeBERT, which is decomposed into a series of smaller vocabulary units to obtain tokens. The tokens are then converted into word id sequences according to the vocabulary of the pre-trained model GraphCodeBERT, and the positions of the nodes and tokens are marked in the mask. The word id sequence, mask, and node arrangement are input into the pre-trained model GraphCodeBERT, where the pre-trained model GraphCodeBERT can aggregate word embeddings into node embeddings before performing pre-training tasks.
6. According to claim 1, a smart contract vulnerability detection method integrating code structure and semantic information, It is characterized in that According to the correspondence between the feature vectors in the feature matrix and the graph nodes, the feature vector corresponding to the node is used as the semantic information of the node in the contract graph, including: According to the feature matrix output by the pre-trained model GraphCodeBERT and the position of the node in the node sequence, the part corresponding to the node is filtered out in the feature matrix to obtain the node feature vector containing semantic information, and the node feature vector is used as the semantic information of the corresponding node in the contract graph.
7. According to claim 1, a smart contract vulnerability detection method integrating code structure and semantic information, It is characterized in that By performing graph convolution operations, the graph neural network can realize information transmission and aggregation on the contract graph, including: Perform multi-layer graph convolution on the input contract graph G(SC) = (V, E) to integrate the information between nodes. The corresponding calculation formula is: Among them, H (l) represents the node feature matrix of the lth layer of the graph neural network, σ is the activation function, represents the degree matrix of the graph, Represents the adjacency matrix of the graph, W (l) is the learnable weight matrix at layer l.
8. According to claim 1, a smart contract vulnerability detection method integrating code structure and semantic information, It is characterized in that The security of the smart contract is comprehensively evaluated by the classifier, the output result is normalized by the softmax function, and whether the smart contract may have security vulnerabilities is determined based on the set threshold, including: Classification is performed according to the feature matrix learned by the graph neural network, where the classifier consists of a linear layer and a softmax function. The formula corresponding to the classification process is: Y=f(W·X+b) Among them, Y is the output of the classifier, X is the input feature matrix, W is the weight matrix, b is the bias vector, and f is the activation function softmax; The predicted value is obtained based on the classifier output result and the set threshold.
9. According to claim 8, a smart contract vulnerability detection method integrating code structure and semantic information, It is characterized in that In the model training phase, a set of smart contract source codes is given to generate prediction values, with the goal of minimizing its cross entropy loss function. The loss function is calculated as: Among them, loss is the loss function value, N represents the total number of samples in the batch, C represents the category, and q xc represents the true vulnerability label of sample x, p x Represents the predicted value of sample x.
Citation Information
Cited By
Security vulnerability detection method and device, computer program product and storage medium
CN120805148A
Intelligent contract vulnerability detection method, system and device and storage medium
CN122286785A
