A deep learning aided optimization algorithm for the design of flat thin-film multilayer optical systems is developed. The authors introduce a deep generative neural network, based on a variational autoencoder, to perform the optimization of photonic devices. This algorithm allows one to find a near-optimal solution to the inverse design problem of creating an anti-reflective grating, a fundamental problem in material science. As a proof of concept, the authors demonstrate the method's capabilities for designing an anti-reflective flat thin-film stack consisting of multiple material types. We designed and constructed a dielectric stack on silicon that exhibits an average reflection of 1.52 %, which is lower than other recently published experiments in the engineering and physics literature. In addition to its superior performance, the computational cost of our algorithm based on the deep generative model is much lower than traditional nonlinear optimization algorithms. These results demonstrate that advanced concepts in deep learning can drive the capabilities of inverse design algorithms for photonics. In addition, the authors develop an accurate regression model using deep active learning to predict the total reflectivity for a given optical system. The surrogate model of the governing partial differential equations can then be broadly used in the design of optical systems and to rapidly evaluate their behavior. (c) 2022 Optica Publishing Group under the terms of the Optica Open Access Publishing Agreement