Abstract
Nonlinear wavefront shaping is crucial for advancing optical technologies, enabling applications in optical computation, information processing, and imaging. However, a significant challenge is that once a metasurface is fabricated, the nonlinear wavefront it generates is fixed, offering little flexibility. This limitation often necessitates the fabrication of different metasurfaces for different wavefronts, which is both time-consuming and inefficient. To address this, we combine evolutionary algorithms with spatial light modulators (SLMs) to dynamically control wavefronts using a single metasurface, reducing the need for multiple fabrications and enabling the generation of arbitrary nonlinear wavefront patterns without requiring complicated optical alignment. We demonstrate this approach by introducing a genetic algorithm (GA) to manipulate visible wavefronts converted from near-infrared light via third-harmonic generation (THG) in a silicon metasurface. The Si metasurface supports multipolar Mie resonances that strongly enhance light-matter interactions, thereby significantly boosting THG emission at resonant positions. Additionally, the cubic relationship between THG emission and the infrared input reduces noise in the diffractive patterns produced by the SLM. This allows for precise experimental engineering of the nonlinear emission patterns with fewer alignment constraints. Our approach paves the way for self-optimized nonlinear wavefront shaping, advancing optical computation and information processing techniques.