1. A system configured to detect defects on a wafer, comprising: an optical inspection subsystem comprising at least a light source and a detector, wherein the light source is configured to generate light that is directed to a wafer, and wherein the detector is configured to detect light from the wafer and to generate images responsive to the detected light; and one or more computer subsystems configured for: generating a rendered image based on information for a design printed on the wafer, wherein the rendered image is a simulation of an image generated by the optical inspection subsystem for the design printed on the wafer, wherein generating the rendered image comprises one or more steps, and wherein the one or more computer subsystems are further configured for performing at least one of the one or more steps by executing a generative model; comparing the rendered image to an optical image of the wafer generated by the optical inspection subsystem, wherein the design is printed on the wafer using a reticle; and detecting defects on the wafer based on results of the comparing.