Android-SEM: Generative Adversarial Network for Android Malware Semantic Enhancement Model Based on Transfer Learning

: Currently, among the millions of Android applications, there exist numerous malicious programs that pose signiﬁcant threats to people’s security and privacy. Therefore, it is imperative to develop approaches for detecting Android malware. Recently developed malware detection methods usually rely on various features, such as application programming interface (API) sequences, images, and permissions, thereby ignoring the importance of source code and the associated comments, which are not usually included in malware. Therefore, we propose Android-SEM, which is an Android source code semantic enhancement model based on transfer learning. Our proposed model is built upon the Transformer architecture to achieve a pretraining framework for generating code comments from malware source code. The performance of the pretraining framework is optimized using a generative adversarial network. Our proposed model relies on a novel regression model-based ﬁlter to retain high-quality comments and source code for feature fusion pertinent to semantic enhancement. Creatively, and contrary to conventional methods, we incorporated a quantum support vector machine (QSVM) for classifying malicious Android code by combining quantum machine learning and classical deep learning models. The results proved that Android-SEM achieves accuracy levels of 99.55% and 99.01% for malware detection and malware categorization, respectively.


Introduction
The number of Android applications has been increasing rapidly owing to the significantly increased use of Android-based mobile devices. Currently, Google Play has over three million applications. Unfortunately, there is also a significant amount of malicious code within these applications. Android-based systems and devices have become primary targets for attackers seeking access to other people's money by stealing their personal information and monitoring their data. Additionally, because of the open-source features associated with Android-based applications, attackers can easily upload programs running malicious code to Google Play, including programs running well-known malicious code categorized as Trojan horses, adware, file infectors, riskware, backdoors, spyware, and ransomware [1,2]. Because of the current proliferation and the increasing complexity of malware, it is imperative to develop efficient malware detection mechanisms to address this crucial issue [3,4].
Security personnel use various technological approaches to detect and classify Android malware. Such approaches can be categorized as static, dynamic, and mixed forms of analyses, which are performed with the aid of machine learning [5]. Over recent years, most • To the best of our knowledge, we are the first to use feature fusion vectors obtained from comments and source code to enhance the semantic information contained in malware. We propose Android-SEM, which is a generative adversarial pre-training model based on the transfer learning method. We effectively use the model for malicious Android code detection and classification. • We transfer comment information that hardly exists in Android malicious code from a large number of Android source code datasets to the malicious code domain through transfer learning to enhance program-related semantic information. • We propose a transfer learning-based filter, which can filter out bad comments without labels, and we use generative adversarial networks to improve the quality of generated comments, thereby effectively improving the classification abilities of our proposed model. • To the best of our knowledge, we are the first to develop a model that uses QSVM combined with classical deep learning to detect malicious code in Android-based applications, and Android-SEM is more accurate than other detection models proposed in recent studies.

Android Malware Detection and Classification
This study focused on static analysis, and the relevant literature is reviewed here. Zhang et al. [13] examined the relationship between entities through API calls, exceptions, permissions, and edges. They constructed a private dataset containing 322,594 samples collected between 2012 and 2018. They used RF, model pool, SVM, and DNN as the four frameworks for their experiments [14][15][16][17]. However, they extracted fewer features, and it is difficult to fully describe the program semantics, thus failing to achieve high-precision detection. Coincidentally, Idrees et al. [18] used a dataset comprising 1745 programs. An unsupervised model was used to preprocess the features and generate vectors by extracting permissions and intent features. They also extracted only a few features for model training. Currently, at least six classifiers have been used for these experiments (RF [19], Naïve Bayes [20], decision tree [21], decisionTable [22], sequential minimal optimization [23], and multilayer perceptron (MLP) [24]). Wang et al. [25] implemented an Android package kit (APK) tool for extracting features from Smail files, and they used Androguard to build an API call graph to form an adjacency matrix, after which they checked for malware using operations-related calls. Rathore et al. [26] used reinforcement learning to develop malware variants, and they proposed two attack types: single-policy attack (white box) and multi-policy attack (gray-box), for which they obtained fooling rates of 44.28% and 29.44%, respectively.
The studies mentioned above have contributed to the malicious code field from different aspects. Whether it is detecting malicious code or developing malicious code variants, good results have been achieved. However, there remains room for improvement in the accuracy of malicious code detection. Additionally, all the studies mentioned above involve the extraction of very general features, which cannot be used to further mine the information of the program itself. Therefore, the methods mentioned above cannot achieve multi-granularity program semantic extraction, cannot comprehensively extract the entire program semantic information, and cannot achieve a high accuracy rate.

