This study presents an optimization method of generating a wide stable-zone, large mode field operation nanosecond laser oscillator based on artificial intelligence algorithms. The work is motivated by the need of the large mode field laser cavities in compact size with variable thermal focal length. A physics model of light field propagation inside the resonator is established by combining thermal lensing tolerance. A multi-objective optimization function is designed to simultaneously balance the beam quality, thermal stability, and cavity compactness. Several algorithms, such as simulated annealing, particle swarm optimization, and genetic algorithms are compared, and ultimately, efficient searching for optimal solutions in complex multi-dimensional parameter spaces is achieved. In the system design, the parameters of cavity segment length, intracavity lens, and Gaussian mirror (VRM) are optimized. Therefore, an optimized cavity structure is experimentally implemented and Q-switching operations are perform. The results demonstrate stable laser output at 100 Hz repetition rate with 190 mJ pulse energy and 7 ns pulse width, and beam quality factors $ M_x^2 $ = 2.1 and $ M_y^2 $ = 1.9 respectively, and the total length of the cavity is only 540 mm, which demonstrates the compactness of laser design. Furthermore, numerical simulations are conducted to compare a variety of resonator configurations and assess the influence of different parameters on the cavity’s thermal stability. After the optimization, the thermal stability curve of the laser resonator shows a significant decrease in slope near the large-mode-field region, indicating an improvement in thermal length adaptability. This enhancement is crucial for ensuring long-term stable operation of high-repetition-rate nanosecond laser oscillators. In summary, this study provides an efficient approach for designing compact, thermally stable, large-mode-area resonators, and valuable insights into designing compact laser with high power output.