A method and device for generating flow characteristic vector

By calculating and splicing the contribution values ​​of the upstream network, targeted traffic feature vectors are generated, which solves the problem of increased downstream network training time caused by universal traffic feature vectors, improves efficiency, and enhances network threat identification capabilities.

CN118264624BActive Publication Date: 2024-08-23BEIJING CHAITIN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410673991.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-28
Publication Date
2024-08-23
Estimated Expiration
2044-05-28

AI Technical Summary

Technical Problem

The existing general traffic feature vectors are not targeted, which increases the training time of the downstream network and reduces the detection efficiency.

Method used

By obtaining the values ​​corresponding to the dimensions of the network traffic sequence of the upstream network, calculating the contribution value, and splicing it with the traffic feature vector of the downstream task, a targeted traffic feature vector is generated for training the downstream network, reducing the feature extraction and conversion process.

Benefits of technology

It reduces the training time and complexity of downstream networks, improves training efficiency, and better describes network traffic sequences through targeted feature vectors, enhancing the identification and defense capabilities of network threats.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118264624B
    Figure CN118264624B
Patent Text Reader

Abstract

The embodiment of the present application provides a method and device for generating a traffic feature vector, obtaining a numerical value corresponding to a dimension of a network traffic sequence of an upstream network; obtaining a first contribution value of the numerical value, the first contribution value being the contribution value of the numerical value in the current round of training of the upstream network; adding each first contribution value of the numerical value to obtain a second contribution value of the numerical value, the second contribution value being the contribution value of the numerical value in the training phase of the upstream network; adding the second contribution value of each numerical value to obtain a total contribution value of the dimension in the training phase; sorting the total contribution value of each dimension in order from large to small, and concatenating the numerical values ​​of the dimensions in the first N places of the sorting to obtain a first vector; concatenating the first vector with the first traffic feature vector of the downstream task to generate a second traffic feature vector of the downstream network for training the downstream task, the first traffic feature vector being a pre-stored traffic feature vector. The embodiment of the present application is conducive to improving the training efficiency of the downstream network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application belong to the field of Internet technology, and in particular, relate to a method and device for generating a traffic feature vector. Background Art

[0002] Downstream tasks are the key link for deep learning technology to move from theory to practical application. Through the application of downstream tasks, deep learning models can produce practical results, meet user needs, and thus bring value to society.

[0003] The downstream task uses a general traffic feature vector, which is not targeted and will increase the training time of the downstream network of the downstream task, which is not conducive to improving the detection efficiency of the downstream network. Therefore, how to generate the traffic feature vector of the downstream network is an urgent problem to be solved. Summary of the invention

[0004] The embodiments of the present application provide a method and device for generating a traffic feature vector to solve the technical problem that the generation process of the above-mentioned existing application packages is complicated and is not conducive to improving the generation efficiency of the application packages.

[0005] In a first aspect, an embodiment of the present application provides a method for generating a traffic feature vector, which is applied to an electronic device, and the method comprises: obtaining a numerical value corresponding to a dimension of a network traffic sequence of an upstream network;

[0006] Obtaining a first contribution value of the numerical value, where the first contribution value is a contribution value of the numerical value in this round of training of the upstream network;

[0007] Adding each of the first contribution values ​​of the numerical value to obtain a second contribution value of the numerical value, where the second contribution value is a contribution value of the numerical value in the training phase of the upstream network;

[0008] Adding the second contribution value of each of the numerical values ​​to obtain a total contribution value of the dimension in the training stage;

[0009] Sort the total contribution value of each dimension in descending order, and concatenate the values ​​of the first N dimensions to obtain a first vector;

[0010] The first vector is concatenated with the first traffic feature vector of the downstream task to generate a second traffic feature vector for training the downstream network of the downstream task, wherein N is a positive integer and the first traffic feature vector is a pre-stored traffic feature vector.

[0011] The beneficial effects of the embodiment of the present application lie in two aspects. On the one hand, the first vector is concatenated with the first traffic characteristic vector of the downstream task to generate a second traffic characteristic vector for training the downstream network of the downstream task. Since the second traffic characteristic vector of the downstream network is targeted, it can reduce the training time of the downstream network of the downstream task, which is beneficial to improving the training efficiency of the downstream network. On the other hand, based on the second traffic characteristic vector of the downstream network, the amount of data that needs to be processed by the downstream network is reduced, the complexity of the downstream network training is reduced, and it is beneficial to reduce the difficulty of training the downstream network.

[0012] In a possible implementation manner of the first aspect, obtaining a numerical value corresponding to a dimension of a network traffic sequence of the upstream network includes:

[0013] Obtaining the network traffic sequence of the upstream network, and inputting the network traffic sequence into an encoder;

[0014] Obtaining a feature representation vector output by the encoder based on the network traffic sequence;

[0015] A numerical value corresponding to a dimension of the network traffic sequence is obtained in the feature representation vector.

[0016] In the embodiment of the present application, obtaining the numerical value corresponding to the dimension of the network traffic sequence can capture the regularity of the network traffic sequence.