Source Code Comment Generation
Source code comments are used to describe the functions and behaviors of the source code, thereby enabling programmers to understand the code. As a result, programmers can conveniently perform follow-up work on the code. However, most developers do not include comments in their code, even in software development environments that require cooperation among multiple stakeholders and rapid iterations. Additionally, there is an overall lack of comments in the source code of benign software as well as in malicious code, where the lack of comments is particularly evident [27]. Code comments are rarer in malicious code than in benign software. Therefore, generating comments for malware is significantly challenging.
In 2019, LeClair et al. [7] combined seq2seq and the attention mechanism to develop the ast-attendgru method for generating code comments automatically [28]. They also integrated a graph convolutional neural network (GCN), based on which they proposed a method for processing abstract syntax tree (AST) information [29,30]. Their proposed solution was a graph neural network-based method that resulted in the enhanced generation of comments after transforming the AST into a graph. The machine translation was significantly enhanced because they used the transformer architecture. Ahmad et al. [31] and Wang et al. [32] also used transformer-based deep learning models to complete translation tasks, and relative to the findings of previous studies, they improved the accuracy of the generated results. By contrast, Dai et al. [33] discovered that when a transformer-based deep learning model processes long text, the text is truncated into multiple fixed-length fields. Therefore, the Transformer-XL method was developed, which is optimized for such cases and can model the relationship beyond a fixed length.

Quantum Machine Learning
The concept of combining machine learning and quantum physics involves using the superposition and entanglement of quanta to improve computing and storage capabilities. It is also used to reduce the complexities and training processing times of calculations involved in artificial intelligence. Compared with classical computing, quantum machine learning has many advantages. Because quantum states can be superimposed, quantum principles can be used to realize parallel computing without the addition of hardware and to accomplish the quadratic or exponential acceleration of solutions relative to those obtained through classical algorithms [34].
Relative to that obtained through classical SVMs, the acceleration effect of QSVMs is reflected mainly in tasks involving the determination of support vectors and the calculation of kernel function matrices [35]. For example, Park et al. [36] used quantum feature mapping to convert data into quantum states, and they constructed SVM cores from these quantum states, which were then evaluated against classical SVMs with radial basis function (RBF) cores.
As the name suggests, a quantum feature map φ(x) is a map from the classical feature vector x to the quantum state |Φ(x) Φ(x)|. This is facilitated by applying the unitary operation U Φ(x) on the initial state |0 n , where n represents the number of qubits used for encoding. Feature maps [37] currently available in Qiskit include PauliFeatureMap, ZZFeatureMap, and ZFeatureMap. The PauliFeatureMap is defined as: In 2019, LeClair et al. [28] combined seq2seq and the attention mechanism to develop the ast-attendgru method for generating code comments automatically [29]. They also integrated a graph convolutional neural network (GCN), based on which they proposed a method for processing abstract syntax tree (AST) information [30,31]. Their proposed solution was a graph neural network-based method that resulted in the enhanced generation of comments after transforming the AST into a graph. The machine translation was significantly enhanced because they used the transformer architecture. Ahmad et al. [32] and Wang et al. [33] also used transformer-based deep learning models to complete translation tasks, and relative to the findings of previous studies, they improved the accuracy of the generated results. By contrast, Dai et al. [34] discovered that when a transformer-based deep learning model processes long text, the text is truncated into multiple fixed-length fields. Therefore, the Transformer-XL method was developed, which is optimized for such cases and can model the relationship beyond a fixed length.

