Training sample generation method and device, target model training method and device and malicious traffic identification method and device

By decoupling features and performing high-precision screening on malicious samples that large models fail to identify, diverse training samples are generated. This solves the problem of insufficient accuracy and generalization ability of large models in identifying malicious traffic, and achieves efficient model optimization and continuous defense.

CN121940179APending Publication Date: 2026-04-28BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING BAIDU NETCOM SCI & TECH CO LTD
Filing Date
2026-01-14
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Existing large models struggle to effectively cover complex attack scenarios in malicious traffic identification, resulting in insufficient identification accuracy and generalization ability. The adversarial examples generated by traditional data augmentation techniques have simple logical structures and high repetition, which affects the model's learning effect.

Method used

By decoupling the features of malicious samples that the target model fails to identify correctly, diverse candidate training samples are generated. The deep semantic features after feature decoupling are used to generate diverse target training samples. High-value samples are selected for optimization training by combining orthogonal mutation strategy and high-precision teacher model.

Benefits of technology

It improves the recognition accuracy and generalization ability of large models, reduces the cost of manual analysis, enables rapid response to new attacks and continuous iteration of model defense capabilities, and shortens the exposure window of security threats.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121940179A_ABST
    Figure CN121940179A_ABST
Patent Text Reader

Abstract

The invention provides a training sample generation method and device, a target model training method and device and a malicious traffic recognition method and device, and relates to the field of artificial intelligence such as deep learning, large model and natural language processing. The training sample generation method comprises the following steps: acquiring each original training sample, wherein the original training samples are malicious samples which cannot be correctly recognized by a target model; performing feature decoupling on each original training sample to obtain a feature set corresponding to each original training sample, the feature set comprising M semantic features; generating N candidate training samples according to each feature set, wherein M and N are positive integers greater than 1; and determining a target training sample from the candidate training samples, wherein the target training sample is used for performing optimization training on the target model. According to the scheme, the recognition accuracy of the target model can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of artificial intelligence technology, particularly to deep learning, large models, and natural language processing, and especially to training sample generation and target model training.

[0002] And methods and devices for identifying malicious traffic. Background Technology

[0003] With the development of technology, large language models (LLMs) have been widely used in various scenarios, such as malicious traffic identification models. To improve the performance of large language models, data augmentation techniques can be used to optimize their training. Summary of the Invention

[0004] This disclosure provides methods and apparatus for generating training samples, training target models, and identifying malicious traffic.

[0005] A training sample generation method, comprising:

[0006] Obtain each original training sample, which is a malicious sample that the target model failed to identify correctly;

[0007] Each original training sample is decoupled from its features to obtain a feature set corresponding to each original training sample, wherein the feature set includes M semantic features;

[0008] N candidate training samples are generated based on each feature set, where M and N are both positive integers greater than 1;

[0009] A target training sample is determined from each candidate training sample, and the target training sample is used to optimize the training of the target model.

[0010] A method for training a target model, comprising:

[0011] Obtain the target training sample, which is generated according to the above training sample generation method;

[0012] The target model is optimized and trained using the target training samples.

[0013] A method for identifying malicious traffic includes:

[0014] Obtain the traffic to be identified;

[0015] The traffic to be identified is identified using a target model to obtain an identification result, which is either malicious or non-malicious traffic. The target model is a model optimized and trained using target training samples, which are generated according to the above-described training sample generation method.

[0016] A training sample generation device includes: a preprocessing module, a feature decoupling module, a candidate generation module, and a target mining module;

[0017] The preprocessing module is used to obtain each original training sample, which is a malicious sample that the target model failed to identify correctly;

[0018] The feature decoupling module is used to decouple the features of each original training sample to obtain a feature set corresponding to each original training sample. The feature set includes M semantic features.

[0019] The candidate generation module is used to generate N candidate training samples based on each feature set, where M and N are both positive integers greater than 1;

[0020] The target mining module is used to determine the target training sample from each candidate training sample, and the target training sample is used to optimize the training of the target model.

[0021] A target model training device includes: a sample acquisition module and a model training module;

[0022] The sample acquisition module is used to acquire target training samples, which are generated according to the above-described training sample generation method.

[0023] The model training module is used to optimize and train the target model using the target training samples.

