Beyond the Black Box: Optimization within Latent Spaces