[0017] In a possible implementation manner of the first aspect, obtaining the first contribution value of the numerical value includes:

[0018] Obtain the loss value of the value in this round of training, the loss value of the previous round of training, and the gradient descent value of the previous round of training;

[0019] The first contribution value of the numerical value is generated according to the loss value of the numerical value in this round of training, the loss value of the previous round of training, the gradient descent value of the previous round of training and a preset first contribution value calculation model.

[0020] In the embodiment of the present application, the first contribution value of the numerical value is an evaluation indicator of this round of training. The value of the numerical value in this round of training can be determined through the first contribution value of the numerical value.

[0021] In a possible implementation manner of the first aspect, adding each of the first contribution values ​​of the numerical value to obtain the second contribution value of the numerical value includes:

[0022] Obtain the start time, end time and time point at which the decline of the loss function value is greater than a preset range of the training phase, mark the time period from the start time to the time point as a mutation period, and mark the time period from the time point to the end time as a flat period;

[0023] Acquire a first training round number and a first weight index corresponding to the mutation period, and acquire a second training round number and a second weight index corresponding to the flat period, wherein the first weight index is greater than the second weight index;

[0024] The second contribution value of the numerical value is generated according to the first contribution value of the numerical value, the first number of training rounds, the first weight index, the second number of training rounds, the second weight index and a preset second contribution value calculation model.

[0025] In the embodiment of the present application, the second contribution value of the numerical value is an evaluation indicator in the training stage. The value of the numerical value in the training stage can be determined through the second contribution value of the numerical value.

[0026] In a possible implementation manner of the first aspect, concatenating the first vector with a first traffic feature vector of a downstream task to generate a second traffic feature vector for training a downstream network of the downstream task includes:

[0027] Input the first vector into a fully connected layer, and obtain a second vector output by the fully connected layer according to the first vector;

[0028] The second vector is concatenated with the first traffic feature vector of the downstream task to generate a second traffic feature vector for training a downstream network of the downstream task.

[0029] In an embodiment of the present application, since the second vector has undergone a feature extraction and conversion process, the trained second vector and the first traffic feature vector of the downstream task are concatenated to generate a second traffic feature vector for training the downstream network of the downstream task. This can avoid the need to perform a complex feature extraction and conversion process again, thereby helping to speed up the training of the downstream network.

[0030] In a possible implementation manner of the first aspect, inputting the first vector into a fully connected layer, and obtaining a second vector output by the fully connected layer according to the first vector includes:

[0031] Inputting the first vector into a fully connected layer, and extracting feature information in the first vector through weight and bias calculation of the fully connected layer;

[0032] Obtain the second vector output by the fully connected layer according to the feature information.

[0033] In an embodiment of the present application, the fully connected layer integrates the feature information in the first vector to obtain a second vector that can fully describe the network traffic sequence. The second vector can better describe the overall characteristics of the network traffic sequence.

[0034] In a possible implementation manner of the first aspect, after concatenating the first vector with the first traffic feature vector of the downstream task to generate a second traffic feature vector for training a downstream network of the downstream task, the generating method further includes:

[0035] Acquire a target value of the second traffic feature vector, train the downstream network corresponding to the downstream task based on the second traffic feature vector and the target value, and acquire the trained downstream network;

[0036] Obtaining a third flow feature vector, and inputting the third flow feature vector into the trained downstream network, wherein the third flow feature vector is a current flow feature vector;

[0037] Obtain a classification result corresponding to the downstream task output by the trained downstream network based on the third traffic feature vector.

[0038] In an embodiment of the present application, through the trained downstream network, the third traffic feature vector can be divided into corresponding classification results, and potential network threats can be handled in a timely manner through the classification results, so that corresponding defense measures can be taken to protect the security of the system and data.

[0039] In a possible implementation manner of the first aspect, obtaining a target value of the second traffic feature vector, training the downstream network corresponding to the downstream task based on the second traffic feature vector and the target value, and obtaining the trained downstream network includes:

[0040] Obtaining the target value of a second flow characteristic vector, and inputting the second flow characteristic vector into the downstream network;

[0041] Obtaining a predicted value output by the downstream network based on the second traffic feature vector, and training the downstream network based on a loss value between the predicted value and the target value;

[0042] When the loss value between the predicted value and the target value is less than a preset value, the training of the downstream network is stopped, and the trained downstream network is obtained.

[0043] In an embodiment of the present application, the trained downstream network is trained and optimized by the second traffic feature vector, and can accurately identify and classify various network traffic, and can quickly discover abnormal behavior, thereby effectively preventing and responding to network attacks.

[0044] In a possible implementation manner of the first aspect, after obtaining the classification result corresponding to the downstream task output by the trained downstream network based on the third traffic feature vector, the generating method further includes:

[0045] A storage area corresponding to the downstream task is obtained, and the classification result is saved in the storage area.

[0046] In an embodiment of the present application, the saved classification results can be used to evaluate the performance of the downstream network, and the downstream network is subsequently optimized based on the evaluation results.

