Aiming at the current problems of the gradual opening of the power client side terminal network, the scattered equipment and the difficulty of security monitoring, an efficient network intrusion detection model based on LightGBM is proposed. Firstly, this paper introduces an improved smoothing mapping method into the target coding, which improves the detection effect of the model. Secondly, the BPSO algorithm is used for feature selection. By designing the objective function, on the premise of ensuring the detection accuracy, the redundant dimensions are automatically removed and the time overhead of the model is reduced. The efficiency of the BPSO algorithm is improved by designing the speed variation strategy. Finally, the LightGBM algorithm is applied to realize intrusion detection and attack classification, and the PSO algorithm is used to realize the automatic selection of LightGBM parameters. Experiments based on multiple open source datasets show that the proposed model has a high degree of automation, high accuracy in attack detection, less false positives and omissions, and can improve the average detection efficiency by 25%.