[0024] A malicious traffic identification device includes: a traffic acquisition module and a traffic identification module;

[0025] The traffic acquisition module is used to acquire the traffic to be identified;

[0026] The traffic identification module is used to identify the traffic to be identified using a target model and obtain an identification result, wherein the identification result is malicious traffic or non-malicious traffic. The target model is a model optimized and trained using target training samples, and the target training samples are generated according to the above-mentioned training sample generation method.

[0027] An electronic device, comprising:

[0028] At least one processor; and

[0029] A memory communicatively connected to the at least one processor; wherein,

[0030] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method described above.

[0031] A non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the methods described above.

[0032] A computer program product includes a computer program / instructions that, when executed by a processor, implement the method described above.

[0033] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0034] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0035] Figure 1 This is a flowchart of the first embodiment of the training sample generation method described in this disclosure;

[0036] Figure 2 This is a flowchart of a second embodiment of the training sample generation method described in this disclosure;

[0037] Figure 3 This is a flowchart of an embodiment of the target model training method described in this disclosure;

[0038] Figure 4 This is a flowchart of an embodiment of the malicious traffic identification method described in this disclosure;

[0039] Figure 5 This is a schematic diagram of the composition structure of Embodiment 500 of the training sample generation device described in this disclosure;

[0040] Figure 6 This is a schematic diagram of the composition structure of Embodiment 600 of the target model training device described in this disclosure;

[0041] Figure 7 This is a schematic diagram of the composition structure of Embodiment 700 of the malicious traffic identification device described in this disclosure;

[0042] Figure 8 A schematic block diagram of an electronic device 800 that can be used to implement embodiments of the present disclosure is shown. Detailed Implementation

[0043] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0044] Furthermore, it should be understood that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0045] Figure 1 This is a flowchart of a first embodiment of the training sample generation method described in this disclosure. Figure 1 As shown, the specific implementation methods are as follows.

[0046] In step 101, each original training sample is obtained. The original training samples are malicious samples that the target model failed to identify correctly.

[0047] In step 102, feature decoupling is performed on each original training sample to obtain the feature set corresponding to each original training sample. The feature set includes M semantic features.

[0048] In step 103, N candidate training samples are generated based on each feature set, where M and N are both positive integers greater than 1.

[0049] In step 104, a target training sample is determined from each candidate training sample. The target training sample is used to optimize the training of the target model.

[0050] Traditional data augmentation techniques often employ lexical-level adversarial strategies based on synonym replacement, such as generating adversarial samples by replacing words in the original malicious sample with synonyms or perturbing characters (e.g., inserting misspellings). However, these methods mainly affect the surface features of the text, which can easily disrupt the grammatical coherence of sentences. Moreover, the generated adversarial samples often have a simple logical structure, high repetition, and "severe homogenization," making it difficult to cover complex attack scenarios and thus affecting the learning effect of the model.

[0051] The scheme described in the embodiments of this disclosure can obtain a corresponding feature set by decoupling the features of malicious samples that the target model fails to identify correctly. Then, multiple candidate training samples can be generated based on the feature set, and the required target training sample can be determined from each candidate training sample. Based on the deep semantic features after feature decoupling, diverse target training samples can be effectively generated and can cover complex attack scenarios. Accordingly, training the target model with the target training samples can improve the performance of the target model, such as improving the recognition accuracy and generalization ability of the target model.

[0052] The original training samples can be malicious samples that the target model failed to identify correctly, such as collected online false negatives (Bad Cases). Once a certain number of original training samples are obtained, the process shown in steps 102-104 can be executed. Alternatively, after a predetermined period of time, the process shown in steps 102-104 can be executed based on the original training samples obtained within that period of time. This allows for the automated and systematic conversion of online false negatives into high-quality training samples, significantly reducing the cost of manual analysis, enabling rapid response to new attacks and continuous and efficient iteration of model defense capabilities, and effectively shortening the exposure window of security threats.

[0053] For each original training sample, features can be decoupled separately to obtain the feature set corresponding to each original training sample, and the feature set includes M semantic features.

