With the continuous development of distributed power supply, its use in the power system is more and more, which makes the power system more and more vulnerable to power fluctuations and system failures, resulting in the stability of the system decline. Therefore, how to improve the stability of grid connection becomes a research hotspot. Virtual synchronous generator can simulate the moment of inertia and damping characteristics of synchronous generator, but its parameter design is complicated. To solve this problem, the mathematical model of virtual synchronous generator is established in this paper, and the parameters are optimized by using the improved hybrid leapfrog algorithm. By comparing the simulation results of grid voltage and frequency, it is proved that the improved hybrid leapfrog algorithm is more suitable for the grid stability of virtual synchronous generator.