Abstract Continuous-variable quantum key distribution with a local local oscillator(LLO CVQKD) has been extensively researched due to its simplicity and security. For the practical security of the LLO CVQKD system, there are two main attack modes referred to as reference pulse attack and polarization attack presently. However, there is currently no general defense strategy against such attacks and the security of the system needs further investigation. Here, we employ a deep learning framework called generative adversarial networks (GANs) to detect both attacks. We first analyze the data in different cases, derive a feature vector as input to a GAN model, and then show the training and testing process of the GAN model for attack classification. The proposed model has two parts, a discriminator and a generator, both of which employ a convolutional neural network (CNN) to improve accuracy. Simulation results show that the proposed scheme can detect and classify attacks without reducing the secret key rate and the maximum transmission distance. It only establishes a detection model by monitoring features of the pulse without adding additional devices.