Edge side large model security reasoning method and system based on Internet of Things security
By iteratively pruning and optimizing the model for edge nodes, the problem of poor inference performance of edge node models was solved, accuracy was improved and resource overhead was reduced, and a good fit between the model and edge nodes was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-05
- Publication Date
- 2026-03-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing edge node deployment model has poor inference performance and poor business adaptability.
By iteratively pruning multiple target edge nodes, analyzing the importance of nodes and edges, and combining the subordinate relationship between nodes and network layers, low-importance layers and nodes are gradually removed to optimize the model and ensure that it is adapted to the business requirements of specific node types.
It improves the accuracy of model inference at edge nodes, reduces the overhead of network and computing resources, and ensures the matching between the model and edge nodes.
Smart Images

Figure CN121690848A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of machine learning, and in particular to an edge-side large model safe inference method and system based on Internet of Things security. BACKGROUND
[0002] Internet of Things technology realizes the interconnection of the physical world and the digital world through sensors, controllers and other terminal devices, and edge nodes serve as a key hub connecting the cloud and terminal devices to support the application landing of intelligent Internet of Things. Large models can gradually be deployed from the cloud to the edge side through model pruning and other processing, thanks to their powerful feature extraction and context reasoning capabilities, to provide highly personalized intelligent services for industrial Internet of Things, smart home and other scenarios.
[0003] It is found in applications that the business adaptation degree between the pruned model and the edge node is poor, and the actual inference effect after the model is deployed on the edge node is significantly lower than expected. SUMMARY
[0004] The purpose of the present application is to provide an edge-side large model safe inference method and system based on Internet of Things security, to solve the technical problem of poor inference effect of the model deployed on the existing edge node.
[0005] In a first aspect, an embodiment of the present application provides an edge-side large model safe inference method based on Internet of Things security, comprising: a plurality of target edge nodes based on Internet of Things iteratively pruning a preset initial model to obtain a first target model, wherein the plurality of target edge nodes correspond to the same node type; wherein the i-th iteration in the iterative pruning comprises: obtaining an i-th weight file of each target edge node, wherein the i-th weight file indicates a plurality of weight data obtained by training an (i-1)-th transition model through node reporting data of the corresponding target edge node, the weight data indicating the importance of the corresponding edge in the corresponding neural network model, and when i is 1, the (i-1)-th transition model is the initial model; analyzing the importance of each node in the (i-1)-th transition model according to the i-th weight file of each target edge node and the association relationship between nodes and edges in the (i-1)-th transition model, to obtain a plurality of node key values of the i-th iteration; analyzing the importance of each network layer in the (i-1)-th transition model according to the plurality of node key values of the i-th iteration and the dependency relationship between nodes and network layers in the (i-1)-th transition model, to obtain a plurality of network layer key values of the i-th iteration; prune the network layers of the i-1th transition model based on the plurality of network layer key values of the i th iteration, to obtain an i th transition model, wherein, in the case that the mean of the network layer key values of at least one network layer pruned in the i th iteration is greater than the layer key threshold value, the i th transition model is determined as the first target model.
[0006] In some embodiments, the importance of each node in the i-1th transition model is analyzed according to the i th weight file of each target edge node and the association between nodes and edges in the i-1th transition model, to obtain the plurality of node key values of the i+1th iteration, including: The fluctuation degree of the weight data of each edge in the i-1th transition model is analyzed according to the i th weight file of each target edge node, to determine the plurality of edge key values of the i+1th iteration; The weight data difference of each edge in the i-1th transition model in the plurality of target edge nodes is analyzed according to the i th weight file of each target edge node, to determine the first edge node set and the second edge node set corresponding to each edge in the i-1th transition model; The edge node partition difference between each edge and other edges of the same node in the i-1th transition model is analyzed according to the first edge node set and the second edge node set corresponding to each edge in the i-1th transition model and the association between nodes and edges in the i-1th transition model, to obtain the similarity index corresponding to each edge in the i-1th transition model; The first edge, the second edge and the third edge are distinguished in the i-1th transition model according to the similarity index corresponding to each edge in the i-1th transition model, wherein the similarity index corresponding to the first edge is greater than a first similarity threshold value, the similarity index corresponding to the second edge is between the first similarity threshold value and a second similarity threshold value, the similarity index corresponding to the third edge is less than the second similarity threshold value, and the first similarity threshold value is greater than the second similarity threshold value; The first edge and the second edge associated with each node in the i-1th transition model are analyzed according to the association between nodes and edges in the i-1th transition model and the similarity index corresponding to each edge in the i-1th transition model, to determine the plurality of node key values of the i th iteration.
[0007] In some embodiments, the similarity index of the target edge in the (i-1)th transition model is determined based on a first overlap index and a second overlap index. The target edge in the (i-1)th transition model is any edge in the (i-1)th transition model. The first overlap index indicates the intersection-union ratio of the first set of edge nodes between the target edge and the target nearest neighbor edge in the (i-1)th transition model. The second overlap index indicates the intersection-union ratio of the second set of edge nodes between the target edge and the target nearest neighbor edge in the (i-1)th transition model. The target nearest neighbor edge in the (i-1)th transition model is associated with the same node in the (i-1)th transition model.
[0008] In some embodiments, the node key value of the target node in the (i-1)th transition model is obtained based on its corresponding key edge ratio, the central tendency of the edge key value of its associated first edge, and the central tendency of the similarity index of its associated second edge. Here, the target node in the (i-1)th transition model is any node in the (i-1)th transition model, and the key edge ratio corresponding to the target node in the (i-1)th transition model is the proportion of the number of its associated first edge and second edge among all its associated edges.
[0009] In some embodiments, the network layer key values of the target network layer in the (i-1)th transition model are determined based on their corresponding node distribution, wherein the target network layer in the (i-1)th transition model is any network layer in the (i-1)th transition model, and the node distribution indicates the data distribution of the node key values of the multiple nodes included in the corresponding network layer.
[0010] In some embodiments, the step of obtaining the network layer key values of the target network layer in the (i-1)th transition model includes: In the (i-1)th transition model, the node feature value corresponding to each network layer is obtained, wherein the node feature value indicates the mainstream trend of the node key values of all nodes in the corresponding network layer; Sort all network layers in the (i-1)th transition model according to the ascending order of the corresponding node feature values to obtain the i-th network layer sequence; Based on the sequence number, node feature value, and node feature difference of the target network layer in the i-1th transition model in the i-th network layer sequence, determine the network layer key value of the target network layer in the i-1th transition model. The node feature difference indicates the difference between the node feature values of the corresponding network layer and the corresponding upper-level network layer. The node feature value of the upper-level network layer is higher than the node feature value of the corresponding network layer.
[0011] In some embodiments, the step of pruning the network layers of the (i-1)th transition model based on multiple network layer key values from the i-th iteration to obtain the i-th transition model includes: Based on the key values of multiple network layers in the i-th iteration, the redundant network layer and the key network layer in the i-1th transition model are distinguished. The key value of the key network layer in the i-th iteration is greater than the key value of the redundant network layer in the i-th iteration. In the (i-1)th transition model, the redundant network layer of the i-th iteration is pruned to obtain the i-th transition model.
[0012] In some embodiments, after iteratively pruning a preset initial model based on multiple target edge nodes of the Internet of Things to obtain a first target model, the method further includes: In the first target model, the changing trend of the node key value of each node during the iterative pruning process is analyzed to obtain multiple node trend values; In the first objective model, the node retention index of each node is determined based on the node trend value corresponding to each node and the node key value corresponding to the last iteration. Based on the node retention index of each node in the first objective model, nodes are removed from the first objective model to obtain the second objective model.
[0013] In some embodiments, after reducing the number of nodes in the first target model according to the node retention index of each node in the first target model to obtain the second target model, the method further includes: Based on the edge key value of each edge in the second objective model in the last iteration, the second objective model is reduced by removing edges to obtain the third objective model.
[0014] Secondly, another embodiment of the present invention provides an edge-side large-model secure inference system based on Internet of Things (IoT) security, the system comprising: The model pruning module is used to iteratively prune a preset initial model based on multiple target edge nodes of the Internet of Things to obtain a first target model, wherein the multiple target edge nodes correspond to the same node type; The i-th iteration in the iterative pruning includes: Obtain the i-th weight file for each target edge node, wherein the i-th weight file indicates multiple weight data obtained by training the (i-1)-th transition model using the node-reported data of the corresponding target edge node, and the weight data indicates the importance of the corresponding edge in the corresponding neural network model. When i is 1, the (i-1)-th transition model is the initial model. Based on the i-th weight file of each target edge node and the relationship between nodes and edges in the (i-1)-th transition model, analyze the importance of each node in the (i-1)-th transition model to obtain multiple node key values for the i-th iteration. Based on the key values of multiple nodes in the i-th iteration and the subordinate relationship between nodes and network layers in the (i-1)-th transition model, the importance of each network layer in the (i-1)-th transition model is analyzed to obtain the key values of multiple network layers in the i-th iteration. Based on the multiple network layer key values of the i-th iteration, the (i-1)-th transition model is pruned to obtain the i-th transition model. Wherein, if the average value of the network layer key values of at least one network layer pruned in the i-th iteration is greater than the layer key threshold, the i-th transition model is determined as the first target model.
[0015] Thirdly, in another embodiment of the present invention, an electronic device is provided, including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the method described in the first aspect.
[0016] Fourthly, in another embodiment of the present invention, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the steps of the method described in the first aspect.
[0017] The present invention has the following beneficial effects: This invention uses multiple target edge nodes of the same node type to iteratively prune the initial model. In each iteration, the corresponding model training is completed independently based on the node-reported data of each target edge node. The differences in weight files corresponding to different target edge nodes are analyzed to determine the importance of each edge in the model iterates in each iteration. Then, using the association between edges and nodes and the subordinate relationship between nodes and network layers in the model, the model architecture is progressively deduced upwards to determine the importance of each network layer in the model iterates in each iteration. Based on this, low-importance network layers are pruned to complete the pruning work in the corresponding iteration round. The iteration ends when the importance of all retained network layers is high. This dynamic pruning optimization of the initial model is completed in combination with the actual needs of the data reported by each target edge node, so that the first target model obtained after pruning can better match the business inference needs of several edge nodes of the corresponding node type. This ensures that the first target model, after being deployed on several edge nodes of the corresponding node type, can output more accurate inference results. Attached Figure Description
[0018] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a flowchart illustrating a secure inference method for edge-side large-model security based on Internet of Things security provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of an edge-side large-model secure inference method system based on Internet of Things security provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0020] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of the edge-side large-model security inference method and system based on IoT security proposed by the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.
[0021] Unless otherwise defined, 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 pertains.
[0022] The following description, in conjunction with the accompanying drawings, details the specific scheme of the edge-side large-model secure inference method and system based on Internet of Things security provided by this invention.
[0023] In one embodiment, the present invention provides an edge-side large-model secure inference method based on Internet of Things (IoT) security, such as... Figure 1 As shown, the method includes: Step S1: Based on the Internet of Things, multiple target edge nodes iteratively prune the preset initial model to obtain the first target model.
[0024] Among them, the multiple target edge nodes correspond to the same node type.
[0025] The i-th iteration in the iterative pruning includes: Obtain the i-th weight file for each target edge node, wherein the i-th weight file indicates multiple weight data obtained by training the (i-1)-th transition model using the node-reported data of the corresponding target edge node, and the weight data indicates the importance of the corresponding edge in the corresponding neural network model. When i is 1, the (i-1)-th transition model is the initial model. Based on the i-th weight file of each target edge node and the relationship between nodes and edges in the (i-1)-th transition model, analyze the importance of each node in the (i-1)-th transition model to obtain multiple node key values for the i-th iteration. Based on the key values of multiple nodes in the i-th iteration and the subordinate relationship between nodes and network layers in the (i-1)-th transition model, the importance of each network layer in the (i-1)-th transition model is analyzed to obtain the key values of multiple network layers in the i-th iteration. Based on the multiple network layer key values of the i-th iteration, the (i-1)-th transition model is pruned to obtain the i-th transition model. Wherein, if the average value of the network layer key values of at least one network layer pruned in the i-th iteration is greater than the layer key threshold (e.g., 0.4), the i-th transition model is determined as the first target model.
[0026] In this invention, the target edge node should be understood as an edge computing node that supports the deployment of neural network models, such as an edge AI gateway / industrial control computer. The above node types include, but are not limited to, temperature monitoring, voltage monitoring, and current monitoring types.
[0027] It should be noted that the target edge node is directly connected to multiple sensors in the Internet of Things (IoT) used to collect specific types of data. After the model is deployed, it can call the deployed model to complete the localized monitoring and processing of the sensing data (such as temperature data, current data, voltage data, etc.) reported by the multiple connected sensors (such as monitoring data anomaly risks).
[0028] The data collected by the target edge nodes is the data reported by the aforementioned nodes.
[0029] The initial model described above can be understood as a complex neural network model configured on a cloud server that remotely connects multiple target edge nodes. It includes multiple network layers, each consisting of multiple nodes and edges.
[0030] In this invention, the model training phase is completed on the cloud server. Once the trained model is determined, the cloud server distributes the trained model (i.e., the aforementioned first target model) to each target edge node for use.
[0031] This invention uses multiple target edge nodes of the same node type to iteratively prune the initial model. In each iteration, the corresponding model training is completed independently based on the node-reported data of each target edge node. The differences in weight files corresponding to different target edge nodes are analyzed to determine the importance of each edge in the model iterates in each iteration. Then, using the association between edges and nodes and the subordinate relationship between nodes and network layers in the model, the model architecture is progressively deduced upwards to determine the importance of each network layer in the model iterates in each iteration. Based on this, low-importance network layers are pruned to complete the pruning work in the corresponding iteration round. The iteration ends when the importance of all retained network layers is high. This dynamic pruning optimization of the initial model is completed in combination with the actual needs of the data reported by each target edge node, so that the first target model obtained after pruning can better match the business inference needs of several edge nodes of the corresponding node type. This ensures that the first target model, after being deployed on several edge nodes of the corresponding node type, can output more accurate inference results.
[0032] Specifically, the steps for analyzing the importance of each node in the (i-1)th transition model based on the i-th weight file of each target edge node and the association between nodes and edges in the (i-1)-th transition model, in order to obtain the key values of multiple nodes in the (i+1)-th iteration, include: Based on the i-th weight file of each target edge node, analyze the fluctuation of the weight data of each edge in the (i-1)-th transition model to determine the key values of multiple edges in the (i+1)-th iteration; Based on the i-th weight file of each target edge node, analyze the weight data differences of each edge in the (i-1)-th transition model in multiple target edge nodes to determine the first edge node set and the second edge node set corresponding to each edge in the (i-1)-th transition model. Based on the first edge node set and the second edge node set corresponding to each edge in the (i-1)th transition model, and the relationship between nodes and edges in the (i-1)th transition model, analyze the edge node partitioning differences between each edge in the (i-1)th transition model and other edges of the same node, so as to obtain the similarity index corresponding to each edge in the (i-1)th transition model. Based on the similarity index corresponding to each edge in the (i-1)th transition model, the first edge, the second edge, and the third edge are distinguished in the (i-1)th transition model. The similarity index corresponding to the first edge is greater than the first similarity threshold, the similarity index corresponding to the second edge is between the first similarity threshold (e.g., 0.6) and the second similarity threshold (e.g., 0.45), and the similarity index corresponding to the third edge is less than the second similarity threshold. The first similarity threshold is greater than the second similarity threshold. Based on the relationships between nodes and edges in the (i-1)th transition model and the similarity index corresponding to each edge in the (i-1)th transition model, analyze the first and second edges associated with each node in the (i-1)th transition model to determine the key values of multiple nodes in the i-th iteration.
[0033] In this context, the fluctuation of the weight data of each edge in the (i-1)th transition model can be quantified by the discrete coefficients of several weight data corresponding to each edge in the (i-1)th transition model (the number of weight data corresponding to each edge is the same as the number of target edge nodes). In this case, the edge key value of the edge in the (i-1)th transition model... It can be represented as:
[0034] in, This represents the discrete coefficients of multiple weight data corresponding to the edges in the (i-1)th transition model. This represents the first normalization function (such as the arctangent function), used to normalize... The values are scaled to the 0-1 range.
[0035] When processing perception data of corresponding node types, the importance of some high-value edges can be directly represented by their edge key values. However, this does not mean that edges with low edge key values are also less important (for example, some edges may be more sensitive to a certain type of perception data, resulting in relatively complex numerical performance at different target edge nodes, thus exhibiting lower edge key values). Analysis revealed that high-value edges usually do not appear in isolation. Therefore, by analyzing the distribution differences between different edges associated with the same node, the isolation degree of each edge can be determined accordingly, thereby indirectly determining the retention value of each edge (for edges with retention value and insensitive to data, their data accuracy is lower than their edge key values; but for edges with retention value and sensitive to data, their data accuracy is higher than their edge key values). Therefore, edges with high retention value (i.e., the first edge) are directly represented by their edge key values, while edges with some retention value (i.e., the second edge) are indirectly represented by their similarity index, thus achieving accurate quantification of the importance of each edge.
[0036] In this invention, the first set of edge nodes (corresponding to normal weight data) and the second set of edge nodes (corresponding to abnormal weight data) corresponding to each edge in the (i-1)th transition model can be determined by performing binary classification processing (such as using a box plot anomaly detection algorithm) on multiple weight data (which are respectively from multiple target edge nodes) for each edge in the (i-1)th transition model.
[0037] Specifically, the similarity index of the target edge in the (i-1)th transition model is determined based on the first overlap index and the second overlap index. The target edge in the (i-1)th transition model is any edge in the (i-1)th transition model. The first overlap index indicates the intersection-union ratio of the first edge node set between the target edge and the target nearest neighbor edge in the (i-1)th transition model. The second overlap index indicates the intersection-union ratio of the second edge node set between the target edge and the target nearest neighbor edge in the (i-1)th transition model. The target nearest neighbor edge in the (i-1)th transition model is associated with the same node in the (i-1)th transition model.
[0038] For example, the similarity index of edges in the (i-1)th transition model It can be represented as:
[0039] in, This represents the set of the first edge nodes of the edges in the (i-1)th transition model. Let R represent the set of first edge nodes corresponding to the r-th nearest neighbor edge in the (i-1)-th transition model, and let R represent the total number of nearest neighbor edges corresponding to the edges in the (i-1)-th transition model. This represents the set of the second edge nodes of the edges in the (i-1)th transition model. This represents the set of second edge nodes corresponding to the r-th nearest neighbor edge in the (i-1)-th transition model. It represents the first overlap index (the intersection-union ratio of the two sets) of the edge in the (i-1)th transition model and its corresponding r-th nearest neighbor edge. Let represent the second overlap index between the edge in the (i-1)th transition model and its corresponding r-th nearest neighbor edge. This represents the second normalization function (such as the mean function), used to scale the calculated cumulative values to the 0-1 range.
[0040] The similarity index mentioned above is used to indicate the degree of difference between a corresponding edge and its adjacent edge (which connects to the same node).
[0041] Furthermore, the node key value of the target node in the (i-1)th transition model is obtained based on the proportion of its corresponding key edges, the central tendency of the key values of its associated first edge, and the central tendency of the similarity index of its associated second edge. Here, the target node in the (i-1)th transition model is any node in the (i-1)th transition model, and the proportion of the key edges corresponding to the target node in the (i-1)th transition model is the proportion of the number of its associated first and second edges among all its associated edges.
[0042] Based on the above settings, the importance of each node in the (i-1)th transition model is evaluated by comprehensively considering the importance of the high-value edges corresponding to each node.
[0043] For example, the node key value of the node in the (i-1)th transition model It can be represented as:
[0044] in, This represents the total number of first edges associated with nodes in the (i-1)th transition model. This represents the total number of second edges associated with nodes in the (i-1)th transition model. This represents the total number of edges associated with a node in the (i-1)th transition model. Let represent the set of all first edges associated with nodes in the (i-1)th transition model. Let represent the set of all second edges associated with nodes in the (i-1)th transition model. This represents the edge key value of the j-th first edge associated with a node in the (i-1)-th transition model. Let represent the similarity index of the k-th second edge associated with the node in the (i-1)-th transition model. and These represent the third and fourth normalization functions (such as the mean function), which are used to scale the corresponding accumulated values to the 0-1 range.
[0045] In some implementations, the network layer key values of the target network layer in the (i-1)th transition model are determined based on its corresponding node distribution, wherein the target network layer in the (i-1)th transition model is any network layer in the (i-1)th transition model, and the node distribution indicates the data distribution of the node key values of the multiple nodes included in the corresponding network layer.
[0046] The steps for obtaining the network layer key values of the target network layer in the (i-1)th transition model include: In the (i-1)th transition model, the node feature value corresponding to each network layer is obtained, wherein the node feature value indicates the mainstream trend of the node key values of all nodes in the corresponding network layer; Sort all network layers in the (i-1)th transition model according to the ascending order of the corresponding node feature values to obtain the i-th network layer sequence; Based on the sequence number, node feature value, and node feature difference of the target network layer in the i-1th transition model in the i-th network layer sequence, determine the network layer key value of the target network layer in the i-1th transition model. The node feature difference indicates the difference between the node feature values of the corresponding network layer and the corresponding upper-level network layer. The node feature value of the upper-level network layer is higher than the node feature value of the corresponding network layer.
[0047] In this invention, the node feature value corresponding to each network layer in the (i-1)th transition model can be the mean or median of the node key values of multiple nodes in the cluster with the most cluster elements obtained after clustering of the node key values of multiple nodes included in it.
[0048] For example, the network layer key values in the (i-1)th transition model It can be represented as:
[0049] in, This represents the total number of network layers included in the (i-1)th transition model. This represents the sequence number of the network layer in the (i-1)th transition model within the i-th network layer sequence. This represents the node feature value of the network layer in the (i-1)th transition model. This represents the mean function (used to calculate the average of node feature values across multiple network layers). This represents a subsequence extending to both sides of the i-th network layer sequence with the i-th transition model as the center (e.g., when the set length is 2, the subsequence length is 5). This represents a subsequence in the i-th network layer sequence, consisting of several network layers above the network layer in the (i-1)-th transition model. This is the activation function.
[0050] In the above setup, the sequence number and node feature difference are used to jointly characterize the importance of the corresponding network layer among all network layers, so as to evaluate the importance of each network layer from a global perspective. The node feature value is used to characterize the importance of several nodes included in the corresponding network layer, so as to evaluate the importance of each network layer from an individual perspective. By combining the two, the importance of each network layer is finally accurately quantified.
[0051] The step of pruning the network layers of the (i-1)th transition model based on multiple network layer key values from the i-th iteration to obtain the i-th transition model includes: Based on the key values of multiple network layers in the i-th iteration, the redundant network layer and the key network layer in the i-1th transition model are distinguished. The key value of the key network layer in the i-th iteration is greater than the key value of the redundant network layer in the i-th iteration. In the (i-1)th transition model, the redundant network layer of the i-th iteration is pruned to obtain the i-th transition model.
[0052] In one example, the aforementioned redundant network layer can be understood as the network layer indicated by the last few (e.g., 1, 2, 3, etc.) network layer key values among the multiple network layer key values in the i-th iteration.
[0053] In some implementations, after multiple target edge nodes based on the Internet of Things iteratively prune a preset initial model to obtain a first target model, the method further includes: In the first target model, the changing trend of the node key value of each node during the iterative pruning process is analyzed to obtain multiple node trend values; In the first objective model, the node retention index of each node is determined based on the node trend value corresponding to each node and the node key value corresponding to the last iteration. Based on the node retention index of each node in the first objective model, nodes are removed from the first objective model to obtain the second objective model.
[0054] In this invention, by linearly fitting multiple key node values of each node in the first target model during the iterative pruning process, the fitting slope value corresponding to each node in the first target model is determined, and this slope value is determined as the node trend value of each node in the first target model.
[0055] When the node trend value is positive, the larger the node trend value, the higher the value of the corresponding node in the first objective model. Similarly, the larger the node key value, the higher the value of the corresponding node in the first objective model.
[0056] When the node trend value is 0 or negative, the corresponding node will be marked as a node to be deleted and removed in the second target model.
[0057] The node retention index is used to indicate the value of a corresponding node being retained in the first objective model.
[0058] For example, the node retention index of a node in the first target model It can be represented as:
[0059] in, This represents the node trend value of the node in the first objective model. This represents the node key value corresponding to the node in the last iteration of the first objective model. This represents the fifth normalization function (such as the hyperbolic tangent function), used to scale the corresponding fitted slope value to the 0-1 interval.
[0060] In this example, if the node retention index is less than or equal to the node retention threshold (e.g., 0.2), the corresponding node will be marked as a node to be deleted and removed accordingly in the first target model.
[0061] Based on the above settings, after completing the coarse-grained optimization of the network layers, and combining the changing trends of the node key values of each node, we further refine the optimization of the nodes within each network layer. This is to further reduce the size of the model finally deployed on the target edge nodes while ensuring the model inference performance, thereby reducing the network resource overhead of the target edge nodes in the process of receiving the model and the computational resource overhead when using the model for inference.
[0062] In some implementations, after reducing the number of nodes in the first target model according to the node retention index of each node in the first target model to obtain the second target model, the method further includes: Based on the edge key value of each edge in the second objective model in the last iteration, the second objective model is reduced by removing edges to obtain the third objective model.
[0063] In this implementation, based on the optimization of the network layer and nodes, and considering the importance of each edge in the last iteration, the edges within the model are further optimized. This reduces the size of the model finally deployed on the target edge node while ensuring the model's inference performance, thereby reducing the network resource overhead of the target edge node during model reception and the computational resource overhead when using the model for inference.
[0064] For example, if the edge key value in the last iteration of the corresponding edge is less than or equal to the edge retention threshold (e.g., 0.44), the corresponding edge is marked as an edge to be deleted and removed accordingly in the second target model.
[0065] In one embodiment, the present invention also provides an edge-side large-model secure inference system based on Internet of Things (IoT) security, such as... Figure 2 As shown, the system 200 includes: The model pruning module 201 is used to iteratively prune a preset initial model based on multiple target edge nodes of the Internet of Things to obtain a first target model.
[0066] Among them, the multiple target edge nodes correspond to the same node type.
[0067] The i-th iteration in the iterative pruning includes: Obtain the i-th weight file for each target edge node, wherein the i-th weight file indicates multiple weight data obtained by training the (i-1)-th transition model using the node-reported data of the corresponding target edge node, and the weight data indicates the importance of the corresponding edge in the corresponding neural network model. When i is 1, the (i-1)-th transition model is the initial model. Based on the i-th weight file of each target edge node and the relationship between nodes and edges in the (i-1)-th transition model, analyze the importance of each node in the (i-1)-th transition model to obtain multiple node key values for the i-th iteration. Based on the key values of multiple nodes in the i-th iteration and the subordinate relationship between nodes and network layers in the (i-1)-th transition model, the importance of each network layer in the (i-1)-th transition model is analyzed to obtain the key values of multiple network layers in the i-th iteration. Based on the multiple network layer key values of the i-th iteration, the (i-1)-th transition model is pruned to obtain the i-th transition model. Wherein, if the average value of the network layer key values of at least one network layer pruned in the i-th iteration is greater than the layer key threshold, the i-th transition model is determined as the first target model.
[0068] It should be noted that the system provided in the above embodiments is only an example of the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device can be divided into different functional modules to complete all or part of the functions described above. In addition, the edge-side large-model secure inference system based on IoT security and the edge-side large-model secure inference method based on IoT security provided in the above embodiments belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0069] This invention also provides an electronic device. Please refer to [link to relevant documentation]. Figure 3 The electronic device may include a processor 301, a memory 302, and a program 3021 stored in the memory 302 and capable of running on the processor 301.
[0070] When program 3021 is executed by processor 301, it can achieve the following: Figure 1 Any steps in the corresponding method embodiments and the achievement of the same beneficial effects will not be repeated here.
[0071] Those skilled in the art will understand that all or part of the steps of the methods described in the above embodiments can be implemented by hardware related to program instructions, and the program can be stored in a readable medium.
[0072] This invention also provides a readable storage medium storing a computer program, which, when executed by a processor, can perform the above-described functions. Figure 1 Any step in the corresponding method embodiment can achieve the same technical effect, and will not be repeated here to avoid repetition.
[0073] The computer-readable storage medium of this invention can be any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0074] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0075] The program code contained on the storage medium can be transmitted using any suitable medium, including but not limited to wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0076] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or terminal. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0077] This invention also provides a computer program product that, when run on a computer, causes the computer to perform the aforementioned steps to implement the edge-side large-model security inference method based on Internet of Things security provided in the above embodiments.
[0078] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0079] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
Claims
1. An edge-side large model secure inference method based on Internet of Things security, characterized in that, The method comprises: a plurality of target edge nodes based on the Internet of Things iteratively pruning a preset initial model to obtain a first target model, wherein the plurality of target edge nodes correspond to a same node type; wherein the i-th iteration in the iterative pruning comprises: obtaining an i-th weight file of each target edge node, wherein the i-th weight file indicates a plurality of weight data obtained by training an (i-1)-th transition model through node reporting data of a corresponding target edge node, the weight data indicating an importance of a corresponding edge in a corresponding neural network model, and i being 1, the (i-1)-th transition model being the initial model; analyzing an importance of each node in the (i-1)-th transition model according to the i-th weight file of each target edge node and an association relationship between nodes and edges in the (i-1)-th transition model to obtain a plurality of node key values of the i-th iteration; analyzing an importance of each network layer in the (i-1)-th transition model according to the plurality of node key values of the i-th iteration and a dependency relationship between nodes and network layers in the (i-1)-th transition model to obtain a plurality of network layer key values of the i-th iteration; performing network layer pruning on the (i-1)-th transition model based on the plurality of network layer key values of the i-th iteration to obtain an i-th transition model, wherein in a case that a mean value of the network layer key values of at least one network layer pruned in the i-th iteration is greater than a layer key threshold value, the i-th transition model is determined as the first target model.
2. The edge-side large model secure inference method based on Internet of Things security according to claim 1, characterized in that, The step of analyzing an importance of each node in the (i-1)-th transition model according to the i-th weight file of each target edge node and an association relationship between nodes and edges in the (i-1)-th transition model to obtain a plurality of node key values of the (i+1)-th iteration comprises: analyzing a fluctuation degree of weight data of each edge in the (i-1)-th transition model according to the i-th weight file of each target edge node to determine a plurality of edge key values of the (i+1)-th iteration; analyzing a weight data difference of each edge in the (i-1)-th transition model in the plurality of target edge nodes according to the i-th weight file of each target edge node to determine a first edge node set and a second edge node set corresponding to each edge in the (i-1)-th transition model; analyzing an edge node division difference between each edge and other edges of a same node in the (i-1)-th transition model according to the first edge node set and the second edge node set corresponding to each edge in the (i-1)-th transition model and an association relationship between nodes and edges in the (i-1)-th transition model to obtain a similarity index corresponding to each edge in the (i-1)-th transition model; distinguishing a first edge, a second edge and a third edge in the (i-1)-th transition model according to the similarity index corresponding to each edge in the (i-1)-th transition model, wherein the similarity index corresponding to the first edge is greater than a first similarity threshold value, the similarity index corresponding to the second edge is between the first similarity threshold value and a second similarity threshold value, the similarity index corresponding to the third edge is less than the second similarity threshold value, and the first similarity threshold value is greater than the second similarity threshold value; According to the association relationship between nodes and edges in the i-1th transition model and the similarity index corresponding to each edge in the i-1th transition model, the first edge and the second edge associated with each node in the i-1th transition model are analyzed to determine the plurality of node key values of the i th iteration.
3. The edge-side large model secure inference method based on Internet of Things security according to claim 2, characterized in that, The similarity index of the target edge in the i-1th transition model is determined based on the first overlap index and the second overlap index, the target edge in the i-1th transition model is any edge in the i-1th transition model, the first overlap index indicates the intersection union ratio of the first edge node set between the target edge and the target neighbor edge in the i-1th transition model, and the second overlap index indicates the intersection union ratio of the second edge node set between the target edge and the target neighbor edge in the i-1th transition model. The target neighbor edge in the i-1th transition model is associated with the same node in the i-1th transition model as the target edge.
4. The edge-side large model secure inference method based on Internet of Things security according to claim 2, characterized in that, The node key value of the target node in the i-1th transition model is determined based on the corresponding key edge proportion, the central tendency of the edge key value of the first edge associated with the target node, and the central tendency of the similarity index of the second edge associated with the target node, wherein the target node in the i-1th transition model is any node in the i-1th transition model, and the target node in the i-1th transition model corresponds to the key edge proportion, which is the number ratio of the first edge and the second edge in all edges associated with the target node.
5. The edge-side large model secure inference method based on Internet of Things security according to claim 1, characterized in that, The network layer key value of the target network layer in the i-1th transition model is determined based on the corresponding node distribution, wherein the target network layer in the i-1th transition model is any network layer in the i-1th transition model, and the node distribution indicates the data distribution of the node key values of the plurality of nodes included in the corresponding network layer.
6. The edge-side large model secure inference method based on Internet of Things security according to claim 5, characterized in that, The step of obtaining the network layer key value of the target network layer in the i-1th transition model includes: In the i-1th transition model, the node feature value corresponding to each network layer is obtained, wherein the node feature value indicates the mainstream trend of the node key values of all nodes included in the corresponding network layer; All network layers included in the i-1th transition model are sorted in descending order of the corresponding node feature value to obtain the i th network layer sequence. According to the sequence number of the target network layer in the i-1th transition model in the i th network layer sequence, the node feature value, and the node feature difference value, the network layer key value of the target network layer in the i-1th transition model is determined, wherein the node feature difference value indicates the difference between the node feature value of the corresponding network layer and the node feature value of the corresponding upper network layer, and the node feature value of the upper network layer is higher than the node feature value of the corresponding network layer.
7. The edge-side large model secure inference method based on Internet of Things security according to claim 1, characterized in that, The step of performing network layer pruning on the i-1th transition model based on the plurality of network layer key values of the i th iteration to obtain the i th transition model includes: Based on the plurality of network layer key values of the i th iteration, the redundant network layer of the i th iteration and the key network layer of the i th iteration are distinguished in the i-1th transition model, wherein the network layer key value of the key network layer of the i th iteration is greater than the network layer key value of the redundant network layer of the i th iteration. In the i-1th transition model, the redundant network layer of the i-th iteration is pruned to obtain the i-th transition model.
8. The edge-side large model secure inference method based on Internet of Things security according to claim 2, characterized in that, After the plurality of target edge nodes based on the Internet of Things perform iterative pruning on the preset initial model to obtain the first target model, the method further comprises: In the first target model, the change trend of the node key value of each node in the iterative pruning process is analyzed to obtain a plurality of node trend values. In the first target model, the node retention index of each node in the first target model is determined according to the node trend value corresponding to each node and the node key value corresponding to the last iteration. According to the node retention index of each node in the first target model, the first target model is pruned to obtain a second target model.
9. The edge-side large model secure inference method based on Internet of Things security according to claim 8, characterized in that, After the node retention index of each node in the first target model is obtained, the method further comprises: According to the edge key value corresponding to the last iteration of each edge in the second target model, the second target model is pruned to obtain a third target model.
10. An edge-side large model secure inference system based on Internet of Things security, characterized in that, The system comprises: A model pruning module is configured to perform iterative pruning on a preset initial model by a plurality of target edge nodes based on the Internet of Things to obtain a first target model, wherein the plurality of target edge nodes correspond to the same node type. The i-th iteration in the iterative pruning comprises: Obtaining an i-th weight file of each target edge node, wherein the i-th weight file indicates a plurality of weight data obtained by training an i-1th transition model based on node report data of the corresponding target edge node, the weight data indicates the importance of the corresponding edge in the corresponding neural network model, and i is 1, the i-1th transition model is the initial model; According to the i-th weight file of each target edge node and the association relationship between nodes and edges in the i-1th transition model, the importance of each node in the i-1th transition model is analyzed to obtain a plurality of node key values of the i-th iteration; According to the plurality of node key values of the i-th iteration and the dependency relationship between nodes and network layers in the i-1th transition model, the importance of each network layer in the i-1th transition model is analyzed to obtain a plurality of network layer key values of the i-th iteration; Based on the plurality of network layer key values of the i-th iteration, the i-1th transition model is pruned to obtain the i-th transition model, wherein in the case that the average value of the network layer key value of at least one network layer pruned in the i-th iteration is greater than the layer key threshold, the i-th transition model is determined as the first target model.