ChatGPT uses GPT-3.5 internally. This system is actually trained to generate the next word when you give a series of words as input. That is, it is a probabilistic machine that tells you what the next word is most likely to be given