# Research on the Simulation Method of HTTP Traffic Based on GAN
## 4 Model Architecture
### Generator Architecture  
This paper innovatively combines the AE (autoencoder) with conditional vectors as inputs to the generator, in contrast to the traditional approach where generators directly obtain input data from the noise space. Similarly, in terms of the internal architecture of the generator, we creatively introduced the Swin Transformer block module as the foundational component of the generator in the field of network data generation. Unlike traditional GAN architectures with a single generator and discriminator, at the overall level of the generative adversarial network (GAN), we treated the improved generator as an independent entity. Multiple entities were simultaneously created, and an evolutionary algorithm was employed for continuous evolution. Through this process of natural selection, the best-performing offspring were gradually retained as the final survivors. The structure of the generator is illustrated in Figure 7a. It consists of a combination of Swin Transformer blocks (referred to as blocks) and patch expand. The initial green layer represents an MLP layer, which transforms the input data to the required input size of the blocks. The final convolutional layer reduced the number of channels in the image without changing its size. The input of the generator consisted of a conditional vector and noise data generated by the AE module. These inputs were integrated through a linear layer and served as the input for the subsequent modules. The purpose of using a conditional vector was to allow the generator to generate specific desired data instead of generating randomly. Additionally, in the later classifier module, the classification of the generated data can further enhance the data generation performance. The type of conditional vector was determined by the number of categories in the original data. It was generated in the form of one-hot encoding, ensuring accurate classification information and facilitating vectorization and matrix operations in subsequent steps. When using the Transformer as a generator to generate data, the phenomenon of checkerboard artifacts and ghosting often occurs [30; 32; 36]. This phenomenon is particularly prominent in image processing. We also observed this problem in network traffic  
Figure 6: Mixed index label distribution of real data. datasets using the same approach. After extensive experimentation with different architectures based on Swin Transformer blocks, we chose the block architecture shown in Figure 7b. We added additional activation layers after the MSA layer and MLP layer of the standard block. By setting the window size M to 2, Swin improved the local quality of the data through its unique local window structure, and the window shifting helped with attention exchange. With these modifications, we successfully eliminated ghosting issues without introducing a significant number of additional parameters. As shown in Figure 7a, in the main architecture part, each block except the last one was followed by a patch expand layer. This layer expanded the output features of the block to increase the resolution and expressive power of the features, and performed normalization. The input dimension of the patch expand layer was (B, H*W, C), where B represents the batch size, H and W represent the height and width of the image, and C represents the number of channels. In the patch expand module, the input feature x was expanded to obtain a tensor of shape (B, L, 2C), where L is the size of the input feature. Then, the tensor was reshaped to (B, H, W, C) and tensor reshuffling was performed. Specifically, each pixel block was expanded to a size of \(2\times 2\), and the number of channels was reduced to one-fourth of the original. The tensor was then reshaped to (B, \(-1\), C/4), where \(-1\) automatically calculated the dimension size. Finally, the expanded features were normalized and returned. In each block and patch expand layer, we doubled the image's H and W dimensions and halved the number of channels.