Generation through the lens of learning theory