In order to improve the prediction accuracy of electricity consumption, the particle swarm optimization algorithm was proposed to find the optimal hyperparameters of long-term and short-term memory (LSTM) neural networks, and the two models are combined to form a power load forecasting model. Aiming at the problem that it is difficult to manually select the LSTM hyperparameters, the PSO algorithm can effectively find the global optimal solution to find the hyperparameters of LSTM model. After continuous training, we find the appropriate hyperparameters and verify them The experimental results show that compared with the traditional LSTM network, the performance and prediction accuracy of the combined pso-lstm combination model have been significantly improved, which has certain academic value and application significance.