Model training method and device, equipment and computer storage medium
By receiving cloud-based models and expanding training samples using generative adversarial networks, a global prediction model is constructed, solving the problems of limited computing resources for IoT devices and insufficient samples on edge servers, thus achieving higher-precision attack behavior detection.
Patent Information
- Application Number
- CN202310507711.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-08
- Publication Date
- 2026-01-09
- Estimated Expiration
- 2043-05-08
AI Technical Summary
IoT devices have limited computing and storage resources, and the small number of edge server samples leads to low accuracy of attack behavior prediction models, resulting in insufficient precision in detecting attack behaviors by existing models.
By receiving the global prediction model from the cloud server, combining generative adversarial network generation and adversarial learning, training samples are constructed using the traffic of nearby edge servers. The training samples are expanded and the global prediction model is trained. The generative adversarial network includes a generator and a discriminator for feature extraction and adversarial learning, and a fourth training sample is constructed to identify attack behaviors.
It improves the accuracy of attack behavior identification, enhances the precision of attack behavior detection, solves the problem of insufficient training samples, and achieves more accurate attack behavior detection.
Smart Images

Figure CN116523026B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of Internet of Things, and in particular relates to a model training method, apparatus, device and computer storage medium. Background Technology
[0002] Most existing IoT devices suffer from limited computing and storage resources. In addition, due to geographically dispersed locations and user privacy concerns, it is usually necessary to train attack behavior prediction models on edge servers in various regions. Based on the trained attack behavior prediction models, attack behaviors are detected to ensure the security of resource storage. Therefore, accurate training of attack behavior prediction models is essential.
[0003] Attack behavior prediction models are usually trained based on existing training samples in edge servers. However, some edge servers have too few samples, which leads to low accuracy of attack behavior prediction models. With the emergence of new attacks, models trained in this way have low accuracy in detecting attacks. Summary of the Invention
[0004] This application provides a model training method, apparatus, device, and computer storage medium that can detect attack behaviors and improve the accuracy of attack behavior detection.
[0005] In a first aspect, embodiments of this application provide a model training method, the method comprising:
[0006] Receive the global prediction model sent by the cloud server. The global prediction model is used to identify attack behavior information.
[0007] The system obtains first traffic from the first edge server and second traffic from the second edge server. The first traffic and second traffic respectively represent user behavior information. The second traffic is a portion of the traffic in the second edge server, which is an edge server adjacent to the first edge server.
[0008] The first training sample is constructed based on the first and second flows;
[0009] Generative adversarial network is used to generate a second training sample corresponding to the first training sample, and adversarial learning is performed between the first training sample and the second training sample to obtain a third training sample. The second training sample and the third training sample respectively represent the user's behavioral information.
[0010] A fourth training sample is constructed based on the first and third training samples, and a global prediction model is trained based on the fourth training sample to obtain the first prediction model, which is used to identify attack behavior information.
[0011] In one possible implementation, the generative adversarial network includes a generator and a first discriminator, and generates a second training sample corresponding to the first training sample using the generative adversarial network, including:
[0012] The generator's encoding network is used to extract features from the first training sample to obtain the first attack behavior features;
[0013] The first discriminator is used to perform adversarial learning on the first attack behavior features and the uniformly distributed features corresponding to the third traffic in the third edge server to obtain the second attack behavior features. The third edge server is other edge servers besides the first edge server, and the third edge server includes the second edge server.
[0014] The second training sample is obtained by decoding the features of the second attack behavior using a decoder.
[0015] In one possible implementation, the generative adversarial network includes a second discriminator that performs adversarial learning between the first training samples and the second training samples to obtain a third training sample, including:
[0016] The third attack behavior feature is determined by using a second discriminator to perform adversarial learning between the first attack behavior feature and the second attack behavior feature.
[0017] The third training sample is obtained by decoding the third attack behavior features using a decoder.
[0018] In one possible implementation embodiment, it further includes:
[0019] The parameters of the first prediction model are sent to the cloud server so that the cloud server can calculate the weighted average of the parameters sent by at least one first edge server, determine the global parameters, and update the global prediction model based on the global parameters.
[0020] In one possible implementation, the method further includes, before sending the parameters of the first prediction model to the cloud server:
[0021] Determine whether the difference between the parameters of the first prediction model and the parameters of the first prediction model obtained in the previous training is greater than a preset threshold.
[0022] If the difference between the parameters of the first prediction model and the parameters of the first prediction model obtained in the previous training exceeds a preset threshold, the parameters of the first prediction model are sent to the cloud server.
[0023] Secondly, embodiments of this application provide a model training apparatus, including:
[0024] The receiving module is used to receive the global prediction model sent by the cloud server. The global prediction model is used to identify attack behavior information.
[0025] The acquisition module is used to acquire the first traffic of the first edge server and the second traffic of the second edge server. The first traffic and the second traffic respectively represent the user's behavior information. The second traffic is a portion of the traffic in the second edge server. The second edge server is an edge server adjacent to the first edge server.
[0026] The building block is used to construct the first training sample based on the first and second traffic flows;
[0027] The determination module is used to generate a second training sample corresponding to the first training sample using a generative adversarial network, and to perform adversarial learning between the first training sample and the second training sample to obtain a third training sample. The second training sample and the third training sample respectively represent the user's behavioral information.
[0028] The determination module is also used to construct a fourth training sample based on the first and third training samples, and to train a global prediction model based on the fourth training sample to obtain a first prediction model to identify attack behavior information.
[0029] In one possible implementation, the determining module includes:
[0030] The extraction unit is used to extract features from the first training sample using the generator's encoding network to obtain the first attack behavior features;
[0031] The determining unit is used to perform adversarial learning on the first attack behavior features and the uniformly distributed features corresponding to the third traffic in the third edge server using the first discriminator to obtain the second attack behavior features. The third edge server is other edge servers besides the first edge server, and the third edge server includes the second edge server.
[0032] The decoding unit decodes the second attack behavior features through the decoder to obtain the second training sample.
[0033] In one possible implementation, the determining module includes:
[0034] The determining unit is also used to perform adversarial learning between the first attack behavior feature and the second attack behavior feature using the second discriminator to determine the third attack behavior feature;
[0035] The decoding unit is also used to decode the third attack behavior features through the decoder to obtain the third training sample.
[0036] Thirdly, embodiments of this application provide an electronic device, the device comprising:
[0037] Processor and memory storing computer program instructions;
[0038] The model training method that implements any of the above when the processor executes computer program instructions.
[0039] Fourthly, embodiments of this application provide a computer storage medium on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the model training method of any one of the above-mentioned methods is implemented.
[0040] Fifthly, embodiments of this application provide a computer program product, characterized in that, when the instructions in the computer program product are executed by the processor of an electronic device, the electronic device is able to execute any of the above-mentioned model training methods.
[0041] The model training method, apparatus, device, and computer storage medium of this application embodiment receive a global prediction model sent by a cloud server. The global prediction model is used to identify attack behavior information. It obtains first traffic from a first edge server and second traffic from a second edge server. The first traffic and second traffic respectively represent user behavior information. The second traffic is a portion of the traffic in the second edge server, which is an edge server adjacent to the first edge server. A first training sample is constructed based on the first traffic and the second traffic. A second training sample corresponding to the first training sample is generated using a generative adversarial network. The first training sample and the second training sample are then subjected to adversarial learning to obtain a third training sample. The second training sample and the third training sample respectively represent user behavior information. A fourth training sample is constructed based on the first training sample and the third training sample. The global prediction model is then trained based on the fourth training sample to obtain a first prediction model for identifying attack behavior information. In this way, the first training sample is constructed by using the traffic in the first edge server and the neighboring second edge server. The third training sample obtained by expanding the first training sample through a generative adversarial network is used together with the first training sample to train the global prediction model and determine the first prediction model. This solves the problem of insufficient training samples for the model. The determined first prediction model can identify unknown attack behavior information and improve the accuracy of attack behavior information identification. The first prediction model is used to detect attack behavior and improve the accuracy of attack behavior detection. Attached Figure Description
[0042] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0043] Figure 1 This is a schematic flowchart of a model training method provided in one embodiment of this application;
[0044] Figure 2This is a flowchart illustrating a model training method provided in another embodiment of this application;
[0045] Figure 3 Another embodiment of this application provides a schematic diagram of the interaction between an edge server and a cloud server.
[0046] Figure 4 This is a schematic diagram of the structure of a model training device provided in another embodiment of this application;
[0047] Figure 5 This is a schematic diagram of the structure of an electronic device provided in another embodiment of this application. Detailed Implementation
[0048] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.
[0049] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0050] Most existing IoT devices suffer from limited computing and storage resources. In addition, due to geographically dispersed locations and user privacy concerns, it is usually necessary to train attack behavior prediction models on edge servers in various regions. Based on the trained attack behavior prediction models, attack behaviors are detected to ensure the security of resource storage. Therefore, accurate training of attack behavior prediction models is essential.
[0051] Attack behavior prediction models are usually trained based on existing training samples in edge servers. However, some edge servers have too few samples, which leads to low accuracy of attack behavior prediction models. With the emergence of new attacks, models trained in this way have low accuracy in detecting attacks.
[0052] To address the problems of the prior art, embodiments of this application provide a model training method, apparatus, device, and computer storage medium. The model training method provided in this application embodiment will be described first below.
[0053] Figure 1 A schematic flowchart of a model training method provided in one embodiment of this application is shown.
[0054] like Figure 1 As shown, the model training method provided in this application embodiment includes S110 to S150.
[0055] S110: Receives the global prediction model sent by the cloud server. The global prediction model is used to identify attack behavior information.
[0056] In some embodiments, the received global prediction model is an initial prediction model. The global prediction model can be an initial prediction model trained based on traffic stored on a cloud server. The traffic stored on the cloud server includes traffic sent by edge servers and is included in all edge servers, representing user behavior information. Here, user behavior information can be converted into traffic through a predetermined function.
[0057] In some embodiments, the global prediction model is an initial prediction model trained based on traffic stored on a cloud server, which can identify existing attack behavior information.
[0058] In some embodiments, the global prediction model may include, but is not limited to, a BP neural network model or a support vector machine model.
[0059] S120. Obtain the first traffic of the first edge server and the second traffic of the second edge server. The first traffic and the second traffic respectively represent the user's behavior information. The second traffic is a portion of the traffic in the second edge server. The second edge server is an edge server adjacent to the first edge server.
[0060] The first traffic refers to all traffic of the first edge server, and the first traffic represents the user behavior information in the first edge server. The second traffic represents the user behavior information in the second edge server.
[0061] In some embodiments, the IoT devices managed by each first edge server are different, and the distribution of traffic included in each first edge server is very different. A portion of the traffic of the neighboring second edge servers can be obtained by random sampling, for example, a portion of the traffic of the neighboring second edge servers can be randomly sampled at a rate of 5%-10%, so that the traffic in the sample can be independent and identically distributed when constructing the sample of each first edge server.
[0062] In some embodiments, the time series of the first traffic and the time series of the second traffic can be obtained.
[0063] S130. Construct the first training sample based on the first flow and the second flow.
[0064] Here, the first training sample includes all traffic from the first edge server and a portion of traffic from the second edge server.
[0065] S140. Generate a second training sample corresponding to the first training sample using a generative adversarial network, and perform adversarial learning between the first training sample and the second training sample to obtain a third training sample. The second training sample and the third training sample respectively represent the user's behavioral information.
[0066] Here, the generative adversarial network generates a second training sample based on the first training sample. Based on the first training sample, the first training sample and the second training sample are used to perform adversarial learning, so that the resulting third training sample becomes closer and closer to the first sample.
[0067] In some embodiments, the first traffic and the second traffic include user behavior information and a label indicating whether it is attack behavior information. User behavior information can be converted into traffic using a predetermined function. The label includes yes or no, for example, it can be represented by "1" or "0", where "1" indicates that the user behavior information is attack behavior information, and "0" indicates that the user behavior information is not attack behavior information. The first training sample is input into the generative adversarial network (GAN). The GAN can generate new user behavior information and labels indicating whether it is attack behavior information based on the user behavior information and the labels in the first training sample. It should be noted that the second training sample includes new user behavior information and labels indicating whether it is attack behavior information. The new user behavior information may include information about user behavior that has not yet occurred.
[0068] S150. Construct a fourth training sample based on the first and third training samples, and train a global prediction model based on the fourth training sample to obtain the first prediction model, in order to identify attack behavior information.
[0069] In some embodiments, the fourth training sample includes the first training sample and the third training sample. It should be noted that the constructed fourth training sample can include a large number of training samples, for example, it can include traffic corresponding to known attack behavior information, and it can also include traffic corresponding to unknown attack behavior information. In some embodiments, a global prediction model is trained based on the traffic corresponding to existing attack behavior information and the traffic corresponding to unknown attack behavior information to obtain the first prediction model.
[0070] In this way, the first training sample is constructed by using the traffic in the first edge server and the neighboring second edge server. The third training sample obtained by expanding the first training sample through a generative adversarial network is used together with the first training sample to train the global prediction model and determine the first prediction model. This solves the problem of the small number of training samples for the model. The determined first prediction model can identify unknown attack behavior information and improve the accuracy of attack behavior information identification. The first prediction model is used to detect attack behavior and improve the accuracy of attack behavior detection.
[0071] Based on this, in some embodiments, the generative adversarial network includes a generator and a first discriminator, and the above-mentioned S140 may specifically include:
[0072] The generator's encoding network is used to extract features from the first training sample to obtain the first attack behavior features;
[0073] The first discriminator is used to perform adversarial learning on the first attack behavior features and the uniformly distributed features corresponding to the third traffic in the third edge server to obtain the second attack behavior features. The third edge server is other edge servers besides the first edge server, and the third edge server includes the second edge server.
[0074] The second training sample is obtained by decoding the features of the second attack behavior using a decoder.
[0075] In some embodiments, based on the first training sample in a certain number of iterations, the first training sample is used to extract features through the encoding network of the generator to obtain the first attack behavior features. The first attack behavior features are input into the first discriminator, and the first attack behavior features are used to perform adversarial learning with the uniformly distributed features corresponding to the third traffic in the third edge server. Under the condition of satisfying a predetermined rule, the second attack behavior features are obtained. Here, satisfying the predetermined rule can be that the value of the objective function satisfies a predetermined condition.
[0076] In one example, the generative adversarial network is an unsupervised neural network, and the objective function of the neural network generated during the adversarial learning process is shown in Equation (1):
[0077]
[0078] Where G represents the generator, D represents the first discriminator, and f * ~prior(f) represents the characteristic f of the uniform distribution corresponding to the third traffic in the third edge server. * Follows a uniform distribution, f * These are the attack behavior characteristics corresponding to the actual traffic existing in the third-edge server, p d (X) represents the distribution of attack behavior features generated by the generator, which is the first attack behavior feature. During the objective function update process, D is updated k times before G is updated once. min max can be understood as maximizing formula (1) when updating D, and minimizing formula (1) when updating G. Based on the first training sample X in a certain iteration number i, for the first attack behavior feature f(x) generated by the generator, the first discriminator D, D(f * The closer the output of generator G and D is to 1, the closer the obtained second attack behavior characteristics are to the real attack behavior characteristics of the uniform distribution corresponding to the third traffic in the third edge server. i The closer the output of (f(x)) is to 0 (i.e., minG), the better the log(1-D) output becomes. i The closer the output of (f(x)) is to 1, the closer the obtained second attack behavior feature is to the real attack behavior feature of the uniform distribution corresponding to the third traffic in the third edge server, i.e., maxD.
[0079] In another example, for the first training sample X in a certain iteration number i, the calculation formula (2) for the first attack behavior feature obtained by the generator's encoding network is as follows:
[0080] f(X)=G(W G *X+b G (2)
[0081] Where G represents the nonlinear activation function Tanh, W G b represents the weights of the encoding network. G The bias is represented by the weights, which are automatically generated by the generative adversarial network.
[0082] In some embodiments, the uniformly distributed features corresponding to the third traffic in the third edge server are added to the first attack behavior features by the generator and the first discriminator to synthesize the second attack behavior features and obtain new attack behavior features.
[0083] In one example, the second attack behavior characteristic can be calculated using formula (3), which is as follows:
[0084]
[0085] Here, concat is a pre-defined function, which can be a function determined when the value of the target function of the neural network generated during adversarial learning meets predetermined conditions. c(e) represents the uniformly distributed feature corresponding to the third traffic in the third edge server, and c(p) represents the label of whether the uniformly distributed feature corresponding to the third traffic in the third edge server is attack behavior information.
[0086] In some embodiments, a first training sample is input into a generator, and a first attack behavior feature is obtained through feature extraction. A second attack behavior feature is obtained by performing adversarial learning between the first attack behavior feature and the uniformly distributed features corresponding to the third traffic in the third edge server. The second attack behavior feature is decoded by a decoder to obtain a second training sample. The obtained second training sample includes traffic corresponding to new user behavior information and a label indicating whether it is attack behavior information. The traffic corresponding to new user behavior information may include traffic corresponding to information about user behavior that has not occurred.
[0087] In some embodiments, after obtaining the second attack behavior features, a second training sample is obtained by deconvolution operation on them through a decoder.
[0088] In this way, by incorporating real user behavior information from other edge servers into the first training samples of the generator and first discriminator in the generative adversarial network, attack behavior information can be identified more accurately.
[0089] Based on this, in some embodiments, the generative adversarial network includes a second discriminator, and the above-mentioned S140 may specifically include:
[0090] The third attack behavior feature is determined by using a second discriminator to perform adversarial learning between the first attack behavior feature and the second attack behavior feature.
[0091] The third training sample is obtained by decoding the third attack behavior features using a decoder.
[0092] In some embodiments, the first attack behavior feature corresponding to the first training sample is subjected to adversarial learning with the second attack behavior feature to determine the third attack behavior feature. The third attack behavior feature is then decoded by a decoder to obtain a third training sample that is close to the first training sample. Here, the first training sample generated by the generator and the label of whether the traffic in the first training sample is attack behavior information, along with the label of whether the traffic in the second training sample is attack behavior information, can also be input into the discriminator for adversarial learning. The first attack behavior feature corresponds to the label of whether the traffic in the first training sample is attack behavior information, and the second attack behavior feature corresponds to the label of whether the traffic in the second training sample is attack behavior information. When the value of the set objective function meets a predetermined condition, a third training sample that is close to the first training sample is determined. The calculation formula (4) of the set objective function is as follows:
[0093]
[0094] Where X is the first training sample, and Y is the label for whether the traffic in the first training sample corresponds to attack behavior information. y is the label for whether the traffic in the second training sample is an attack behavior.
[0095] In some embodiments, such as Figure 2 As shown, the generator's encoding network extracts features from the first training sample to obtain the first attack behavior features. The first discriminator performs adversarial learning between the first attack behavior features and the uniformly distributed features corresponding to the third traffic in the third edge server. When the value of the set objective function meets the predetermined conditions, the second attack behavior features are determined. The second attack behavior features are decoded by the decoder to obtain the second training sample. The second discriminator performs adversarial learning between the first attack behavior features and the second attack behavior features. When the value of the reset objective function meets the predetermined conditions, the third attack behavior features are determined.
[0096] In this way, the adversarial learning between the first attack behavior features and the second attack behavior features makes the traffic in the determined third training sample closer to the traffic in the first edge server, that is, the user behavior information in the determined third training sample is closer to the user behavior information in the first edge server.
[0097] Based on this, in some embodiments, the method may further include:
[0098] The parameters of the first prediction model are sent to the cloud server so that the cloud server can calculate the weighted average of the parameters sent by at least one first edge server, determine the global parameters, and update the global prediction model based on the global parameters.
[0099] In some embodiments, each first edge server trains a global prediction model using a first training sample and a third training sample to form multiple first prediction models that identify attack behavior information, and each first prediction model includes multiple parameters.
[0100] In some embodiments, Figure 3 A schematic diagram illustrating the interaction between the edge server and the cloud server is shown, such as... Figure 3 As shown, the first edge server sends the parameters of the first prediction model to the cloud server. The cloud server calculates the weighted average of at least one parameter sent by the first edge server, determines the global parameters, and updates the global prediction model based on the global parameters. The first edge server receives the parameters of the global prediction model sent by the cloud server. The first edge server calculates the gradient according to the allocated data and updates the parameters in the initial training model of the first prediction model. In this way, distributed federated learning is integrated to realize intelligent IoT security detection on the edge side.
[0101] In some embodiments, if it is necessary to identify attack behavior information in a certain area, an edge server is attached next to the base station. Each edge server can predict the traffic for a future period based on the existing traffic time series, thereby identifying attack behavior information.
[0102] In one example, taking a BP neural network as the global prediction model, if a 9-4-1 neural network structure is used to predict the traffic of the first edge server over a future period, then each first edge server uses this 9-4-1 BP neural network structure. Therefore, each first edge server needs to train 40 (9×4+4*1, with 36 parameters from the 9 input neurons to the 4 hidden neurons, and 4 parameters from the 4 hidden neurons to the 1 output neuron) parameters for the BP neural network. The 9 input neurons correspond to the time series of base station traffic. For example, to predict the traffic on November 19, 2022, we need the traffic time series from November 10th to November 18th as input values.
[0103] In another example, for a BP neural network, the objective function is set, and the formula (5) for calculating the objective function is as follows:
[0104]
[0105] The traffic includes user behavior information and labels indicating whether it is an attack, and the fourth training sample xi The corresponding real label is Y i C i This represents the features corresponding to the fourth training sample and the label indicating whether the fourth training sample represents attack behavior information (the features corresponding to the fourth training sample are obtained by using a deep learning model to learn the average, maximum, and minimum packet sizes, where the packet sizes include the traffic in the fourth training sample; the label indicating whether the fourth training sample represents attack behavior information is obtained by using a deep learning model to learn the attack behavior information in the fourth training sample), W i Let represent the parameters of the first training model obtained during the k-th round of training based on the fourth training sample when the first edge server i trains the global prediction model, let W represent the parameters W of the global prediction model of the cloud server, let λ represent the regularization coefficient, and let n represent the number of first edge servers.
[0106] Based on formula (5), when the cloud server sends a synchronization request, it sends the parameters of the first prediction model to the cloud server, and the cloud server integrates the parameters of the first prediction model (using a weighted average method) to form the parameters of the global prediction model. Based on the generated parameters of the global prediction model, the cloud server distributes the global parameters to the edge servers to update the initial prediction model corresponding to each first prediction model.
[0107] Taking the 40 parameters of the aforementioned BP neural network as an example, each first edge server is trained with 40 parameters. The parameters of each edge server are different. Assuming that 5 edge servers are sampled, let's explain the 4 parameters of the hidden layer-output layer. The last 4 parameters of the first first edge server are {1, 2, 1, 2}, and the last 4 parameters of the other four first edge servers are {2, 2, 0, 2}, {2, 2, 2, 1}, {1, 2, 1, 2}, and {2, 2, 2, 2}, respectively. The last 4 parameters are integrated using the weighted average method to achieve {2, 2, 1.5, 1.8}. The last 4 parameters of the global prediction model are: {2, 2, 1.5, 1.8}. The last 4 parameters of the global prediction model are updated to {2, 2, 1.5, 1.8}, and this parameter is distributed to the first edge servers so that the initial prediction model of each first edge server updates the last 4 parameters to {2, 2, 1.5, 1.8}.
[0108] After multiple iterations of the first training sample, the fourth training sample is iterated, and after iterations of training samples from k rounds to k+1 rounds, the parameters of the model are updated. The calculation formula (6) for the parameter update process in the k+1 round is as follows:
[0109]
[0110] The traffic includes user behavior information and labels indicating whether it is an attack, and the fourth training sample x i The corresponding label is Y i C i W represents the feature corresponding to the fourth training sample and the label indicating whether the fourth training sample contains attack behavior information. i Let λ represent the parameters of the first training model obtained by the first edge server i during the k-th round of training based on the fourth training sample when training the global prediction model. Let λ represent the regularization coefficient and n represent the number of first edge servers.
[0111] In this way, the parameters of the model are updated through the interaction between the first edge server and the cloud server, making the determined global prediction model more accurate, and thus the determined first prediction model can more accurately identify attack behavior information.
[0112] Based on this, in some embodiments, before sending the parameters of the first prediction model to the cloud server, the method may further include:
[0113] Determine whether the difference between the parameters of the first prediction model and the parameters of the first prediction model obtained in the previous training is greater than a preset threshold.
[0114] If the difference between the parameters of the first prediction model and the parameters of the first prediction model obtained in the previous training exceeds a preset threshold, the parameters of the first prediction model are sent to the cloud server.
[0115] As an example, the first edge server i trains a global prediction model. Based on the difference between the parameters of the first training model obtained in the k-th round of training based on the fourth training sample and the parameters of the first training model obtained in the (k+1)-th round of training based on the fourth training sample, it determines whether to send the parameters of the first prediction model to the cloud server. The formula for calculating this difference (7) is as follows:
[0116]
[0117] In ΔW i If the value exceeds a preset threshold, the parameters of the first prediction model are sent to the cloud server. (In ΔW) i If the value is not greater than a preset threshold, the edge server will not send the parameters of the first prediction model to the cloud server.
[0118] In this way, the number of parameter updates can be controlled by setting a preset threshold, thus reducing the processing load.
[0119] In the embodiments provided in this application, for example, the last four parameters of the first prediction model in the first first edge server are {1, 2, 1, 2}, the first prediction models in the other four first edge servers are {2, 2, 0, 2}, {2, 2, 2, 1}, {1, 2, 1, 2}, {2, 2, 2, 2}, and the last four parameters of the first prediction model in the second first edge server are {2, 2, 0, 2}, one of which is 0. It is very likely that the BP neural network generated by the insufficient or abnormal parameters of this first edge server cannot effectively and reasonably reflect the previous problem. After the cloud server integrates the first prediction models of multiple first edge servers, it obtains {2, 2, 1.5, 1.8}. Obviously, the third value of the global prediction model, 1.5, is more in line with the norm. However, if the second first edge server remains in a deserted location, the user behavior information it collects will certainly be very limited, indicating that it has already "tried its best." If the adversarial network generates useful samples, and the second first edge server trains based on these samples, then the four parameter values trained by the second first edge server will certainly be more reasonable. For example, if the four parameters trained using the generated samples are {2, 2, 1.5, 2}, this is closer to the four parameter values of the global prediction model {2, 2, 1.5, 1.8}. Through continuous iteration, the parameters generated by the second first edge server will become more and more "convergent" with those of the other first servers, thus gradually improving the accuracy of the global prediction model.
[0120] In the embodiments provided in this application, based on sample generation, the first prediction model will have independent and sufficient data to train an independent model. The global prediction model integrates multiple first prediction models, which not only maintains a certain degree of independence of the first prediction models but also enables joint modeling even when user behavior information is not shared, thereby improving the accuracy of the global prediction model parameters. Thus, even in the absence of effective samples, the first prediction model generates useful data through a generative adversarial network, achieving a distribution of samples from the first edge server that approximates the overall sample distribution, thereby improving the accuracy of the global prediction model construction.
[0121] The generative adversarial network method provided in this application is more effective than simply using real samples plus noise to generate new samples. It reduces the uncertainty of sample generation and avoids the problem of whether the final result is good or bad due to simply adding noise to new samples.
[0122] Based on the model training method provided in the above embodiments, this application also provides specific implementations of the model training apparatus. Please refer to the following embodiments.
[0123] First see Figure 4The model training apparatus 300 provided in this application embodiment includes:
[0124] The receiving module 310 is used to receive the global prediction model sent by the cloud server. The global prediction model is used to identify attack behavior information.
[0125] The acquisition module 320 is used to acquire the first traffic of the first edge server and the second traffic of the second edge server. The first traffic and the second traffic respectively represent the user's behavior information. The second traffic is a portion of the traffic in the second edge server. The second edge server is an edge server adjacent to the first edge server.
[0126] Module 330 is used to construct the first training sample based on the first traffic and the second traffic;
[0127] The determination module 340 is used to generate a second training sample corresponding to the first training sample using a generative adversarial network, and to perform adversarial learning between the first training sample and the second training sample to obtain a third training sample. The second training sample and the third training sample respectively represent the user's behavioral information.
[0128] The determination module 340 is also used to construct a fourth training sample based on the first training sample and the third training sample, and to train a global prediction model based on the fourth training sample to obtain a first prediction model to identify attack behavior information.
[0129] In one possible implementation, the generative adversarial network includes a generator and a first discriminator, and the determination module 340 may include:
[0130] The extraction unit is used to extract features from the first training sample using the generator's encoding network to obtain the first attack behavior features;
[0131] The determining unit is used to perform adversarial learning on the first attack behavior features and the uniformly distributed features corresponding to the third traffic in the third edge server using the first discriminator to obtain the second attack behavior features. The third edge server is other edge servers besides the first edge server, and the third edge server includes the second edge server.
[0132] The decoding unit decodes the second attack behavior features through the decoder to obtain the second training sample.
[0133] In one possible implementation, the generative adversarial network includes a second discriminator, and the determination module 340 may include:
[0134] The determining unit is also used to perform adversarial learning between the first attack behavior feature and the second attack behavior feature using the second discriminator to determine the third attack behavior feature;
[0135] The decoding unit is also used to decode the third attack behavior features through the decoder to obtain the third training sample.
[0136] Based on this, in some embodiments, the device 300 may further include:
[0137] The sending module is used to send the parameters of the first prediction model to the cloud server, so that the cloud server can calculate the weighted average of the parameters sent by at least one first edge server, determine the global parameters, and update the global prediction model based on the global parameters.
[0138] Based on this, in some embodiments, the device 300 may further include:
[0139] The judgment module is used to determine whether the difference between the parameters of the first prediction model and the parameters of the first prediction model obtained in the previous training is greater than a preset threshold before sending the parameters of the first prediction model to the cloud server.
[0140] The sending module is specifically used to send the parameters of the first prediction model to the cloud server when the difference between the parameters of the first prediction model and the parameters of the first prediction model obtained in the previous training is greater than a preset threshold.
[0141] The various modules of the model training device provided in this application embodiment can achieve Figure 1 and Figure 2 It provides functionality for each step of the model training method and enables the corresponding technical effects. For the sake of brevity, it will not be elaborated here.
[0142] Based on the same inventive concept, embodiments of this application also provide an electronic device.
[0143] Figure 5 A schematic diagram of the hardware structure of the electronic device provided in an embodiment of this application is shown.
[0144] An electronic device may include a processor 501 and a memory 502 storing computer program instructions.
[0145] Specifically, the processor 501 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0146] Memory 502 may include mass storage for data or instructions. For example, and not limitingly, memory 502 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 502 may include removable or non-removable (or fixed) media. Where appropriate, memory 502 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 502 is non-volatile solid-state memory.
[0147] Memory may include read-only memory (ROM), random access memory (RAM), disk storage media devices, optical storage media devices, flash memory devices, and electrical, optical, or other physical / tangible memory storage devices. Therefore, typically, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of this disclosure.
[0148] The processor 501 reads and executes computer program instructions stored in the memory 502 to implement any of the model training methods in the above embodiments.
[0149] In one example, the electronic device may also include a communication interface 503 and a bus 504. For example, Figure 5 As shown, the processor 501, memory 502, and communication interface 503 are connected through bus 504 and complete communication with each other.
[0150] The communication interface 503 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.
[0151] Bus 504 includes hardware, software, or both, that couples components of an electronic device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Linear Predictive Coding (LPC) bus, a memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (Peripheral Component Interconnect-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VESA Local Bus, VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, bus 504 may include one or more buses. Although specific buses are described and illustrated in the embodiments of this application, this application contemplates any suitable bus or interconnection. The electronic device can perform the model training method in the embodiments of this invention, thereby achieving... Figure 1 and Figure 2 The model training method described.
[0152] Furthermore, in conjunction with the model training methods described in the above embodiments, this application embodiment can provide a computer storage medium for implementation. This computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the model training methods described in the above embodiments.
[0153] This application also provides a computer program product, wherein the instructions in the computer program product, when executed by the processor of an electronic device, cause the electronic device to perform various processes implementing any of the above-described model training method embodiments.
[0154] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0155] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, read-only memory (ROM), flash memory, erasable read-only memory (EROM), floppy disks, compact disc read-only memory (CD-ROM), optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0156] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0157] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.
[0158] The above are merely specific embodiments of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. A model training method applied to a first edge server, characterized in that, include: Receive a global prediction model sent by a cloud server, the global prediction model being used to identify attack behavior information; The system acquires first traffic from the first edge server and second traffic from the second edge server. The first traffic and the second traffic respectively represent user behavior information. The second traffic is a portion of the traffic in the second edge server, and the second edge server is an edge server adjacent to the first edge server. A first training sample is constructed based on the first traffic and the second traffic; A second training sample corresponding to the first training sample is generated using a generative adversarial network, and the first training sample and the second training sample are subjected to adversarial learning to obtain a third training sample. The second training sample and the third training sample respectively represent the user's behavioral information. A fourth training sample is constructed based on the first training sample and the third training sample, and the global prediction model is trained based on the fourth training sample to obtain the first prediction model, so as to identify attack behavior information.
2. The model training method according to claim 1, characterized in that, The generative adversarial network includes a generator and a first discriminator. Generating a second training sample corresponding to the first training sample using the generative adversarial network includes: The generator's encoding network is used to extract features from the first training sample to obtain the first attack behavior features; The first discriminator is used to perform adversarial learning on the first attack behavior features and the uniformly distributed features corresponding to the third traffic in the third edge server to obtain the second attack behavior features. The third edge server is other edge servers besides the first edge server, and the third edge server includes the second edge server. The second attack behavior feature is decoded by the decoder to obtain the second training sample.
3. The model training method according to claim 2, characterized in that, The generative adversarial network includes a second discriminator, and the step of performing adversarial learning between the first training sample and the second training sample to obtain a third training sample includes: The second discriminator is used to perform adversarial learning between the first attack behavior feature and the second attack behavior feature to determine the third attack behavior feature; The third attack behavior feature is decoded by the decoder to obtain the third training sample.
4. The model training method according to claim 1, characterized in that, Also includes: The parameters of the first prediction model are sent to the cloud server so that the cloud server can calculate the weighted average of the parameters sent by at least one first edge server, determine the global parameters, and update the global prediction model based on the global parameters.
5. The model training method according to claim 4, characterized in that, Before sending the parameters of the first prediction model to the cloud server, the method further includes: Determine whether the difference between the parameters of the first prediction model and the parameters of the first prediction model obtained in the previous training is greater than a preset threshold. If the difference between the parameters of the first prediction model and the parameters of the first prediction model obtained in the previous training is greater than a preset threshold, the parameters of the first prediction model are sent to the cloud server.
6. A model training device, applied to a first edge server, characterized in that, include: The receiving module is used to receive a global prediction model sent by a cloud server, which is used to identify attack behavior information; The acquisition module is used to acquire the first traffic of the first edge server and the second traffic of the second edge server. The first traffic and the second traffic respectively represent the user's behavior information. The second traffic is a portion of the traffic in the second edge server. The second edge server is an edge server adjacent to the first edge server. A construction module is used to construct a first training sample based on the first traffic and the second traffic; The determination module is used to generate a second training sample corresponding to the first training sample using a generative adversarial network, and to perform adversarial learning between the first training sample and the second training sample to obtain a third training sample, wherein the second training sample and the third training sample respectively represent the user's behavioral information. The determining module is further configured to construct a fourth training sample based on the first training sample and the third training sample, and train the global prediction model based on the fourth training sample to obtain a first prediction model to identify attack behavior information.
7. The model training apparatus according to claim 6, characterized in that, The generative adversarial network includes a generator and a first discriminator, and the determining module includes: The extraction unit is used to extract features from the first training sample using the encoding network of the generator to obtain the first attack behavior features; The determining unit is used to perform adversarial learning on the first attack behavior features and the uniformly distributed features corresponding to the third traffic in the third edge server using the first discriminator to obtain the second attack behavior features. The third edge server is other edge servers besides the first edge server, and the third edge server includes the second edge server. The decoding unit decodes the second attack behavior features using a decoder to obtain the second training sample.
8. The model training apparatus according to claim 7, characterized in that, The generative adversarial network includes a second discriminator, and the determining module includes: The determining unit is further configured to use the second discriminator to perform adversarial learning on the first attack behavior feature and the second attack behavior feature to determine the third attack behavior feature; The decoding unit is also used to decode the third attack behavior feature through the decoder to obtain a third training sample.
9. An electronic device, characterized in that, The device includes: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements the model training method as described in any one of claims 1-5.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions, which, when executed by a processor, implement the model training method as described in any one of claims 1-5.
Citation Information
Patent Citations
Adversarial sample detection method and universal adversarial attack defense system
CN112396129A
Adversarial attack detection method, system and device, and computer-readable storage medium
WO2022077907A1