Quantum Machine Learning
The concept of combining machine learning and quantum physics involves using the superposition and entanglement of quanta to improve computing and storage capabilities. It is also used to reduce the complexities and training processing times of calculations involved in artificial intelligence. Compared with classical computing, quantum machine learning has many advantages. Because quantum states can be superimposed, quantum principles can be used to realize parallel computing without the addition of hardware and to accomplish the quadratic or exponential acceleration of solutions relative to those obtained through classical algorithms [35].
Relative to that obtained through classical SVMs, the acceleration effect of QSVMs is reflected mainly in tasks involving the determination of support vectors and the calculation of kernel function matrices [36]. For example, Park et al. [37] used quantum feature mapping to convert data into quantum states, and they constructed SVM cores from these quantum states, which were then evaluated against classical SVMs with radial basis function (RBF) cores.
As the name suggests, a quantum feature map φ(x) is a map from the classical feature vector x to the quantum state |Φ(x) Φ(x)|. This is facilitated by applying the unitary operation U Φ(x) on the initial state |0 n , where n represents the number of qubits used for encoding. Feature maps [38] currently available in Qiskit include PauliFeatureMap, ZZFeatureMap, and ZFeatureMap. The PauliFeatureMap is defined as: In mathematics and mathematical physics, a Pauli matrix is a set of three 2 × 2 unitary Hermitian complex matrices. In quantum mechanics, they appear as a term in the Pauli equation that describes the interaction between magnetic field and spin. All Pauli matrices are Hermitian matrices, and they and the linear expansion of the identity matrix become the vector space of 2 × 2 Hermitian matrices.
A unitary operator of depth d is defined as follows: Which contains layers of Hadamard gates interleaved with entangling blocks, U Φ(x) , encoding the classical data, as shown in Figure 1 for d = 2.
In mathematics and mathematical physics, a Pauli matrix is a set of three 2 × 2 unitary Hermitian complex matrices. In quantum mechanics, they appear as a term in the Pauli equation that describes the interaction between magnetic field and spin. All Pauli matrices are Hermitian matrices, and they and the linear expansion of the identity matrix become the vector space of 2 × 2 Hermitian matrices.
A unitary operator of depth d is defined as follows: Which contains layers of Hadamard gates interleaved with entangling blocks, U Φ(x) , encoding the classical data, as shown in Figure 1 for d = 2. Within the entangling blocks, U Φ(x) : P i ∈ {I, X, Y, Z} denotes the Pauli matrices. The index S describes connectivities between different qubits or data points, where S ∈ {( n k ) combinations, k = 1, . . . n}, and by default, the data mapping function φ S (x) is as follows: When k = 2, P 0 = Z, P 1 = ZZ, the following is the ZZFeatureMap: However, as discussed by Havlicek et al. [37], quantum kernel machine algorithms may exhibit quantum advantages over classical approaches only if the corresponding quantum kernel is difficult to estimate classically. Although necessary, the difficulty of estimating the kernel using classical resources is not always a sufficient condition for obtaining quantum advantages using quantum kernel machine algorithms. Nonetheless, it was proven recently by Liu et al. [38] that there are learning problems for which learners with access to quantum kernel methods will have a quantum advantage over learners based solely on classical algorithms.
Quantum computing has made a huge leap in processing power. Through quantum effects, such as interference or entanglement, quantum computing is expected to achieve quantum advantages, such as the exponential acceleration of computing performance, and effectively solve specific problems that are difficult for classical computers to solve. Additionally, the efficiency of conventional nuclear computing is not high. In the high case, quantum computing will grow exponentially with the size of the problem. In addition to increasing computing speed, quantum computing can improve model accuracy and model training speed. Previous studies [8] have demonstrated the exponential speedup potential of training SVMs using quantum computing, particularly using quantum techniques, to invert the kernel matrix from polynomial to logarithmic complexity. Currently, quantum computing is being gradually applied in image processing and other fields, and it has obtained significantly good results [39]. Therefore, quantum advantage is also required in the field of malicious code detection to improve and break the existing bottleneck. Although we do not currently have the hardware conditions to conduct a real experiment, we can model it using a classical computer.