[0047] In a second aspect, an embodiment of the present application provides a device for generating a traffic feature vector, including:

[0048] A first acquisition module is used to obtain a value corresponding to a dimension of a network traffic sequence of an upstream network;

[0049] A second acquisition module is used to acquire a first contribution value of the numerical value, where the first contribution value is a contribution value of the numerical value in this round of training of the upstream network;

[0050] A first adding module, configured to add each of the first contribution values ​​of the numerical value to obtain a second contribution value of the numerical value, where the second contribution value is a contribution value of the numerical value in a training phase of the upstream network;

[0051] A second adding module, used for adding the second contribution value of each of the numerical values ​​to obtain a total contribution value of the dimension in the training stage;

[0052] A concatenation module, used to sort the total contribution value of each dimension in descending order, and concatenate the values ​​of the dimensions in the first N places of the sorting to obtain a first vector;

[0053] A generation module is used to concatenate the first vector with the first traffic feature vector of the downstream task to generate a second traffic feature vector for training the downstream network of the downstream task, wherein N is a positive integer and the first traffic feature vector is a pre-stored traffic feature vector.

[0054] The beneficial effects of the embodiment of the present application lie in two aspects. On the one hand, the first vector is concatenated with the first traffic characteristic vector of the downstream task to generate a second traffic characteristic vector for training the downstream network of the downstream task. Since the second traffic characteristic vector of the downstream network is targeted, it can reduce the training time of the downstream network of the downstream task, which is beneficial to improving the training efficiency of the downstream network. On the other hand, based on the second traffic characteristic vector of the downstream network, the amount of data that needs to be processed by the downstream network is reduced, the complexity of the downstream network training is reduced, and it is beneficial to reduce the difficulty of training the downstream network. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. Some specific embodiments of the present application will be described in detail in an illustrative and non-restrictive manner with reference to the drawings. The same reference numerals in the drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the drawings:

[0056] Figure 1 is a flow chart of a method for generating a flow characteristic vector provided in an embodiment of the present application;

[0057] Figure 2 A schematic block diagram of a device for generating a traffic feature vector provided in an embodiment of the present application. DETAILED DESCRIPTION

[0058] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only embodiments of a part of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present application.

[0059] The generation method provided in the embodiments of the present application can be applied to electronic devices such as servers, mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, laptop computers, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), etc. The embodiments of the present application do not impose any restrictions on the specific types of electronic devices.

[0060] Figure 1 is a flow chart of a method for generating a traffic feature vector provided in an embodiment of the present application, such as Figure 1 As shown, the generation method provided in the embodiment of the present application includes the following steps, which are described in detail as follows:

[0061] S101, obtaining a value corresponding to a dimension of a network traffic sequence of an upstream network;

[0062] Among them, network traffic sequence usually refers to a set of network traffic data arranged in chronological order, which reflects the data transmission in the network. Network traffic sequence can be used to analyze network traffic patterns to perform tasks such as network monitoring, optimization and fault detection.

[0063] The dimension of the network traffic sequence can be set by the user or by the system default.

[0064] For ease of explanation, the dimensions of network traffic sequences include the following:

[0065] Payload, in network traffic, refers to the data content part of the data packet that is actually transmitted, that is, the part excluding control information such as protocol header and metadata. Payload carries the actual data information.

[0066] Source address and destination address: Indicates the starting point and destination of the data packet.

[0067] Port number: Used to identify the specific application or service running on the source and destination addresses.

[0068] Protocol type: such as TCP, UDP, ICMP, etc., used to define the way and rules for data packets to be transmitted in the network.

[0069] Among them, TCP (Transmission Control Protocol) is a connection-oriented, reliable, byte-stream-based transport layer communication protocol. It is designed to ensure reliable data transmission in the network and to ensure the integrity and order of data packets through mechanisms such as confirmation, retransmission, sorting, and flow control.

[0070] Among them, UDP (User Datagram Protocol) is a connectionless transport layer protocol that provides simple, transaction-oriented, unreliable information transmission services. It does not guarantee the order or reliability of data packets, but has low overhead and simplicity, and is suitable for applications that have high real-time requirements but less stringent requirements on data reliability.

[0071] Among them, ICMP (Internet Control Message Protocol) is an auxiliary protocol of the network layer, which is used to transmit control messages between IP hosts and routers. It is mainly used to diagnose network problems and ensure the accessibility of network communications, such as reporting network problems by sending error messages or implementing network diagnostic tools.

[0072] Packet size: Indicates the size of each packet, which can reflect the load and transmission efficiency of network traffic.

[0073] Timestamp: records the time when a data packet is transmitted in the network, which helps analyze the time distribution and pattern of network traffic.

[0074] Packet rate: Indicates the number of packets transmitted per unit time, which can reflect the speed of network traffic and bandwidth utilization.

[0075] Traffic Direction: Indicates whether the packet flows from the source address to the destination address or vice versa, which helps analyze the bidirectionality and symmetry of network traffic.