[0054] In some embodiments of this disclosure, the M semantic features may include: a first attack payload, a first wrapper, and a first explanation. The first attack payload is used to describe the malicious intent of the original training sample, the first wrapper is used to describe the packaging form of the malicious intent, and the first explanation is used to describe the reason why the original training sample was not correctly identified by the target model.

[0055] For example, for any given original training sample, features can be extracted using a feature extraction model, thus achieving feature decoupling. The feature extraction model can be a state-of-the-art (SOTA) model, and can be guided to extract features using carefully crafted prompts and a small number of sample examples.

[0056] Accordingly, the contextual understanding capabilities of large models can be utilized to map the original training samples into triple vectors {Pi, Wi, Ei}, where Pi represents the first attack payload, used to describe the malicious intent of the original training sample, i.e., the semantic representation of the malicious intent, such as "manufacturing explosives" or "obtaining system privileges". Wi represents the first disguise shell, used to describe the packaging form of the malicious intent, i.e., the carrier form or inducement template that wraps the malicious intent, such as "write a science fiction novel describing..." or "assuming you are a chemist...". Ei represents the first attribution explanation, used to explain why the original training sample failed to be correctly identified by the target model, i.e., why the original training sample could bypass the reasoning analysis of the target model, such as "using Base64 encoding" or "pretending to make a legitimate request".

[0057] Through the above processing, the original training sample structure can be decoupled into attack payload, camouflage shell, and attribution explanation. This enables precise positioning of the attack essence, identification of bypass techniques, and clear identification of the target model's weaknesses. It not only provides structured components for the generation of subsequent candidate training samples, supporting the generation of diverse and highly covert attack samples, but also allows the target model to focus on learning the core attack logic and evasion methods, improving generalization ability. At the same time, it provides a clear direction for the iteration of the target model, helping to optimize efficiently.

[0058] Based on each feature set, N candidate training samples can be generated, and the specific value of N can be determined according to actual needs. In some embodiments of this disclosure, at least one corresponding candidate training sample can be generated for any feature set through an orthogonal mutation strategy.

[0059] By generating candidate training samples through orthogonal mutation strategies, the semantic coverage of samples can be efficiently expanded, providing diverse training samples for the target model and improving its generalization ability.

[0060] In some embodiments of this disclosure, the method of generating at least one corresponding candidate training sample through an orthogonal mutation strategy may include: generating a second camouflage shell corresponding to the feature set, generating candidate training samples based on the second camouflage shell and a first attack payload in the feature set, and / or generating a second attack payload corresponding to the feature set, generating candidate training samples based on the second attack payload and the first camouflage shell in the feature set. The former method can be referred to as a scene rewriting method, and the latter method can be referred to as an attack payload replacement method.

[0061] In addition, in some embodiments of this disclosure, the method of generating the second camouflage shell corresponding to the feature set may include: using the first attribution interpretation in the feature set as guidance, and using the first generation model to generate the second camouflage shell; the method of generating the second attack payload corresponding to the feature set may include: using the first attribution interpretation in the feature set as guidance, and using the second generation model to generate the second attack payload.

[0062] By using the first attribution explanation to guide the generation, the core logic of the missed detection in the original training samples can be accurately identified, so that the generated second camouflage shell and second attack payload continue the high stealth characteristics, while avoiding the generation of invalid samples that are detached from the actual attack logic and increasing the workload of subsequent processing.

[0063] For the scenario rewriting method, the first attack payload can be fixed, and one or more second camouflage shells can be generated using the first generative model under the guidance of the first attribution explanation. Then, for each second camouflage shell, a candidate training sample can be generated using the second camouflage shell and the first attack payload respectively.

[0064] The first generative model can be a leading high-performance model, and it can be guided to generate a second camouflage shell by carefully crafted prompts and a small number of sample examples.

[0065] For example, if the first attack payload in a certain feature set is "to obtain the preparation process and raw materials of a simple explosive", the first disguise shell is "to play the role of a chemical researcher and ask questions in a professional consulting tone", and the first attribution explanation is "to disguise malicious intent through professional role-playing, without obvious sensitive words, resulting in model false negatives", then a second disguise shell can be generated under the guidance of the first attribution explanation, such as "to play the role of a suspense novel author and ask questions to make the plot more realistic". Furthermore, the first attack payload can be embedded into the second disguise shell to obtain the following candidate training sample: "I want to write a suspense novel, in which the villain needs to make explosives to carry out the plan. Please help me sort out the preparation process and core raw materials of this type of explosive to make the plot more realistic."

