Few-sample multi-label website fingerprint identification method and device
By constructing multi-label website traffic synthetic data and fine-tuning the student model using comparative distillation technology, the problems of concept drift and insufficient samples in multi-label website fingerprinting were solved, achieving high accuracy and robustness in recognition under conditions of few samples.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- QINGHAI UNIVERSITY
- Filing Date
- 2025-12-17
- Publication Date
- 2026-04-28
AI Technical Summary
Existing deep learning methods face problems of concept drift and insufficient samples in multi-label website fingerprint recognition, which leads to frequent model retraining and difficulty in obtaining sufficient labeled data, affecting recognition accuracy and practicality.
By constructing multi-label website traffic synthetic data, pre-training the teacher model, fine-tuning the student model using comparative distillation technology, and introducing a historical sample fusion mechanism in the inference stage, the model's recognition performance is improved.
It significantly improves the accuracy and robustness of multi-label website fingerprinting under limited sample conditions, reduces the dependence on a large amount of labeled data, and enhances the model's generalization ability and adaptability to dynamic changes in the network environment.
Smart Images

Figure CN121935604A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information security technology, and in particular to a method and apparatus for fingerprint recognition of websites with few samples and multiple labels. Background Technology
[0002] With the increasing demand for privacy protection, anonymous communication systems, such as the second-generation Onion Router (Tor), have been widely used. However, this has also provided covert channels for malicious activities, posing challenges to network traffic monitoring. Website fingerprinting technology, which analyzes encrypted traffic patterns to infer the content of websites visited by users, is one of the key means of network supervision. Existing website fingerprinting is mainly divided into single-label and multi-label methods. Single-label methods assume that only one website is visited per session, and deep learning-based methods have achieved high accuracy. However, in actual browsing, users often open multiple tabs simultaneously, leading to overlapping traffic and increasing the difficulty of identification.
[0003] To address multi-label scenarios, early methods relied on manually segmenting clean traffic blocks, but this required prior knowledge of the number of websites and had limited recognition capabilities. Recently, methods based on deep learning architectures such as Transformer have improved multi-label recognition performance through sequence modeling capabilities. However, these methods still face two major challenges: first, concept drift caused by dynamic changes in website content and the network environment necessitates frequent re-collection of large amounts of data and retraining of the model, which is time-consuming and labor-intensive; second, the number of multi-label combinations grows exponentially with the number of labels, making it extremely difficult to collect sufficient labeled data, thus limiting the accuracy and practicality of the model in real-world scenarios with few samples.
[0004] Therefore, there is an urgent need for a multi-label website fingerprinting method that can maintain high recognition performance even in dynamic environments where there are very few target website samples and concept drift exists. Summary of the Invention
[0005] This application provides a method and apparatus for identifying website fingerprints with few samples and multiple labels, which can solve two major technical problems of existing deep learning methods under few sample conditions: first, concept drift caused by dynamic changes in websites requires frequent retraining of models with a large amount of new data; second, the explosion of multi-label combinations makes it difficult to obtain sufficient labeled samples, which restricts the practicality of the model, thereby effectively improving the recognition accuracy in few sample scenarios.
[0006] In a first aspect, embodiments of this application provide a method for fingerprint recognition of websites with few samples and multiple labels, including: Acquire single-tag website traffic data, and construct multi-tag website traffic composite data based on the single-tag website traffic data; The teacher model is pre-trained based on synthetic multi-label website traffic data. The pre-trained teacher model is able to extract the general features of multi-label website traffic. We obtain a small sample traffic data of the target multi-tag website. Based on the small sample traffic data and the teacher model, we fine-tune the student model through comparative distillation to obtain a target student model adapted to the target multi-tag website. The system acquires traffic data from multi-label websites to be identified, and then fuses multiple historical samples with similar characteristics to the target student model and the traffic data from the multi-label websites to be identified to obtain the multi-label website fingerprint recognition result.
[0007] In one embodiment, the multi-label website fingerprinting result is obtained by fusing multiple historical samples with similar characteristics to the target student model and the traffic data of the multi-label website to be identified. Specifically, this can be implemented as follows: The multi-label website traffic data features to be identified are input into the target student model to obtain the first multi-label prediction result; Based on the known multi-labels of multiple historical samples, a second multi-label prediction result is generated. The multiple historical samples are samples in the fine-tuning training set that are similar in features to the multi-label website traffic data to be identified. The first and second multi-label prediction results are weighted and fused to generate multi-label website fingerprint recognition results.
[0008] In another embodiment, based on few-sample traffic data and a teacher model, the target student model is fine-tuned through comparative distillation to obtain a target student model adapted to the target multi-tag website. Specifically, this can be implemented as follows: By inputting a small sample of traffic data into the teacher model and the target student model respectively, the feature representations of the teacher model and the target student model for the same input sample are obtained; Calculate the supervised loss between the predicted results output by the target student model and the true labels; Calculate the comparative distillation loss between the feature representations of the target student model and the feature representations of the teacher model; A joint loss function is constructed based on supervised loss and contrastive distillation loss, and the parameters of the target student model are updated through an optimization algorithm to obtain a target student model adapted to the target multi-tag website.
[0009] In yet another embodiment, the comparative distillation loss between the feature representations of the target student model and the feature representations of the teacher model is calculated, which can be specifically implemented as follows: Obtain the intermediate layer feature representations extracted from the input samples by the teacher model and the target student model, respectively; The obtained intermediate layer feature representations are subjected to projection transformations to obtain the corresponding projected features; Calculate the similarity between the projected features of the target student model and the projected features of the teacher model; Based on similarity, the comparative distillation loss is calculated by enhancing the similarity between positive sample pairs and reducing the similarity between negative sample pairs.
[0010] In yet another embodiment, constructing multi-tag website traffic composite data based on single-tag website traffic data can be specifically implemented as follows: Randomly extract traffic data segments from at least two single-tag websites with different sources. The obtained traffic data fragments are interleaved and superimposed in the time dimension to generate multi-tag website traffic composite data with multiple tag attributes.
[0011] In yet another embodiment, the network structure for pre-training the teacher model is a one-dimensional convolutional neural network. And / or, the loss function for pre-training the teacher model is a multi-label classification loss function; And / or, the optimization algorithm for pre-training the teacher model is the Adam algorithm for adaptive moment estimation.
[0012] Secondly, embodiments of this application provide a few-sample, multi-label website fingerprinting device, including: a data construction module, a model training module, a model fine-tuning module, and a data fusion module.
[0013] The aforementioned data construction module is used to acquire single-tag website traffic data and construct multi-tag website traffic composite data based on the single-tag website traffic data. The aforementioned model training module is used to pre-train the teacher model based on multi-tag website traffic synthetic data. The pre-trained teacher model can extract the general features of multi-tag website traffic. The aforementioned model fine-tuning module is used to obtain a small sample traffic data of the target multi-tag website. Based on the small sample traffic data and the teacher model, the student model is fine-tuned through comparative distillation to obtain a target student model adapted to the target multi-tag website. The aforementioned data fusion module is used to acquire traffic data of multi-label websites to be identified, and to fuse multiple historical samples with similar characteristics of the target student model and the traffic data of the multi-label websites to be identified to obtain the multi-label website fingerprint identification result.
[0014] Thirdly, embodiments of this application provide an electronic device, including a processor and a memory storing a computer program, wherein the processor executes the program to implement the steps of the few-sample multi-label website fingerprint recognition method of the first aspect.
[0015] Fourthly, embodiments of this application provide a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the few-sample multi-label website fingerprint recognition method of the first aspect.
[0016] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the steps of the few-sample, multi-label website fingerprinting method of the first aspect.
[0017] The beneficial effects of the few-sample, multi-label website fingerprinting method provided in this application include: First, by synthesizing multi-label training data from the acquired single-label data and pre-training the teacher model, the dependence on a large amount of real labeled data is fundamentally reduced, solving the core bottleneck of high data collection and labeling costs.
[0018] Secondly, comparative distillation is employed, enabling the student model to quickly and efficiently adapt to a very limited amount of target scene data. This method not only transfers the general feature knowledge of the teacher model to the student model, but also preserves the latent semantic relationships between multiple labels through feature alignment, significantly improving the model's discriminative ability and generalization under limited sample conditions.
[0019] Finally, a historical sample retrieval and fusion mechanism based on feature similarity is introduced during the inference stage, which is equivalent to providing the model with an external memory. This strategy of combining parameterized models with instantiated retrieval further enhances the model's robustness and accuracy in handling fuzzy samples and responding to dynamic changes in the network environment (concept drift). Attached Figure Description
[0020] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 A system framework diagram of a few-sample, multi-label website fingerprinting system provided in this application embodiment; Figure 2 A flowchart illustrating the few-sample, multi-label website fingerprinting method provided in this application embodiment; Figure 3 A schematic diagram comparing the classification performance of the few-sample, multi-label website fingerprinting method provided in this application embodiment with existing methods under closed-world 2-tab and 3-tab settings; Figure 4A schematic diagram showing a comparison of the classification performance of the few-sample, multi-label website fingerprinting method provided in this application embodiment with existing methods under closed-world 4-tab and 5-tab settings; Figure 5 A schematic diagram illustrating the classification effect of the few-sample, multi-label website fingerprinting method provided in this application embodiment when the number of website labels in a closed world is unknown; Figure 6 A schematic diagram illustrating the classification effect against concept drift of the few-sample, multi-label website fingerprinting method provided in this application embodiment under closed-world 2-tab and 3-tab settings; Figure 7 A schematic diagram illustrating the classification effect against concept drift in closed-world 4-tab and 5-tab settings of the few-sample multi-label website fingerprinting method provided in this application embodiment; Figure 8 A schematic diagram comparing the classification performance of the few-sample, multi-label website fingerprinting method provided in this application embodiment with existing methods under open-world 2-tab and 3-tab settings; Figure 9 A schematic diagram comparing the classification performance of the few-sample, multi-label website fingerprinting method provided in this application embodiment with existing methods under open-world 4-tab and 5-tab settings; Figure 10 This is a schematic diagram of the structure of a few-sample, multi-label website fingerprint recognition device provided in an embodiment of this application; Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0023] In the description of this application, it should be understood that the terms "upper," "lower," "left," "right," "front," "rear," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or relative positional relationship shown in the accompanying drawings. They are used only for the convenience of describing this application and for simplification, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this application. Unless otherwise specified, the above-mentioned orientational descriptions can be flexibly set in practical applications, provided that the relative positional relationships shown in the accompanying drawings are satisfied.
[0024] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0025] In the description of this application, it should be noted that, unless otherwise expressly specified and limited, the terms "installation," "connection," "linking," and "communication" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection. They can refer to a direct connection or an indirect connection through an intermediate medium, or a connection within two components. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.
[0026] In embodiments of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, article, or apparatus that includes that element.
[0027] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0028] In the embodiments of this application, at least one can also be described as one or more, and multiple can be two, three, four or more, and this application does not impose any restrictions.
[0029] In the description of this specification, specific features, structures, materials, or characteristics may be combined in any suitable manner in one or more embodiments or examples.
[0030] The solution provided in this application can be applied to Figure 1 The illustrated few-sample, multi-label website fingerprinting system, Figure 1 This is a system framework diagram of a few-sample, multi-label website fingerprint recognition system provided in an embodiment of this application.
[0031] For example, the few-sample multi-label website fingerprinting system 100 includes a teacher model pre-training module 110 and a student model fine-tuning module 120.
[0032] The teacher model pre-training module 110 is used to train a teacher model with a one-dimensional convolutional neural network as the core feature extractor based on synthetic multi-label traffic data. This model undergoes supervised training using a multi-label classification loss function, and the extracted multi-label website fingerprint features are mapped to classification results via a multilayer perceptron, thus forming a general feature extraction model with strong generalization capabilities.
[0033] The student model fine-tuning module 120 takes a small number of real traffic data samples from the target scenario as input, uses a structurally similar one-dimensional convolutional neural network to extract features, and constructs a multi-label classifier with the help of a multilayer perceptron. This module introduces label supervision loss and feature alignment distillation loss simultaneously during training through a comparative distillation mechanism, realizing knowledge transfer from the teacher model to the student model, thereby quickly adapting to the target multi-label website with a small amount of labeled data.
[0034] The finely tuned student model is combined with a k-nearest neighbor retrieval mechanism to form a multi-label website fingerprint recognition system. For the sample to be identified, the system integrates the direct classification results of the student model with the label information of similar samples retrieved from the historical feature database, and outputs an enhanced recognition result through weighted fusion, which significantly improves the robustness and accuracy of recognition in open environments and under conditions of few samples.
[0035] Figure 2 This is a flowchart illustrating the few-sample, multi-label website fingerprinting method provided in an embodiment of this application. (Refer to...) Figure 2 This application provides a method for identifying website fingerprints using a small number of samples and multiple labels, which may include: Step S201: Obtain single-tag website traffic data and construct multi-tag website traffic composite data based on the single-tag website traffic data.
[0036] Among them, single-tag website traffic data refers to traffic records where all traffic characteristics (such as accessed URLs, data packet size, time series patterns, etc.) originate from and belong to only one specific single website.
[0037] For example, single-tag data may include, but is not limited to: online video streaming, web browsing, file downloads, real-time communication, and online games.
[0038] In this embodiment of the application, the steps for constructing multi-tag website traffic composite data include: First, obtain single-tag website traffic data from at least two different sources.
[0039] Each single-tag website traffic data point corresponds to a specific website category, such as "Google," "Facebook," or "YouTube." These single-tag data points represent actual traffic records collected.
[0040] Next, for each single-tag website traffic data, a random segment operation is performed to obtain the corresponding traffic data fragment.
[0041] Specifically, random segmentation can start at any position on the timeline and be segmented according to a preset length or a random length to ensure that the obtained segments can reflect the local traffic patterns under the label.
[0042] Then, multiple traffic data fragments from different single-tag data are interleaved and superimposed in the time dimension to synthesize website traffic data with multi-tag attributes.
[0043] Interleaving can be done in a non-overlapping or partially overlapping manner, splicing and aligning traffic segments with different labels in chronological or random order, so that the synthesized data exhibits the composite characteristics of multiple traffic behavior labels on the overall timeline.
[0044] Optionally, one or more operations such as time offset, different overlap ratios, or noise injection can be introduced during the overlay process to further enhance the diversity and realism of the synthesized data and simulate traffic scenarios with multiple users and behaviors in a real network environment.
[0045] The multi-label website traffic synthetic data in the embodiments of this application can be used to train a classification model that can identify complex traffic patterns, or to test the performance of a multi-label traffic analysis system.
[0046] Step S202: Pre-train the teacher model based on multi-label website traffic synthetic data. The pre-trained teacher model can extract the general features of multi-label website traffic.
[0047] The teacher model refers to a deep neural network with a large capacity and complex structure, such as a deep convolutional neural network (CNN), a recurrent neural network (RNN) or its variants such as a long short-term memory network (LSTM), a gated recurrent unit (GRU), or a Transformer architecture based on a self-attention mechanism.
[0048] The goal of the teacher model is to have sufficient parameters and levels to capture the complex hierarchical information in traffic data, from low-level protocol features to high-level behavioral patterns.
[0049] Specifically, the multi-label website traffic synthetic data generated in step S201 is used as the training input for the teacher model. This data can be in the form of the original network packet sequence, a preprocessed traffic statistical feature sequence (such as the number of packets and bytes within a time window), or a graphical representation (such as a time series diagram or grayscale image).
[0050] The core of pre-training is to use the known precise time-label correspondence of synthetic data to train the teacher model in a supervised learning manner.
[0051] Training task: Typically set as a multi-label classification task or a sequence labeling task. The model is trained to accurately predict multiple behavioral labels that exist simultaneously in an input traffic segment, or to label each time point of the sequence.
[0052] Training process: By optimizing the loss function designed for the above tasks (such as multi-label classification loss) and using optimization algorithms such as Adam to iteratively update the model parameters, the model gradually learns to decouple different website behavior patterns in mixed traffic.
[0053] Generation of general features: After training, the outputs of the intermediate layers of the teacher model (usually the activation values before the last feature extraction layer) are considered as general features. These features encode the essential properties of the input flow, are invariant to the same behavior pattern, and are separable for different patterns.
[0054] In one embodiment, a specially designed one-dimensional convolutional neural network (1D-CNN), such as a Deep Fingerprinting Network (DF-Net) consisting of four stacked convolutional blocks, can be used as the core feature extractor of the teacher model.
[0055] Input: The preprocessed flow statistics feature sequence described above is used as the one-dimensional time series input.
[0056] Architecture: Each convolutional block contains a convolutional layer, batch normalization, activation function, pooling layer, and dropout layer. The number of convolutional kernels increases block by block (e.g., 32, 64, 128, 256) to build a feature pyramid from shallow to deep layers.
[0057] Training: Connect a multilayer perceptron classification head to its backend and perform end-to-end training with multi-label classification as the goal.
[0058] Output: After pre-training, the parameters of DF-Net are fixed. For any new traffic, the feature vector obtained through forward propagation of DF-Net is the extracted general feature, which can be represented as: in, The model input is represented by t, which represents a segment of raw traffic data input to the teacher model. Its mathematical form is a one-dimensional real number vector (sequence) of length L. This typically corresponds to a preprocessed sequence of traffic statistics, such as the packet count values of L consecutive time windows. Represents the feature extraction function. This represents the general feature matrix obtained after the input t is extracted by the teacher model. The superscript T indicates that it was generated by the teacher model. L and l represent the sequence lengths before and after DF-Net processing, respectively, and d represents the feature dimension.
[0059] Thus, by pre-training on large-scale synthetic data, the teacher model is able to learn to extract highly generalizable and discriminative universal features from complex mixed traffic.
[0060] Step S203: Obtain a small sample traffic data of the target multi-tag website. Based on the small sample traffic data and the teacher model, fine-tune the student model through comparative distillation to obtain a target student model adapted to the target multi-tag website.
[0061] In this embodiment of the application, the few-sample traffic data is n-shot, where n∈{5, 10, 15, 20}.
[0062] Contrastive distillation is a model training and optimization technique whose core purpose is to guide the student model to learn the general knowledge and structured representation of the teacher model by comparing the intermediate layer features of the teacher model and the student model and minimizing the differences between them.
[0063] Specifically, comparative distillation is achieved through the following synergistic mechanism: Dual-path feature extraction and representation alignment: A small number of samples are simultaneously input into both the frozen teacher model and the student model to be trained, extracting intermediate-layer feature representations from both for the same sample. For effective knowledge transfer, these features are further transformed into a comparable common semantic space through a projection network. In this space, by using a comparative distillation loss function, the student model's feature representation is forced to converge towards its corresponding teacher model feature representation (positive sample pairs), while distancing itself from teacher model features for other samples (negative sample pairs). This process transfers the general, robust semantic patterns and feature discriminative power inherent in the teacher model to the student model.
[0064] Few-shot label supervision: To ensure the student model accurately adapts to the target website, a supervision loss (such as binary cross-entropy loss) is calculated between its predicted output and the true multi-label data. This loss directly constrains the model to learn the specific classification boundary and label co-occurrence relationship in the target scenario.
[0065] Joint Optimization and Balancing: This approach combines the contrastive distillation loss with the supervised loss through a weighted joint loss function. An optimization algorithm (such as Adam) is used to minimize this joint loss, updating only the parameters of the student model. This joint optimization strategy achieves an optimal balance between mimicking the teacher's general knowledge (feature-level alignment) and fitting a target-specific distribution (output-level supervision).
[0066] Based on the above principles, the student model can quickly inherit the powerful representational capabilities of the teacher model with very little real labeled data, and focus on the target domain to obtain a target student model that is both highly accurate and has strong generalization ability, as well as lightweight, making it suitable for practical deployment.
[0067] The following example further illustrates in detail the specific implementation of the above principle.
[0068] First, obtain a small sample training set from the target multi-tag website: Where D represents the entire training dataset, which is a set containing N samples. Let represent the input features of the i-th sample; in multi-label tasks, It is a data packet direction sequence; Let represent the label set of the i-th sample; this is a multi-label output. In single-label classification, It is a single tag (such as "YouTube"). In multi-tag classification, It is a set that may contain multiple labels (such as {"YouTube", "Facebook", "Google"}); i=1,2,..., Ni=1,2,...,N indicates that there are N samples in the dataset.
[0069] Next, load the pre-trained teacher model DF-Net obtained in step S202 and freeze all its parameters. Initialize a student model DF-Net with the same or simpler structure. S (such as CNNs with fewer layers).
[0070] For samples in a batch They were then input into the teacher model DF-Net. T and student model DF-Net S Extract the specified intermediate layer feature representation. and .
[0071] Then and Each input is a projection head with a shared structure, mapped onto a common low-dimensional space used for contrastive learning, to obtain the projected feature vector. and .
[0072] Label-supervised loss: The student model prediction results are calculated using binary cross-entropy. With real labels Error between: in, Represents the binary cross-entropy loss. This indicates the total number of websites. Indicates website The actual label, with a value of 0 or 1; Indicates website The probability of predicting the label.
[0073] Contrastive distillation loss: In the projected feature space, the feature representations of students and teachers are aligned by optimizing the similarity of positive and negative sample pairs. (Sample) Comparative distillation loss Satisfy the following formula: in, and These represent the student model and the teacher model for the samples, respectively. The extracted fingerprint feature vector, and its representation obtained through projection. Indicates L2 normalized embedding and The cosine similarity between them, where τ is a temperature parameter used to control the concentration of the similarity distribution.
[0074] The total loss is the weighted sum of the two losses mentioned above: in, The value represents the number of samples in the dataset, and λ is used to control the relative contribution of the distillation loss. In this embodiment, λ is set to 0.01.
[0075] After training convergence, a target student model adapted to the target multi-label website is obtained. This model integrates the general knowledge of the teacher model and the specific information of the target scenario, ensuring high classification accuracy while maintaining a small model size and fast inference speed, making it suitable for practical deployment.
[0076] Step S204: Obtain the multi-label website traffic data to be identified, and fuse multiple historical samples with similar features based on the target student model and the multi-label website traffic data to be identified to obtain the multi-label website fingerprint identification result.
[0077] Specifically, the traffic data features of the multi-label website to be identified are input into the target student model to obtain the first multi-label prediction result; based on the known multi-labels of multiple historical samples, the second multi-label prediction result is generated; the first multi-label prediction result and the second multi-label prediction result are weighted and fused to generate the multi-label website fingerprint recognition result.
[0078] Among them, several historical samples are samples in the fine-tuning training set that have similar characteristics to the traffic data of the multi-label website to be identified.
[0079] The following example illustrates the specific steps of this identification process.
[0080] Step 1: Obtain multi-tag website traffic data (test sample) to be identified. test Inputting it into the target student model yields: First multi-label prediction result: the probability vector output by the model. Each element This represents the predicted probability that the test sample belongs to website category c.
[0081] Feature representation of test samples: Feature vectors extracted from the intermediate layers of the student model. This is used for subsequent similarity searches.
[0082] Step 2: Retrieve and test sample features from the constructed training set feature library. The k most similar historical samples are denoted as the neighborhood set. ,in, Let i be the characteristics of the i-th neighbor. Represents the true multi-label vector (one-hot or multi-hot form).
[0083] Calculate the Euclidean distance d between the test sample and each neighbor feature. , ).
[0084] Step 3: Calculate the second multi-label prediction result (i.e., the kNN classification result): in, Represents Euclidean distance. Indicates the first The weights of each neighbor are assigned as follows: neighbors that are closer in the feature space are given higher weights, while neighbors that are farther away are given lower weights.
[0085] Step 4: Calculate the first multi-label prediction result. Compared with the second multi-label prediction results Weighted fusion is performed to obtain multi-label website fingerprint recognition results. The calculation method is as follows: Where β∈[0,1] is the fusion weight, used to balance the confidence of the two prediction methods. In this embodiment, β is set to 0.1, indicating that the prediction of the student model is the main one, while a small amount of correction based on neighbor memory is introduced.
[0086] The beneficial effects of the few-sample, multi-label website fingerprinting method provided in this application include: 1. By training the teacher model using synthetic multi-tag website traffic, the reliance on a large amount of labeled traffic is reduced, while effectively capturing the potential patterns of multi-tag website traffic.
[0087] 2. By comparing knowledge distillation, the alignment of features between the teacher model and the student model is effectively achieved, guiding the student model to capture potential semantic relationships, enhancing the feature similarity within the same website and the differences between different websites, thereby effectively promoting knowledge transfer.
[0088] 3. In the model inference stage, by directly utilizing the knowledge of neighbor similar samples in the existing training set, the model's recognition performance of multi-label websites in a low-sample environment is further improved.
[0089] 4. A multi-label traffic dataset reflecting website concept drift was collected, and the robustness of the model in dealing with website concept drift under the condition of limited target website traffic samples was verified.
[0090] In this embodiment of the application, the following dataset and partitioning method are used to train and validate the proposed few-sample, multi-label website fingerprinting method: Closed World Evaluation Dataset: This dataset utilizes the latest publicly available Few-shot Multi-tab Website Fingerprinting (FMWF) dataset in the field of few-shot multi-tab website classification. It contains traffic data from multi-tab websites with different tab counts, specifically 2-tab, 3-tab, 4-tab, and 5-tab scenarios. Each tab count setting includes 100 category label combinations, with each combination containing approximately 50 traffic samples.
[0091] Open World Evaluation Dataset: The Towards Robust Multi-tab Website Fingerprinting (ARES) dataset, a non-monitored website dataset, is introduced to simulate real-world open network environments. This dataset contains 58,000 combinations of non-monitored websites across different tab settings, with each combination corresponding to one sample.
[0092] Concept Drift Evaluation Dataset: To evaluate the effectiveness of the model against dynamic changes in network traffic (i.e., concept drift), multi-label website traffic data were re-collected at least one year later, following the FMWF dataset collection specifications. This dataset contains 50 website combinations under different tab settings, with each combination of websites accessed once.
[0093] Training data partitioning: Teacher model pre-training phase: Training and optimization are performed using a multi-label website traffic dataset synthesized from single-label website traffic.
[0094] Student model fine-tuning phase: The dataset was randomly divided into a fine-tuning training set and a test set. The fine-tuning training set used a 100-way n-shot configuration (n∈{5,10,15,20}), and the test set used a 100-way 1-shot configuration. To ensure statistical reliability, five independent random classification experiments were conducted. The final results are reported in the form of mean ± standard deviation (%), with the best recognition result indicated in bold and the second-best result indicated by underline.
[0095] To comprehensively evaluate the performance of the above methods, the embodiments of this application adopt the following evaluation metrics: Closed-world evaluation: Top-k accuracy (A@K), precision, recall, and F1 score are used to measure the model’s ability to distinguish multi-tag website traffic.
[0096] Open-world evaluation: In addition to the A@K, precision, recall, and F1 score of monitored websites, the rejection rate (RR) of non-monitored websites and the overall recognition accuracy (Acc) of monitored and non-monitored websites are also evaluated to comprehensively reflect the model's ability to identify monitored websites and reject non-monitored websites.
[0097] The following is in conjunction with the appendix Figures 3 to 9 The provided multi-label test data provides a detailed explanation of the beneficial effects of this application.
[0098] Figure 3 and Figure 4The paper demonstrates the classification performance of the proposed method in a closed-world scenario, comparing it with other existing methods under different n values (small sample size) and different tab settings.
[0099] The results show that the proposed method exhibits the best classification performance under all n values and tab conditions, achieving the highest values for all evaluation metrics. In particular, the performance gap between the proposed method and the state-of-the-art (SOTA) technology becomes more significant when the n value is smaller and the number of tabs is larger. This demonstrates that the present invention can more effectively capture the diversity and dynamic changes of traffic in complex scenarios where the target website sample is limited and users simultaneously open a large number of websites, thereby achieving more stable and accurate identification.
[0100] Figure 5 This paper demonstrates the classification performance of the proposed method versus comparative methods in a closed-world scenario when the number of website tags opened by the user is unknown. The results show that the proposed method maintains the best performance for all n values, indicating that it can adaptively handle the complexity of multi-tag website traffic without prior knowledge and maintain high classification accuracy in environments with an uncertain number of tags.
[0101] Figure 6 and Figure 7 This paper demonstrates the classification performance of the proposed method in addressing concept drift. Under different n values and tab settings, the overall classification performance of the proposed method only shows a slight downward trend, and the decline is not significant, indicating good stability. Notably, when the n value is small (e.g., 5) and the number of tabs is large (e.g., 5-tab), the classification accuracy actually improves. This further verifies that the present invention, through knowledge distillation, can effectively transfer robust knowledge from the teacher model to the student model, enabling it to maintain high recognition accuracy even when faced with website content updates or environmental changes.
[0102] Figure 8 and Figure 9This paper demonstrates the performance comparison between the proposed method and comparative methods under different n values and tab settings in an open-world scenario. In terms of identifying monitored websites, the proposed method performs best across all settings, demonstrating the effectiveness of its core task. Regarding the rejection rate for non-monitored websites, the proposed method is slightly lower than methods such as Website Fingerprinting via Time-Frequency Consistency (WF-TFC), Deep Fingerprinting (DF), and Transformer-based Model for Multi-tab Website Fingerprinting (TMWF) in most settings. However, since the number of non-monitored website samples is far greater than that of monitored websites, the overall accuracy of these methods is relatively higher. This invention maintains an acceptable rejection rate while ensuring a high recognition rate for monitored websites, demonstrating good overall balance.
[0103] The foregoing mainly describes the solution provided in this application. Accordingly, this application also provides a few-sample, multi-label website fingerprint recognition device, which is used to implement the above-described method embodiments.
[0104] The following describes the few-sample, multi-label website fingerprint recognition device provided in the embodiments of this application. The few-sample, multi-label website fingerprint recognition device described below can be referred to in conjunction with the few-sample, multi-label website fingerprint recognition method described above.
[0105] Figure 10 This is a schematic diagram of the structure of a few-sample, multi-label website fingerprint recognition device provided in an embodiment of this application. Figure 10 As shown in the figure, this application provides a few-sample, multi-label website fingerprint recognition device, which may include: Data construction module 1001 is used to acquire single-tag website traffic data and construct multi-tag website traffic composite data based on the single-tag website traffic data; The model training module 1002 is used to pre-train the teacher model based on multi-label website traffic synthetic data. The pre-trained teacher model can extract the general features of multi-label website traffic. The model fine-tuning module 1003 is used to obtain a small sample traffic data of the target multi-label website. Based on the small sample traffic data and the teacher model, the student model is fine-tuned through comparative distillation to obtain a target student model adapted to the target multi-label website. The data fusion module 1004 is used to acquire the multi-label website traffic data to be identified, and to fuse multiple historical samples with similar characteristics based on the target student model and the multi-label website traffic data to be identified to obtain the multi-label website fingerprint recognition result.
[0106] In one embodiment, the data fusion module 1004 is specifically used for: The multi-label website traffic data features to be identified are input into the target student model to obtain the first multi-label prediction result; Based on the known multi-labels of multiple historical samples, a second multi-label prediction result is generated. The multiple historical samples are samples in the fine-tuning training set that are similar in features to the multi-label website traffic data to be identified. The first and second multi-label prediction results are weighted and fused to generate multi-label website fingerprint recognition results.
[0107] In yet another embodiment, the model fine-tuning module 1003 is specifically used for: By inputting a small sample of traffic data into the teacher model and the target student model respectively, the feature representations of the teacher model and the target student model for the same input sample are obtained; Calculate the supervised loss between the predicted results output by the target student model and the true labels; Calculate the comparative distillation loss between the feature representations of the target student model and the feature representations of the teacher model; A joint loss function is constructed based on supervised loss and contrastive distillation loss, and the parameters of the target student model are updated through an optimization algorithm to obtain a target student model adapted to the target multi-tag website.
[0108] In yet another embodiment, the model fine-tuning module 1003 is specifically used for: Obtain the intermediate layer feature representations extracted from the input samples by the teacher model and the target student model, respectively; The obtained intermediate layer feature representations are subjected to projection transformations to obtain the corresponding projected features; Calculate the similarity between the projected features of the target student model and the projected features of the teacher model; Based on similarity, the comparative distillation loss is calculated by enhancing the similarity between positive sample pairs and reducing the similarity between negative sample pairs.
[0109] In yet another embodiment, the data construction module 1001 is specifically used for: Randomly extract traffic data segments from at least two single-tag websites with different sources. The obtained traffic data fragments are interleaved and superimposed in the time dimension to generate multi-tag website traffic composite data with multiple tag attributes.
[0110] In yet another embodiment, the network structure for pre-training the teacher model is a one-dimensional convolutional neural network. And / or, the loss function for pre-training the teacher model is a multi-label classification loss function; And / or, the optimization algorithm for pre-training the teacher model is the Adam algorithm for adaptive moment estimation.
[0111] In some embodiments, the few-sample, multi-label website fingerprint recognition device includes hardware structures and / or software modules corresponding to the execution of each function in order to achieve the above-described functions. Those skilled in the art will readily recognize that, based on the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0112] This application embodiment can divide the few-sample, multi-label website fingerprint recognition device into functional modules according to the above method embodiment. For example, each function can be divided into a separate functional module, or two or more functions can be integrated into a feature extraction module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0113] Figure 11 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application, such as... Figure 11As shown, the electronic device may include a processor 1110, a communication interface 1120, a memory 1130, and a communication bus 110, wherein the processor 1110, the communication interface 1120, and the memory 1130 communicate with each other through the communication bus 110. The processor 1110 can call logical instructions in the memory 1130 to execute the steps of a few-sample multi-label website fingerprinting method. The method includes: acquiring single-label website traffic data; constructing multi-label website traffic synthetic data based on the single-label website traffic data; pre-training a teacher model based on the multi-label website traffic synthetic data, wherein the pre-trained teacher model can extract general features of multi-label website traffic; acquiring few-sample traffic data of a target multi-label website; fine-tuning a student model based on the few-sample traffic data and the teacher model through comparative distillation to obtain a target student model adapted to the target multi-label website; acquiring multi-label website traffic data to be identified; fusing multiple historical samples with similar features based on the target student model and the multi-label website traffic data to be identified to obtain a multi-label website fingerprinting result.
[0114] Furthermore, the logical instructions in the aforementioned memory 1130 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0115] On the other hand, this application also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can perform the steps of the few-sample multi-label website fingerprinting method provided in the above embodiments, such as: acquiring single-label website traffic data, constructing multi-label website traffic synthetic data based on the single-label website traffic data; pre-training a teacher model based on the multi-label website traffic synthetic data, wherein the pre-trained teacher model can extract the general features of multi-label website traffic; acquiring few-sample traffic data of a target multi-label website, and fine-tuning a student model based on the few-sample traffic data and the teacher model through comparative distillation to obtain a target student model adapted to the target multi-label website; acquiring multi-label website traffic data to be identified, and fusing multiple historical samples with similar features based on the target student model and the multi-label website traffic data to be identified to obtain a multi-label website fingerprinting result.
[0116] On the other hand, embodiments of this application also provide a processor-readable storage medium storing a computer program for causing the processor to execute the steps of the methods provided in the above embodiments, such as: acquiring single-label website traffic data, constructing multi-label website traffic synthetic data based on the single-label website traffic data; pre-training a teacher model based on the multi-label website traffic synthetic data, wherein the pre-trained teacher model can extract general features of multi-label website traffic; acquiring few-sample traffic data of a target multi-label website, and fine-tuning a student model based on the few-sample traffic data and the teacher model through comparative distillation to obtain a target student model adapted to the target multi-label website; acquiring multi-label website traffic data to be identified, and fusing multiple historical samples with similar features based on the target student model and the multi-label website traffic data to be identified to obtain a multi-label website fingerprint recognition result.
[0117] Processor-readable storage media can be any available medium or data storage device that the processor can access, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MOs), etc.), optical storage (such as CDs, DVDs, BDs, HVDs, etc.), and semiconductor storage (such as ROMs, EPROMs, EEPROMs, non-volatile memory (NAND flash), solid-state drives (SSDs)).
[0118] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0119] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of embodiments.
[0120] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for fingerprinting websites with few samples and multiple labels, characterized in that, The method includes: Acquire single-tag website traffic data, and construct multi-tag website traffic composite data based on the single-tag website traffic data; The teacher model is pre-trained based on the multi-tag website traffic synthetic data, and the pre-trained teacher model is able to extract the general features of multi-tag website traffic. Obtain a small sample traffic data of the target multi-tag website. Based on the small sample traffic data and the teacher model, fine-tune the student model through comparative distillation to obtain a target student model adapted to the target multi-tag website. The traffic data of the multi-label website to be identified is obtained, and multiple historical samples with similar characteristics to the target student model and the traffic data of the multi-label website to be identified are fused to obtain the multi-label website fingerprint identification result.
2. The method for identifying website fingerprints with few samples and multiple labels according to claim 1, characterized in that, The multi-label website fingerprinting result is obtained by fusing multiple historical samples with similar characteristics to the target student model and the multi-label website traffic data to be identified, including: The multi-label website traffic data features to be identified are input into the target student model to obtain the first multi-label prediction result; Based on the known multi-labels of the multiple historical samples, a second multi-label prediction result is generated, wherein the multiple historical samples are samples in the fine-tuning training set that are similar in features to the multi-label website traffic data to be identified. The first multi-label prediction result and the second multi-label prediction result are weighted and fused to generate the multi-label website fingerprint recognition result.
3. The method for identifying website fingerprints with few samples and multiple labels according to claim 1 or 2, characterized in that, The step of fine-tuning the target student model based on the few-sample traffic data and the teacher model through comparative distillation to obtain a target student model adapted to the target multi-tag website includes: The few-sample traffic data is input into the teacher model and the target student model respectively to obtain the feature representations of the teacher model and the target student model for the same input sample; Calculate the supervised loss between the predicted result output by the target student model and the true label; Calculate the contrastive distillation loss between the feature representation of the target student model and the feature representation of the teacher model; A joint loss function is constructed based on the supervised loss and the contrastive distillation loss, and the parameters of the target student model are updated through an optimization algorithm to obtain the target student model adapted to the target multi-tag website.
4. The method for identifying website fingerprints with few samples and multiple labels according to claim 3, characterized in that, The calculation of the comparative distillation loss between the feature representation of the target student model and the feature representation of the teacher model includes: Obtain the intermediate layer feature representations extracted by the teacher model and the target student model for the input sample, respectively; The obtained intermediate layer feature representations are subjected to projection transformations to obtain the corresponding projection features; Calculate the similarity between the projected features of the target student model and the projected features of the teacher model; Based on the aforementioned similarity, the comparative distillation loss is calculated by enhancing the similarity between positive sample pairs and reducing the similarity between negative sample pairs.
5. The method for identifying website fingerprints with few samples and multiple labels according to claim 1, characterized in that, The construction of multi-tag website traffic composite data based on the single-tag website traffic data includes: Randomly extract traffic data segments from at least two single-tag websites with different sources. The obtained traffic data fragments are interleaved and superimposed in the time dimension to generate multi-tag website traffic composite data with multiple tag attributes.
6. The method for identifying website fingerprints with few samples and multiple labels according to any one of claims 1 to 5, characterized in that, The network structure used to pre-train the teacher model is a one-dimensional convolutional neural network. And / or, the loss function used to pre-train the teacher model is a multi-label classification loss function; And / or, the optimization algorithm for pre-training the teacher model is the Adaptive Moment Estimation Optimization Adam algorithm.
7. A fingerprint recognition device for websites with few samples and multiple labels, characterized in that, include: The data construction module is used to acquire single-tag website traffic data and construct multi-tag website traffic composite data based on the single-tag website traffic data. The model training module is used to pre-train the teacher model based on the multi-tag website traffic synthetic data. The pre-trained teacher model is able to extract the general features of multi-tag website traffic. The model fine-tuning module is used to obtain a small sample traffic data of the target multi-label website. Based on the small sample traffic data and the teacher model, the student model is fine-tuned through comparative distillation to obtain a target student model adapted to the target multi-label website. The data fusion module is used to acquire the multi-label website traffic data to be identified, and to fuse it based on the target student model and multiple historical samples with similar characteristics of the multi-label website traffic data to obtain the multi-label website fingerprint identification result.
8. An electronic device comprising a processor and a memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the few-sample multi-label website fingerprinting method according to any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the few-sample, multi-label website fingerprinting method as described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the few-sample, multi-label website fingerprinting method according to any one of claims 1 to 6.