Method
The overall architecture proposed in this study is presented in Figure 2. The architecture comprises three stages: feature engineering, a semantic enhancement model based on transfer learning, and classification. The third stage is based on classical and quantum classifiers.

Feature Engineering
First, we obtained more than 2.1 million pairs of Java methods and one-sentence method comments from more than 28 thousand Java projects [11]. We further processed the sequence parts of the dataset, standardized logical symbols, numbers, and variables, and limited the vocabulary size. As shown in Figure 3, for the malware dataset, we obtained a total of 21,720 Android samples using CICMalDroid2020 [12] and Google Play. We implemented a multi-process batch program on the malware applications, unpacked the APKs to obtain the Dex files, and converted them into their intermediate representation (IR) format to obtain the class files, which we packaged into jar files. After reverse-cracking the applications to obtain their source codes, we extracted their functions through regular matching and subjected them to the same normalization process used on the pretraining data. Simultaneously, the Androguard tool was used to extract the API sequence, and all the information was stored in an SQLite database, which is convenient for management, postprocessing, and future use.

Model Design
Source code comments are essential in program development. From the perspective of program analysis, comments can further improve the semantic information of the code. However, determining the source code comments of malware is challenging. For this purpose, we propose a semantic enhancement model for malicious code based on migration learning, as shown in Figure 4.
According to recent NLP-related research, transfer learning models based on the Transformer architecture [40] combine two advantages: transfer learning and attention. Therefore, we used a transformer to develop our semantic enhancement model. First, we used the functions and comments in the pretraining dataset to pretrain the model. Second, we extracted methods from the malicious code dataset, performed word table mapping, and trained the fine-tuning model through word embedding and position embedding. The feature vector was obtained after passing through multiple encoders, and the matrix vector in the encoder was input into the decoder from which comment vectors were automatically generated. To perform the feature fusion of the two vectors, we used bilinear pooling [41] and obtained a high-dimensional semantically enhanced vector. Finally, we obtained a low-dimensional vector representation through a fully connected layer.
Because it is based on the transformer as an extension of the pre-trained model architecture, the O(n 2 ) computational complexity of the Android-SEM model is also acceptable.
In the pretraining stage, we used a generative adversarial approach to optimize the generator effect. Generative adversarial networks are commonly used in the field of image processing, but we borrowed their core ideas and applied them to sequence structure processing. We treated the generator in the pretraining stage as a "fake coin maker", the comments it generated as "fake coins", and the human-labeled comments in the dataset as "real coins". In addition, we regarded the discriminator composed of the encoder and the fully connected layer as "police" and improved the quality of the comments generated by the generator through the mutual confrontation between the "police" and the "fake coin maker".    We propose a transfer learning-based scoring device for generated comments to avoid generating bad comment vectors that do not represent program semantics effectively. Because similar source code and comment vectors must have similar semantics, the Euclidean distance between the two is small. Therefore, during the pretraining stage, we used the function vector obtained from the encoder and the Euclidean distance between the comments vector obtained from the decoder and the BLUE value calculated from the generated comments and its label value, both of which were trained using a linear regression model. After the model is saved, the bad comments are filtered by generating the Euclidean distance between the comments vector and the function vector obtained during the fine-tuning stage. Therefore, we could eliminate bad comments in the feature fusion stage without the need for annotated labels.
By contrast, we conducted fine-tuning training on the API sequences extracted from the malicious code dataset. We also used the concept of NLP to map the API sequences through the vocabulary, PyTorch.nn.embedding for word embedding, and the bidirectional gated recurrent unit (Bi-GRU) to learn the API semantics and context to obtain the vector representation of the API sequence. Finally, the feature fusion vector formed using the method, comments, and feature vector of the API sequence were spliced in preparation for malicious code detection and classification tasks. The tasks were performed using two methods: quantum feature mapping and MLP.
Currently, significant research has been conducted on CNN-based image processing of Android code and the subsequent analysis [42], and most studies involving sequence formats used significantly common features. In this study, we used migration learning to migrate the source code comments to the original uncommented malicious Android code. We obtained features that were not considered in previous studies through the semantic enhancement model. Follow-up experiments proved that the semantic enhancement model based on the transformer architecture can enhance malicious code classification.