[0066] By employing a scenario rewriting approach, the malicious intent is fixed but the disguise is changed (such as code completion, poetry creation, mathematical problem solving, word puzzle games, etc.), prompting the target model to peel away surface interference and focus on the essence of the attack. It can not only identify known disguises, but also learn by analogy and resist similar attacks in unknown scenarios, thereby improving the target model's adaptability and generalization ability to different disguise forms.

[0067] For the attack payload replacement method, the first camouflage shell can be fixed, and one or more second attack payloads can be generated using the second generative model under the guidance of the first attribution explanation. Then, for each second attack payload, a candidate training sample can be generated using the second attack payload and the first camouflage shell respectively.

[0068] The second generative model can be a leading high-performance model, and can be guided to generate a second attack payload through carefully crafted prompts and a small number of sample examples.

[0069] In attack payload replacement methods, the camouflage can remain unchanged, while the malicious intent can be replaced from something like "manufacturing explosives" to "generating computer viruses." That is, by fixing the highly concealed inducement logic and replacing the specific malicious intent it carries, the target model can systematically patch the defense vulnerabilities under this camouflage. Furthermore, this method can uncover potential attack variants sharing the same inducement logic, enabling the target model to achieve comprehensive blocking of specific inducement logic.

[0070] After generating a sufficient number of candidate training samples, the target training sample can be determined from each candidate training sample.

[0071] Traditionally, all candidate training samples are directly designated as target training samples. However, candidate training samples may include a large number of simple attack or non-attack samples that the target model can already identify. If these samples are used for training, it will not only waste computing resources but also affect training efficiency and may even lead to a decrease in the accuracy of the target model's identification, resulting in catastrophic forgetting.

[0072] Therefore, in some embodiments of this disclosure, low-value samples that do not meet predetermined requirements can be filtered out from each candidate training sample, and the remaining candidate training samples can be determined as target training samples.

[0073] This allows for dynamic evaluation of the "value" of each candidate training sample, retaining only high-value samples, thereby enabling the mining of high-value hard negative examples, saving computational resources, and improving training efficiency and effectiveness.

[0074] Specifically, in some embodiments of this disclosure, for any candidate training sample, the confidence level of the target model in correctly identifying the candidate training sample can be obtained, and the confidence level can be compared with a first threshold (theta_high). In response to determining that the confidence level is greater than or equal to the first threshold, the candidate training sample can be identified as a low-value sample.

[0075] For example, for any candidate training sample, the target model can generate a corresponding recognition result, such as malicious or non-malicious, and simultaneously generate a corresponding confidence score. Accordingly, the confidence score can be compared with a first threshold, the specific value of which can be determined according to actual needs, such as 85%. If the confidence score is greater than or equal to the first threshold, it indicates that the target model has been able to identify the candidate training sample well. For the target model, this candidate training sample is a "simple sample," therefore it can be identified as a low-value sample and filtered out.

[0076] Through the above processing, "simple samples" that the target model can already recognize can be filtered out in advance, avoiding low-value samples from occupying training resources and improving training efficiency. At the same time, it can reduce the risk of overfitting caused by repeated learning, prevent the decision boundary of the target model from becoming solidified, and allow training to focus on high-value samples that are not yet mastered, i.e. knowledge that is currently "unknown", maximizing the training benefits per unit sample and helping the target model to iterate and optimize efficiently.

[0077] In addition, in some embodiments of this disclosure, for any candidate training sample, in response to the obtained confidence level being less than a first threshold, a teacher model can be used to generate a recognition result for the candidate training sample. The recognition accuracy of the teacher model is higher than the recognition accuracy of the target model, and the recognition accuracy of the teacher model is greater than a second threshold. In response to determining that the recognition result is a non-malicious sample, the candidate training sample can be identified as a low-value sample and filtered out. In response to determining that the recognition result is a malicious sample, the candidate training sample can be identified as a target training sample.

