generative ai models are trained using the following method