Quantum Classifier
Nuclear methods have a wide range of applications in quantum machine learning [43]. In this study, we first used classical data and quantum feature mapping to encode the data into the quantum state space. The most important decision at this step involved selecting an appropriate and effective feature mapping method. The quantum feature mapping φ((x)) was from the classical feature vector (x) to the quantum state |Φ(x) Φ(x)|. This was facilitated by applying the unitary operation U Φ(x) in the initial state |0 n , where n represents the number of qubits used for encoding. Therefore, we selected three different entangled quantum feature mapping methods to provide quantum advantages for the experiments. As mentioned in the Related work section, when K = 2, P 0 = Z, and P 1 = ZZ, the ZZFeatureMap is as follows, and its simple circuit simulation diagram is shown in Figure 5: Among these, we used two different entanglement methods for ZZFeatureMap: circular and linear. On the other hand, we also customized the Pauli Gate in the feature map, similar to the method mentioned in the Related work section, such that when P 0 = X, P 1 = Y, and P 2 = ZZ, the PauliFeatureMap is as follows, and its simple circuit simulation diagram is shown in Figure 6: Through any one of the three aforementioned types of quantum feature mapping φ((x)), a quantum nucleus, k(x i , x j ) = φ(x j ) † φ(x i ), can be naturally generated. This quantum core can be used as a measure of similarity. When the value of k(x i , x j ) was larger, x i and x j were closer. We represented the quantum nucleus as a matrix, and we calculated each element in the kernel matrix by calculating the transition amplitude as follows: Next, classification was performed using the SVM. Figure 7 below represents a schematic diagram of the analog circuit. Owing to the limitations of the existing hardware, we could only perform classical simulation. Therefore, the acceleration may not be reflected accordingly. In the follow-up experiments, we compared the accuracy of the feature maps of different encoding methods to those of the classical SVM, thereby proving the effectiveness of QSVM in detecting malicious Android code.

Datasets
Our experimental dataset included data from CICMalDroid2020 and Google Play. The details are presented in Figure 8. First, we obtained more than 16,000 APK files of five types from the CICMalDroid2020 dataset. After complete feature engineering and extraction, 14,873 samples comprising 1500 types of adware, 2204 types of banking malware, 4622 types of SMS malware, 2534 types of riskware, and 4013 types of benign software were obtained. We used these samples as the dataset for classifying Android malware. To balance the number of benign and malicious samples, we obtained 6847 types of benign software from Google Play. To further ensure the effectiveness of the experiment, we obtained software from multiple categories, including business, games, and education, to prevent the emergence of a single type of benign software. We balanced the numbers of benign and malicious software samples in preparation for the malware detection tasks.

Experimental Setup
This section describes the implementation rules and evaluation indicators applied in this study. The model used in the experiment utilized the dataset introduced in Section 4.1. This dataset was divided into a training set and a test set based on a ratio of 7:3. In addition, we evaluated the performance of the model in terms of accuracy, precision, and recall. Because the task we needed to solve was more sensitive to false positives than negatives, we used F1 as an evaluation indicator.
The calculation method is shown in Table 1, where true positive TP i denotes the number of c i samples correctly classified as such. False positive FP i denotes the number of c i samples incorrectly classified as non-c i samples. False negative FN i represents the number of non-c i samples incorrectly classified as c i samples. True negative TN i represents the number of non-c i samples correctly classified as non-c i samples. Table 2 shows the starting values of the configuration parameter set for the Android-SEM model.

Implementation
In this section, we discuss the experiment based on several questions:

1.
Is the semantic enhancement model based on transfer learning effective in solving the problem of malicious code classification? 2.
Regarding the semantic enhancement model proposed in this study, how do we prove that it results in significant benefits and improvements for solving the problem of malicious code detection and classification? 3.
Under different feature mapping methods, can QSVM complete the task of malicious code detection and classification like SVM?

Model Classification Capabilities
We validated the model against the dataset described in the previous section. We also compared our proposed method with existing methods, specifically those proposed by Haq et al. [44] and Sihag et al. [45]. Their datasets were significantly similar to ours and are publicly available. Therefore, it is suitable to compare their findings to the results of our newly proposed model.
To detect malicious behavior, we used 6847 benign files from Google Play and 6847 malicious files from CICMalDroid2020. Table 3 and Figure 9 show the precision, recall, accuracy, F1, and ROC/AUC values of the model based on the dataset. For the binary classification problem, the model proposed in this study achieved an F1 score of 0.9943, and the AUC value was close to 0.9996. We also performed a multi-classification task of malicious files for malware on a separate CICMalDroid2020 dataset. In the five categories, the AUC values of each category were very close. The AUC value of Riskware is the lowest at 0.9992, whereas the AUC value of Adware is the highest at 0.9999, which is close to 1. The semantic enhancement model proposed in this study achieved high-precision classification. The aforementioned results show that the semantic enhancement model based on transfer learning is effective for Android malware detection and classification tasks.
For comparison, Sihag et al. [45] used a CNN engine to determine the maliciousness and type of malware by capturing network data packets to generate images, and they achieved accuracy levels of 99.12% and 98.91%, respectively. By contrast, Haq et al. [44] used a method for generating images based on entire APK files and applied a CNN model based on transfer learning for training, obtaining an accuracy level of 96.4%. However, the former used images to express only network interactions (streams and sessions generated through packet inspection) and did not involve other crucial information, such as system calls, APIs, or permissions. Therefore, there remain opportunities to improve the accuracy. Meanwhile, the latter generated grayscale images directly from entire APK files. Although grayscale images are often used for malicious code detection, this method is evidently insufficient for the intended purpose, which was also reflected in the achieved accuracy level.  In contrast, this study does not rely on analyzing images. Instead, it features the first semantic enhancement model that uses source code and transfer learning to generate comments automatically. Large-scale data were used for pretraining through a transformerbased deep learning model, and comments were generated from the source code to enhance program semantics. After the vector generated by the encoder and decoder parts during the pretraining process was filtered, feature fusion was performed through bilinear pooling. Finally, the context relationship was obtained through Bi-GRU training using the API sequence. This study is the first to use a pretraining model to generate comments automatically, which were then used as semantic enhancement features after feature fusion. It is also the first to use a generative adversarial network to improve the quality of generated semantics and migration learning to significantly save training time and achieve significantly high levels of accuracy.

Model Comparison Experiment
To prove the contribution of the proposed semantic enhancement model to the accuracy of malicious Android code detection, we conducted experiments to verify the mutual combination of different modules in the training model. The results are shown in Table 4, proving the necessity and effectiveness of the proposed model's complexity.
First, it is worth noting that, as shown in Table 4, the semantic enhancement model based on migration learning achieved the best performance after feature fusion through filters and bilinear pooling, and it achieved accuracy levels of 99.55% and 99.01% in two and five categories, respectively. Second, the method of fusing features using bilinear pooling was replaced with simple splicing, which resulted in an approximately 0.2% lower accuracy than that of the former. We believe that the semantic information obtained only via simple feature vector splicing may not be as rich as that obtained via mapping the features in two different vector spaces into the same dimension after mapping from high latitudes. The inclusion of a filter resulted in an improvement of approximately 5% owing to the removal of the bad comment vectors. This proves the significant effect of the filter proposed in this study. We removed the semantic enhancement module of the part that generates source code comments, and we retained only the pretrained encoder for position information, word embedding, and the multi-head attention mechanism in the encoder. Simultaneously, the semantic vector obtained using the API sequence through word embedding and Bi-GRU was retained. The two were vectorized and classified. The accuracy obtained in this experiment was approximately 2% lower than that obtained in the previous experiment. However, compared with the enhanced semantic module, the difference was 6%. This shows that the proposed semantic enhancement model can obtain more semantic information and improve classification accuracy. Finally, when we eliminated the entire pretraining module and used word embedding and a long short-term memory (LSTM) model for semantic extraction and feature classification, the accuracy dropped by approximately 5% compared with that of the former. This shows that the transformer-based pretraining model can obtain additional semantic information from a large Android program source code corpus in advance to complete the malicious code detection task, achieve a satisfactory classification result, and significantly reduce training time.