[0078] The teacher model can be a high-performance large-scale model. It can be guided to generate recognition results using carefully crafted prompts and a small number of sample examples. The teacher model's recognition accuracy needs to be higher than that of the target model, and it also needs to exceed a second threshold. The specific value of the second threshold can be determined based on actual needs. A teacher model typically refers to a large-scale model with a large number of parameters, a long thought process / inference time, and is unsuitable for real-time online applications, but possessing high recognition accuracy.

[0079] For any candidate training sample, if the teacher model determines it as a non-malicious sample, it means that the candidate training sample is likely not aggressive, so it can be identified as a low-value sample and filtered out. If the teacher model determines it as a malicious sample, it means that the candidate training sample is a high-value sample, so it can be retained and identified as a target training sample.

[0080] By using a high-precision teacher model for secondary verification, candidate training samples that the target model is uncertain about but are not malicious can be further filtered out, thereby avoiding invalid training samples from interfering with the training. Subsequently, the retained high-value samples can be used to optimize the training of the target model, so that the training can focus on the defense blind spots of the target model and maximize the training benefits per unit sample, helping the target model to accurately correct the decision boundary and improve the reliability of defense.

[0081] Based on the above introduction, Figure 2 This is a flowchart of a second embodiment of the training sample generation method described in this disclosure. Figure 2 As shown, the specific implementation methods are as follows.

[0082] In step 201, each original training sample is obtained. The original training samples are malicious samples that the target model failed to identify correctly.

[0083] In step 202, feature decoupling is performed on each original training sample to obtain the feature set corresponding to each original training sample. The feature set includes M semantic features.

[0084] The M semantic features may include: a first attack payload, a first camouflage shell, and a first attribution explanation. The first attack payload is used to describe the malicious intent of the original training sample, the first camouflage shell is used to describe the packaging form of the malicious intent, and the first attribution explanation is used to describe the reason why the original training sample was not correctly identified by the target model.

[0085] In step 203, at least one corresponding candidate training sample is generated based on each feature set using an orthogonal mutation strategy.

[0086] For example, for any feature set, a second camouflage shell corresponding to the feature set can be generated, and candidate training samples can be generated based on the second camouflage shell and the first attack payload in the feature set, and / or, a second attack payload corresponding to the feature set can be generated, and candidate training samples can be generated based on the second attack payload and the first camouflage shell in the feature set.

[0087] Alternatively, the first attribution explanation in the feature set can be used as a guide to generate the second camouflage shell using the first generative model. Similarly, the first attribution explanation in the feature set can be used as a guide to generate the second attack payload using the second generative model.

[0088] In step 204, for each candidate training sample, the processing shown in steps 205-208 is performed respectively.

[0089] In step 205, the confidence level of the target model in correctly identifying the candidate training sample is obtained, and it is determined whether the confidence level is greater than or equal to the first threshold. If so, step 206 is executed; otherwise, step 207 is executed.

[0090] In step 206, the candidate training sample is identified as a low-value sample and filtered out, and then the process ends.

[0091] In step 207, the teacher model is used to generate the recognition result of the candidate training sample, and it is determined whether the recognition result is a malicious sample or a non-malicious sample. If it is a malicious sample, step 208 is executed; if it is a non-malicious sample, step 206 is executed.

[0092] In step 208, the candidate training sample is determined as the target training sample, and then the process ends.

[0093] The target model can be trained using the obtained target training samples.

[0094] Accordingly, Figure 3 This is a flowchart illustrating an embodiment of the target model training method described in this disclosure. Figure 3 As shown, the specific implementation methods are as follows.

[0095] In step 301, the target training sample is obtained.

[0096] In step 302, the target model is optimized and trained using the target training samples.

[0097] Among them, the target training samples can be according to Figure 1 or Figure 2 Generated by the method shown.

[0098] In some embodiments of this disclosure, the method of optimizing the target model using target training samples may include: obtaining a first sample set, the first sample set including historical training samples of the target model, adding the target training samples to the first sample set to obtain a second sample set, and using the second sample set to perform incremental training or full retraining of the target model.

[0099] Through the above processing, the target training samples can be fused with historical training samples, thus preserving the defensive capabilities already mastered by the target model and supplementing the target model's defensive blind spots by adding new high-value difficult examples. In addition, the specific incremental training method or full retraining method can be determined according to actual needs, which is very flexible and convenient.

