In recent years, deep learning has been increasingly used in fault diagnosis of rotating machinery. However, the actual acquisition of rolling bearing fault signals often contains ambient noise, making it difficult to determine the optimal values of the parameters. In this paper, a sparrow search algorithm (LSSA) based on backward learning of lens imaging and Gaussian Cauchy variation is proposed. The lens imaging reverse learning strategy enhances the traversal capability of the algorithm and allows for a better balance of algorithm exploration and development. Then, the performance of the proposed LSSA was tested on the benchmark function. Finally, LSSA is used to find the optimal modal component K and the optimal penalty factor α in VMD-GRU, which in turn realizes the fault diagnosis of rolling bearings. The experimental results show that the model can achieve a 96.61% accuracy in rolling bearing fault diagnosis, which proves the effectiveness of the method.