# Polymorphic Adversarial Cyberattacks Using WGAN
## 3 Deep Learning-Based Techniques in Cybersecurity  
### Generative Adversarial Networks  
In this section, we provide an overview of GAN architecture. Generative Adversarial Network is a paradigm based on machine learning models that can generate synthetic data from the original input data. It consists of two neural networks known as the Generator and the Discriminator [6]. The discriminator can be simply called a classifier that distinguishes the generated data as original or fake. It takes two forms of data: Original data and the data generated by the generator. The discriminator uses original data as a positive example and generated data as negative/adversarial examples during training. \(L_{D}\) represents the penalty to the discriminator. When the discriminator cannot detect or correctly differentiate the data, the penalty increases and decreases otherwise. To update the weights of the discriminator, it uses backpropagation. Another loss \(L_{G}\) represents a loss of the generator [53]. Figure 1 shows the discriminator training process. The generator produces a synthetic dataset by receiving feedback from the discriminator and learns to produce data in order that the discriminator classifies the synthetic data as the original. The training of the Generator includes the following steps:  
* A random input noise. * The generator, to produce synthetic data from the random data. * The discriminator, to distinguish the synthetic data and original data. * Loss \(L_{G}\) that fines the generator if it is unable to produce data, which can deceive the discriminator. As discussed, there are two variants of neural networks in the GAN. Therefore, it needs to train the generator and the discriminator alternately. Moreover, it is important to check if GAN is converged or not. The alternative training works as follows:  
1. Training of the generator runs for some epochs. 2. Training of the discriminator runs for some epochs. 3. Continue repeating steps 1 and 2 until the GAN converges. To train the GAN more efficiently, we need to keep either of the Neural Networks constant. For instance, while training the generator, we need to keep the discriminator constant. Otherwise, it will be difficult to converge [54]. While training the discriminator, the generator needs to be constant since it needs to learn to differentiate between the generated and fake data. The loss function represents the difference value between the generated data and the adversarial data as follows:  
\[\underset{G}{min}\underset{D}{max}\ V(D,G)=E_{x\sim p_{data}\ (x)}[log(D(x))]+E_{z\sim p_{z}(z)}[log(1-D(G(z)))] \tag{1}\]  
Figure 1: WGAN architecture. The authors in [6] introduced a loss function named min-max loss. They trained the discriminator \(D\) to maximize the average of the \(D(x)\), with \(D(x)\) denoting the estimated probability of data as original, and the \(log(1-D(G(z)))\). \(G(z)\) represents the output synthesized by the generator from the noise \(z\). \(D(G(z))\) is the approximate value of the discriminator that the generated data is real. \(E_{X}\) represents the expected value over the original data, \(p_{z}(z)\) is input noise variables, and \(E_{z}\) represents the expected value of the random data inputs to the generator. Moreover, the authors concurrently train the generator \(G\), which seeks to minimize the \(log\left(1-D(G(z))\right)\) predicted by the discriminator for synthetic data. The discriminator \(D\) and the generator \(G\) play a min-max game with the following value function \(V\left(D,G\right)\). To minimize the loss at the generator, we need to minimize the value of the \(log\) (\(1-D(G(z))\). The lower loss at \(G\) indicates that the generator produces synthetic data that can be classified as the original. According to the research in [46; 52; 54], most of the common challenges in training a GAN are as follows:  
* Convergence problem: Classification performance of the discriminator decreases in the following cycles. Training the GAN from this point indicates that the generator trains with less meaningful data.