[0076] In a possible implementation manner of the first aspect, obtaining a numerical value corresponding to a dimension of a network traffic sequence of the upstream network includes:

[0077] Obtaining the network traffic sequence of the upstream network, and inputting the network traffic sequence into an encoder;

[0078] Obtaining a feature representation vector output by the encoder based on the network traffic sequence;

[0079] A numerical value corresponding to a dimension of the network traffic sequence is obtained in the feature representation vector.

[0080] In the embodiment of the present application, obtaining the numerical value corresponding to the dimension of the network traffic sequence can capture the regularity of the network traffic sequence.

[0081] S102, obtaining a first contribution value of the numerical value, where the first contribution value is a contribution value of the numerical value in this round of training of the upstream network;

[0082] In a possible implementation manner of the first aspect, obtaining the first contribution value of the numerical value includes:

[0083] Obtain the loss value of the value in this round of training, the loss value of the previous round of training, and the gradient descent value of the previous round of training;

[0084] The first contribution value of the numerical value is generated according to the loss value of the numerical value in this round of training, the loss value of the previous round of training, the gradient descent value of the previous round of training and a preset first contribution value calculation model.

[0085] Among them, the first contribution value calculation model is:

[0086] ;

[0087] Said is the loss value of the previous round of training, is the loss value of this round of training, is the gradient descent value of the previous round of training, is the first contribution value.

[0088] Among them, each round of training is a complete traversal of the model over the entire training set.

[0089] In the embodiment of the present application, the first contribution value of the numerical value is an evaluation indicator of this round of training. The value of the numerical value in this round of training can be determined through the first contribution value of the numerical value.

[0090] S103, adding each of the first contribution values ​​of the numerical value to obtain a second contribution value of the numerical value, where the second contribution value is a contribution value of the numerical value in the training phase of the upstream network;

[0091] In a possible implementation manner of the first aspect, adding each of the first contribution values ​​of the numerical value to obtain the second contribution value of the numerical value includes:

[0092] Obtain the start time, end time and time point at which the decline of the loss function value is greater than a preset range of the training phase, mark the time period from the start time to the time point as a mutation period, and mark the time period from the time point to the end time as a flat period;

[0093] Among them, a decrease in the loss function value that is greater than the preset value indicates that the upstream network has learned effective features.

[0094] Among them, the time point when the decrease in the loss function value is greater than the preset value indicates the time point when the upstream network has learned effective features.

[0095] Among them, the time point when the decrease in the loss function value is greater than the preset value represents an important turning point in the training process of the upstream network. At the time point when the decrease in the loss function value is greater than the preset value, the upstream network captures effective features, causing its performance to undergo significant positive changes.

[0096] For the sake of illustration, an example is given below:

[0097] Train a deep learning model and set a preset amplitude, for example, set the preset amplitude to 0.15.

[0098] In 5 consecutive epochs, i.e. 5 rounds of training, the change of loss function value is as follows:

[0099] In the first round of training, the loss function value decreased by 0.1.

[0100] In the second round of training, the loss function value decreased by 0.1.

[0101] In the third round of training, the loss function value decreased by 0.1.

[0102] In the fourth round of training, the loss function value decreased by 0.1.

[0103] In the fifth round of training, the loss function value decreased by 0.2.

[0104] In this example, in the fifth round of training, the decrease in the loss function value is 0.2, which is greater than the preset value of 0.15. Therefore, the decrease in the loss function value is greater than the preset value. The time point at the end of the fifth round of training is taken as the time point when the decrease in the loss function value is greater than the preset value.

[0105] For the sake of illustration, an example is given below:

[0106] Train a deep learning model and set a preset amplitude, for example, set the preset amplitude to 0.25.

[0107] In 6 consecutive epochs, i.e. 6 rounds of training, the change of loss function value is as follows:

[0108] In the first round of training, the loss function value decreased by 0.1.

[0109] In the second round of training, the loss function value decreased by 0.1.

[0110] In the third round of training, the loss function value decreased by 0.1.

[0111] In the fourth round of training, the loss function value decreased by 0.1.

[0112] In the fifth round of training, the loss function value decreased by 0.1.

[0113] In the sixth round of training, the loss function value decreased by 0.3.

[0114] In this example, in the sixth round of training, the decrease in the loss function value is 0.3, which is greater than the preset value of 0.25. Therefore, the decrease in the loss function value is greater than the preset value. The time point at the end of the sixth round of training is taken as the time point at which the decrease in the loss function value is greater than the preset value.

[0115] The time period from the start time to the time point is marked as a mutation period.

[0116] For the sake of illustration, an example is given below:

[0117] For example, the time point when the loss function value decreases by more than the preset value is the end time of the fourth round of training, and the time period between the start time of the first round of training and the end time of the fourth round of training is the mutation period;

[0118] For example, the time point when the loss function value decreases by more than the preset value is the end time of the fifth round of training, and the time period between the start time of the first round of training and the end time of the fifth round of training is the mutation period;

