Routing service identification method and device
By selecting routers with high cumulative contributions in the blockchain smart contract module for consensus voting, the problem of malicious routers' influence in federated learning is solved, and the training and recognition accuracy of the routing service identification model is improved.
Patent Information
- Application Number
- CN202411725508.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-11-27
AI Technical Summary
The lack of a malicious router screening mechanism in existing federated learning techniques makes the training of routing service identification models susceptible to the influence of malicious routers, resulting in a decrease in identification accuracy.
By selecting routers with high cumulative contributions as consensus routers within the blockchain's smart contract module and conducting voting based on the consensus mechanism, honest routers are selected to participate in the aggregation of global model parameters, thus reducing the impact of malicious routers.
It improved the training accuracy of the routing service identification model, enhanced the identification accuracy, and reduced the impact of malicious routers on model training.
Smart Images

Figure CN119520370B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to methods and apparatus for identifying routing services. Background Technology
[0002] Routing services refer to the service types of data packets transmitted by a router. These service types often play a crucial role in router data transmission, routing calculation, and network management. Related technologies utilize federated learning to train a routing service identification model, and then use this trained model for service identification. However, current federated learning systems rarely include malicious router filtering mechanisms. This makes the training of the routing service identification model susceptible to the influence of malicious routers, leading to performance degradation and consequently, decreased accuracy in routing service identification. Summary of the Invention
[0003] This application provides a routing service identification method and apparatus to improve the identification accuracy of routing services.
[0004] On the one hand, embodiments of this application provide a routing service identification method, including the following steps:
[0005] Get the k Rotation training d One training router and m A consensus router;
[0006] For each of the training routers, the training router is controlled to train its local model based on its local dataset; wherein, the local dataset includes multiple preset packet quintuple information and a service type label for each preset packet quintuple information.
[0007] Based on the relative voting messages of each training router and the local model parameters of at least one training router, the first... k The global model parameters from each round of training are aggregated to obtain the aggregated global model parameters; wherein, the relative voting messages of the training routers include the voting messages of each consensus router relative to the training router;
[0008] When federated learning does not reach the preset termination condition, the aggregated global model parameters are determined as the first... k The global model parameters for +1 training round are set to... k=k +1, and return to the point where the first digit was obtained. k Rotation training d One training router and mThe consensus router process continues until the federated learning reaches the termination condition, and a routing service identification model is obtained based on the aggregated global model parameters.
[0009] The routing service identification model is used to identify the service type of the router under test by analyzing the five-tuple information of the data packets.
[0010] On the other hand, embodiments of this application provide a routing service identification device, including:
[0011] The acquisition module is used to acquire the first... k Rotation training d One training router and m A consensus router;
[0012] The first processing module is used to control each of the training routers based on the first... k The global model parameters from the round of training and the local dataset of the training router are used to train the local model of the training router; wherein, the local dataset includes multiple preset packet quintuple information and the service type label of each preset packet quintuple information.
[0013] The second processing module is configured to process the data based on the relative voting messages of each training router and the local model parameters of at least one training router. k The global model parameters from each round of training are aggregated to obtain the aggregated global model parameters; wherein, the relative voting messages of the training routers include the voting messages of each consensus router relative to the training router;
[0014] The third processing module is used to determine the aggregated global model parameters as the first condition when the federated learning does not reach the preset termination condition. k The global model parameters for +1 training round are set to... k=k +1, and return to the point where the first digit was obtained. k Rotation training d One training router and m The consensus router process continues until the federated learning reaches the termination condition, and a routing service identification model is obtained based on the aggregated global model parameters.
[0015] The fourth processing module is used to identify the service of the data packet five-tuple information of the router under test using the routing service identification model, and obtain the service type of the data packet five-tuple information as the service type of the router under test.
[0016] According to the routing service identification method and apparatus of this application, for each round of training, the first step is to divide... d One training router and mA consensus router, and control d Each training router trains its local model based on its local dataset, which includes multiple pre-defined packet 5-tuple information sets and service type labels for each set. Then, it utilizes... d The relative voting messages of each training router, combined with the local model parameters of at least one training router, are used to aggregate the global model parameters. The relative voting messages of the training routers include the voting messages of each consensus router relative to the training routers. Then, training is performed in a loop or terminated depending on whether the termination condition is met, resulting in a routing service identification model. Finally, the routing service identification model is used to identify the service type of the router under test by using the five-tuple information of the data packets. This allows for the accurate selection of more honest routers to participate in model training and reduces the probability of malicious training routers participating in the aggregation of global model parameters. This reduces the impact of malicious routers on the training of the routing service identification model, effectively improves the training accuracy of the routing service identification model, and thus enhances the identification accuracy of routing services.
[0017] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the description, claims and drawings. Attached Figure Description
[0018] Figure 1 This is a diagram illustrating the routing service identification scenario provided in this application;
[0019] Figure 2 This is a flowchart of the routing service identification method provided in this application;
[0020] Figure 3 This is a flowchart of the selection of the training router and consensus router provided in this application;
[0021] Figure 4 This is a flowchart of the consensus voting process provided in this application;
[0022] Figure 5 This is a flowchart of the process for obtaining router contribution information provided in this application;
[0023] Figure 6 This is yet another flowchart of the consensus voting process provided in this application;
[0024] Figure 7 This is a flowchart of the global model parameter aggregation provided in this application;
[0025] Figure 8This is a structural diagram of the routing service identification device provided in this application;
[0026] Figure 9 This is a schematic diagram of the routing service identification method provided in this application;
[0027] Figure 10 This is a schematic diagram of the contribution consensus mechanism provided in this application. Detailed Implementation
[0028] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0029] The present application will be further described below with reference to the accompanying drawings and specific embodiments. The described embodiments should not be considered as limitations on the present application, and all other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of the present application.
[0030] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0031] 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 application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0032] Routing services refer to the service types of data packets transmitted by routers. These service types often play a crucial role in router data transmission, routing calculations, and network management. Related technologies utilize federated learning to train a routing service identification model, and then use this trained model for service identification. Federated learning, as a distributed learning method in machine learning, can train a machine learning model without collecting training data samples from all users. It allows multiple participating terminals to train the model locally and send model updates to a central server for aggregation, ultimately forming a global model on the central server. However, current federated learning systems rarely include malicious router filtering mechanisms. This makes the training of the routing service identification model susceptible to malicious router influence, leading to performance degradation and consequently, decreased accuracy in routing service identification.
[0033] In view of this, embodiments of this application provide a routing service identification method and apparatus, which aim to reduce the impact of malicious routers on the training of the routing service identification model, effectively improve the training accuracy of the routing service identification model, and thus improve the identification accuracy of routing services.
[0034] First, the implementation steps of the routing service identification method provided in this application will be described in detail below with reference to the accompanying drawings.
[0035] The routing service identification method provided in this application can be applied to terminals, servers, or software running on either terminal or server. Terminals can be tablets, laptops, desktop computers, etc., but are not limited to these. Servers can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Additionally, a server can be a router server in a blockchain network, but is not limited to these. Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms.
[0036] Reference Figure 1 , Figure 1 This is a scenario diagram of routing service identification provided in this application. In this application scenario, the routing service identification method of this application can be executed by the smart contract module of the blockchain. It is understood that the blockchain smart contract module integrates multiple smart contracts. Each router acts as a node in the blockchain, and each smart contract is distributed among the routers and corresponds one-to-one with each router. Each smart contract stores a computer-readable storage medium for executing the routing service identification method of this application. Under the control of the smart contracts, each router collaboratively executes the aforementioned routing service identification method of this application to train the routing service identification model. The blockchain smart contract module also integrates an application contract. The application contract stores a computer-readable storage medium for executing the routing service identification method of this application. After the routing service identification model is trained, the application contract of the smart contract module uses the routing service identification model to achieve real-time service identification of the router under test.
[0037] Reference Figure 2 , Figure 2 This is a flowchart of the routing service identification method provided in this application, which may include the following steps S101-S105.
[0038] S101, obtain the first kRotation training d One training router and m A consensus router.
[0039] It should be noted that both the training router and the consensus router are routers within the blockchain. Specifically, each training router operates independently. Each training router trains its local model, and upon completion, encapsulates its local model parameters and other parameters into a message and broadcasts it to the consensus routers. Each consensus router then performs a consensus vote based on the message broadcast by the training routers and sends the voting results to the smart contract module. The smart contract module selects one or more training routers to participate in global model parameter aggregation based on the voting results, and uses the selected routers' local model parameters and contributions to achieve global model parameter aggregation. The consensus voting process among the consensus routers is implemented through a pre-defined consensus mechanism.
[0040] Understandably, the training process for the routing service identification model involves multiple training rounds, and the total number of training rounds can be flexibly set according to the actual situation. k Round training refers to the first round of training in the routing service identification model. k Each training round. It should be understood that the embodiments of this application are from... k= 1. Begin.
[0041] In this step, for the first k In the training round, among the many routers in the blockchain, the smart contract module was selected. d One router participating in local training is selected as the training router, and at the same time, [the following is selected]... m Each router participating in the consensus voting process serves as a consensus router, enabling subsequent local training and global model parameter aggregation.
[0042] Optionally, the number of training routers and the number of consensus routers can be set according to actual conditions, and this application embodiment does not specifically limit this. However, it should be noted that the number of training routers and the number of consensus routers are both integers.
[0043] Optionally, in some embodiments, the above-mentioned acquisition of the first k Rotation training d One training router and m A consensus router can be randomly selected from among the many routers in the blockchain. d The router is the first one. k The training router is trained in rounds and randomly selected. m The router is the first one. k Consensus routers trained in rounds, but not limited to this.
[0044] S102, For each training router, control the training router to train the local model of the training router based on the local dataset of the training router.
[0045] It should be noted that the local dataset may include, but is not limited to, multiple preset data packet quintuple information and the business type label of each preset data packet quintuple information.
[0046] It is understood that the 5-tuple information in a data packet can include, but is not limited to, the source Internet Protocol (IP) address, source port, destination Internet Protocol (IP) address, destination port, and protocol type. The service type tag within this 5-tuple can be categorized based on the data packet's characteristics, purpose, and network traffic patterns. For example, the service type tag could be for web browsing, video streaming, file transfer, and email, but is not limited to these categories. Specifically, a web browsing service type data packet can include data packets generated by a user terminal accessing a webpage or loading webpage resources; a video streaming service type data packet can include data packets from video streaming services such as online video playback and live streaming; a file transfer service type data packet can include data packets generated by various file transfer protocols; and an email service type data packet can include data packets generated by various email protocols.
[0047] In this step, at the... k In the first round of training, for the i A training router The smart contract module controls the first i The training router is based on the first... i The local dataset of the training router and the first k The global model parameters of the training round affect the first round. i The local model of the training router is trained to achieve local model training.
[0048] Optionally, the local model used to train the router can be configured according to actual conditions, and this application embodiment does not impose specific limitations on it. For example, the local model can be a Convolutional Neural Network (CNN) model, and other neural networks such as YOLOv3 and Faster R-CNN are also applicable, and this application embodiment does not impose specific limitations on it.
[0049] Optionally, in some embodiments, the above-described control training router trains the local model of the training router based on the local dataset of the training router, which may include training the local model of the training router for the first... k During the training round, the smart contract module simultaneously sends... dEach training router broadcasts a training message so that all training routers at the same time receive the training message and, based on the first... k The global model parameters are used for local model training during round training. Upon completion of training, the local model parameters and other parameters are encapsulated into a message and broadcast to [the relevant authority / organization]. m A consensus router.
[0050] Optionally, in other embodiments, the above-described control training router trains the local model of the training router based on the local dataset of the training router, which may include training the local model of the training router for the first... k In each round of training, the smart contract module sequentially sends training instructions to each training router, enabling each training router to respond to the training instructions based on the first training cycle. k The global model parameters are used for local model training during round training. Upon completion of training, the local model parameters and other parameters are encapsulated into a message and broadcast to [the relevant authority / organization]. m A consensus router, but not limited to this.
[0051] S103, based on the relative voting messages of each training router and the local model parameters of at least one training router, the first... k The global model parameters from each round of training are aggregated to obtain the aggregated global model parameters.
[0052] It should be noted that the relative voting messages for training the router may include, but are not limited to, those for training the router. m The consensus router's voting message relative to the training router. This voting message carries information indicating whether the consensus router agrees to the training router's participation in global model parameter aggregation. This information can be flexibly configured according to the actual situation; for example, it could be the consensus router's approval coefficient for the training router's participation in global model parameter aggregation. A higher approval coefficient indicates that the consensus router strongly agrees to the training router's participation, but this is not a limitation.
[0053] In this step, at the... k In the first round of training, the smart contract module obtains... d The relative voting messages of each training router and the local model parameters, wherein the relative voting messages of the training router may include, but are not limited to, the following: m Voting messages from consensus routers relative to the training router, these voting messages are... m Each consensus router is obtained by performing consensus voting on the training routers based on a preset consensus mechanism, and then using... dThe aggregation of global model parameters is achieved by using relative voting messages from each training router and local model parameters from at least one training router. It is understood that the consensus mechanism is the core mechanism in blockchain technology that ensures transaction security and reliability. Based on competitive or voting mathematical principles, it implements secure accounting rules through a consensus protocol, determining how each router reaches a consensus on transaction data. The consensus mechanism guarantees that compliant data is ultimately confirmed by all honest routers, achieving consistency and liveness of distributed ledger data records. The aforementioned consensus mechanism can be flexibly configured according to actual circumstances. For example, the consensus mechanism can be Proof of Work (PoW), and other consensus mechanisms such as Proof of Stake (PoS) and Delegated Proof of Stake (DPoS) are also applicable. This application embodiment does not specifically limit this.
[0054] Optionally, in some embodiments, the above-described method for adjusting the voting parameters of the training routers based on their relative voting messages and the local model parameters of at least one training router is as follows: k The global model parameters from each round of training are aggregated to obtain aggregated global model parameters, which can be included in the first round of training. k In the first round of training, the smart contract module obtains... d The relative voting messages and local model parameters of each trained router are then... d Select from the training routers d’ The training routers whose relative voting messages meet the preset conditions are selected as aggregation routers, and then the calculation is performed. d’ The average local model parameters of each aggregation router are used as the average model parameter. A correction value corresponding to the average model parameter is found in the preset first mapping data and used as the global correction value. Finally, the global correction value and the first... k The sum of the global model parameters in each round of training is used as the first... k The aggregated global model parameters are obtained from rounds of training. The number of aggregation routers and preset conditions can be flexibly set according to actual conditions, and this embodiment does not impose specific limitations on them. For example, if the voting message of the consensus router relative to the training router carries the consensus router's approval coefficient value for the training router's participation in the global model parameter aggregation, the preset condition could be that the approval coefficient value is greater than a preset coefficient threshold, but it is not limited to this. Furthermore, the preset first mapping data can include multiple preset average model parameters and the correction value corresponding to each preset average model parameter, but it is not limited to this. Moreover, the preset first mapping data can be chart data or tabular data, but it is not limited to this.
[0055] S104, when federated learning does not reach the preset termination condition, the aggregated global model parameters are determined as the first...k The global model parameters for +1 training round are set to... k=k +1, and return to the point where the first digit was obtained. k Rotation training d One training router and m The consensus router proceeds through a series of steps until the federated learning reaches the termination condition, and a routing service identification model is obtained based on the aggregated global model parameters.
[0056] It should be noted that the routing service identification model is used to identify the service type of the router.
[0057] In this step, at the... k During the first round of training, after completing the global model parameter aggregation, the smart contract module determines whether the federated learning has reached the preset termination condition. If so, it indicates that the routing business identification model training is complete, and the federated learning can terminate. At this point, the smart contract module utilizes the first... k The aggregated global model parameters from the first round of training are used to generate and output the routing service identification model; otherwise, it indicates that the routing service identification model has not yet been fully trained and the federated learning has not yet terminated. In this case, the smart contract module will... k The aggregated global model parameters from the first round of training are used as the first... k The global model parameters after +1 rounds of training, i.e., the... k The global model parameters for +1 round of training will adopt the parameters from the first training round. k The aggregated global model parameters from the rounds of training, and let k=k +1, and then return to step S101 to achieve loop training.
[0058] Optionally, the termination condition can be set according to actual circumstances, and this application embodiment does not specifically limit it. For example, the termination condition can be that the current training round of federated learning is greater than or equal to the preset total training rounds, i.e. k≥N , N The total number of training rounds is preset; or, the termination condition can be the first training round. k The aggregated global model parameters after round training are relative to the first round. k The difference in the aggregated global model parameters after -1 training round is less than a preset difference threshold, but is not limited to this.
[0059] S105 uses the routing service identification model to identify the service type of the router under test by analyzing the five-tuple information of the data packets.
[0060] In this step, after training the routing service identification model, real-time routing service identification can be achieved using the model. Specifically, the smart contract module determines the router under test and obtains the packet 5-tuple information of the router under test. Then, it uses the routing service identification model to identify the service type of the router under test based on this packet 5-tuple information. It can be understood that the service type of the router under test refers to the service type of the packet 5-tuple information.
[0061] Therefore, in the embodiments of this application, for each round of training, the first step is to divide... d One training router and m A consensus router, and control d Each training router trains its local model based on its local dataset, which includes multiple pre-defined packet 5-tuple information sets and service type labels for each set. Then, it utilizes... d The relative voting messages of each training router, combined with the local model parameters of at least one training router, are used to aggregate the global model parameters. The relative voting messages of the training routers include the voting messages of each consensus router relative to the training routers. Then, training is iterated or terminated depending on whether a termination condition is met, resulting in a routing service identification model. Finally, the routing service identification model is used to identify the service type of the router under test based on the five-tuple information of the data packets. This approach accurately selects more honest routers to participate in model training and reduces the probability of malicious training routers participating in the global model parameter aggregation, thereby reducing the impact of malicious routers on the training of the routing service identification model and effectively improving the training accuracy of the model, ultimately enhancing the accuracy of routing service identification. It can be understood that honest routers refer to routers with high accuracy and efficiency in local model training, while malicious training routers refer to training routers with low contributions to the global model parameter aggregation.
[0062] The steps described above will be explained in further detail below.
[0063] In some implementations, refer to Figure 1 and Figure 3 In step S101 above, the first... k Rotation training d One training router and m The implementation process of a consensus router may include the following steps S1011-S1013.
[0064] S1011, Obtaining the blockchain M The initial routers and their cumulative contributions.
[0065] It should be noted that, M=d+m That is, the sum of the total number of training routers and the total number of consensus routers equals the total number of initial routers. However, it should be noted that the total number of initial routers is an integer.
[0066] It is understandable that the cumulative contribution of the initial router refers to the contribution of the first router. k The sum of the contributions of the initial routers to federated learning in each round of training can be understood as the contribution of the initial routers to the training of the routing service identification model. Furthermore, the... k The target block of the -1 round of training stores the cumulative contribution of each initial router and other data, that is, the cumulative contribution of each initial router can be obtained through the -1 round of training. k -1 round of training yields the target block.
[0067] In this step, the initial router acts as the router for the blockchain, in the... k At the start of the training round, the smart contract module obtains the blockchain's... M An initial router, this M The first initial router is used to participate in the training of the routing service identification model, and at the same time, through the first k -1 rounds of training target blocks obtain the cumulative contribution of each initial router in order to select training routers and consensus routers based on the cumulative contribution.
[0068] Optionally, the type of contribution of the initial router to federated learning can be set according to the actual situation, and this implementation does not specifically limit it. For example, the contribution of the initial router to federated learning can be in the first... k The training accuracy or efficiency of the local model in the initial router during the training round, but not limited to these.
[0069] S1012, according to M The cumulative contribution of each initial router to M Sort the initial routers to obtain M The sorted initial routers.
[0070] It should be noted that the cumulative contribution of the initial router is negatively correlated with its sort number. This means that the higher the cumulative contribution of the initial router, the smaller its sort number, and vice versa.
[0071] In this step, the smart contract module utilizes M The cumulative contribution of each initial router to M The initial routers are sorted, with those having higher cumulative contributions ranked higher and those having lower cumulative contributions ranked lower. This process is repeated until the initial routers are sorted.M The initial routers are sorted so that the selection of training routers and consensus routers can be adapted based on the size of their cumulative contributions.
[0072] S1013, in M Among the sorted initial routers, select the first... m The initial routers serve as consensus routers, and the remaining... d The initial router was selected as the training router.
[0073] In this step, the selection principle for training routers and consensus routers is to choose routers with high cumulative contributions as consensus routers, and routers with low cumulative contributions as training routers. Based on this, in M Among the sorted initial routers, the smart contract module is selected first. m The initial routers are used as consensus routers, while the remaining routers are used as consensus routers. d An initial router is selected as the training router. For example, if there are 70 initial routers in a blockchain, the top 10 are selected as consensus routers, and the remaining 60 are selected as training routers, but this is not a limitation. d A training router can form a training router set. ,and m A consensus router can then be used to form a consensus router set. .
[0074] Therefore, it can be seen that this implementation method is based on each initial router being in the front. k The sum of contributions to federated learning in each round of training, in the context of blockchain. M Among the initial routers, the router with the highest cumulative contribution is selected as the consensus router, and the router with the lowest cumulative contribution is selected as the training router. This can effectively improve the selection accuracy of the consensus router and the training router, thereby improving the training accuracy of the routing service identification model.
[0075] In some implementations, refer to Figure 1 In step S103 above, the relative voting messages of each training router and the local model parameters of at least one training router are used to adjust the parameters of the first training router. k Before aggregating the global model parameters from each round of training to obtain the aggregated global model parameters, the above method may include the following steps:
[0076] For each training router that has completed training, control each consensus router to perform consensus voting on the training router, and obtain the voting message of each consensus router relative to the training router as the relative voting message of the training router.
[0077] It should be noted that the relative voting messages for training the router may include, but are not limited to, those for training the router. m The consensus router's voting message relative to the training router. This voting message carries information indicating whether the consensus router agrees to the training router's participation in global model parameter aggregation. This information can be flexibly configured according to the actual situation; for example, it could be the consensus router's approval coefficient value for the training router's participation in global model parameter aggregation, but it is not limited to this.
[0078] Understandably, each consensus router implements consensus voting processing based on a preset consensus mechanism.
[0079] In this embodiment, in the first k During each round of training, the smart contract module controls the training routers that have completed local model training. m Each consensus router votes on whether to allow a training router to participate in global model parameter aggregation, obtaining the relative voting message for that training router. The smart contract module then selects one or more training routers to participate in global model parameter aggregation based on the consensus voting results, and utilizes the local model parameters and contributions of the selected training routers to achieve global model parameter aggregation. This can be understood as traversing... d A training router can be obtained d The relative voting messages of each training router. It is evident that this implementation integrates the blockchain consensus mechanism into the training of the routing service identification model. In each training round, the blockchain consensus mechanism controls each consensus router to vote on each training router, enabling the aggregation of global model parameters while fully considering the consensus voting results. This allows for the accurate selection of more honest routers to participate in local model training and reduces the probability of malicious training routers participating in global model parameter aggregation, thereby reducing the impact of malicious training routers on the routing service identification model and improving the training accuracy of the routing service identification model.
[0080] Optionally, in some embodiments, the above-described control of each consensus router to perform consensus voting processing on the training router, obtaining the voting messages of each consensus router relative to the training router as the relative voting messages of the training router, may include, for the first... k During the training round, the smart contract module simultaneously sends... m Each consensus router broadcasts a consensus message, enabling other consensus routers to receive the message and perform consensus voting on the training router based on a preset consensus mechanism. This generates a voting message from each consensus router relative to the training router, which is then sent to the smart contract module. The smart contract module retrieves this voting message as the relative voting message for the training router. The consensus mechanism described above can be flexibly configured according to actual needs.
[0081] It is understandable that the consensus voting process of each consensus router can be performed simultaneously or sequentially. Furthermore, for each consensus router, it can perform consensus voting processing on each training router simultaneously, or it can perform consensus voting processing on each training router sequentially.
[0082] In some implementations, refer to Figure 1 and Figure 4 The specific implementation process of controlling each consensus router to perform consensus voting on the training router and obtaining the voting message of each consensus router relative to the training router as the relative voting message of the training router may include the following steps S01-S03.
[0083] S01, the control consensus router decrypts the verification message of the training router based on the public key of the training router.
[0084] It should be noted that the verification message from the training router is a verification message broadcast by the training router and encrypted with the training router's private key. The training router's private key can be flexibly set according to the actual situation. This verification message may include, but is not limited to, the training router's local model parameters and message broadcast timestamp. The training router's local model parameters refer to the parameters of the training router's local model after the training router has completed local model training; the training router's message broadcast timestamp refers to the timestamp at which the training router broadcasts its verification message to each consensus router after completing local model training.
[0085] S02, if the consensus router successfully decrypts the verification message of the training router, it obtains the current contribution of the training router through the consensus router, obtains the voting information of the consensus router relative to the training router based on the current contribution of the training router, and signs the voting information of the consensus router relative to the training router using the private key of the training router to obtain the voting message of the consensus router relative to the training router.
[0086] It should be noted that the current contribution of the training router refers to the contribution made on the [number]th [day]. k The contribution of the training router to federated learning during each round of training.
[0087] S03. If the consensus router fails to decrypt the verification message of the training router, the preset null value voting information is determined as the voting information of the consensus router relative to the training router, and the voting information of the consensus router relative to the training router is signed using the private key of the training router to obtain the voting message of the consensus router relative to the training router.
[0088] In this embodiment, addressing the current deficiency in federated learning systems where malicious router filtering mechanisms are lacking, a router filtering method based on legitimacy verification is provided in the consensus voting process. Furthermore, current blockchain-based federated learning still employs traditional consensus mechanisms such as Proof-of-Work and Proof-of-Stake to achieve router consensus. This not only wastes the computational resources of the consensus routers and reduces their resource utilization, but also degrades the overall training performance of the routing service identification model. Therefore, this embodiment also provides a consensus voting method based on router contribution in the consensus voting process.
[0089] Specifically, in this implementation, each consensus router needs to... d Each training router undergoes consensus voting, meaning that whether a training router can participate in the aggregation of global model parameters is determined by... m The consensus routers reach a consensus decision. The smart contract module predefines a voting set to store the relative voting messages of all trained routers; this voting set is represented as... , Indicates training router A subset of the votes Consensus router Compared to training routers Voting information.
[0090] In the k In the first round of training, for the j Consensus router , and the i Training routers , It includes: being controlled by a smart contract module to train the router. Train a local model using a local dataset. When training the router... When local model training is complete, train the router. Record message broadcast timestamps via private key For encapsulated local model parameters and timestamp Sign the verification message to obtain the verification message. And broadcast to the consensus router .
[0091] In the consensus voting process, the first step is to filter routers based on legitimacy verification. Specifically, for consensus routers... and training router Controlled by the smart contract module, the consensus router By training the router public key For training routers Verification message Decryption processing is performed if the consensus router Successfully decrypted the verification message This indicates that the training router... Broadcast verification message Legal, training router A legitimate router; if a consensus router Unable to successfully decrypt verification message This indicates that the training router... Broadcast verification message Illegal, training router This is an illegal router; at this point, the consensus router... Preset null value voting information Confirmed as voting information And store it in the training router voting subset To update the set VQ Among them, null value voting information is used to instruct the training router. Verification message illegal.
[0092] Then, consensus voting is conducted based on the router's contribution. Specifically, for the consensus router... and training router Controlled by the smart contract module, the consensus router For sets VQ The purpose of traversing and searching is to determine the set. VQ Does it contain voting information? Understandably, this only applies to verification messages. Voting information under illegal circumstances Existing in a set VQ Therefore, in the verification message Under legal circumstances, consensus router In the set VQ No voting information could be found in the search results. At this time, the consensus router According to the training router The current contribution level is used to determine the voting information. And store it in the training router voting subset In order to update the set VQ Finally, consensus router Using training routers private key For sets VQ Voting information Perform signature encryption to obtain the voting message. And send it to the smart contract module. Understandably, this is done in the consensus router. Unable to successfully decrypt verification message In the case of voting information Regarding voting information The voting message obtained after signing and encryption It is an empty value.
[0093] By traversal m A consensus router can obtain m The voting messages of each consensus router relative to a single training router, i.e., a subset of the votes from a single training router. Then through traversal d By training a router, one can obtain... d The relative voting messages of the training routers, i.e., the set .
[0094] Therefore, in this embodiment, the illegitimacy of the training router is determined by whether or not the verification message of the training router is decrypted, which effectively identifies malicious training routers. Furthermore, if the verification message of the training router is invalid, null value voting information is assigned to the consensus router's voting information relative to the training router and encapsulated into a corresponding voting message, thus reducing the probability of malicious training routers participating in global model parameter aggregation. If the verification message of the training router is valid, the blockchain contribution consensus mechanism is executed. This consensus mechanism uses the router's contribution as the consensus indicator among the consensus routers, utilizing the... k In each round of training, the contribution of the training router to federated learning is used to determine the voting information of the consensus router relative to the training router and encapsulate it into corresponding voting messages. This not only effectively improves the trust between consensus routers during the training of the routing service identification model, but also improves the consensus voting accuracy, consensus voting efficiency, and resource utilization of each consensus router. Furthermore, it improves the accuracy of global model parameter aggregation, thereby enhancing the overall training performance of the routing service identification model.
[0095] Optionally, the public key of the training router can be set according to actual conditions, and this implementation method does not impose specific limitations on it. It should be understood that the private key and public key of the training router form a key pair, and the key pair generation algorithm can be flexibly set according to actual conditions. For example, the key pair generation algorithm can be an asymmetric encryption algorithm, an elliptic curve encryption algorithm, a digital signature algorithm, etc., but is not limited to these. Furthermore, the decryption processing algorithm can also be flexibly set according to actual conditions. For example, the decryption processing algorithm can be an asymmetric encryption algorithm, a digital signature algorithm, etc., but is not limited to these.
[0096] Optionally, in some embodiments, obtaining the voting information of the consensus router relative to the training router based on the current contribution of the training router may include obtaining the voting information of the consensus router relative to the training router based on the current contribution of the training router in combination with machine learning methods, but is not limited thereto. The machine learning method can be set according to the actual situation; for example, the machine learning method may be a support vector machine or a random forest, but is not limited thereto.
[0097] In some implementations, refer to Figure 1 and Figure 5 In step S02 above, the process of obtaining the current contribution of the training router may include the following steps S021-S023.
[0098] S021, based on the local dataset weights of the training routers, the total number of consensus routers, and the initial training contribution of the training routers, the result is obtained in the... k The target training contribution of the router in each round of training.
[0099] It should be noted that the local dataset weights of the training router are used to indicate the proportion of dataset labels held by the training router in the dataset labels participating in the training of the routing service identification model. The initial training contribution of the training router refers to the weights on the first training iteration. k The sum of the local model training contributions of the training router relative to each consensus router in each round of training. Furthermore, in the... k The target training contribution of the router in the training round refers to the contribution made in the training round. k The contribution of the local model training of the router to federated learning during round training.
[0100] In this step, at the... k In the first round of training, the consensus router evaluates the local model training status of the training router based on its local dataset weights, the total number of consensus routers, and its initial training contribution, thereby obtaining the result in the first round. k The target training contribution of the router in the training round is used to map the training progress in the second round. k The impact of the local dataset and local model accuracy of the training router on the global model during round training.
[0101] Optionally, in some embodiments, the above-described method, based on the local dataset weights of the training routers, the total number of consensus routers, and the initial training contribution of the training routers, yields the result for the first... k The target training contribution of the training router in each round of training can be obtained by combining machine learning methods with the local dataset weights of the training router, the total number of consensus routers, and the initial training contribution of the training router.k The target training contribution of the router in each round of training.
[0102] Alternatively, in other embodiments, for local dataset weights, there exists a [missing information - likely related to blockchain technology]. M The first initial router participates in the training of the routing service identification model, and the second... i' Initial router Label the dataset stored locally and the total number of dataset samples Upload to the smart contract module. The smart contract module counts the total number of dataset labels used in training the routing service identification model, forming a label set. , n The total number of dataset labels used to train the routing service identification model. For the first n The dataset labels used to train the routing service identification model are thus formed into the label table shown in Table 1 below. This indicates that the router possesses the dataset with this label.
[0103] Table 1: Label Table
[0104]
[0105] The smart contract module obtains the initial router based on the tag table. Total number of dataset labels held m’ This is combined with the total number of dataset samples used in training the routing service identification model, the total number of dataset labels used in training the routing service identification model, and the initial router. The initial router is calculated based on the total number of samples in the dataset. The local dataset weights are calculated and stored. The initial router... The weights of the local dataset satisfy the following formula (1):
[0106] (1);
[0107] In equation (1), Indicates the initial router Local dataset weights; Indicates the initial router The total number of samples in the dataset; m’ Indicates the initial router The total number of dataset labels held; n This represents the total number of dataset labels used in training the routing service identification model. This represents the total number of dataset samples used in training the routing service identification model.
[0108] Regarding the initial training contribution of the training router, in the... k At the start of the training round, the smart contract module will allocate resources based on the cumulative contribution of each initial router. M The initial routers were divided into m A consensus router and d There are 1 training router. Among them, d A training router can form a training router set. ,and m A consensus router can then be used to form a consensus router set. It is understandable that only the training router, which votes through the consensus router, has a contribution. For the consensus router... and training router Smart contract modules or consensus routers controlled by smart contract modules The consensus router can be configured based on the above label table. Local dataset and training router Label alignment is performed on the local dataset, a public dataset is selected, and the training router is trained based on the public dataset. The local model was tested, and classification accuracy was used to measure the performance of the trained router during testing. Compared to consensus routers The contribution of local model training. Among them, in the... k Training the router in rounds of training Compared to consensus routers The contribution of the local model training satisfies the following formula (2):
[0109] (2);
[0110] In equation (2), Indicates the first k Training the router in rounds of training Compared to consensus routers The contribution of the local model training, its value range can be However, it is not limited to this; Consensus router Compared to training routers Public datasets; Represents public datasets Total number of data samples; Represents public datasets Sample labels for each data item; Indicates that the training router The prediction result output by the local model, which is compared with the sample labels. Corresponding. Among them, Used to indicate sample label Is it equal to the prediction result? If the sample label Equal to the prediction result ,but ,otherwise .
[0111] Smart contract modules or consensus routers controlled by smart contract modules By traversal m A consensus router is obtained, and a training router is derived. The training router's contribution to the local model training is then calculated relative to the contribution of each consensus router. Compared to m The sum of the local model training contributions of each consensus router is used as the training router. Initial training contribution And store.
[0112] In consensus voting processing, through a consensus router Obtain the training router Local dataset weights and initial training contribution and the total number of consensus routers m And by calculating from these data, the first k Training the router in rounds of training The target training contribution. It is understandable that if in the... k Training the router in rounds of training The higher the contribution of the target training, the better in the th... k Training the router in rounds of training The better the local model training status, the worse it is; otherwise, the worse it is. Specifically, in the... k Training the router in rounds of training The target training contribution satisfies the following formula (3):
[0113] (3);
[0114] In equation (3), Indicates the first k Training the router in rounds of training The target training contribution; Indicates training router Local dataset weights, express d The minimum value among the weights of the local dataset of each trained router. express d The maximum value of the weights in the local dataset of each trained router; Indicates the first k Training the router in rounds of training The initial training contribution; m This represents the total number of consensus routers.
[0115] S022, according to the in... k In the first round of training, the data transmission latency and data loss rate of the router are trained, and the results are obtained in the second round. k The communication quality parameters of the router are trained in each round of training.
[0116] It should be noted that the message broadcast latency of the training router refers to the data transmission latency value of the training router during message broadcasting, and the data loss rate of the training router refers to the data loss rate of the training router during message broadcasting. Furthermore, in the... k The communication quality parameters of the trained router in the first round of training are used to indicate the communication quality parameters in the second round of training. k The training rounds train the router's communication performance during message broadcasting.
[0117] In this step, in addition to considering the impact of training data and model accuracy on the global model, the impact of inter-router communication quality on the training of the routing service identification model is also considered. Since in a blockchain, the training router needs to broadcast its local model parameters and other parameters to other consensus routers, in order to complete the training of the routing service identification model more quickly, it is necessary to select training routers with communication quality that meet the expected requirements to participate in the global model parameter aggregation. Based on this, this implementation evaluates the communication quality of the training routers from two aspects: message broadcast latency and data loss rate. Specifically, in the first... k During the training round, the consensus router is used to obtain the result in the first round. k In the training round, the data transmission latency and data loss rate of the router are trained. The data transmission latency indicates message broadcast delay, while the data loss rate indicates data loss rate. Then, the data transmission latency and data loss rate are used to determine the data transmission latency and data loss rate in the first training round. k The communication quality parameters of the router are trained in each round of training. These communication quality parameters indicate the communication quality parameters obtained in the first round of training. k The training rounds train the router's communication performance during message broadcasting.
[0118] Optionally, in some embodiments, the above is based on the first k In the first round of training, the data transmission latency and data loss rate of the router are trained, and the results are obtained in the second round. k The communication quality parameters of the router trained in the first round of training can include those based on the parameters trained in the second round of training. k In the first round of training, the router's data transmission latency and data loss rate are trained, and machine learning methods are used to obtain the data transmission latency and data loss rate in the second round. k The communication quality parameters of the router are trained in each round of training.
[0119] Alternatively, in other embodiments, in the first k During the training round, the consensus router is controlled by the smart contract module. and training router Training router Train a local model using a local dataset when training the router. When local model training is complete, train the router. Record message broadcast timestamps via private key For encapsulated local model parameters and timestamp Sign the verification message to obtain the verification message. And broadcast to the consensus router .
[0120] In consensus voting processing, through a consensus router For training routers The message broadcast latency is evaluated. Specifically, the consensus router... Receive verification message And record the received verification messages. timestamp Then use the training router public key For verification messages Decrypt the message to obtain the training router. Message broadcast timestamp Finally, calculate the timestamp. relative to timestamp The difference is used as the first k Training the router in rounds of training Data transmission latency value ,Right now For training a routing service identification model with latency requirements, the data transmission latency value must be met. Less than or equal to the preset constraint delay T It is understandable that if the data transmission delay value... The smaller, then in the first k Training the router in rounds of training The lower the message broadcast latency, the better; otherwise, the higher the latency.
[0121] Through consensus router For training routers The data loss rate is evaluated. Specifically, the smart contract module pre-sets the corresponding bounded tolerance thresholds according to the hierarchy of the global model, that is, sets the bounded tolerance threshold for the later layers of the global model to be [value missing]. The middle layer bounded tolerance threshold is The bounded tolerance threshold of the previous layer is Then, the global bounded tolerance threshold of the global model is set to... And store it. The division of the global model into front, middle and back layers can be set according to the actual situation, and this implementation does not make specific limitations on it.
[0122] Exemplarily, in some embodiments, the global model It can be represented as , where the parameters To parameters These are all model parameters from the previous layer. To parameters These are all mid-level model parameters. To parameters These are all model parameters for the later layers, thus dividing the global model into the front, middle, and back layers.
[0123] Based on this, through consensus router Received by training router Broadcast verification message Using the training router public key Decryption is performed to obtain the training router. Actual local model parameters Actual local model parameters It can be understood as a consensus router. The actual model parameters received, and the router trained after training is also obtained. Local model parameters As a training router The expected local model parameters, based on the training router Actual local model parameters and expected local model parameters Calculations yielded the results at the 1st month. k Training the router in rounds of training The data loss rate. It's understandable that if in the... k Training the router in rounds of training The smaller the data loss rate, the better in the th... k Training the router in rounds of training The lower the data loss, the higher the loss; otherwise, the higher the loss. Specifically, in the first... k Training the router in rounds of training The data loss rate satisfies the following formula (4):
[0124] (4);
[0125] In equation (4), Indicates the first k Training the router in rounds of training Data loss rate; Indicates the first k Training the router in rounds of training The expected size of the local model parameters; Indicates the first k Training the router in rounds of training The actual local model parameters; Indicates training router The expected size of the local model parameters relative to the training router The difference between the actual local model parameters. For training routing service identification models with data loss rate requirements, the data loss rate must be met. Less than or equal to the global bounded tolerance threshold of the global model .
[0126] Finally, through the consensus router According to the k Training the router in rounds of training Data transmission latency value and data loss rate Calculations yielded the results at the 1st month. k Training the router in rounds of training The communication quality parameters. Among them, in the first... k Training the router in rounds of training The communication quality parameters satisfy the following formula (5):
[0127] (5);
[0128] In equation (5), Indicates the first k Training the router in rounds of training Communication quality parameters; Indicates the first k Training the router in rounds of training The data transmission delay value; T This indicates the preset constraint delay, which can be flexibly set according to the actual situation; This represents the global bounded tolerance threshold of the global model; Indicates the first k Training the router in rounds of training The data loss rate. It is understandable that if the data transmission latency value... Less than or equal to the preset constraint delay T And data loss rate Less than or equal to the global bounded tolerance threshold of the global model ,but The value is 1 if it is not 0 otherwise.
[0129] S023, according to the... k The training router's target training contribution and communication quality parameters are used in each round of training to obtain the current contribution of the training router.
[0130] In this step, at the... k During the training round, the consensus router is based on the first round of training. k The target training contribution and communication quality parameters of the router are calculated in the training round. k The contribution of the training router to federated learning during each round of training.
[0131] Alternatively, in some embodiments, according to the first k In each round of training, the target training contribution and communication quality parameters of the trained router are used to obtain the current contribution of the trained router. This can include calculations based on the parameters obtained in the first round of training. k In each round of training, the target training contribution and communication quality parameters of the training router are combined with machine learning methods to obtain the current contribution of the training router.
[0132] Alternatively, in other embodiments, for consensus routers and training router Consensus Router Based on training router Target training contribution and communication quality parameters Calculations yielded the results at the 1st month. k Training the router in rounds of training The current contribution level. It is understandable that if in the... k Training the router in rounds of training The higher the current contribution, the higher the ranking in the [number]th [stage]. k Training the router in rounds of training The greater the contribution to the training of the routing service identification model, the less significant the contribution. Specifically, in the... k Training the router in rounds of training The current contribution satisfies the following formula (6):
[0133] (6);
[0134] In equation (6), Indicates the first k Training the router in rounds of training Contribution to federated learning, i.e., training the router The current contribution level.
[0135] Therefore, this implementation evaluates the contribution of the training router to federated learning from two aspects: the communication quality of the training router and the training status of the local model. The communication quality of the training router is used as the criterion, and the training status of the local model is used as the benchmark to determine the current contribution of the training router. This can accurately measure the contribution of the training router to federated learning, improve the accuracy of the router contribution, and thus effectively improve the accuracy and efficiency of consensus voting processing.
[0136] In some implementations, refer to Figure 1 and Figure 6 In step S02 above, the process of obtaining the voting information of the consensus router relative to the training router based on the current contribution of the training router may include any one of the following steps S024-S025:
[0137] S024, if the current contribution of the training router is greater than or equal to a preset contribution threshold, then the preset first key value is determined as the voting information of the consensus router relative to the training router; wherein, the first key value is used to indicate that the consensus router agrees to the training router's participation in the aggregation of global model parameters.
[0138] S025, if the current contribution of the training router is less than the preset contribution threshold, then the preset second key value is determined as the voting information of the consensus router relative to the training router; wherein, the second key value is used to indicate that the consensus router opposes the training router's participation in the aggregation of global model parameters.
[0139] In this embodiment, in the consensus voting method based on router contribution, for the consensus router... and training router When consensus router In the set VQ No voting information could be found in the search results. At that time, consensus router The training router Contribution assessment is performed, which involves comparing the training routers. Is the current contribution greater than or equal to the preset contribution threshold?
[0140] If training router The current contribution is greater than or equal to the preset contribution threshold, that is... , This indicates the preset contribution threshold, which explains the training of the router. In the k The training round contributes significantly to the training of the routing service identification model; therefore, the preset first key value is determined as the voting information. This means consensus routers Agree to train router Participate in the aggregation of global model parameters.
[0141] If training router The current contribution is less than the preset contribution threshold, that is... This indicates that the router is being trained. In the k The training rounds contribute little to the training of the routing service identification model, so the preset second key value is determined as the voting information. This means consensus routers Oppose training routers It participates in the aggregation of global model parameters, thereby realizing the blockchain contribution consensus mechanism.
[0142] Thus, this implementation uses router contribution as the consensus metric among consensus routers. This not only accurately selects training routers with relatively high contributions to participate in global model parameter aggregation and rejects training routers with relatively low contributions from participating in global model parameter aggregation, effectively improving the accuracy of global model parameter aggregation, but also effectively improves the consensus voting accuracy, consensus voting efficiency, and resource utilization of each consensus router. This ensures the availability of consensus voting processing in the training of the routing service identification model, thereby improving the overall training performance of the routing service identification model.
[0143] Optionally, both the first key value and the second key value can be set according to actual conditions, and this embodiment does not impose specific limitations on them. For example, the first key value can be 1, that is, when Time indicates consensus router Agree to train router It participates in the aggregation of global model parameters, and the second key value can be 0, that is, when Time indicates consensus router Oppose training routers Participate in the aggregation of global model parameters.
[0144] Optionally, the contribution threshold can be set according to the actual situation, and this implementation method does not impose specific limitations on it.
[0145] In some implementations, refer to Figure 1 and Figure 7 In step S103 above, the relative voting messages of each training router and the local model parameters of at least one training router are used to adjust the parameters of the first training router. k The process of aggregating the global model parameters from each round of training to obtain the aggregated global model parameters may include the following steps S1031-S1033.
[0146] S1031, in thek During the block generation period of each training round, for each training router, the relative voting message of the training router is decrypted using the training router's public key. If the relative voting message of the training router is successfully decrypted and the aggregation ratio of the training router is greater than a preset ratio threshold, then the training router and its local model parameters are added to a preset aggregation list. The cumulative contribution of the training router is updated according to its current contribution, and the updated cumulative contribution of the training router is stored in the next training round. k Candidate blocks for round training.
[0147] It should be noted that the aggregation percentage of the training routers refers to the proportion of consensus routers among all consensus routers that agree to participate in the aggregation of global model parameters. Furthermore, the updated cumulative contribution of the training routers will be used in the [missing information - likely a specific step or event]. k In the +1 round of training, training routers and consensus routers are divided. The cumulative contribution of the updated training routers will be used as the basis for the consensus routers in the +1 round of training. k The cumulative contribution of the training router in +1 training rounds.
[0148] Understandably, the preset aggregation list is a pre-defined storage list used to store the training routers participating in global model parameter aggregation and their local model parameters. Furthermore, candidate blocks refer to blocks generated within the block generation time period; they are primarily used to store the updated cumulative contribution of the training routers. It is important to emphasize that candidate blocks are not final blocks.
[0149] In this step, at the... k During the block generation time period of the training round, for the training router The smart contract module receives training from the router. Relative voting messages and using the trained router public key Performing a second decryption verification aims to further validate the legitimacy of the training router and reduce the probability of a malicious training router participating in global model parameter aggregation. If the smart contract module cannot decrypt the training router... The relative voting message indicates that the training router Illegal; considered as training router. The decryption verification failed, at which point the smart contract module determined the training router. It does not participate in global model parameter aggregation and filters out training routers. If the smart contract module successfully decrypts the training router... The relative voting message indicates that the training router Legal, considered as a training router After decryption verification, the smart contract module obtains the training router. The aggregation ratio, and determine the training router Whether the aggregation ratio is greater than the preset ratio threshold. Among them, the training router... The aggregation ratio refers to the percentage of routers that are trained in agreement. The percentage of consensus routers participating in the aggregation of global model parameters among all consensus routers satisfies the following formula (7):
[0150] (7);
[0151] In equation (7), To train the router The aggregation ratio; This represents the summation function. This indicates agreement to train the router. The number of consensus routers participating in the aggregation of global model parameters; d This represents the total number of consensus routers.
[0152] If the aggregation ratio If the percentage is greater than the threshold, it means that most consensus routers agree to train the router. Participating in global model parameter aggregation, only a minority of consensus routers oppose the training router. The smart contract module participates in the global model parameter aggregation, at which point it determines the training router. Participate in global model parameter aggregation, and train the router and training router Local model parameters Add to the preset aggregation list AG Meanwhile, based on the training router The current contribution of the router to the training The cumulative contribution is updated to obtain the training router. The updated cumulative contribution points are stored in the [number]th [number]. k The updated cumulative contribution will be used as the candidate block in the first round of training. k Train the router in +1 round of training. The cumulative contribution.
[0153] If the aggregation ratio If the percentage is less than the threshold, it means that most consensus routers disagree with the training router. Only a minority of consensus routers agree on training routers to participate in global model parameter aggregation. The smart contract module participates in the global model parameter aggregation, at which point it determines the training router. It does not participate in global model parameter aggregation and filters out training routers. .
[0154] Understandably, this step starts from... i Starting with =1, the smart contract module iterates through... d The relative voting messages of the training routers can be obtained from d Select from the training routers d’ A training router that participates in global model parameter aggregation. d’ The training routers that participate in global model parameter aggregation can be denoted as aggregation routers, with a pre-defined aggregation list. AG Will store this d’ Each aggregation router and its local model parameters.
[0155] Understandably, in the first k Outside of the block generation period for each round of training, the smart contract module stops receiving relative voting messages from any training routers.
[0156] Optionally, the percentage threshold can be set according to the actual situation, for example, the percentage threshold can be 0.5, but it is not limited to this.
[0157] Optionally, the decryption processing algorithm can be set according to the actual situation, and this implementation method does not impose specific limitations on it. For example, the decryption processing algorithm can be an asymmetric encryption algorithm, a digital signature algorithm, etc., but is not limited to these.
[0158] Optionally, in some embodiments, updating the cumulative contribution of the training router based on its current contribution to obtain the updated cumulative contribution of the training router may include weighting the current contribution and the cumulative contribution of the training router to obtain the updated cumulative contribution of the training router, wherein the sum of the weight of the current contribution and the weight of the cumulative contribution is one.
[0159] Optionally, in other embodiments, updating the cumulative contribution of the training router based on its current contribution to obtain the updated cumulative contribution of the training router may include calculating the sum of the current contribution and the cumulative contribution of the training router as the updated cumulative contribution of the training router. Wherein, the training router... The updated cumulative contribution satisfies the following formula (8):
[0160] (8);
[0161] In equation (8), Indicates training router The updated cumulative contribution; Indicates the first k Training the router in rounds of training Current contribution level; Indicates the first k -1 round of training target block; This represents the contribution extraction function. Indicates from the first k -1 round of training target block Obtain the training router The cumulative contribution.
[0162] It is understandable that, in some embodiments, in the first... k During the block generation period of each training round, each consensus router can simultaneously broadcast its voting messages relative to each training router to the smart contract module. This allows the smart contract module to obtain voting messages from multiple consensus routers relative to each training router at the same time, thereby ensuring that the block generation process is completed correctly in the first training round. k Before the block generation period of a training round ends, the smart contract module determines whether each training router participates in the global model parameter aggregation. In other embodiments, in the first... k During the block generation period of each training round, each consensus router can sequentially send its voting messages relative to each training router to the smart contract module. This allows the smart contract module to obtain voting messages from multiple consensus routers relative to each training router at different times. Previously, when the first... k At the end of the block generation period for each round of training, the smart contract module determines whether at least one training router participates in the global model parameter aggregation. The number of training routers that complete the determination is less than or equal to [the specified value]. d .
[0163] It is understandable that the smart contract module can simultaneously determine whether each training router participates in the global model parameter aggregation, or the smart contract module can determine whether each training router participates in the global model parameter aggregation sequentially.
[0164] S1032, when the first k At the end of the block generation period in the training round, the local model parameters and current contributions of each training router in the aggregation list are used to evaluate the performance of the first training round. k The global model parameters from each round of training are aggregated to obtain the aggregated global model parameters.
[0165] It should be noted that the aggregated global model parameters refer to the parameters of the first generation. k The updated parameters of the global model during each round of training.
[0166] In this step, at the... k During the block generation period of the training round, the smart contract module iterates through... d The relative voting messages from the training routers come from dSelect from the training routers d’ Each aggregation router participates in the global model parameter aggregation, and... d’ Each aggregation router and its local model parameters are added to the preset aggregation list. AG In the middle. When the first k When the block generation period of the training round ends, the smart contract module obtains the aggregated list. AG and using aggregated lists AG middle d’ The local model parameters and current contribution of the aggregation router are used to evaluate the first aggregation router. k The global model parameters from each round of training are aggregated to obtain the aggregated global model parameters.
[0167] Optionally, in some embodiments, the above-described method utilizes the local model parameters and current contribution of each training router in the aggregation list to evaluate the performance of the first training router. k The global model parameters from each round of training are aggregated to obtain aggregated global model parameters, which may include calculations. d’ The mean of the local model parameters of each aggregation router is used as the average model parameter to calculate... d’ The current contribution of each aggregation router is used as the average contribution. The correction value corresponding to the average model parameters and average contribution is retrieved from the preset second mapping data and used as the global correction value. Finally, the global correction value and the first... k The sum of the global model parameters in each round of training is used as the first... k The aggregated global model parameters from the training rounds. The second mapping data may include multiple predefined composite variables and corresponding correction values for each composite variable. The predefined composite variables may include predefined average model parameters and predefined average contributions. Furthermore, the second mapping data can be graph data or tabular data, but is not limited to these.
[0168] Optionally, in some embodiments, the above-described method utilizes the local model parameters and current contribution of each training router in the aggregation list to evaluate the performance of the first training router. k The global model parameters from each round of training are aggregated to obtain aggregated global model parameters. This can include using the local model parameters and current contribution of each training router in the aggregation list, combined with the following formula (9), to calculate the aggregated global model parameters:
[0169] (9);
[0170] In equation (9), Indicates the first k The aggregated global model parameters after each round of training are the parameters of the 1st round. k +1 round of training global model parameters; Indicates the first kTraining the router in rounds of training Contribution to federated learning, i.e., training the router Current contribution level; Indicates the first k Training the router in rounds of training Local model parameters; Represents an aggregate list AG The training router, i.e., the aggregation router; Represents an aggregate list AG The sum of the current contributions of all training routers.
[0171] S1033, based on the aggregation list, the aggregated global model parameters, and the... k The target block of the -1 round of training, combined with the first round of training k The candidate blocks from the first round of training are obtained. k The target block for the round of training is broadcast to the blockchain.
[0172] It should be noted that the first k The target block of the first round of training is mainly used to store the first... k The training includes parameter information from previous training rounds, such as the aggregated global model parameters, the parameters of each training router and its local model in the aggregated list, the private key, the updated cumulative contribution, etc., but is not limited to these.
[0173] Understandably, the training router and consensus router, as nodes in the blockchain, can use their respective public keys to access the third... k The target block of the training round is decrypted to read the first... k The information stored in the target block of the training round.
[0174] In this step, after completing the global model parameter aggregation, a new block needs to be generated to store the first... k The relevant data parameters for the training round are processed, and the block is broadcast to the blockchain so that the blockchain's routers and smart contract modules can read the data in the block, facilitating subsequent training. Specifically, the smart contract module utilizes an aggregated list. AG The information stored in the middle, the aggregated global model parameters , No. k -1 round of training target block and the k The candidate blocks from each round of training are used to construct new blocks and utilize the aggregated list. AG Each training router uses its private key to sign and encrypt the new block, thus obtaining the first... k The target block for the first round of training will be broadcast to the blockchain. Among them, the first... k The target block of each round of training satisfies the following formula (10):
[0175] (10);
[0176] In equation (10), Indicates the first k The target block for round training; Indicates the first k -1 round of training target block; AG Represents an aggregate list; This represents the private key of each training router in the aggregation list; This represents the block generation function.
[0177] Therefore, in this implementation, firstly, the relative voting messages of each training router are decrypted and verified. This ensures the legitimacy of the training routers and reduces the probability of malicious training routers participating in global model parameter aggregation. Then, based on the principle of majority rule, it is determined whether the training routers that have passed the decryption verification are agreed to participate in global model parameter aggregation. Training routers whose relative voting messages have been successfully decrypted and whose aggregation ratio is greater than a preset ratio threshold are selected to participate in global model parameter aggregation, thus determining the final voting result. This can accurately select honest training routers to participate in global model parameter aggregation and reduce the impact of malicious training routers on global model parameter aggregation. At the same time, the cumulative contribution of the training routers participating in global model parameter aggregation is calculated and stored in the candidate block to facilitate the division of training routers and consensus routers in subsequent training rounds. Afterward, the aggregation processing of global model parameters is implemented by fully considering the router contribution and the router's local model parameters. This not only effectively improves the accuracy of global model parameter aggregation but also enhances the decentralization of federated learning, thereby improving the training accuracy and efficiency of the routing service identification model. Finally, the information stored in the aggregation list, the aggregated global model parameters, and the first... k -1 round of training target block and the first k The candidate blocks from the training round are used to construct new blocks, and the new blocks are signed and encrypted using the private keys of each training router in the aggregation list, thus obtaining the first block. k The target block for each round of training is broadcast to the blockchain, thus ensuring the normal progress of subsequent training and improving the training security of the routing service identification model. It can be understood that an honest training router refers to a training router that makes a high contribution to the aggregation of global model parameters.
[0178] In some implementations, in step S103 above, the voting information of each training router and the local model parameters of at least one training router are used to adjust the voting parameters of the training router. kAfter aggregating the global model parameters from each round of training to obtain the aggregated global model parameters, the above method may further include the following step S11:
[0179] S11. For each training router, if the aggregate ratio of the training router is greater than the preset ratio threshold, then the training router is rewarded based on its current contribution and the total number of samples in the local dataset, combined with the preset reward and punishment hyperparameters; otherwise, there is no reward.
[0180] In this implementation, an incentive mechanism is designed for each training router. As can be understood, an incentive mechanism refers to using certain economic means or rewards to motivate routers within the system to actively adopt specific data and algorithms, participating in the operation and construction of the blockchain system. This mechanism encourages routers to contribute to the blockchain ecosystem by providing economic incentives, thereby maintaining the normal operation and development of the network. In the incentive mechanism, the reward value of the training router is jointly determined by its current contribution and the total number of samples in its local dataset; the decision condition is... m The voting results of the consensus routers on the training router are used to determine whether it is an honest training router. If more than half of the consensus routers agree that the training router should participate in the global model parameter aggregation, the smart contract module should reward it accordingly. Otherwise, the training router is considered malicious and should not be rewarded. In multiple training iterations, malicious training routers show lower enthusiasm for participating in global model parameter aggregation, thus their reward values gradually decrease. Conversely, honest training routers show some enthusiasm for participating, leading to a gradual increase in their reward values. This approach effectively increases the enthusiasm of each router in training the routing service identification model and enhances the scalability of the blockchain. It also accelerates the screening of malicious training routers, improving the training efficiency and accuracy of the routing service identification model.
[0181] It is understandable that the reward value has a certain value, and it can be set according to the actual situation. For example, when the training of the routing service identification model ends, each training router can settle its reward, but it is not limited to this.
[0182] Optionally, the reward and punishment parameters can be flexibly set according to the actual situation, and this implementation method does not impose specific limitations on them.
[0183] Optionally, in some embodiments, the above-mentioned rewarding the training router based on its current contribution and the total number of local dataset samples, combined with preset reward and punishment hyperparameters, may include obtaining the reward value of the training router based on preset reward and punishment hyperparameters, the current contribution of the training router, and the total number of local dataset samples of the training router, combined with machine learning methods.
[0184] Optionally, in other embodiments, the above-mentioned rewarding the training router based on its current contribution and the total number of local dataset samples, combined with preset reward / penalty hyperparameters, may include obtaining the reward value of the training router based on the preset reward / penalty hyperparameters, the current contribution of the training router, and the total number of local dataset samples, combined with the following formula (11):
[0185] (11);
[0186] In equation (11), Indicates the first k Training the router in rounds of training The reward value; Indicates the first k Training the router in rounds of training Current contribution level; Indicates training router The total number of samples in the local dataset; This indicates that the reward or punishment parameters have exceeded the limit.
[0187] It is understandable that the smart contract module can reward each training router simultaneously, or it can reward each training router sequentially.
[0188] In some implementations, in step S103 above, the voting information of each training router and the local model parameters of at least one training router are used to adjust the voting parameters of the training router. k After aggregating the global model parameters from each round of training to obtain the aggregated global model parameters, the above method may further include the following step S12:
[0189] S12, For each consensus router, a reward is given based on the voting information of the consensus router relative to each training router and the number of samples in the public dataset, combined with the preset reward and punishment hyperparameters.
[0190] In this embodiment, an incentive mechanism is designed for each consensus router. In this mechanism, the reward value of a consensus router is determined by its relative performance to other routers. d The voting information of the training routers and the consensus router relative to each other. d The consensus routers jointly decide based on the public dataset of the training routers, and the decision criterion is that the consensus router agrees with the consensus router's decision. dTo determine whether a training router votes correctly, the smart contract module should reward the consensus router when it votes correctly and not when it votes incorrectly. This incentive mechanism effectively motivates consensus routers to participate in consensus voting, thereby accelerating the filtering of malicious training routers and improving the training efficiency and accuracy of the routing service identification model.
[0191] It is understandable that the reward value has a certain value, and it can be set according to the actual situation. For example, when the routing service identification model training ends, each consensus router can settle its reward, but it is not limited to this.
[0192] Optionally, in some embodiments, the above-mentioned rewarding the consensus router based on the voting information of the consensus router relative to each training router and the number of public dataset samples, combined with a preset reward and punishment hyperparameter, may include obtaining the reward value of the consensus router based on the preset reward and punishment hyperparameter, the voting information of the consensus router relative to each training router, and the number of public dataset samples of the consensus router relative to each training router, combined with a machine learning method.
[0193] Optionally, in other embodiments, the above-mentioned rewarding the consensus router based on the voting information of the consensus router relative to each training router and the number of samples in the public dataset, combined with a preset reward / penalty hyperparameter, may include obtaining the reward value of the consensus router based on the preset reward / penalty hyperparameter, the voting information of the consensus router relative to each training router, and the number of samples in the public dataset of the consensus router relative to each training router, combined with the following formula (12):
[0194] (12);
[0195] In equation (12), Indicates the first k Consensus Router in Round Training The reward value; Indicates the first k Consensus Router in Round Training Compared to training routers The number of samples in the public dataset; This indicates that the reward / penalty parameters have exceeded the limit; d This represents the total number of training routers; Used to indicate in the k Consensus Router in Round Training For training routers Whether the vote is correct depends on the following formula (13):
[0196] (13);
[0197] In equation (13), when either the first or second condition is met, it indicates that the first condition is met. k Consensus Router in Round Training For training routers The vote was correct. The value is 1; when the first and second conditions are not met, it means that in the first... k Consensus Router in Round Training For training routers The vote was incorrect. The value is 0. The first condition is... and The second condition is and .
[0198] It is understandable that the smart contract module can reward each consensus router simultaneously, or the smart contract module can reward each consensus router sequentially.
[0199] In addition, refer to Figure 8 This application embodiment also provides a routing service identification device, which may include:
[0200] Module 201 is used to obtain the first... k Rotation training d One training router and m A consensus router;
[0201] The first processing module 202 is used to control each training router based on the first... k The global model parameters and the local dataset of the training router are used to train the local model of the training router; the local dataset includes multiple preset packet quintuple information and the service type label of each preset packet quintuple information.
[0202] The second processing module 203 is used to process the relative voting messages of each training router and the local model parameters of at least one training router according to the first... k The global model parameters from each round of training are aggregated to obtain the aggregated global model parameters; among them, the relative voting messages of the training routers include the voting messages of each consensus router relative to the training router;
[0203] The third processing module 204 is used to determine the aggregated global model parameters as the first condition when federated learning has not reached the preset termination condition. k The global model parameters for +1 training round are set to... k=k +1, and return to the point where the first digit was obtained.k Rotation training d One training router and m The consensus router process continues until the federated learning reaches the termination condition, and the routing service identification model is obtained based on the aggregated global model parameters.
[0204] The fourth processing module 205 is used to identify the service type of the data packet five-tuple information of the router under test using the routing service identification model, and to obtain the service type of the data packet five-tuple information as the service type of the router under test.
[0205] The content of the above method embodiments is applicable to this system embodiment. The specific functions implemented in this system embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0206] To facilitate understanding of the routing service identification method and apparatus described above in this application, an example based on a practical application scenario is provided below. (Refer to...) Figure 1 In this application scenario, the blockchain's smart contract module integrates multiple smart contracts. Each router acts as a node in the blockchain, and each smart contract is distributed across and corresponds one-to-one with each router. Each smart contract stores a computer-readable storage medium for executing the routing service identification method described in this application. Under the control of the smart contracts, each router collaboratively executes the aforementioned routing service identification method to train the routing service identification model. The blockchain's smart contract module also integrates application contracts. These application contracts store a computer-readable storage medium for executing the routing service identification method described in this application. After training the routing service identification model, the application contracts of the smart contract module utilize the routing service identification model to achieve real-time service identification of the router under test.
[0207] Reference Figure 9 The specific process for implementing routing service identification in this application is shown in steps S301-S308 below.
[0208] S301, Router Division: In the... k At the start of the training round, the initial router acts as a node in the blockchain, and the smart contract module first passes through the... k -1 round of training target block acquisition M The cumulative contribution of each initial router is then used. M The cumulative contribution of each initial router to M The initial routers are sorted, with those having higher cumulative contributions ranked higher and those having lower cumulative contributions ranked lower. This process is repeated until the initial routers are sorted. M The sorted initial routers, then in M Among the sorted initial routers, select the first...m The initial routers are used as consensus routers, while the remaining routers are used as consensus routers. d The initial router was selected as the training router.
[0209] S302, Local Model Training: After completing the router partitioning, the smart contract module simultaneously trains the local model. d The training router broadcasts training messages. For the first... i Training routers , Training router Receive training messages and based on the first k The global model parameters are used for local model training during round-robin training. Upon completion of training, the router is trained. Local model parameters and message broadcast timestamp Encapsulate it into a message and use a private key Perform signature encryption, then broadcast to m A consensus router.
[0210] S303, Consensus Voting Processing: Refer to... Figure 10 Each consensus router needs to... d Each training router undergoes a consensus voting process; that is, whether a training router can participate in the aggregation of global model parameters is determined by... m The consensus router makes a consensus decision. In the... k During the training round, for the consensus router and training router Consensus Router Use consensus router public key For the training router Broadcast verification message Decryption is performed to verify its legitimacy;
[0211] If decryption succeeds, it means the verification message was successful. Legal, training router This is legal; at this point, the consensus router... Determine the training router If the current contribution is greater than or equal to a preset contribution threshold, then let the voting information... Consensus router Agree to train router Participate in the aggregation of global model parameters; otherwise, let Consensus router Oppose training routers Participate in the aggregation of global model parameters; the calculation of the current contribution can be found in the above formulas (1)-(6); if decryption fails, it indicates that the verification message is invalid. Illegal, training router Illegal, at this point the consensus router Preset null value voting information Confirmed as voting information After that, consensus router Using training routers private key Voting information Perform signature encryption to obtain the voting message. And send it to the smart contract module;
[0212] Finally, if j≠m This means m The consensus router has not completed the process for the first consensus router. i The consensus voting is conducted among the training routers, at which point the smart contract module instructs... j=j+ 1 and return to the consensus router Use consensus router public key For the training router Broadcast verification message The decryption process is performed to achieve cyclical processing; if j=m This means m The consensus router completes the process for the first consensus router. i The consensus vote is conducted among the training routers, at which point the smart contract module determines... i Is it equal to d If so, then it means it's complete. m A consensus router pair d The consensus vote of the training routers is then obtained. d The relative voting message of the training router, otherwise the smart contract module makes i=i+ 1, and return to the consensus router. Use consensus router public key For the training router Broadcast verification message The decryption process is performed in a loop. It is understandable that this step... i =1 and j= 1. Begin.
[0213] S304, Committee Consensus: Refer to Figure 10 In the k During the block generation time period of the training round, for the training router The smart contract module obtains the training router. Relative voting messages and using the trained router public key Perform secondary decryption verification;
[0214] If the smart contract module cannot decrypt the training router The relative voting message indicates that the training router Illegal; considered as training router. The decryption verification failed, at which point the smart contract module determined the training router. It does not participate in global model parameter aggregation and filters out training routers. ;
[0215] If the smart contract module successfully decrypts the training router The relative voting message indicates that the training router Legal, considered as a training router Upon successful decryption and verification, the smart contract module then determines the training router. If the aggregation ratio is greater than the preset ratio threshold, the aggregation ratio can be found in the above formula (7). If so, then the training router is determined. Participate in global model parameter aggregation, and train the router and training router Local model parameters Add to the preset aggregation list AG Meanwhile, based on the training router The current contribution of the router to the training The cumulative contribution is updated to obtain the training router. The updated cumulative contribution points are stored in the [number]th [number]. k Candidate blocks for round-robin training, training router If the updated cumulative contribution satisfies the above formula (8), then the training router is determined. It does not participate in global model parameter aggregation and filters out training routers. ;
[0216] Finally, if i=d This indicates that the smart contract module has completed the process. d The test router is checked; otherwise, it indicates that the training process has not been completed. d The smart contract module makes the judgment of the training router. i=i +1, and return to obtaining the training router. The steps involve relative voting messages to achieve cyclic processing. This step starts from... i =1. It is understandable that in the first... k During the block generation period of the training round, the smart contract module can complete the task. d The judgment of a training router.
[0217] S305, Global Model Parameter Aggregation: When the... kWhen the block generation period of the training round ends, the smart contract module obtains the aggregated list. AG and using aggregated lists AG middle d’ The local model parameters and current contribution of the first aggregation router are combined with the above formula (9) to determine the first... k The global model parameters trained in each round are aggregated to obtain the aggregated global model parameters. Finally, the smart contract module uses the aggregated list. AG The information stored in the middle, the aggregated global model parameters, and the first k -1 round of training target block and the k The candidate blocks from each round of training are used to construct new blocks and utilize the aggregated list. AG Each training router uses its private key to sign and encrypt the new block, thus obtaining the first block as shown in formula (10) above. k The target block for each training round will be broadcast to the blockchain for subsequent training rounds.
[0218] S306, Incentive Mechanism: The reward value for training the router is determined by both the current contribution and the total number of samples in the local dataset. The decision condition is... m The smart contract module rewards the training router with a corresponding reward value when more than half of the consensus routers agree that the training router should participate in the global model parameter aggregation. Otherwise, the smart contract module does not reward the training router, as shown in formula (11) above.
[0219] The reward value of the consensus router is determined by the consensus router relative to... d The voting information of the training routers and the consensus router relative to each other. d The consensus routers jointly decide based on the public dataset of the training routers, and the decision criterion is that the consensus router agrees with the consensus router's decision. d Whether the training router votes correctly, for each training router, when the consensus router votes correctly for the training router, the smart contract module gives the consensus router a reward, and when the consensus router votes incorrectly for the training router, the smart contract module does not give the consensus router a reward, as shown in the above formulas (12)-(13).
[0220] S307, Training Termination Judgment: The smart contract module determines whether the federated learning has reached the preset termination condition; if so, it means that the federated learning can be terminated. At this time, the smart contract module uses the... k The aggregated global model parameters from the first round of training are used to generate a routing service identification model and output it; otherwise, it indicates that federated learning has not yet terminated, and the smart contract module will... k The aggregated global model parameters from the first round of training are used as the first... kThe global model parameters after +1 rounds of training, i.e., the... k The global model parameters for +1 round of training will adopt the parameters from the first training round. k The aggregated global model parameters from the rounds of training, and let k=k +1, and then return to step S301 to achieve loop training.
[0221] S308, Real-time Routing Service Identification: The smart contract module determines the router under test and obtains the packet 5-tuple information of the router under test. Then, it uses the routing service identification model to identify the service type of the router under test based on the packet 5-tuple information. It can be understood that the service type of the router under test refers to the service type of the packet 5-tuple information.
[0222] Although embodiments of this application have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the claims and their equivalents.
[0223] The above is a detailed description of the preferred embodiments of this application, but this application is not limited to the embodiments described. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of this application, and these equivalent modifications or substitutions are all included within the scope defined by the claims of this application.
Claims
1. A method for identifying routing services, characterized in that, The method includes the following steps: Get the k Rotation training d One training router and m A consensus router; For each of the training routers, the training router is controlled to train its local model based on its local dataset; wherein, the local dataset includes multiple preset packet quintuple information and a service type label for each preset packet quintuple information. Based on the relative voting messages of each training router and the local model parameters of at least one training router, the first... k The global model parameters from each round of training are aggregated to obtain the aggregated global model parameters; wherein, the relative voting messages of the training routers include the voting messages of each consensus router relative to the training router; When federated learning does not reach the preset termination condition, the aggregated global model parameters are determined as the first... k The global model parameters for +1 training round are set to... k=k +1, and return to the point where the first digit was obtained. k Rotation training d One training router and m The consensus router process continues until the federated learning reaches the termination condition, and a routing service identification model is obtained based on the aggregated global model parameters. The routing service identification model is used to identify the service type of the router under test by using the five-tuple information of the data packets. Wherein, in the step of adjusting the relative voting messages of each of the training routers and the local model parameters of at least one of the training routers, the first... k Before aggregating the global model parameters from each round of training to obtain the aggregated global model parameters, the method further includes the following steps: For each training router that has completed training, control each consensus router to perform consensus voting processing on the training router, and obtain the voting message of each consensus router relative to the training router as the relative voting message of the training router; The step of controlling each consensus router to perform consensus voting processing on the training router to obtain voting messages from each consensus router relative to the training router includes: The consensus router is controlled to decrypt the verification message of the training router based on the public key of the training router; If the consensus router successfully decrypts the verification message of the training router, it obtains the current contribution of the training router through the consensus router. Based on the current contribution of the training router, it obtains the voting information of the consensus router relative to the training router, and signs the voting information of the consensus router relative to the training router using the private key of the training router to obtain the voting message of the consensus router relative to the training router; wherein, the current contribution of the training router is the value obtained at the i-th... k The contribution of the training router to federated learning during the training rounds; If the consensus router fails to decrypt the verification message of the training router, it determines the preset null value voting information as the voting information of the consensus router relative to the training router, and signs the voting information of the consensus router relative to the training router using the private key of the training router to obtain the voting message of the consensus router relative to the training router.
2. The routing service identification method according to claim 1, characterized in that, The acquisition of the first k Rotation training d One training router and m A consensus router, including: Obtaining blockchain M Each initial router and the cumulative contribution of each initial router; wherein, M=d+m The cumulative contribution of the initial router is the first k The sum of the contributions of the initial routers to federated learning during each round of training; according to M The cumulative contribution of each of the initial routers M Sort the initial routers to obtain M The initial routers are sorted; wherein the cumulative contribution of the initial routers is negatively correlated with the sorting number of the initial routers; exist M Of the sorted initial routers, the first one is selected. m The initial routers are used as the consensus routers, and the remaining ones... d The initial router was determined to be the training router.
3. The routing service identification method according to claim 1, characterized in that, Obtaining the current contribution of the training router includes: Based on the local dataset weights of the training routers, the total number of consensus routers, and the initial training contribution of the training routers, the result is obtained in the first... k The target training contribution of the training router in the training round; wherein, the initial training contribution of the training router is the value obtained in the training round. k The sum of the local model training contributions of the training routers relative to each consensus router in each round of training; According to the k The data transmission latency and data loss rate of the training router mentioned in the training round are obtained in the first round. k The communication quality parameters of the training router described in the round of training; According to the k The target training contribution and communication quality parameters of the training router in each round of training are used to obtain the current contribution of the training router.
4. The routing service identification method according to claim 1, characterized in that, The step of obtaining the voting information of the consensus router relative to the training router based on the current contribution of the training router includes: If the current contribution of the training router is greater than or equal to a preset contribution threshold, then the preset first key value is determined as the voting information of the consensus router relative to the training router; wherein, the first key value is used to indicate that the consensus router agrees to the training router's participation in the aggregation of the global model parameters; Alternatively, if the current contribution of the training router is less than the contribution threshold, then the preset second key value is determined as the voting information of the consensus router relative to the training router; wherein, the second key value is used to indicate that the consensus router opposes the training router's participation in the aggregation of the global model parameters.
5. The routing service identification method according to claim 1, characterized in that, The step involves adjusting the relative voting messages of each training router and the local model parameters of at least one training router. k The global model parameters from each round of training are aggregated to obtain the aggregated global model parameters, including: In the k During the block generation time period of each training round, for each training router, the relative voting message of the training router is decrypted using the public key of the training router. If the relative voting message of the training router is successfully decrypted and the aggregation ratio of the training router is greater than a preset ratio threshold, then the training router and its local model parameters are added to a preset aggregation list. The cumulative contribution of the training router is updated according to its current contribution, and the updated cumulative contribution of the training router is obtained and stored in the next training round. k Candidate blocks for round training; wherein, the aggregation ratio of the training router is the percentage of the number of consensus routers among all the consensus routers that agree to the training router's participation in the aggregation of the global model parameters; When the k At the end of the block generation time period of the training round, the local model parameters and current contribution of each training router in the aggregation list are used to evaluate the performance of the training round. k The global model parameters trained in each round are aggregated to obtain the aggregated global model parameters; Based on the aggregated list, the aggregated global model parameters, and the first k The target block of the -1 round of training, combined with the first round of training k The candidate blocks from the first round of training are obtained. k The target block for the round of training is broadcast to the blockchain.
6. The routing service identification method according to claim 1, characterized in that, The process involves adjusting the relative voting messages of each training router and the local model parameters of at least one training router for the first... k After aggregating the global model parameters from each round of training to obtain the aggregated global model parameters, the method further includes the following steps: For each training router, if the aggregate ratio of the training router is greater than a preset ratio threshold, then the training router is rewarded based on its current contribution and the total number of samples in the local dataset, combined with preset reward and penalty hyperparameters; otherwise, no reward is given.
7. The routing service identification method according to claim 1, characterized in that, The process involves adjusting the relative voting messages of each training router and the local model parameters of at least one training router for the first... k After aggregating the global model parameters from each round of training to obtain the aggregated global model parameters, the method further includes the following steps: For each consensus router, a reward is given based on the voting information of the consensus router relative to each training router and the total number of samples in the public dataset, combined with preset reward and penalty hyperparameters.
8. A routing service identification device, characterized in that, The apparatus, applied to the routing service identification method as described in any one of claims 1-7, comprises: The acquisition module is used to acquire the first... k Rotation training d One training router and m A consensus router; The first processing module is used to control each of the training routers based on the first... k The global model parameters from the round of training and the local dataset of the training router are used to train the local model of the training router; wherein, the local dataset includes multiple preset packet quintuple information and the service type label of each preset packet quintuple information. The second processing module is configured to process the data based on the relative voting messages of each training router and the local model parameters of at least one training router. k The global model parameters from each round of training are aggregated to obtain the aggregated global model parameters; wherein, the relative voting messages of the training routers include the voting messages of each consensus router relative to the training router; The third processing module is used to determine the aggregated global model parameters as the first condition when the federated learning does not reach the preset termination condition. k The global model parameters for +1 training round are set to... k=k +1, and return to the point where the first digit was obtained. k Rotation training d One training router and m The consensus router process continues until the federated learning reaches the termination condition, and a routing service identification model is obtained based on the aggregated global model parameters. The fourth processing module is used to identify the service of the data packet five-tuple information of the router under test using the routing service identification model, and obtain the service type of the data packet five-tuple information as the service type of the router under test.
Citation Information
Patent Citations
Decentralized federated machine learning method under privacy protection
CN111600707A
Business identification method based on federal learning
CN115278570A