Quantum Classifiers with Different Encoding Methods
To prove that QSVM was comparable to classical SVMs in detecting and classifying malicious Android code, or better in certain circumstances, the hyperparameters were varied, and the classification performance and decision boundary were observed to select the best data fitting method and make slight adjustments. The objective was for the SVM kernel to produce better classification results than those of the QSVM.
Subsequently, we constructed the classification accuracy and confusion matrices of different types of quantum cores in the QSVM. The function of the SVM kernel is to transform data into a more suitable modeling space. Different algorithms use different types of kernel functions. It is well known that the most commonly used functions are linear and RBF, which we used as our comparison methods. Specifically, we used the linear and RBF methods in the classical SVM, after which we compared the scores of different quantum kernel functions in the QSVM with the results outlined in Table 5. We used the Android-SEM model to enhance the semantic information of Android source code and embed it in a vector space. We also used MLP to compress the feature vector from high latitude to low latitude, so that quantum classifiers can easily support it, after which we implemented different kernel functions for the ablation experiments. We then conducted comparative experiments on the classification of malicious Android code. Based on the test dataset, the accuracy of QSVM is comparable to that of classic SVM, and the detection accuracy of malicious code can reach 99%. Compared to the performance on simple datasets, QSVM can maintain satisfactory results on complex datasets. In other words, QSVM can provide enhanced performance if the dataset is a complex boundary that cannot be captured using conventional classical kernels. It is also undeniable that achieving such a high accuracy rate is related to the previous classic deep learning models. The semantic enhancement model based on transfer learning pre-trains feature vectors, thereby significantly improving the accuracy of QSVM. In addition, according to the confusion matrix presented in Figure 10, the results listed in Table 5 show that the precision of QSVM is significantly improved. This experiment proves that QSVM is effective in detecting and classifying malicious code.

Conclusions and Future Work
Based on the concept of transfer learning, in this study, we focused on obtaining comment information not initially present in Android malware through migration. We inte-grated conventional deep learning models with quantum machine learning and proposed Android-SEM, which is a transfer learning-based model for the semantic enhancement of Android malicious code. To improve the effectiveness of our proposed model in detecting malicious code, we optimized the performance of the comment vectors generated by the semantic enhancement module through a generative adversarial approach. We also proposed a comment filter based on a linear regression model that retains high-quality comment vectors and combines them with other features to detect and classify Android malicious code. Experiments on the CICmalDroid2020 dataset showed that our proposed method can detect malicious code in 13,694 benign and malicious samples with an accuracy level of 99.55%. Moreover, 14,873 samples of different types of malicious code in the dataset can be classified with 99.01% accuracy. We conducted ablation experiments for the proposed model, which illustrated the necessity of each module, demonstrated the effectiveness of our proposed method, and showed that our proposed method achieved enhanced accuracy in the detection and classification of malicious code. In addition, this study combined quantum and classical machine learning methods. Simulation experiments showed that quantum and classical machine learning models achieved exceptional accuracy levels in malicious code detection tasks, with QSVM resulting in a theoretical enhancement.
In our future studies, we shall first add data flow information and structural features to the existing basis to extend the scope of our proposed system and further explore the problem of classifying Android malicious code. Second, we shall consider quantum state processing of the model's classical part to realize a full quantum model. Finally, we intend to enable the efficient analysis of obfuscated malicious code to improve the effectiveness of our proposed method in the real world.