[0119] For example, the time point when the loss function value decreases by more than a preset amount is the time point at which the sixth round of training ends, and the time period between the start time of the first round of training and the end time of the sixth round of training is the mutation period.

[0120] The time period from the time point to the end time is marked as a flat period.

[0121] For the sake of illustration, an example is given below:

[0122] For example, if the deep learning model undergoes 6 rounds of training, the time point when the loss function value decreases by more than the preset value is the end time of the 4th round of training, and the time period between the end time of the 4th round of training and the end time of the 6th round of training is the plateau period.

[0123] For example, if the deep learning model undergoes 7 rounds of training, the time point when the loss function value decreases by more than the preset value is the end time of the 5th round of training, and the time period between the end time of the 5th round of training and the end time of the 7th round of training is the plateau period.

[0124] For example, the deep learning model undergoes 8 rounds of training. The time point when the loss function value decreases by more than the preset value is the end of the 5th round of training. The time period between the end of the 5th round of training and the end of the 8th round of training is the plateau period.

[0125] Obtain a first training round number and a first weight index corresponding to the mutation period, obtain a second training round number and a second weight index corresponding to the flat period, the first weight index being greater than the second weight index; generate the second contribution value of the numerical value according to the first contribution value of the numerical value, the first training round number, the first weight index, the second training round number, the second weight index and a preset second contribution value calculation model.

[0126] Among them, the second contribution value calculation model is:

[0127] ;

[0128] Said is the first contribution value of the ith one in the mutation period, the is the first training round number, M1 is the first weight index, is the jth first contribution value in the flat period, The second training round number, the M2 is a second weight index, the is the second contribution value.

[0129] Among them, M1 and M2 are user-set or system default, and are not restricted here.

[0130] For the sake of illustration, an example is given below:

[0131] For example, when M1 is 2.25 and M2 is 0.1, the second contribution value calculation model is:

[0132] ;

[0133] For example, when M1 is 2.5 and M2 is 0.2, the second contribution value calculation model is:

[0134] ;

[0135] Among them, M1 is greater than M2, that is, the first weight index is greater than the second weight index. By setting the first weight index greater than the second weight index, the first contribution value of the mutation period can be magnified and the first contribution value of the flat period can be reduced. In this way, the characteristics of the mutation period can be more influential, which is conducive to the upstream network to better learn the characteristics of the mutation period.

[0136] In the embodiment of the present application, the second contribution value of the numerical value is an evaluation indicator in the training stage. The value of the numerical value in the training stage can be determined through the second contribution value of the numerical value.

[0137] S104, adding the second contribution value of each of the values ​​to obtain a total contribution value of the dimension in the training stage;

[0138] The number of dimensions can be set by the user or by system default.

[0139] For the sake of illustration, an example is given below:

[0140] For example, there are five dimensions A1, A2, A3, A4 and A5.

[0141] Dimension A1 contains value B1 and value B2:

[0142] The second contribution value of value B1 in dimension A1 is 10.

[0143] The second contribution value of value B2 in dimension A1 is 15.

[0144] Dimension A2 contains value B3 and value B4:

[0145] The second contribution value of value B3 in dimension A2 is 20.

[0146] The second contribution value of value B4 in dimension A2 is 10.

[0147] Dimension A3 contains the value B5 and the value B6:

[0148] The second contribution value of value B5 in dimension A3 is 15.

[0149] The second contribution value of value B6 in dimension A3 is 25.

[0150] Dimension A4 contains only the value B7:

[0151] The second contribution value of value B7 in dimension A4 is 20.

[0152] Dimension A5 contains only the value B8:

[0153] The second contribution value of value B8 in dimension A5 is 30.

[0154] Calculate the total contribution of each dimension:

[0155] The total contribution value of dimension A1 = the second contribution value of value B1 + the second contribution value of value B2 = 10 + 15 = 25.

[0156] The total contribution value of dimension A2 = the second contribution value of value B3 + the second contribution value of value B4 = 20 + 10 = 30.

[0157] The total contribution value of dimension A3 = the second contribution value of value B5 + the second contribution value of value B6 = 15 + 25 = 40.

[0158] The total contribution of dimension A4 = the second contribution of value B7 = 20.

[0159] The total contribution of dimension A5 = the second contribution of value B8 = 30.

[0160] Therefore, the total contribution of dimension A1 is 25, the total contribution of dimension A2 is 30, the total contribution of dimension A3 is 40, the total contribution of dimension A4 is 20, and the total contribution of dimension A5 is 30.

[0161] S105, sorting the total contribution value of each dimension in descending order, and concatenating the values ​​of the dimensions in the first N places of the sorting to obtain a first vector;

[0162] The total contribution value of each dimension is sorted in descending order, and the feature vectors of the numerical values ​​of the dimensions in the first N places of the sort are concatenated to obtain a first vector.

[0163] Among them, N can be set by the user or by system default.

[0164] For the sake of illustration, an example is given below:

