This study presents an optimization method for 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, incorporating thermal lensing tolerance. A multi-objective optimization function is designed to balance the beam quality, thermal stability, and cavity compactness simultaneously. Several algorithms, including simulated annealing, particle swarm optimization, and genetic algorithms are compared, and ultimately achieves efficient searching for optimal solutions in complex multi-dimensional parameter spaces. In system design, the cavity segment lengths, intracavity lens, and Gaussian mirror (VRM) parameters are optimized. Accordingly, the optimized cavity structure is experimentally implemented and Q-switched operated. 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 Mx2 = 2.1 and My2 = 1.9 respectively, and the total length of the cavity is only 540mm which demonstrates the compactness of laser design. Furthermore, numerical simulations were conducted to compare a variety of resonator configurations and assess the impact of different parameters to the cavity’s thermal stability. After the optimization, the thermal stability curve of the laser resonator shows a significantly slope reduction near the large-mode-field region, indicating improved thermal length adaptability. This enhancement is crucial for ensuring long-term stable operation of high-repetition-rate nanosecond laser oscillators. In conclusion, this study provides an efficient approach to the design of compact, thermally stable, large-mode-area resonators, offering valuable insights for compact laser design with high power output.