[0100] The optimized target model can then be applied to online traffic defense systems. Accordingly, Figure 4 This is a flowchart illustrating an embodiment of the malicious traffic identification method described in this disclosure. Figure 4 As shown, the specific implementation methods are as follows.

[0101] In step 401, the traffic to be identified is obtained.

[0102] In step 402, the target model is used to identify the traffic to be identified, and the identification result is obtained. The identification result is malicious traffic or non-malicious traffic. The target model is a model that has been optimized and trained using target training samples.

[0103] Among them, the target training samples can be according to Figure 1 or Figure 2 Generated by the method shown.

[0104] Specifically, the target model can be a malicious traffic identification model. By optimizing the training, the performance of the malicious traffic identification model can be improved, thereby improving the accuracy of the identification results.

[0105] If new online missed cases are generated, these new online missed cases can be used as the original training samples, and the process can be repeated. Figure 1 or Figure 2 The training sample generation process shown is used to generate new target training samples. Furthermore, the new target training samples can be used to further optimize and train the malicious traffic identification model, thereby forming an automated model closed-loop iteration.

[0106] Furthermore, the above example only illustrates the scenario of malicious traffic identification. In practical applications, the target model can be used in various scenarios, demonstrating broad applicability, such as intelligent customer service, educational tutoring, and protection of sensitive enterprise information. Moreover, through long-term closed-loop iteration, a large number of high-value samples and their corresponding feature sets can be accumulated. These byproducts can evolve into a structured "dynamic adversarial attack feature library." This feature library not only serves the target model but can also be used for automated red team testing within enterprises, providing enterprise regulatory departments with a standardized evaluation benchmark for the robustness of large models.

[0107] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this disclosure is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this disclosure. Secondly, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this disclosure. Furthermore, for parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0108] The above is an introduction to the method embodiments. The following describes the solution described in this disclosure further through device embodiments.

[0109] Figure 5 This is a schematic diagram of the structural composition of Embodiment 500 of the training sample generation device described in this disclosure. Figure 5 As shown, it includes: a preprocessing module 501, a feature decoupling module 502, a candidate generation module 503, and a target mining module 504.

[0110] The preprocessing module 501 is used to obtain each original training sample, which is a malicious sample that the target model failed to identify correctly.

[0111] The feature decoupling module 502 is used to decouple the features of each original training sample to obtain the feature set corresponding to each original training sample. The feature set includes M semantic features.

[0112] The candidate generation module 503 is used to generate N candidate training samples based on each feature set, where M and N are both positive integers greater than 1;

[0113] The target mining module 504 is used to determine the target training sample from each candidate training sample. The target training sample is used to optimize the training of the target model.

[0114] In some embodiments of this disclosure, the M semantic features may include: a first attack payload, a first camouflage shell, and a first attribution explanation. The first attack payload is used to describe the malicious intent of the original training sample, the first camouflage shell is used to describe the packaging form of the malicious intent, and the first attribution explanation is used to describe the reason why the original training sample failed to be correctly identified by the target model.

[0115] In some embodiments of this disclosure, the candidate generation module 503 can generate at least one corresponding candidate training sample for any feature set through an orthogonal mutation strategy.

[0116] In some embodiments of this disclosure, the candidate generation module 503 may generate at least one corresponding candidate training sample by means of an orthogonal mutation strategy, including: generating a second camouflage shell corresponding to the feature set, generating candidate training samples based on the second camouflage shell and the first attack payload in the feature set, and / or generating a second attack payload corresponding to the feature set, generating candidate training samples based on the second attack payload and the first camouflage shell in the feature set.

[0117] In addition, in some embodiments of this disclosure, the candidate generation module 503 may generate the second camouflage shell corresponding to the feature set by using the first attribution interpretation in the feature set as a guide and generating the second camouflage shell using the first generation model; the candidate generation module 503 may generate the second attack payload corresponding to the feature set by using the first attribution interpretation in the feature set as a guide and generating the second attack payload using the second generation model.

[0118] After generating a sufficient number of candidate training samples, the target mining module 504 can determine the target training sample from each candidate training sample.

