building generative ai models from foundation model