[0165] For example, N is 2, and the first two dimensions in the sort are dimension A3 and dimension A2, and the feature vectors of the values ​​of dimension A3 and dimension A2 are concatenated to obtain the first vector.

[0166] For example, N is 3, and the first three dimensions are dimension A3, dimension A2, and dimension A5. The feature vectors of the values ​​of dimension A3, dimension A2, and dimension A5 are concatenated to obtain the first vector.

[0167] For example, N is 4, and the first four dimensions are dimension A3, dimension A2, dimension A5, and dimension A1. The feature vectors of the values ​​of dimension A3, dimension A2, dimension A5, and dimension A1 are concatenated to obtain the first vector.

[0168] S107, concatenating the first vector with the first traffic feature vector of the downstream task to generate a second traffic feature vector for training the downstream network of the downstream task, wherein N is a positive integer, and the first traffic feature vector is a pre-stored traffic feature vector.

[0169] The first traffic feature vector of the downstream task is set by the user or by the system by default.

[0170] Among them, concatenating the first vector with the first flow feature vector of the downstream task is actually to connect them end to end to form a second flow feature vector, and the second flow feature vector is used to train the downstream network of the downstream task.

[0171] For the sake of illustration, an example is given below:

[0172] For example, there is a first vector G and a first traffic feature vector H, which are expressed as follows:

[0173] The first vector G: [G1,G2,G3]. The first traffic feature vector H: [H1,H2,H3].

[0174] After concatenating the first vector G and the first traffic feature vector H, the obtained second traffic feature vector is [G1, G2, G3, H1, H2, H3].

[0175] For the sake of illustration, an example is given below:

[0176] For example, there is a first vector P and a first traffic feature vector H, which are expressed as follows:

[0177] The first vector P: [P1,P2,P3,P4,P5]. The first traffic feature vector H: [H1,H2,H3].

[0178] After concatenating the first vector P and the first traffic feature vector H, the obtained second traffic feature vector is [P1, P2, P3, P4, P5, H1, H2, H3].

[0179] In a possible implementation manner of the first aspect, concatenating the first vector with a first traffic feature vector of a downstream task to generate a second traffic feature vector for training a downstream network of the downstream task includes:

[0180] Input the first vector into a fully connected layer, and obtain a second vector output by the fully connected layer according to the first vector;

[0181] The second vector is concatenated with the first traffic feature vector of the downstream task to generate a second traffic feature vector for training a downstream network of the downstream task.

[0182] In an embodiment of the present application, since the second vector has undergone a feature extraction and conversion process, the trained second vector and the first traffic feature vector of the downstream task are concatenated to generate a second traffic feature vector for training the downstream network of the downstream task. This can avoid the need to perform a complex feature extraction and conversion process again, thereby helping to speed up the training of the downstream network.

[0183] In a possible implementation manner of the first aspect, inputting the first vector into a fully connected layer, and obtaining a second vector output by the fully connected layer according to the first vector includes:

[0184] Inputting the first vector into a fully connected layer, and extracting feature information in the first vector through weight and bias calculation of the fully connected layer;

[0185] Obtain the second vector output by the fully connected layer according to the feature information.

[0186] In an embodiment of the present application, the fully connected layer integrates the feature information in the first vector to obtain a second vector that can fully describe the network traffic sequence. The second vector can better describe the overall characteristics of the network traffic sequence.

[0187] In a possible implementation manner of the first aspect, after concatenating the first vector with the first traffic feature vector of the downstream task to generate a second traffic feature vector for training a downstream network of the downstream task, the generating method further includes:

[0188] Acquire a target value of the second traffic feature vector, train the downstream network corresponding to the downstream task based on the second traffic feature vector and the target value, and acquire the trained downstream network;

[0189] Obtaining a third flow feature vector, and inputting the third flow feature vector into the trained downstream network, wherein the third flow feature vector is a current flow feature vector;

[0190] Obtain a classification result corresponding to the downstream task output by the trained downstream network based on the third traffic feature vector.

[0191] Among them, downstream tasks are introduced for training. For example, the first downstream task is added first. The first downstream task is set to judge the packet loss rate of terminal users according to the third traffic feature vector. The probability of packet loss is higher for terminals in remote areas, so the third traffic feature vector is more correlated with the location.

[0192] The downstream task can be a simple network with only two fully connected layers. Usually, the training of the downstream network can be completed in a few minutes to a few hours.

[0193] The second downstream task can be set to determine whether the traffic is malicious traffic based on the third traffic feature vector.

[0194] The payload stores the attacker's malicious attack payload, which contains the code, instructions or data required to perform malicious activities, and the payload is the carrier of these malicious contents. According to the third traffic feature vector, the correlation with the payload is high.

[0195] Among them, the entire deep learning network is composed of an upstream network and a downstream network. The training of the upstream network and the downstream network is separate. Since there is no need to retrain the upstream network and only train the downstream network, the training of the downstream network can be completed in a very short time. Therefore, the training efficiency of the entire network is greatly improved.

