A security detection model construction method and system based on fine-grained gating mechanism
By introducing a fine-grained gating mechanism and an attention gating module into the security detection model, the multi-level interactive features of network traffic information are extracted, which solves the problem of insufficient detection accuracy in the existing technology and achieves higher quality network security. Information representation and detection accuracy.
Patent Information
- Application Number
- CN202410993243.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-07-24
AI Technical Summary
Existing technology is difficult to mine the fine-grained and multi-level interactive relationships of network information, resulting in insufficient accuracy in network security information detection.
Using a security detection model based on a fine-grained gating mechanism, through the attention gating module and the judgment module, the multi-level, fine-grained interactive joint content features of network traffic information are extracted to generate a robust network security information representation for computer use. Network security testing.
It improves the accuracy and generalization ability of network security detection, can better capture multi-level interactive relationships in traffic information data, generates high-quality feature representation, and achieves more accurate classification of network traffic features.
Smart Images

Figure CN118523967B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer information security technology, and in particular to a security detection model construction method and system based on a fine-grained gating mechanism. Background Art
[0002] With the development of computer Internet technology and Internet of Things technology, the importance of network security has become increasingly prominent. The continuous improvement of the interconnectivity and interoperability of computer systems has not only improved the convenience of our daily lives, but also opened up a channel for criminals to exploit network vulnerabilities. Efficient and accurate network information detection algorithms are an important means to protect computers from increasingly frequent and complex network attacks. Therefore, automated detection of network information has become a hot research topic in the current field of computer network security. Among them, deep learning technology stands out with its powerful implicit relationship mining and pattern mining capabilities. In response to the existing automatic detection technology of network information assisted by deep learning technology, this paper proposes a security detection model construction method based on fine-grained gating mechanism. This technology aims at the problem that the existing technology is difficult to mine fine-grained and multi-level network information. While refining the content of network information, it designs multi-level interactive attention-gating units to mine the fine-grained interactive relationship of network information and then generate robust and complete information attribute network security information representation, which can provide an important solution reference for computer network security detection and analysis. Summary of the invention
[0003] In view of the deficiencies in the prior art, the present invention develops a method and system for constructing a security detection model based on a fine-grained gating mechanism. The present invention can mine the fine-grained interactive relationship of network information and then generate a robust network security information representation with complete information attributes, which can provide an important solution reference for computer network security detection and analysis.
[0004] The technical solution of the present invention to solve the technical problem is:
[0005] A method for constructing a security detection model based on a fine-grained gating mechanism includes the following steps:
[0006] S1, create a dataset containing network traffic information;
[0007] S2. Preprocess the network traffic information in the dataset to obtain a fine-grained content feature sequence that can be read by a computer. ;
[0008] S3. Build a security detection model: The security monitoring model includes an attention gating module and a judgment module. First, the fine-grained content feature sequence Input to the attention gating module to obtain multi-level, fine-grained interactive joint content features , and then combine the multi-level, fine-grained interactive joint content features Input to the judgment module to get the prediction label of whether it is security information ;
[0009] S4. Train and optimize the security detection model to obtain the optimal value corresponding to the trainable parameters, and input the optimal value into the security detection model to obtain the final prediction label , determine whether to issue an alarm based on the final predicted label.
[0010] In a specific implementation manner, step S1 is specifically as follows:
[0011] The dataset contains Network traffic information , , express Network traffic information The Bit network traffic information, Indicates the amount of network traffic information.
[0012] In a specific implementation manner, step S2 is specifically as follows:
[0013] Network traffic information in the dataset Preprocessing includes data standardization and unified representation dimension operations. Processed into a computer-readable sequence of fine-grained content features , Represents a fine-grained content feature sequence The The preprocessing process is as follows:
[0014] ,
[0015] in, represents the trainable parameters in the preprocessing process, Data standardization and unified representation dimension operations during representation and processing.
[0016] In a specific implementation manner, step S3 is specifically as follows:
[0017] The fine-grained content feature sequence output after preprocessing Input to the attention gate module, through the operation of the attention gate control module Fine-grained content feature sequences Trainable parameters in the attention gate control module Calculate and output the multi-level interactive joint content features ;
[0018] The overall calculation process of the attention gating module is expressed as:
[0019] .
[0020] In a specific implementation, the specific calculation process of the attention gating module is as follows:
[0021] The attention gating module consists of Attention gate layer Each attention gating layer consists of Attention gating units that interact in parallel The fine-grained content feature sequence output after preprocessing Input to the first layer attention gate layer to receive, output As the input of the second layer, The attention gating layer receives the Output of the layer As input, The attention gating layer Attention Gating Unit Based on the content characteristics of the current location As the main feature, with the content features of other locations As a supplementary feature, it captures its fine-grained interaction relationship and merges it into the current Attention Gating Unit Output ,in, , , , capturing content features at other locations through interactive attention mechanisms Content features related to current location The interactive relationship, and then the content features of other locations Apply a gating mechanism to control the inflow of information;
[0022] The specific calculation process is as follows:
[0023] ,
[0024] ,
[0025] ,
[0026] ,
[0027] ,
[0028] ,
[0029] ,
[0030] in, represents the query variable generated by linear transformation of the i-th content feature in the m-th attention gating layer, represents the key-value variable generated by linear transformation of the j-th content feature in the m-th attention gating layer, represents the value variable generated by linear transformation of the j-th content feature in the m-th attention gating layer, and They represent the i-th and j-th learnable weight matrices in the linear transformation process of the m-th attention gating layer, respectively. and They represent the i-th and j-th bias matrices in the linear transformation process of the m-th attention gating layer, respectively. represents the activation function in the linear transformation process, Represents the representation dimension of content features after linear transformation, represents the attention score of the jth content feature to the ith content feature in the mth attention gating layer, represents the interaction feature between the jth content feature and the ith content feature in the mth attention gating layer, represents the gating score in the mth attention gating layer to control the amount of interaction features flowing into the content features of the current position, represents the transformation weight matrix of the jth content feature to the ith content feature in the mth attention gating layer, represents the gated transformation bias matrix of the jth content feature to the ith content feature in the mth attention gating layer, Represents a splicing operation, represents the activation function in the gated transformation, represents the output of the i-th attention gating unit in the m+1-th attention gating layer;
[0031] Each attention gate unit captures the current position content features with fine-grained interactivity , and the output of this layer As the input of the next attention gating layer, the above operation is repeated many times until the multi-level, fine-grained interactive content feature output is captured ;
[0032] Then the output of the last layer, the M-layer attention gating layer, is To merge, Joint content features for representing multiple levels of interactivity;
[0033] .
[0034] In a specific implementation, the multi-level, fine-grained interactive joint content features output by the attention gating module are Input to the judgment module to obtain the prediction label used to determine whether it is security information , the calculation process of the judgment module can be expressed as:
[0035] ,
[0036] in, Indicates the operation of the judgment module. Represents the trainable parameters of the judgment module.
[0037] In a specific implementation manner, step S4 is specifically as follows:
[0038] The Adam optimizer is used to train the security detection model and set parameters, including the number of bits of network traffic information in the dataset. , a single attention gating layer in the attention gating module Number of layers , training batch size, initial learning rate, learning rate decay period, and training period of Adam optimizer;
[0039] At the same time, classification loss is used to optimize the model architecture and optimize the trainable parameters contained in the safety monitoring model. The calculation is as follows:
[0040] ,
[0041] ,
[0042] in, represents the classification loss, represents the fitted data distribution, represents the real data distribution, represents the real data label, Represents a minimize operation. Represents trainable parameters The corresponding optimal value;
[0043] The optimal value corresponding to the obtained trainable parameter Input to the security detection model to output the optimized final prediction label for determining whether it is security information , according to the predicted label The result determines whether to issue an alarm.
[0044] The present invention also provides a security detection model construction system based on a fine-grained gating mechanism, which executes a security detection model construction method based on a fine-grained gating mechanism, specifically including the following modules:
[0045] Data processing module: creates a data set containing network traffic information, and preprocesses the network traffic information in the data set to obtain a fine-grained content feature sequence that can be read by a computer;
[0046] Attention gating module: processes the fine-grained content feature sequence to obtain multi-level, fine-grained interactive joint content features;
[0047] Judgment module: By processing the multi-level, fine-grained interactive joint content features, a prediction label is obtained to determine whether it is security information. ;
[0048] Training and optimization module: training and optimizing the attention gating module and judgment module;
[0049] Instruction output module: The input data is re-calculated according to the output of the training optimization module to obtain the final prediction label, and then it is determined whether to issue an alarm based on the final prediction label.
[0050] The effects provided in the content of the invention are only the effects of the embodiments, rather than all the effects of the invention. The above technical solution has the following advantages or beneficial effects:
[0051] The present invention divides network traffic features from a fine-grained perspective and performs corresponding fine-grained feature extraction, combines interactive attention units and gated computing units to extract fine-grained, multi-level interactive joint content features of network traffic features, can capture multi-level interactive relationships in traffic information data, and generate high-quality, robust feature representations based on its fine-grained traffic content for network security detection, improves the overall generalization and representation capabilities of the model, and can better learn robust joint content features. The network security detection classification technology implemented in this way can classify network traffic features more accurately, thereby providing an important reference for analyzing and managing network security. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention.
[0053] Figure 1 Schematic diagram of the structure of the attention gating layer in the present invention.
[0054] Figure 2 A line diagram showing the impact of the number of attention gate network layers on the overall model performance. DETAILED DESCRIPTION
[0055] The following description further describes the specific details of the present invention for a full understanding of the present invention. The terms used in the description of the present invention are only used to illustrate the advantages and features of the present invention and are not intended to limit the present invention.
[0056] Example 1
[0057] A method for constructing a security detection model based on a fine-grained gating mechanism includes the following steps:
[0058] S1, create a dataset containing network traffic information;
[0059] S2. Preprocess the network traffic information in the dataset to obtain a fine-grained content feature sequence that can be read by a computer. ;
[0060] S3. Build a security detection model: The security monitoring model includes an attention gating module and a judgment module. First, the fine-grained content feature sequence Input to the attention gating module to obtain multi-level, fine-grained interactive joint content features , and then combine the multi-level, fine-grained interactive joint content features Input to the judgment module to get the prediction label of whether it is security information ;
[0061] S4. Train and optimize the security detection model to obtain the optimal value corresponding to the trainable parameters, and input the optimal value into the security detection model to obtain the final prediction label , determine whether to issue an alarm based on the final predicted label.
[0062] In a specific implementation manner, step S1 is specifically as follows:
[0063] The dataset contains Network traffic information , , express Network traffic information The Bit network traffic information, Indicates the amount of network traffic information.
[0064] In a specific implementation manner, step S2 is specifically as follows:
[0065] Network traffic information in the dataset Preprocessing includes data standardization and unified representation dimension operations. Processed into a computer-readable sequence of fine-grained content features , Represents a fine-grained content feature sequence The The preprocessing process is as follows:
[0066] ,
[0067] in, represents the trainable parameters in the preprocessing process, Data standardization and unified representation dimension operations during representation and processing.
[0068] In a specific implementation manner, step S3 is specifically as follows:
[0069] The fine-grained content feature sequence output after preprocessing Input to the attention gate module, through the operation of the attention gate control module Fine-grained content feature sequences Trainable parameters in the attention gate control module Calculate and output the multi-level interactive joint content features ;
[0070] The overall calculation process of the attention gating module is expressed as:
[0071] .
[0072] In a specific implementation manner, Figure 1 As shown in Figure 2, the specific calculation process of the attention gating module is as follows:
[0073] The attention gating module consists of Attention gate layer Each attention gating layer consists of Attention gating units that interact in parallel The fine-grained content feature sequence output after preprocessing Input to the first layer attention gate layer to receive, output As the input of the second layer, The attention gating layer receives the Output of the layer As input, The attention gating layer Attention Gating Unit Based on the content characteristics of the current location As the main feature, with the content features of other locations As a supplementary feature, it captures its fine-grained interaction relationship and merges it into the current Attention Gating Unit Output ,in, , , , capturing content features at other locations through interactive attention mechanisms Content features related to current location The interactive relationship, and then the content features of other locations Apply a gating mechanism to control the inflow of information;
[0074] The specific calculation process is as follows:
[0075] ,
[0076] ,
[0077] ,
[0078] ,
[0079] ,
[0080] ,
[0081] ,
[0082] in, represents the query variable generated by linear transformation of the i-th content feature in the m-th attention gating layer, represents the key-value variable generated by linear transformation of the j-th content feature in the m-th attention gating layer, represents the value variable generated by linear transformation of the j-th content feature in the m-th attention gating layer, and They represent the i-th and j-th learnable weight matrices in the linear transformation process of the m-th attention gating layer, respectively. and They represent the i-th and j-th bias matrices in the linear transformation process of the m-th attention gating layer, respectively. represents the activation function in the linear transformation process, Represents the representation dimension of content features after linear transformation, represents the attention score of the jth content feature to the ith content feature in the mth attention gating layer, represents the interaction feature between the jth content feature and the ith content feature in the mth attention gating layer, represents the gating score in the mth attention gating layer to control the amount of interaction features flowing into the content features of the current position, represents the transformation weight matrix of the jth content feature to the ith content feature in the mth attention gating layer, represents the gated transformation bias matrix of the jth content feature to the ith content feature in the mth attention gating layer, Represents a splicing operation, represents the activation function in the gated transformation, represents the output of the i-th attention gating unit in the m+1-th attention gating layer;
[0083] Each attention gate unit captures the current position content features with fine-grained interactivity , and the output of this layer As the input of the next attention gating layer, the above operation is repeated many times until the multi-level, fine-grained interactive content feature output is captured ;
[0084] Then the output of the last layer, the M-layer attention gating layer, is To merge, Joint content features for representing multiple levels of interactivity;
[0085] .
[0086] In a specific implementation, the multi-level, fine-grained interactive joint content features output by the attention gating module are Input to the judgment module to obtain the prediction label used to determine whether it is security information , the calculation process of the judgment module can be expressed as:
[0087] ,
[0088] in, Indicates the operation of the judgment module. Represents the trainable parameters of the judgment module.
[0089] In a specific implementation manner, step S4 is specifically as follows:
[0090] The Adam optimizer is used to train the security detection model and set parameters, including the number of bits of network traffic information in the dataset. , a single attention gating layer in the attention gating module Number of layers , training batch size, initial learning rate, learning rate decay period, and training period of Adam optimizer;
[0091] At the same time, classification loss is used to optimize the model architecture and optimize the trainable parameters contained in the safety monitoring model. The calculation is as follows:
[0092] ,
[0093] ,
[0094] in, represents the classification loss, represents the fitted data distribution, represents the real data distribution, represents the real data label, Represents a minimize operation. Represents trainable parameters The corresponding optimal value;
[0095] The optimal value corresponding to the obtained trainable parameter Input to the security detection model to output the optimized final prediction label for determining whether it is security information , according to the predicted label The final prediction label is To predict the label The update of the optimal value corresponding to the trainable parameter is input into the attention gating module and the judgment module, and the original prediction label The result is overwritten by the new predicted label, and the final predicted label is obtained, which is recorded as .
[0096] Example 2
[0097] In order to prove the technical effect of the method in the present invention, the fine-grained gating algorithm AGULS proposed in the present invention is compared with other methods in the prior art. As shown in Table 1, the present invention is compared with the prior art in six aspects: Accuracy overall classification accuracy, Attack attack samples, NO-Attack non-attack samples, Precision accuracy, Recall recall rate and F1 score. It can be seen from the data in Table 1 that the results in the present invention are better than other methods. Therefore, the present invention can more accurately realize the classification of network traffic features.
[0098] Table 1 Comparative experimental results of the fine-grained gating algorithm AGULS in the present invention and other methods in the prior art
[0099]
[0100] Example 3
[0101] The present invention also conducted an ablation experiment, as shown in Table 2, comparing the results of three cases: without attention unit w / o att, without gating unit w / o gu, and with attention unit and gating unit w / att&gu algorithm. The algorithm with attention unit and gating unit w / att&gu is the method used in the present invention. Through the ablation experiment in Table 2, it can be seen that adding the attention gating unit in the present invention can help improve the performance of the overall model.
[0102] Table 2 Ablation experiment results
[0103]
[0104] Example 4
[0105] In order to determine the optimal number of attention gating network layers, this paper studies the impact of the number of attention gating network layers on the overall model performance. The research results are as follows: Figure 2 As shown by Figure 2 It can be seen that the performance of the entire model reaches the best when the number of attention gate network layers is set to 3, so the number of attention gate network layers is set to 3.
[0106] Example 5
[0107] The present invention also provides a security detection model construction system based on a fine-grained gating mechanism, which executes a security detection model construction method based on a fine-grained gating mechanism, specifically including the following modules:
[0108] Data processing module: creates a data set containing network traffic information, and preprocesses the network traffic information in the data set to obtain a fine-grained content feature sequence that can be read by a computer;
[0109] Attention gating module: processes the fine-grained content feature sequence to obtain multi-level, fine-grained interactive joint content features;
[0110] Judgment module: By processing the multi-level, fine-grained interactive joint content features, a prediction label is obtained to determine whether it is security information. ;
[0111] Training and optimization module: training and optimizing the attention gating module and judgment module;
[0112] Instruction output module: The input data is re-calculated according to the output of the training optimization module to obtain the final prediction label, and then it is determined whether to issue an alarm based on the final prediction label.
[0113] Although the above describes the specific implementation mode of the invention in conjunction with the drawings, it is not intended to limit the scope of protection of the invention. Based on the technical solution of the present invention, various modifications or variations that can be made by those skilled in the art without creative work are still within the scope of protection of the present invention.
Claims
1. A method for constructing a security detection model based on a fine-grained gating mechanism, characterized in that: The steps include: S1, create a dataset containing network traffic information; S2. Preprocess the network traffic information in the dataset to obtain a fine-grained content feature sequence that can be read by a computer. ; S3. Build a security detection model: The security monitoring model includes an attention gating module and a judgment module. First, the fine-grained content feature sequence Input to the attention gating module to obtain multi-level, fine-grained interactive joint content features , and then combine the multi-level, fine-grained interactive joint content features Input to the judgment module to get the prediction label of whether it is security information ; Step S3 is as follows: The fine-grained content feature sequence output after preprocessing Input to the attention gate module, through the operation of the attention gate control module Fine-grained content feature sequences Trainable parameters in the attention gate control module Calculate and output the multi-level interactive joint content features ; The overall calculation process of the attention gating module is expressed as: ; The specific calculation process of the attention gating module is as follows: The attention gating module consists of Attention gate layer Each attention gating layer consists of Attention gating units that interact in parallel The fine-grained content feature sequence output after preprocessing Input to the first layer attention gate layer to receive, output As the input of the second layer, The attention gating layer receives the Output of the layer As input, The attention gating layer Attention Gating Unit Based on the content characteristics of the current location As the main feature, with the content features of other locations As a supplementary feature, it captures its fine-grained interaction relationship and merges it into the current Attention Gating Unit Output ,in, , , , capturing content features at other locations through interactive attention mechanisms Content features related to the current location The interactive relationship, and then the content features of other locations Apply a gating mechanism to control the inflow of information; The specific calculation process is as follows: , , , , , , , in, represents the query variable generated by linear transformation of the i-th content feature in the m-th attention gating layer, represents the key-value variable generated by linear transformation of the j-th content feature in the m-th attention gating layer, represents the value variable generated by linear transformation of the j-th content feature in the m-th attention gating layer, and They represent the i-th and j-th learnable weight matrices in the linear transformation process of the m-th attention gating layer, respectively. and They represent the i-th and j-th bias matrices in the linear transformation process of the m-th attention gating layer, respectively. represents the activation function in the linear transformation process, Represents the representation dimension of content features after linear transformation, represents the attention score of the jth content feature to the ith content feature in the mth attention gating layer, represents the interaction feature between the jth content feature and the ith content feature in the mth attention gating layer, represents the gating score in the mth attention gating layer to control the amount of interaction features flowing into the content features of the current position, represents the transformation weight matrix of the jth content feature to the ith content feature in the mth attention gating layer, represents the gated transformation bias matrix of the jth content feature to the ith content feature in the mth attention gating layer, Represents a splicing operation, represents the activation function in the gated transformation, represents the output of the i-th attention gating unit in the m+1-th attention gating layer; Each attention gate unit captures the current position content features with fine-grained interactivity , and the output of this layer As the input of the next attention gating layer, the above operation is repeated many times until the multi-level, fine-grained interactive content feature output is captured ; Then the output of the last layer, the M-layer attention gating layer, is To merge, Joint content features for representing multiple levels of interactivity; ; The multi-level, fine-grained interactive joint content features output by the attention gating module Input to the judgment module to obtain the prediction label used to determine whether it is security information , the calculation process of the judgment module can be expressed as: , in, Indicates the operation of the judgment module. Represents the trainable parameters of the judgment module; S4. Train and optimize the security detection model to obtain the optimal value corresponding to the trainable parameters, and input the optimal value into the security detection model to obtain the final prediction label , determine whether to issue an alarm based on the final predicted label.
2. According to the method for constructing a security detection model based on a fine-grained gating mechanism according to claim 1, it is characterized in that: Step S1 is specifically as follows: The dataset contains Network traffic information , , express Network traffic information The Bit network traffic information, Indicates the amount of network traffic information.
3. The method for constructing a security detection model based on a fine-grained gating mechanism according to claim 2 is characterized in that: Step S2 is specifically as follows: Network traffic information in the dataset Preprocessing includes data standardization and unified representation dimension operations. Processed into a computer-readable sequence of fine-grained content features , Represents a fine-grained content feature sequence The The preprocessing process is as follows: , in, represents the trainable parameters in the preprocessing process, Data standardization and unified representation dimension operations during representation and processing.
4. The method for constructing a security detection model based on a fine-grained gating mechanism according to claim 3 is characterized in that: Step S4 is specifically as follows: The Adam optimizer is used to train the security detection model and set parameters, including the number of bits of network traffic information in the dataset. , a single attention gating layer in the attention gating module Number of layers , training batch size, initial learning rate, learning rate decay period, and training period of Adam optimizer; At the same time, classification loss is used to optimize the model architecture and optimize the trainable parameters contained in the safety monitoring model. The calculation is as follows: , , in, represents the classification loss, represents the fitted data distribution, represents the real data distribution, represents the real data label, Represents a minimize operation. Represents trainable parameters The corresponding optimal value; The optimal value corresponding to the obtained trainable parameter Input to the security detection model to output the optimized final prediction label for determining whether it is security information , according to the predicted label The result determines whether to issue an alarm.
5. A security detection model construction system based on fine-grained gating mechanism, characterized in that: A method for constructing a security detection model based on a fine-grained gating mechanism according to any one of claims 1 to 4 is implemented, specifically comprising the following modules: Data processing module: creates a data set containing network traffic information, and preprocesses the network traffic information in the data set to obtain a fine-grained content feature sequence that can be read by a computer; Attention gating module: processes the fine-grained content feature sequence to obtain multi-level, fine-grained interactive joint content features; Judgment module: By processing the multi-level, fine-grained interactive joint content features, a prediction label is obtained to determine whether it is security information. ; Training and optimization module: training and optimizing the attention gating module and judgment module; Instruction output module: The input data is re-calculated according to the output of the training optimization module to obtain the final prediction label, and then it is determined whether to issue an alarm based on the final prediction label.