[0119] In some embodiments of this disclosure, the target mining module 504 can filter out low-value samples that do not meet predetermined requirements from each candidate training sample, and can determine the remaining candidate training samples as target training samples.

[0120] Specifically, in some embodiments of this disclosure, the target mining module 504 can obtain the confidence level of the target model in correctly identifying the candidate training sample for any candidate training sample, and can compare the confidence level with a first threshold. In response to determining that the confidence level is greater than or equal to the first threshold, the candidate training sample can be identified as a low-value sample.

[0121] In addition, in some embodiments of this disclosure, for any candidate training sample, in response to the obtained confidence level being less than a first threshold, the target mining module 504 can also use the teacher model to generate the recognition result of the candidate training sample. The recognition accuracy of the teacher model is higher than the recognition accuracy of the target model, and the recognition accuracy of the teacher model is greater than a second threshold. In response to determining that the recognition result is a non-malicious sample, the candidate training sample can be identified as a low-value sample and filtered out. In response to determining that the recognition result is a malicious sample, the candidate training sample can be identified as a target training sample.

[0122] Figure 6 This is a schematic diagram of the structural composition of Embodiment 600 of the target model training device described in this disclosure. Figure 6 As shown, it includes: a sample acquisition module 601 and a model training module 602.

[0123] Sample acquisition module 601 is used to acquire target training samples, which can be selected according to... Figure 1 or Figure 2 Generated by the method shown.

[0124] The model training module 602 is used to optimize and train the target model using the target training samples.

[0125] In some embodiments of this disclosure, the model training module 602 may optimize the training of the target model using the target training samples by: obtaining a first sample set, which includes historical training samples of the target model; adding the target training samples to the first sample set to obtain a second sample set; and using the second sample set to perform incremental training or full retraining of the target model.

[0126] Figure 7 This is a schematic diagram of the structural composition of Embodiment 700 of the malicious traffic identification device described in this disclosure. Figure 7 As shown, it includes: a traffic acquisition module 701 and a traffic identification module 702.

[0127] Traffic acquisition module 701 is used to acquire traffic to be identified.

[0128] Traffic identification module 702 is used to identify traffic to be identified using a target model, and obtain an identification result, wherein the identification result is malicious traffic or non-malicious traffic. The target model is a model optimized and trained using target training samples, and the target training samples can be selected according to... Figure 1 or Figure 2 Generated by the method shown.

[0129] The specific workflow of each of the above device embodiments can be found in the relevant descriptions in the foregoing method embodiments, and will not be repeated here.

[0130] The solutions described in this disclosure can be applied to the field of artificial intelligence, particularly deep learning, large-scale models, and natural language processing. Artificial intelligence is the study of enabling computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It involves both hardware and software technologies. Artificial intelligence hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. Artificial intelligence software technologies mainly include computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graph technologies.

[0131] Furthermore, the collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0132] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0133] Figure 8 A schematic block diagram of an electronic device 800 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0134] like Figure 8As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. The RAM 803 may also store various programs and data required for the operation of the electronic device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0135] Multiple components in electronic device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of displays, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows electronic device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0136] The computing unit 801 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as those described in this disclosure. For example, in some embodiments, the methods described in this disclosure can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the methods described in this disclosure can be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the methods described herein by any other suitable means (e.g., by means of firmware).

[0137] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard parts (ASSPs), systems-on-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0138] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0139] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory (EPROM), flash memory, optical fiber, compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0140] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a cathode ray tube (CRT) or liquid crystal display (LCD) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0141] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0142] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.

[0143] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0144] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A method for generating training samples, comprising: Obtain each original training sample, which is a malicious sample that the target model failed to identify correctly; Each original training sample is decoupled from its features to obtain a feature set corresponding to each original training sample, wherein the feature set includes M semantic features; N candidate training samples are generated based on each feature set, where M and N are both positive integers greater than 1; A target training sample is determined from each candidate training sample, and the target training sample is used to optimize the training of the target model.

2. The method according to claim 1, wherein, The M semantic features include: a first attack payload, a first camouflage shell, and a first attribution explanation; the first attack payload is used to describe the malicious intent of the original training sample, the first camouflage shell is used to describe the packaging form of the malicious intent, and the first attribution explanation is used to describe the reason why the original training sample was not correctly identified by the target model.