[0196] In an embodiment of the present application, through the trained downstream network, the third traffic feature vector can be divided into corresponding classification results, and potential network threats can be handled in a timely manner through the classification results, so that corresponding defense measures can be taken to protect the security of the system and data.

[0197] In a possible implementation manner of the first aspect, obtaining a target value of the second traffic feature vector, training the downstream network corresponding to the downstream task based on the second traffic feature vector and the target value, and obtaining the trained downstream network includes:

[0198] Obtaining the target value of a second flow characteristic vector, and inputting the second flow characteristic vector into the downstream network;

[0199] Obtaining a predicted value output by the downstream network based on the second traffic feature vector, and training the downstream network based on a loss value between the predicted value and the target value;

[0200] When the loss value between the predicted value and the target value is less than a preset value, the training of the downstream network is stopped, and the trained downstream network is obtained.

[0201] In an embodiment of the present application, the trained downstream network is trained and optimized by the second traffic feature vector, and can accurately identify and classify various network traffic, and can quickly discover abnormal behavior, thereby effectively preventing and responding to network attacks.

[0202] In a possible implementation manner of the first aspect, after obtaining the classification result corresponding to the downstream task output by the trained downstream network based on the third traffic feature vector, the generating method further includes:

[0203] A storage area corresponding to the downstream task is obtained, and the classification result is saved in the storage area.

[0204] The classification result is a key output, and the classification result is stored in the storage area to ensure that the classification result can be retrieved later.

[0205] In an embodiment of the present application, the saved classification results can be used to evaluate the performance of the downstream network, and the downstream network is subsequently optimized based on the evaluation results.

[0206] The beneficial effects of the embodiment of the present application lie in two aspects. On the one hand, the first vector is concatenated with the first traffic characteristic vector of the downstream task to generate a second traffic characteristic vector for training the downstream network of the downstream task. Since the second traffic characteristic vector of the downstream network is targeted, it can reduce the training time of the downstream network of the downstream task, which is beneficial to improving the training efficiency of the downstream network. On the other hand, based on the second traffic characteristic vector of the downstream network, the amount of data that needs to be processed by the downstream network is reduced, the complexity of the downstream network training is reduced, and it is beneficial to reduce the difficulty of training the downstream network.

[0207] For the method of generating the flow characteristic vector described in the above embodiment, please refer to Figure 2 , Figure 2 A schematic block diagram of a device for generating a flow characteristic vector provided in an embodiment of the present application is shown in FIG. Figure 2 The generating device 200 shown in the figure can be applied to the above-mentioned electronic device. Figure 2 The generating device 200 shown is described in detail. The generating device 200 may include a first acquisition module 201, a second acquisition module 202, a first addition module 203, a second addition module 204, a splicing module 205, a splicing module 205, and a generating module 206.

[0208] A first acquisition module 201 is used to acquire a value corresponding to a dimension of a network traffic sequence of an upstream network;

[0209] A second acquisition module 202 is used to acquire a first contribution value of the numerical value, where the first contribution value is a contribution value of the numerical value in the current round of training of the upstream network;

[0210] A first adding module 203, configured to add each of the first contribution values ​​of the numerical value to obtain a second contribution value of the numerical value, where the second contribution value is a contribution value of the numerical value in the training phase of the upstream network;

[0211] A second adding module 204, configured to add the second contribution value of each of the numerical values ​​to obtain a total contribution value of the dimension in the training stage;

[0212] A concatenation module 205 is used to sort the total contribution value of each dimension in descending order, and concatenate the values ​​of the dimensions in the first N places of the sorting to obtain a first vector;

[0213] The generation module 206 is used to concatenate the first vector with the first traffic feature vector of the downstream task to generate a second traffic feature vector for training the downstream network of the downstream task, wherein N is a positive integer and the first traffic feature vector is a pre-stored traffic feature vector.

[0214] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0215] The beneficial effects of the embodiment of the present application lie in two aspects. On the one hand, the first vector is concatenated with the first traffic characteristic vector of the downstream task to generate a second traffic characteristic vector for training the downstream network of the downstream task. Since the second traffic characteristic vector of the downstream network is targeted, it can reduce the training time of the downstream network of the downstream task, which is beneficial to improving the training efficiency of the downstream network. On the other hand, based on the second traffic characteristic vector of the downstream network, the amount of data that needs to be processed by the downstream network is reduced, the complexity of the downstream network training is reduced, and it is beneficial to reduce the difficulty of training the downstream network.

