Smart contract vulnerability detection method based on cross-modal knowledge distillation
Through cross-modal knowledge distillation technology, combined with teacher and student networks, the binary code and source code information of smart contracts are integrated, which solves the problem of inability to integrate logical information in existing technologies, achieves efficient and accurate vulnerability detection, and avoids the problems of smart contracts. potential losses.
Patent Information
- Application Number
- CN202210474802.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-29
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-04-29
AI Technical Summary
Existing technology cannot effectively integrate logical information in the form of binary code and source code of smart contracts, resulting in vulnerability detection being unable to deeply mine semantic information and achieving comprehensive vulnerability detection.
Using a method based on cross-modal knowledge distillation, through mutual learning between teacher network and student network, and combining the feature information of binary code and source code, multi-modal semantic information is fused and optimized, and GCN and TMP models are used for feature extraction and graph Generate and implement static vulnerability detection.
It achieves deeper vulnerability mining, builds an efficient and fast vulnerability detection architecture, improves the accuracy and efficiency of vulnerability detection, and can effectively discover vulnerabilities in smart contracts and avoid economic losses.
Smart Images

Figure CN114841318B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a smart contract vulnerability detection method based on cross-modal knowledge distillation. Background Art
[0002] At present, as an emerging technology in the computer field, blockchain has been continuously improved to a new level and has gradually become an important factor affecting national defense security. With the advent of technology, attacks for the sake of gaining benefits have followed one after another, causing huge losses; in the field of blockchain, the number of contracts verified by Ethereum is as high as millions, and the attacks caused are countless. Therefore, blockchain talents at home and abroad have continuously invested in the research of smart contract vulnerability detection and are committed to improving the ecological security of blockchain; and currently smart contracts are mainly in the form of binary code, lacking smart contracts in source code form, and cannot provide comprehensive vulnerability detection for smart contracts. The reasons are as follows: smart contracts in binary code form lack sufficient logical structure, and their detection cannot deeply mine semantic information. Although smart contracts in source code form have sufficient logical structure, they require a lot of calculations. Therefore, how to integrate the contract logic information in binary code form and source code form in the process of vulnerability detection, and use static vulnerability detection to mine deep vulnerabilities in contracts is a major problem for current vulnerability detection technology.
[0003] There are two main static detection methods for smart contracts: formal verification and symbolic execution. The former formally models the smart contract documents and codes through logical language, and verifies the correctness and security of the contract functions while ensuring the mathematical logic of the verification process is complete. The latter symbolizes the variables in the code and maintains a set of constraints for all executions. It determines the input after the execution and then generates new test input to detect whether the symbolic value can cause vulnerabilities. The main analysis objects of the two methods are the logical information of the contract binary code or source code, and it is impossible to fuse and process the feature information of the two modes. The teacher-student network model is also called the knowledge distillation model, which can pass the information "distilled" from the teacher network to the student network, thereby achieving the purpose of knowledge transfer between the teacher and student models, and finally allowing the "experience" of the teacher network to be passed to the student network, so that the student network can process and fuse the feature information of multiple modes.
[0004] Therefore, how to combine static vulnerability detection technology and the teacher-student network model to build a smart contract logic information fusion framework among multiple modalities, and use source code semantic information to fill the defect of semantic information loss after binary code disassembly, is an urgent problem to be solved in the current smart contract vulnerability detection method. Summary of the invention
[0005] The purpose of the present invention is to propose a smart contract vulnerability detection method based on cross-modal knowledge distillation to address the problem that the feature information of two modalities cannot be merged and processed in the prior art.
[0006] The technical solution adopted by the present invention to solve the above technical problems is:
[0007] The smart contract vulnerability detection method based on cross-modal knowledge distillation includes the following steps:
[0008] Step 1: Obtain a smart contract, the smart contract includes binary code and source code;
[0009] Step 2: Disassemble the binary code to obtain the control flow graph, and generate the source code to obtain the contract graph;
[0010] Step 3: Input the control flow graph and contract graph into the teacher network, and input the control flow graph into the student network;
[0011] The teacher network specifically performs the following steps:
[0012] First, the control flow graph and the contract graph are feature extracted respectively to obtain the binary code feature representation vector and the source code feature representation vector. Then, the binary code feature representation vector and the source code feature representation vector are aggregated to obtain multimodal semantic information. The obtained multimodal semantic information is then input into the fully connected layer. The output of the fully connected layer is then activated using the sigmoid function to obtain the prediction result of the multimodal teacher network.
[0013] The student network specifically performs the following steps:
[0014] First, the control flow graph is feature extracted to obtain a binary code feature representation vector. Then, the binary code feature representation vector and the binary code feature representation vector obtained in the teacher network are used to calculate the loss, and the loss calculation result is used as the first loss function to optimize the student network.
[0015] Then the binary code feature representation vector is input into the fully connected layer. The last layer of the fully connected layer uses the following formula to make the dimension of the binary code feature representation vector the same as the source code feature representation vector:
[0016]
[0017] Among them, W s represents the trainable matrix, b s represents the bias parameter, represents the binary code feature representation vector, y s represents the binary code feature representation vector after dimension processing;
[0018] The output of the fully connected layer is activated by the ReLU function. The result after the ReLU function activation is similarly calculated with the source code feature representation vector obtained by the teacher network, and the similarity calculation result is used as the second loss function to optimize the student network. After that, the feature information representation vector in the optimized student network is passed to the fully connected layer for prediction, and the prediction result is activated by the sigmoid function to obtain the final prediction result.
[0019] Step 4: Calculate the loss of the prediction results of the multimodal teacher network and the final prediction results, and use the loss calculation results as the third loss function to optimize the student network and the teacher network;
[0020] Step 5: Use the student network and teacher network optimized in step 4 to detect smart contract vulnerabilities.
[0021] Furthermore, the steps of obtaining the binary code feature representation vector are:
[0022] Firstly, the GCN model is used to extract features of the semantic information in the control flow graph. Then the extracted features are processed by batch normalization and ReLU function, and then by maximum pooling and average pooling to obtain the binary code feature representation vector.
[0023] Furthermore, the batch normalization process is expressed as:
[0024] y=γ·x+β
[0025]
[0026] Among them, γ takes the variance of x and β takes the mean of x, γ and β serve as trainable parameters of the normalization operation, x represents the input of the batch normalization process, and y represents the output of the batch normalization process.
[0027] Furthermore, the ReLU function is expressed as:
[0028] f(x)=max(0,x).
[0029] Furthermore, the specific steps of the graph generation process are:
[0030] The key function call features in the source code are used as the main node, and the key variable features of the function in the source code are used as the secondary node;
[0031] Embed the starting node feature, sequence number feature and edge type feature of the edge between every two nodes into the contract graph;
[0032] The edge between each two nodes is a control edge or a data edge.
[0033] Furthermore, the steps of obtaining the source code feature representation vector are:
[0034] First, the contract graph is ablated to eliminate the secondary nodes and retain the edges connecting the eliminated secondary nodes to the main nodes. Then, the key variable features of the functions corresponding to the secondary nodes in the contract graph are transferred to the main nodes closest to the secondary nodes to obtain the contract graph after the ablation operation. Then, the contract graph after the ablation operation is input into the temporal edge transfer graph neural network for feature extraction. Finally, the extracted features are batch normalized, ReLU function and average pooled to obtain the source code feature representation vector.
[0035] Furthermore, the temporal edge transfer graph neural network is divided into an edge transfer phase and an edge readout phase;
[0036] The edge transfer phase is used to generate edge information and aggregate edge information;
[0037] The edge readout stage is used to convert the node state g before feature extraction i and the state o of the node after feature extraction i To carry out polymerization;
[0038] The aggregation is represented by:
[0039]
[0040]
[0041]
[0042] in, represents the final hidden layer state, represents the initial hidden state of the node, represents the element-wise product, and represents the model parameters to be learned, y′ represents the aggregation result, j represents the sequence number of the model parameter, and V represents the total number of nodes.
[0043] Furthermore, the first loss function is expressed as a single-modal loss function, which is expressed as:
[0044]
[0045] in, represents the binary vulnerability information representation vector output by the student network, represents the binary vulnerability information representation vector output by the teacher network, N represents the number of samples in the training set, and b i represents the i-th binary code sample.
[0046] Furthermore, the second loss function is expressed as a cross-modal transfer loss function, which is expressed as:
[0047]
[0048] in, Represents the source feature information from the teacher network.
[0049] Furthermore, the third loss function is expressed as a teacher-student mutual learning loss function, which is expressed as:
[0050]
[0051]
[0052]
[0053]
[0054] in, and denote the supervised classification losses of the teacher network and the student network respectively, Indicates whether the i-th sample has a vulnerability, k∈{0,1}, and denote the prediction scores of whether the i-th sample is vulnerable or not generated by the teacher network and the student network, respectively. λ, γ, and ω denote the balancing factors controlling different loss weights. The subscript s denotes the student network, the subscript t denotes the teacher network, and x i Represents the i-th multimodal fusion sample.
[0055] The beneficial effects of the present invention are:
[0056] Compared with the prior art, this application proposes a smart contract vulnerability detection method based on cross-modal knowledge distillation, which only analyzes the logical information of one modality as the basis for smart contract vulnerability detection. First, based on static detection technology, this method analyzes the inherent logical structure of smart contracts, strips off semantic information that is not related to vulnerability information, and realizes deeper vulnerability mining by combining multimodal feature information fusion. Secondly, this method uses the control flow chart derived from binary code as the analysis basis, and the student network acts as the main processing architecture to supplement the inherent logical information of the source code and build an efficient and fast vulnerability detection architecture; thirdly, the loss optimization structure of single-modal loss, cross-modal loss and teacher-student mutual learning loss is deployed, and the model parameters are optimized layer by layer and stage by stage to achieve efficient knowledge transfer effect, so that the final prediction of the student network is closer to the output of the teacher network. After experiments on a large number of smart contracts, it was found that the vulnerability detection method of this application can effectively discover vulnerabilities in a large number of smart contracts with high accuracy. The vulnerability detection method proposed in this application helps to discover and prevent vulnerabilities before smart contract vulnerabilities cause losses, avoiding immeasurable economic losses. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 This is the overall flow chart of this application;
[0058] Figure 2 Processing flow chart for binary code;
[0059] Figure 3 It is a source code processing flow chart;
[0060] Figure 4 A flowchart for cross-modal knowledge transfer;
[0061] Figure 5 Schematic diagram of ablation operation. DETAILED DESCRIPTION
[0062] It should be particularly noted that, in the absence of conflict, the various embodiments disclosed in this application can be combined with each other.
[0063] Specific implementation method 1: refer to Figure 1Specifically illustrate this embodiment, the smart contract vulnerability detection method based on cross-modal knowledge distillation described in this embodiment, first, the binary code and the source code contract are respectively disassembled and graph generated to generate a control flow chart of the binary code and a contract graph of the source code; then, the teacher network uses the control flow chart of the binary code disassembly and the contract graph generated by the source code as input, sets the GCN (graph convolutional neural network) and TMP models to preliminarily process the data, and uses a variety of activation functions to optimize the network output; then, aggregates the feature information from the binary code and the source code, and uses a fully connected network and a sigmoid function to process the aggregated information, and finally outputs the prediction result of the teacher model; the student network uses the control flow chart of the binary code disassembly as input, processes the input with a structure similar to the teacher network model and obtains feature information, then restores the feature information dimension to realize cross-modal knowledge transfer, and finally generates the prediction result of the student network; in addition, in the process of processing the teacher network and the student network, set the single-modal transfer loss, cross-modal transfer loss and teacher-student mutual learning loss to continuously optimize the model parameters and realize efficient multi-modal information fusion.
[0064] Specifically, this application includes the following steps:
[0065] First, the two forms of smart contracts (binary code and source code) are disassembled and graphed before being input into the network;
[0066] Second, after the contract is processed, it will be input into the teacher and student models, and the contract binary code and source code feature representation vector will be obtained after being processed by the model;
[0067] Third, the feature representation vectors of binary code and source code are used in the single-modal loss and cross-modal transfer loss, and the model is optimized based on the results.
[0068] Fourth, the outputs of the student network and the teacher network are used as the teacher-student mutual learning loss and the knowledge transfer mechanism is optimized, such as Figure 1 As shown;
[0069] In this application, x = (b, s) represents the components of binary code and source code in the total sample, then y∈{0, 1} C Represents the binary vector label of the sample, 0 means that the contract has no vulnerability, 1 means that the contract has a vulnerability, where C represents the number of samples detected; the data type input to the teacher network is set to D = {(b, s, y)}, representing binary code, source code and label respectively, and the data type of the student network is set to D = {(b, y)}.
[0070] Binary code processing flow
[0071] The binary code of the smart contract is disassembled to generate a control flow graph. The semantic information in the binary code is converted into a graph and transmitted to the teacher and student networks. The GCN model is used to extract the semantic information in the graph. After that, the output vector is optimized through batch normalization and ReLU function. The specific form of batch normalization operation is as follows:
[0072] y=γ·x+β (1)
[0073]
[0074] γ takes the variance of x and β takes the mean of x as trainable parameters for the normalization operation; the ReLU activation function is as follows:
[0075] f(x)=max(0,x) (3)
[0076] In order to reduce the amount of model calculation, the present invention sets the maximum pooling layer and the average pooling layer to process the optimized data, and finally generates a feature representation vector at the binary code level. Figure 2 Shown
[0077] Source code processing flow
[0078] The source code of the smart contract has rich logical information. The contract graph is generated through the graph generation operation, and the contract graph transfers the characteristic information of the source code into the graph structure. In this graph, the main node is used as the key function call, and the secondary node is used as the key variable of the function. At the same time, the starting node, timing number and edge type of the edge are embedded in the graph, which are control edges, data edges and other types respectively; in order to simplify the neural network data calculation, the present invention proposes to set the ablation operation on the graph, transfer the secondary node features to the nearest main node, and retain the edges connecting the eliminated nodes (only update the starting node). At this time, the features of the core node are composed of three parts: its own features, input feature set, and output feature set; the graph obtained after ablation is then input into the temporal edge transfer graph neural network (TMP) model as input. The model is divided into two stages, namely the edge transfer stage and the readout stage; the edge transfer stage is mainly used to generate edge information and aggregate edge information, while the readout stage is mainly used to convert the final state of the node g i With the initial state o i Aggregation is performed, wherein represents the final hidden layer state, represents the initial hidden state of the node, represents the element-wise product, W g , b g are all model parameters to be learned, and y is the final aggregation result. The aggregation formula is as follows:
[0079]
[0080]
[0081]
[0082] y=Sigmoid(g i o i ) 7
[0083] After the feature extraction of TMP, the same batch normalization method and ReLU activation function as before are set to optimize the output vector, and then the average pooling process is used to generate the source code level vulnerability information representation vector. Figure 3 As shown, the multimodal teacher network
[0084] The teacher network uses the control flow graph after binary code disassembly and the contract graph of source code graph generation operation as multi-modal inputs, and then processes the two inputs as described in the previous article, and finally generates a feature information representation vector. In the teacher network, the feature information of the two modes will undergo an aggregation operation to form semantic information that aggregates binary code and source code, and then input into the fully connected neural network. The input dimension of the fully connected neural network is the sum of the number of rows of two feature information representation vectors, and the output dimension is equal to the number of rows of one feature information representation vector. Then, the output of the fully connected neural network is activated using the sigmoid function to generate the prediction result of the multimodal teacher network.
[0085] Unimodal Student Network
[0086] The unimodal student network takes the control flow graph after binary code disassembly as input. After the above processing of the control flow graph, the binary level feature information representation vector obtained will be used as the input of the fully connected neural network for operation, such as Figure 3 As shown, the last layer of the fully connected neural network uses the following formula to make the binary code feature information table a vector format that is the same as the source code feature representation vector:
[0087]
[0088] Where W s As a trainable matrix, b s As a bias parameter; the output obtained by the fully connected neural network will then be activated by the ReLU function to obtain a smoother result, which will be calculated similarly to the source code feature information representation vector obtained by the teacher network, and then used as a loss function to optimize the model. The optimized feature information representation vector will then be passed to the fully connected neural network for prediction, and the result will be activated by the sigmoid function to obtain a more accurate result.
[0089] Unimodal loss
[0090] Although the process of representing the vector of feature information obtained by the teacher and student networks is roughly the same, the position, size, and parameters of each processing are different. Therefore, the proposed unimodal loss function is to optimize the model parameters of the student network when it is smaller than the teacher network, so that it can extract as much semantic information as possible from the control flow graph of the binary code. The loss function is set as follows:
[0091]
[0092] in represents the binary vulnerability information representation vector output by the student network, represents the binary vulnerability information representation vector output by the teacher network, and N represents the number of samples in the training set.
[0093] Cross-modal transfer loss
[0094] The key point of the smart contract vulnerability detection mechanism proposed in this application based on multimodal knowledge distillation is how to transfer the knowledge obtained by the teacher network to the student network. In order to solve this problem, this application proposes a cross-modal transfer loss. This method uses the similarity between the processed binary code feature information representation and the source code feature information representation as the loss function of the knowledge transfer process, and optimizes the model parameters of the transfer process by continuously reducing the value of the loss function. The loss function is as follows:
[0095]
[0096] in Represents the source code feature information representation from the teacher network. The essential reason for the loss function is that the logical structure of binary code and source code is similar from a global perspective. The binary code semantic information will lose some semantic information after the disassembly operation. At this time, cross-modal knowledge transfer is relied on to supplement the logical structure extracted from the source code by the teacher network into the binary code feature information representation, thereby promoting the student network to help detect vulnerabilities in smart contracts. Figure 4 shown.
[0097] Teacher-student mutual learning loss
[0098] In order to achieve a more effective knowledge transfer effect from multimodality to single modality, this paper proposes a teacher-student mutual learning framework and defines contract vulnerability detection as a binary classification problem. Considering the lack of semantic information of smart contract binary code in vulnerability detection, a binary cross entropy error (BCE) operation is performed between the soft labels predicted by the student network and the output of the teacher network, as shown below:
[0099]
[0100]
[0101] in and Represent the supervised classification losses of the teacher network and the student network, respectively. Indicates whether the i-th sample has a vulnerability, k∈{0,1}; As mentioned above, x=(b,s) and b represent the multimodal and unimodal inputs to the teacher network and the student network, so and They represent the prediction scores of whether the i-th sample has a vulnerability generated by the teacher network and the student network respectively. Finally, by combining the supervised classification loss with the unimodal transmission loss and cross-modal transmission loss proposed above, the overall loss of the two networks is obtained as follows:
[0102]
[0103]
[0104] Among them, λ, γ and ω are balancing factors that control the weights of different losses. It can be seen that in the framework, in addition to the student network learning from the teacher, the teacher network also provides its "teaching strategy" to the student. The two models are jointly optimized in each mini-batch. In each iteration, the parameters of the two networks are updated based on the current model to calculate the vulnerability information vector, the vulnerability information vector of the peer network and the soft label output and the hard label output.
[0105] This application combines the semantic information of smart contracts in binary code and source code to achieve the transfer of source code semantic information to binary code, and construct a lightweight, multimodal information detection model. The model constructed by the present invention includes a teacher and a student model, and three types of loss calculations are used to continuously optimize the model parameters, including single-modal loss, cross-modal knowledge transfer loss, and multimodal-single-modal mutual learning loss. Through the above settings, a vulnerability detection solution combining multimodality of smart contracts is realized, which improves the efficiency of vulnerability detection while reducing the complexity of the smart contract vulnerability detection process.
[0106] It should be noted that the specific implementation is only an explanation and description of the technical solution of the present invention, and cannot be used to limit the scope of protection of the rights. Any partial changes made according to the claims and description of the present invention should still fall within the scope of protection of the present invention.
Claims
1. A smart contract vulnerability detection method based on cross-modal knowledge distillation, characterized by The following steps are involved: Step 1: Obtain a smart contract, the smart contract includes binary code and source code; Step 2: Disassemble the binary code to obtain the control flow graph, and generate the source code to obtain the contract graph; Step 3: Input the control flow graph and contract graph into the teacher network, and input the control flow graph into the student network; The teacher network specifically performs the following steps: First, the control flow graph and the contract graph are feature extracted respectively to obtain the binary code feature representation vector and the source code feature representation vector. Then, the binary code feature representation vector and the source code feature representation vector are aggregated to obtain multimodal semantic information. The obtained multimodal semantic information is then input into the fully connected layer. The output of the fully connected layer is then activated using the sigmoid function to obtain the prediction result of the multimodal teacher network. The student network specifically performs the following steps: First, the control flow graph is feature extracted to obtain a binary code feature representation vector. Then, the binary code feature representation vector and the binary code feature representation vector obtained in the teacher network are used to calculate the loss, and the loss calculation result is used as the first loss function to optimize the student network. Then the binary code feature representation vector is input into the fully connected layer. The last layer of the fully connected layer uses the following formula to make the dimension of the binary code feature representation vector the same as the source code feature representation vector: Among them, W s represents the trainable matrix, b s represents the bias parameter, represents the binary code feature representation vector, y s represents the binary code feature representation vector after dimension processing; The output of the fully connected layer is activated by the ReLU function. The result after the ReLU function activation is similarly calculated with the source code feature representation vector obtained by the teacher network, and the similarity calculation result is used as the second loss function to optimize the student network. After that, the feature information representation vector in the optimized student network is passed to the fully connected layer for prediction, and the prediction result is activated by the sigmoid function to obtain the final prediction result. Step 4: Calculate the loss of the prediction results of the multimodal teacher network and the final prediction results, and use the loss calculation results as the third loss function to optimize the student network and the teacher network; Step 5: Use the student network and teacher network optimized in step 4 to detect smart contract vulnerabilities.
2. The smart contract vulnerability detection method based on cross-modal knowledge distillation according to claim 1 is characterized in that The steps for obtaining the binary code feature representation vector are: Firstly, the GCN model is used to extract features of the semantic information in the control flow graph. Then the extracted features are processed by batch normalization and ReLU function, and then by maximum pooling and average pooling to obtain the binary code feature representation vector.
3. The smart contract vulnerability detection method based on cross-modal knowledge distillation according to claim 2 is characterized in that The batch normalization process is expressed as: y=γ·x+β β=E(x) Among them, γ takes the variance of x and β takes the mean of x, γ and β serve as trainable parameters of the normalization operation, x represents the input of the batch normalization process, and y represents the output of the batch normalization process.
4. The smart contract vulnerability detection method based on cross-modal knowledge distillation according to claim 2 is characterized in that The ReLU function is expressed as: f(x)=max(0,x).
5. The smart contract vulnerability detection method based on cross-modal knowledge distillation according to claim 1 is characterized in that The specific steps of the graph generation process are: The key function call features in the source code are used as the main node, and the key variable features of the function in the source code are used as the secondary node; Embed the starting node feature, sequence number feature and edge type feature of the edge between every two nodes into the contract graph; The edge between each two nodes is a control edge or a data edge.
6. The smart contract vulnerability detection method based on cross-modal knowledge distillation according to claim 5 is characterized in that The steps for obtaining the source code feature representation vector are: First, the contract graph is ablated to eliminate the secondary nodes and retain the edges connecting the eliminated secondary nodes to the main nodes. Then, the key variable features of the functions corresponding to the secondary nodes in the contract graph are transferred to the main nodes closest to the secondary nodes to obtain the contract graph after the ablation operation. Then, the contract graph after the ablation operation is input into the temporal edge transfer graph neural network for feature extraction. Finally, the extracted features are batch normalized, ReLU function and average pooled to obtain the source code feature representation vector.
7. The smart contract vulnerability detection method based on cross-modal knowledge distillation according to claim 6 is characterized in that The temporal edge transfer graph neural network is divided into an edge transfer phase and an edge readout phase; The edge transfer phase is used to generate edge information and aggregate edge information; The edge readout stage is used to convert the node state g before feature extraction i and the state o of the node after feature extraction i To carry out polymerization; The aggregation is represented by: in, represents the final hidden layer state, represents the initial hidden state of the node, represents the element-wise product, and represents the model parameters to be learned, y′ represents the aggregation result, j represents the sequence number of the model parameter, and V represents the total number of nodes.
8. The smart contract vulnerability detection method based on cross-modal knowledge distillation according to claim 1 is characterized in that The first loss function is expressed as a single-modal loss function, which is expressed as: in, represents the binary vulnerability information representation vector output by the student network, represents the binary vulnerability information representation vector output by the teacher network, N represents the number of samples in the training set, and b i represents the i-th binary code sample.
9. The smart contract vulnerability detection method based on cross-modal knowledge distillation according to claim 8 is characterized in that The second loss function is expressed as a cross-modal transfer loss function, which is expressed as: in, Represents the source feature information from the teacher network.
10. The smart contract vulnerability detection method based on cross-modal knowledge distillation according to claim 9 is characterized in that The third loss function is expressed as a teacher-student mutual learning loss function, which is expressed as: in, and denote the supervised classification losses of the teacher network and the student network respectively, Indicates whether the i-th sample has a vulnerability, k∈{0,1}, and denote the prediction scores of whether the i-th sample is vulnerable or not generated by the teacher network and the student network, respectively. λ, γ, and ω denote the balancing factors controlling different loss weights. The subscript s denotes the student network, the subscript t denotes the teacher network, and x i Represents the i-th multimodal fusion sample.