3. The method according to claim 2, wherein, The step of generating N candidate training samples based on each feature set includes: For any feature set, at least one corresponding candidate training sample is generated using an orthogonal mutation strategy.

4. The method according to claim 3, wherein, The step of generating at least one corresponding candidate training sample through an orthogonal mutation strategy includes: Generate a second camouflage shell corresponding to the feature set, and generate the candidate training samples based on the second camouflage shell and the first attack payload in the feature set; And / or, generate a second attack payload corresponding to the feature set, and generate the candidate training samples based on the second attack payload and the first camouflage shell in the feature set.

5. The method according to claim 4, wherein, The step of generating the second camouflage shell corresponding to the feature set includes: using the first attribution explanation in the feature set as a guide, and using the first generation model to generate the second camouflage shell; The step of generating the second attack payload corresponding to the feature set includes: using the first attribution explanation in the feature set as a guide, and generating the second attack payload using a second generative model.

6. The method according to claim 1, wherein, The process of determining the target training sample from each candidate training sample includes: Low-value samples that do not meet the predetermined requirements are filtered out from each candidate training sample, and the remaining candidate training samples are determined as the target training samples.

7. The method according to claim 5, wherein, The process of filtering out low-value samples that do not meet the predetermined requirements from each candidate training sample includes: For any candidate training sample, obtain the confidence level of the target model in correctly identifying the candidate training sample; The confidence level is compared with a first threshold, and in response to determining that the confidence level is greater than or equal to the first threshold, the candidate training sample is identified as the low-value sample.

8. The method according to claim 7, further comprising: In response to determining that the confidence level is less than the first threshold, the recognition result of the candidate training sample is generated using the teacher model, wherein the recognition accuracy of the teacher model is higher than the recognition accuracy of the target model, and the recognition accuracy of the teacher model is greater than the second threshold; In response to determining that the identification result is a non-malicious sample, the candidate training sample is identified as the low-value sample; In response to determining that the identification result is a malicious sample, the candidate training sample is determined as the target training sample.

9. A method for training a target model, comprising: Obtain target training samples, wherein the target training samples are generated according to the method of any one of claims 1-8; The target model is optimized and trained using the target training samples.

10. The method according to claim 9, wherein, The step of optimizing the target model using the target training samples includes: Obtain a first sample set, which includes historical training samples of the target model; The target training samples are added to the first sample set to obtain the second sample set; The target model is then subjected to incremental training or full retraining using the second sample set.

11. A method for identifying malicious traffic, comprising: Obtain the traffic to be identified; The traffic to be identified is identified using a target model to obtain an identification result, which is either malicious traffic or non-malicious traffic. The target model is a model optimized and trained using target training samples, which are generated according to any one of claims 1-8.

12. A training sample generation apparatus, comprising: The module consists of a preprocessing module, a feature decoupling module, a candidate generation module, and a target mining module. The preprocessing module is used to obtain each original training sample, which is a malicious sample that the target model failed to identify correctly; The feature decoupling module is used to decouple the features of each original training sample to obtain a feature set corresponding to each original training sample. The feature set includes M semantic features. The candidate generation module is used to generate N candidate training samples based on each feature set, where M and N are both positive integers greater than 1; The target mining module is used to determine the target training sample from each candidate training sample, and the target training sample is used to optimize the training of the target model.

13. A target model training device, comprising: Sample acquisition module and model training module; The sample acquisition module is used to acquire target training samples, wherein the target training samples are generated according to the method of any one of claims 1-8; The model training module is used to optimize and train the target model using the target training samples.

14. A malicious traffic identification device, comprising: Traffic acquisition module and traffic identification module; The traffic acquisition module is used to acquire the traffic to be identified; The traffic identification module is used to identify the traffic to be identified using a target model and obtain an identification result, wherein the identification result is malicious traffic or non-malicious traffic, and the target model is a model optimized and trained using target training samples, wherein the target training samples are generated according to the method of any one of claims 1-8.

15. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the method according to any one of claims 1-11.

16. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-11.

17. A computer program product comprising a computer program / instructions that, when executed by a processor, implement the method of any one of claims 1-11.