[0216] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for generating a flow characteristic vector, characterized in that: The generation method comprises: Get the value corresponding to the dimension of the network traffic sequence of the upstream network; Obtaining a first contribution value of the numerical value, where the first contribution value is a contribution value of the numerical value in this round of training of the upstream network; Adding each of the first contribution values ​​of the numerical value to obtain a second contribution value of the numerical value, where the second contribution value is a contribution value of the numerical value in the training phase of the upstream network; Adding the second contribution value of each of the numerical values ​​to obtain a total contribution value of the dimension in the training stage; Sort the total contribution value of each dimension in descending order, and concatenate the values ​​of the first N dimensions to obtain a first vector; Concatenate the first vector with a first traffic feature vector of a downstream task to generate a second traffic feature vector for training a downstream network of the downstream task, wherein N is a positive integer and the first traffic feature vector is a pre-stored traffic feature vector; The obtaining the first contribution value of the numerical value comprises: Obtain the loss value of the value in this round of training, the loss value of the previous round of training, and the gradient descent value of the previous round of training; Generate the first contribution value of the numerical value according to the loss value of the numerical value in the current round of training, the loss value of the previous round of training, the gradient descent value of the previous round of training, and a preset first contribution value calculation model; The adding each of the first contribution values ​​of the numerical value to obtain the second contribution value of the numerical value comprises: Obtain the start time, end time and time point at which the decline of the loss function value is greater than a preset range of the training phase, mark the time period from the start time to the time point as a mutation period, and mark the time period from the time point to the end time as a flat period; Acquire a first training round number and a first weight index corresponding to the mutation period, and acquire a second training round number and a second weight index corresponding to the flat period, wherein the first weight index is greater than the second weight index; A second contribution value of the numerical value is generated according to the first contribution value of the numerical value, the first number of training rounds, the first weight index, the second number of training rounds, the second weight index, and a preset second contribution value calculation model.

2. The generation method according to claim 1, characterized in that: The obtaining of the value corresponding to the dimension of the network traffic sequence of the upstream network includes: Obtaining the network traffic sequence of the upstream network, and inputting the network traffic sequence into an encoder; Obtaining a feature representation vector output by the encoder based on the network traffic sequence; A numerical value corresponding to a dimension of the network traffic sequence is obtained in the feature representation vector.

3. The generation method according to claim 1, characterized in that: The step of concatenating the first vector with a first traffic feature vector of a downstream task to generate a second traffic feature vector for training a downstream network of the downstream task includes: Input the first vector into a fully connected layer, and obtain a second vector output by the fully connected layer according to the first vector; The second vector is concatenated with the first traffic feature vector of the downstream task to generate a second traffic feature vector for training a downstream network of the downstream task.

4. The generation method according to claim 3, characterized in that: The step of inputting the first vector into a fully connected layer and obtaining a second vector output by the fully connected layer according to the first vector includes: Inputting the first vector into a fully connected layer, and extracting feature information in the first vector through weight and bias calculation of the fully connected layer; Obtain the second vector output by the fully connected layer according to the feature information.

5. The generation method according to any one of claims 1 to 4, characterized in that: After the first vector is concatenated with the first traffic feature vector of the downstream task to generate a second traffic feature vector for training a downstream network of the downstream task, the generation method further includes: Acquire a target value of the second traffic feature vector, train the downstream network corresponding to the downstream task based on the second traffic feature vector and the target value, and acquire the trained downstream network; Obtaining a third flow feature vector, and inputting the third flow feature vector into the trained downstream network, wherein the third flow feature vector is a current flow feature vector; Obtain a classification result corresponding to the downstream task output by the trained downstream network based on the third traffic feature vector.

6. The generation method according to claim 5, characterized in that: The step of obtaining a target value of the second traffic feature vector, training the downstream network corresponding to the downstream task based on the second traffic feature vector and the target value, and obtaining the trained downstream network includes: Obtaining the target value of a second flow characteristic vector, and inputting the second flow characteristic vector into the downstream network; Obtaining a predicted value output by the downstream network based on the second traffic feature vector, and training the downstream network based on a loss value between the predicted value and the target value; When the loss value between the predicted value and the target value is less than a preset value, the training of the downstream network is stopped, and the trained downstream network is obtained.

7. The generation method according to claim 6, characterized in that: After obtaining the classification result corresponding to the downstream task output by the trained downstream network based on the third traffic feature vector, the generation method further includes: A storage area corresponding to the downstream task is obtained, and the classification result is saved in the storage area.

8. A device for generating a flow characteristic vector, characterized in that: The method for generating a flow characteristic vector according to any one of claims 1 to 7 comprises: A first acquisition module is used to obtain a value corresponding to a dimension of a network traffic sequence of an upstream network; A second acquisition module is used to acquire a first contribution value of the numerical value, where the first contribution value is a contribution value of the numerical value in this round of training of the upstream network; A first adding module, configured to add each of the first contribution values ​​of the numerical value to obtain a second contribution value of the numerical value, where the second contribution value is a contribution value of the numerical value in a training phase of the upstream network; A second adding module, used for adding the second contribution value of each of the numerical values ​​to obtain a total contribution value of the dimension in the training stage; A concatenation module, used to sort the total contribution value of each dimension in descending order, and concatenate the values ​​of the dimensions in the first N places of the sorting to obtain a first vector; A generation module is used to concatenate the first vector with the first traffic feature vector of the downstream task to generate a second traffic feature vector for training the downstream network of the downstream task, wherein N is a positive integer and the first traffic feature vector is a pre-stored traffic feature vector.