In order to learn to generate responses that are appropriate and coherent in a conversational setting. ChatGPT uses a transformer architecture and is trained to predict the next word in a sequence based on the words that come before it.