To identify latent representations that decode into compounds satisfying a set of user-specified constraints, NGT iteratively trains a policy π η (z), parameterized as a normalizing flow (Figure , Methods). Formally, NGT seeks a policy such that π η (z) ∝ E p θ (x|z,D) [R 0 (x)], where the binarized reward R 0 (x) is equal to one if molecule x satisfies all of the specified constraints and zero otherwise. Once trained, we sample latent codes from the policy and decode to find compounds that meet the search criteria.